1 /* PSPP - computes sample statistics.
2 Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 #include <libpspp/alloc.h>
23 #include <language/command.h>
24 #include <libpspp/message.h>
25 #include <libpspp/getl.h>
26 #include <language/syntax-file.h>
27 #include <language/lexer/lexer.h>
28 #include <libpspp/str.h>
29 #include <data/file-name.h>
33 #define _(msgid) gettext (msgid)
36 cmd_include (struct lexer *lexer, struct dataset *ds UNUSED)
38 struct source_stream *ss;
42 /* Skip optional FILE=. */
43 if (lex_match_id (lexer, "FILE"))
44 lex_match (lexer, '=');
46 /* File name can be identifier or string. */
47 if (lex_token (lexer) != T_ID && lex_token (lexer) != T_STRING)
49 lex_error (lexer, _("expecting file name"));
50 return CMD_CASCADING_FAILURE;
53 target_fn = ds_cstr (lex_tokstr (lexer));
55 ss = lex_get_source_stream (lexer);
56 found_fn = fn_search_path (target_fn, getl_include_path ( ss ));
60 getl_include_source (ss, create_syntax_file_source (found_fn));
64 msg (SE, _("Can't find `%s' in include file search path."),
68 return lex_end_of_command (lexer);