X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fdata-io%2Ffile-type.c;h=31df716b9dee3f99d35374bf7aec77fc9a149092;hb=b2859987e3e1c67ffd240945f4590bb23d31bdb8;hp=6a7e7cc2e2b815d82f6e5b966e56079ab3b29c91;hpb=2322678e8fddbbf158b01b2720db2636404bba3b;p=pspp diff --git a/src/language/data-io/file-type.c b/src/language/data-io/file-type.c index 6a7e7cc2e2..31df716b9d 100644 --- a/src/language/data-io/file-type.c +++ b/src/language/data-io/file-type.c @@ -18,21 +18,26 @@ 02110-1301, USA. */ #include + +#include + #include -#include "alloc.h" -#include "case.h" -#include "command.h" -#include "compiler.h" -#include "data-in.h" -#include "data-reader.h" -#include "dictionary.h" -#include "message.h" -#include "file-handle.h" -#include "format.h" -#include "lexer.h" -#include "str.h" -#include "variable.h" -#include "procedure.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "gettext.h" #define _(msgid) gettext (msgid) @@ -96,6 +101,17 @@ struct file_type_pgm static int parse_col_spec (struct col_spec *, const char *); static void create_col_var (struct col_spec *c); +static const struct case_source_class file_type_source_class; + +static bool inside_file_type; + +/* Returns true if we're parsing the inside of a FILE TYPE...END + FILE TYPE construct, false otherwise. */ +bool +in_file_type (void) +{ + return inside_file_type; +} int cmd_file_type (void); @@ -390,15 +406,6 @@ cmd_record_type (void) struct file_type_pgm *fty; struct record_type *rct; - /* Make sure we're inside a FILE TYPE structure. */ - if (pgm_state != STATE_INPUT - || !case_source_is_class (vfm_source, &file_type_source_class)) - { - msg (SE, _("This command may only appear within a " - "FILE TYPE/END FILE TYPE structure.")); - return CMD_CASCADING_FAILURE; - } - fty = vfm_source->aux; /* Initialize the record_type structure. */ @@ -580,13 +587,6 @@ cmd_end_file_type (void) { struct file_type_pgm *fty; - if (pgm_state != STATE_INPUT - || case_source_is_class (vfm_source, &file_type_source_class)) - { - msg (SE, _("This command may only appear within a " - "FILE TYPE/END FILE TYPE structure.")); - return CMD_CASCADING_FAILURE; - } fty = vfm_source->aux; fty->case_size = dict_get_case_size (default_dict); @@ -735,7 +735,7 @@ file_type_source_destroy (struct case_source *source) } } -const struct case_source_class file_type_source_class = +static const struct case_source_class file_type_source_class = { "FILE TYPE", NULL,