projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove property settings from psppire_data_window and put them into the GtkBuilder...
[pspp]
/
src
/
language
/
data-io
/
get-data.c
diff --git
a/src/language/data-io/get-data.c
b/src/language/data-io/get-data.c
index bc09715bd81bdf056d3f5e382933ee79a4a8a32a..32202babdea8848f5c3a06b6431b0db3c4b007ff 100644
(file)
--- a/
src/language/data-io/get-data.c
+++ b/
src/language/data-io/get-data.c
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* PSPP - a program for statistical analysis.
- Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2008
, 2009
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-24,6
+24,7
@@
#include <data/dictionary.h>
#include <data/format.h>
#include <data/procedure.h>
#include <data/dictionary.h>
#include <data/format.h>
#include <data/procedure.h>
+#include <data/settings.h>
#include <language/command.h>
#include <language/data-io/data-parser.h>
#include <language/data-io/data-reader.h>
#include <language/command.h>
#include <language/data-io/data-parser.h>
#include <language/data-io/data-reader.h>
@@
-33,6
+34,8
@@
#include <language/lexer/lexer.h>
#include <libpspp/message.h>
#include <language/lexer/lexer.h>
#include <libpspp/message.h>
+#include "xalloc.h"
+
#include "gettext.h"
#define _(msgid) gettext (msgid)
#define N_(msgid) (msgid)
#include "gettext.h"
#define _(msgid) gettext (msgid)
#define N_(msgid) (msgid)
@@
-82,7
+85,7
@@
parse_get_psql (struct lexer *lexer, struct dataset *ds)
if (!lex_force_string (lexer))
goto error;
if (!lex_force_string (lexer))
goto error;
- psql.conninfo = strdup (ds_cstr (lex_tokstr (lexer)));
+ psql.conninfo =
x
strdup (ds_cstr (lex_tokstr (lexer)));
lex_get (lexer);
lex_get (lexer);
@@
-150,7
+153,7
@@
parse_get_gnm (struct lexer *lexer, struct dataset *ds)
if (!lex_force_string (lexer))
goto error;
if (!lex_force_string (lexer))
goto error;
- gri.file_name = strdup (ds_cstr (lex_tokstr (lexer)));
+ gri.file_name =
x
strdup (ds_cstr (lex_tokstr (lexer)));
lex_get (lexer);
lex_get (lexer);
@@
-169,7
+172,7
@@
parse_get_gnm (struct lexer *lexer, struct dataset *ds)
if ( ! lex_force_string (lexer) )
goto error;
if ( ! lex_force_string (lexer) )
goto error;
- gri.sheet_name = strdup (ds_cstr (lex_tokstr (lexer)));
+ gri.sheet_name =
x
strdup (ds_cstr (lex_tokstr (lexer)));
gri.sheet_index = -1;
}
else if (lex_match_id (lexer, "INDEX"))
gri.sheet_index = -1;
}
else if (lex_match_id (lexer, "INDEX"))
@@
-193,7
+196,7
@@
parse_get_gnm (struct lexer *lexer, struct dataset *ds)
if ( ! lex_force_string (lexer) )
goto error;
if ( ! lex_force_string (lexer) )
goto error;
- gri.cell_range = strdup (ds_cstr (lex_tokstr (lexer)));
+ gri.cell_range =
x
strdup (ds_cstr (lex_tokstr (lexer)));
}
else
goto error;
}
else
goto error;
@@
-268,7
+271,7
@@
static int
parse_get_txt (struct lexer *lexer, struct dataset *ds)
{
struct data_parser *parser = NULL;
parse_get_txt (struct lexer *lexer, struct dataset *ds)
{
struct data_parser *parser = NULL;
- struct dictionary *dict =
NULL
;
+ struct dictionary *dict =
dict_create ()
;
struct file_handle *fh = NULL;
struct dfm_reader *reader = NULL;
struct file_handle *fh = NULL;
struct dfm_reader *reader = NULL;
@@
-285,7
+288,7
@@
parse_get_txt (struct lexer *lexer, struct dataset *ds)
if (fh == NULL)
goto error;
if (fh == NULL)
goto error;
- parser = data_parser_create ();
+ parser = data_parser_create (
dict
);
has_type = false;
data_parser_set_type (parser, DP_DELIMITED);
data_parser_set_span (parser, false);
has_type = false;
data_parser_set_type (parser, DP_DELIMITED);
data_parser_set_span (parser, false);
@@
-429,18
+432,29
@@
parse_get_txt (struct lexer *lexer, struct dataset *ds)
lex_get (lexer);
}
lex_get (lexer);
}
- else if (lex_match_id (lexer, "QUALIFIER"))
+ else if (lex_match_id (lexer, "QUALIFIER
S
"))
{
{
- if (!set_type (parser, "QUALIFIER", DP_DELIMITED, &has_type))
+ if (!set_type (parser, "QUALIFIER
S
", DP_DELIMITED, &has_type))
goto error;
lex_match (lexer, '=');
if (!lex_force_string (lexer))
goto error;
goto error;
lex_match (lexer, '=');
if (!lex_force_string (lexer))
goto error;
+ if (settings_get_syntax () == COMPATIBLE
+ && ds_length (lex_tokstr (lexer)) != 1)
+ {
+ msg (SE, _("In compatible syntax mode, the QUALIFIER string "
+ "must contain exactly one character."));
+ goto error;
+ }
+
data_parser_set_quotes (parser, ds_ss (lex_tokstr (lexer)));
lex_get (lexer);
}
data_parser_set_quotes (parser, ds_ss (lex_tokstr (lexer)));
lex_get (lexer);
}
+ else if (settings_get_syntax () == ENHANCED
+ && lex_match_id (lexer, "ESCAPE"))
+ data_parser_set_quote_escape (parser, true);
else if (lex_match_id (lexer, "VARIABLES"))
break;
else
else if (lex_match_id (lexer, "VARIABLES"))
break;
else
@@
-451,7
+465,7
@@
parse_get_txt (struct lexer *lexer, struct dataset *ds)
}
lex_match (lexer, '=');
}
lex_match (lexer, '=');
- dict = dict_create ();
+
record = 1;
type = data_parser_get_type (parser);
do
record = 1;
type = data_parser_get_type (parser);
do