projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed error running 'make distcheck'
[pspp]
/
src
/
language
/
utilities
/
include.c
diff --git
a/src/language/utilities/include.c
b/src/language/utilities/include.c
index e802abecc49ed4b3129c38ede93024eaaa76430c..19a5baa465dec0bb32b3b07e9d7e84a1009f1076 100644
(file)
--- a/
src/language/utilities/include.c
+++ b/
src/language/utilities/include.c
@@
-22,8
+22,8
@@
#include <string.h>
#include <unistd.h>
#include <string.h>
#include <unistd.h>
-#include "data/
file-name
.h"
-#include "data/
procedure
.h"
+#include "data/
dataset
.h"
+#include "data/
session
.h"
#include "language/command.h"
#include "language/lexer/include-path.h"
#include "language/lexer/lexer.h"
#include "language/command.h"
#include "language/lexer/include-path.h"
#include "language/lexer/lexer.h"
@@
-58,18
+58,17
@@
do_insert (struct lexer *lexer, struct dataset *ds, enum variant variant)
if (lex_match_id (lexer, "FILE"))
lex_match (lexer, T_EQUALS);
if (lex_match_id (lexer, "FILE"))
lex_match (lexer, T_EQUALS);
- /* File name can be identifier or string. */
- if (lex_token (lexer) != T_ID && !lex_is_string (lexer))
- {
-
lex_error (lexer, _("expecting file name"
));
- return CMD_FAILURE;
- }
+ if (!lex_force_string_or_id (lexer))
+ return CMD_FAILURE;
+
+
relative_name = utf8_to_filename (lex_tokcstr (lexer
));
+ if (NULL == relative_name)
+ return CMD_FAILURE;
- relative_name = utf8_to_filename (lex_tokcstr (lexer));
filename = include_path_search (relative_name);
free (relative_name);
filename = include_path_search (relative_name);
free (relative_name);
- if (
! filename)
+ if (! filename)
{
msg (SE, _("Can't find `%s' in include file search path."),
lex_tokcstr (lexer));
{
msg (SE, _("Can't find `%s' in include file search path."),
lex_tokcstr (lexer));
@@
-81,8
+80,9
@@
do_insert (struct lexer *lexer, struct dataset *ds, enum variant variant)
error_mode = LEX_ERROR_CONTINUE;
cd = false;
status = CMD_FAILURE;
error_mode = LEX_ERROR_CONTINUE;
cd = false;
status = CMD_FAILURE;
- encoding = xstrdup (dataset_get_default_syntax_encoding (ds));
- while ( T_ENDCMD != lex_token (lexer))
+ encoding = xstrdup (session_get_default_syntax_encoding (
+ dataset_session (ds)));
+ while (T_ENDCMD != lex_token (lexer))
{
if (lex_match_id (lexer, "ENCODING"))
{
{
if (lex_match_id (lexer, "ENCODING"))
{
@@
-92,56
+92,54
@@
do_insert (struct lexer *lexer, struct dataset *ds, enum variant variant)
free (encoding);
encoding = xstrdup (lex_tokcstr (lexer));
free (encoding);
encoding = xstrdup (lex_tokcstr (lexer));
+ lex_get (lexer);
}
else if (variant == INSERT && lex_match_id (lexer, "SYNTAX"))
{
lex_match (lexer, T_EQUALS);
}
else if (variant == INSERT && lex_match_id (lexer, "SYNTAX"))
{
lex_match (lexer, T_EQUALS);
- if (
lex_match_id (lexer, "INTERACTIVE")
)
+ if (
lex_match_id (lexer, "INTERACTIVE")
)
syntax_mode = LEX_SYNTAX_INTERACTIVE;
syntax_mode = LEX_SYNTAX_INTERACTIVE;
- else if (
lex_match_id (lexer, "BATCH"))
+ else if (lex_match_id (lexer, "BATCH"))
syntax_mode = LEX_SYNTAX_BATCH;
syntax_mode = LEX_SYNTAX_BATCH;
- else if (
lex_match_id (lexer, "AUTO"))
+ else if (lex_match_id (lexer, "AUTO"))
syntax_mode = LEX_SYNTAX_AUTO;
else
{
syntax_mode = LEX_SYNTAX_AUTO;
else
{
- lex_error (lexer, _("expecting %s, %s, or %s after %s"),
- "BATCH", "INTERACTIVE", "AUTO", "SYNTAX");
+ lex_error_expecting (lexer, "BATCH", "INTERACTIVE", "AUTO");
goto exit;
}
}
else if (variant == INSERT && lex_match_id (lexer, "CD"))
{
lex_match (lexer, T_EQUALS);
goto exit;
}
}
else if (variant == INSERT && lex_match_id (lexer, "CD"))
{
lex_match (lexer, T_EQUALS);
- if (
lex_match_id (lexer, "YES")
)
+ if (
lex_match_id (lexer, "YES")
)
{
cd = true;
}
{
cd = true;
}
- else if (
lex_match_id (lexer, "NO"))
+ else if (lex_match_id (lexer, "NO"))
{
cd = false;
}
else
{
{
cd = false;
}
else
{
- lex_error (lexer, _("expecting %s or %s after %s"),
- "YES", "NO", "CD");
+ lex_error_expecting (lexer, "YES", "NO");
goto exit;
}
}
else if (variant == INSERT && lex_match_id (lexer, "ERROR"))
{
lex_match (lexer, T_EQUALS);
goto exit;
}
}
else if (variant == INSERT && lex_match_id (lexer, "ERROR"))
{
lex_match (lexer, T_EQUALS);
- if (
lex_match_id (lexer, "CONTINUE")
)
+ if (
lex_match_id (lexer, "CONTINUE")
)
{
error_mode = LEX_ERROR_CONTINUE;
}
{
error_mode = LEX_ERROR_CONTINUE;
}
- else if (
lex_match_id (lexer, "STOP"))
+ else if (lex_match_id (lexer, "STOP"))
{
error_mode = LEX_ERROR_STOP;
}
else
{
{
error_mode = LEX_ERROR_STOP;
}
else
{
- lex_error (lexer, _("expecting %s or %s after %s"),
- "CONTINUE", "STOP", "ERROR");
+ lex_error_expecting (lexer, "CONTINUE", "STOP");
goto exit;
}
}
goto exit;
}
}
@@
-154,7
+152,7
@@
do_insert (struct lexer *lexer, struct dataset *ds, enum variant variant)
}
status = lex_end_of_command (lexer);
}
status = lex_end_of_command (lexer);
- if (
status == CMD_SUCCESS)
+ if (status == CMD_SUCCESS)
{
struct lex_reader *reader;
{
struct lex_reader *reader;
@@
-165,7
+163,7
@@
do_insert (struct lexer *lexer, struct dataset *ds, enum variant variant)
lex_discard_rest_of_command (lexer);
lex_include (lexer, reader);
lex_discard_rest_of_command (lexer);
lex_include (lexer, reader);
- if (
cd
)
+ if (
cd
)
{
char *directory = dir_name (filename);
chdir (directory);
{
char *directory = dir_name (filename);
chdir (directory);