From: John Darrington Date: Sat, 28 Oct 2006 08:31:22 +0000 (+0000) Subject: Eliminated global variable getl_buf X-Git-Tag: sav-api~1726 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1629e9b28338e59f9e4c027f3792a9419840a2c;p=pspp Eliminated global variable getl_buf --- diff --git a/po/de.po b/po/de.po index 080863ae8a..daab46357b 100644 --- a/po/de.po +++ b/po/de.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: PSPP 0.4.2\n" "Report-Msgid-Bugs-To: pspp-dev@gnu.org\n" -"POT-Creation-Date: 2006-10-26 14:25+0800\n" +"POT-Creation-Date: 2006-10-26 16:30+0800\n" "PO-Revision-Date: 2006-05-26 17:49+0800\n" "Last-Translator: John Darrington \n" "Language-Team: German \n" @@ -1070,7 +1070,7 @@ msgstr "" #: src/language/command.c:802 src/language/data-io/matrix-data.c:539 #: src/language/data-io/print-space.c:75 src/language/dictionary/vector.c:203 -#: src/language/lexer/lexer.c:448 src/language/stats/autorecode.c:154 +#: src/language/lexer/lexer.c:456 src/language/stats/autorecode.c:154 #: src/language/xforms/select-if.c:62 msgid "expecting end of command" msgstr "" @@ -1115,16 +1115,16 @@ msgid "" "specified." msgstr "" -#: src/language/control/repeat.c:393 +#: src/language/control/repeat.c:399 #, c-format msgid "%ld TO %ld is an invalid range." msgstr "" -#: src/language/control/repeat.c:429 +#: src/language/control/repeat.c:435 msgid "String expected." msgstr "" -#: src/language/control/repeat.c:448 +#: src/language/control/repeat.c:454 msgid "No matching DO REPEAT." msgstr "" @@ -1234,27 +1234,27 @@ msgid "" "by itself on a single line with exactly one space between words." msgstr "" -#: src/language/data-io/data-reader.c:206 -#: src/language/data-io/data-reader.c:218 +#: src/language/data-io/data-reader.c:207 +#: src/language/data-io/data-reader.c:219 #, c-format msgid "Error reading file %s: %s." msgstr "" -#: src/language/data-io/data-reader.c:221 +#: src/language/data-io/data-reader.c:222 #, c-format msgid "%s: Partial record at end of file." msgstr "" -#: src/language/data-io/data-reader.c:272 +#: src/language/data-io/data-reader.c:273 #, c-format msgid "Attempt to read beyond end-of-file on file %s." msgstr "" -#: src/language/data-io/data-reader.c:275 +#: src/language/data-io/data-reader.c:276 msgid "Attempt to read beyond END DATA." msgstr "" -#: src/language/data-io/data-reader.c:433 +#: src/language/data-io/data-reader.c:434 msgid "" "This command is not valid here since the current input program does not " "access the inline file." @@ -2032,11 +2032,11 @@ msgid "" "s." msgstr "" -#: src/language/dictionary/value-labels.c:158 src/language/lexer/lexer.c:585 +#: src/language/dictionary/value-labels.c:158 src/language/lexer/lexer.c:593 msgid "expecting string" msgstr "" -#: src/language/dictionary/value-labels.c:167 src/language/lexer/lexer.c:599 +#: src/language/dictionary/value-labels.c:167 src/language/lexer/lexer.c:607 msgid "expecting integer" msgstr "" @@ -2265,94 +2265,94 @@ msgstr "" msgid "expecting format type" msgstr "" -#: src/language/lexer/lexer.c:259 +#: src/language/lexer/lexer.c:267 #, c-format msgid "%s does not form a valid number." msgstr "" -#: src/language/lexer/lexer.c:363 +#: src/language/lexer/lexer.c:371 #, c-format msgid "Bad character in input: `%c'." msgstr "" -#: src/language/lexer/lexer.c:365 +#: src/language/lexer/lexer.c:373 #, c-format msgid "Bad character in input: `\\%o'." msgstr "" -#: src/language/lexer/lexer.c:396 +#: src/language/lexer/lexer.c:404 #, c-format msgid "Subcommand %s may only be specified once." msgstr "" -#: src/language/lexer/lexer.c:404 +#: src/language/lexer/lexer.c:412 #, c-format msgid "missing required subcommand %s" msgstr "" -#: src/language/lexer/lexer.c:433 +#: src/language/lexer/lexer.c:441 #, c-format msgid "Syntax error %s at %s." msgstr "" -#: src/language/lexer/lexer.c:436 +#: src/language/lexer/lexer.c:444 #, c-format msgid "Syntax error at %s." msgstr "" -#: src/language/lexer/lexer.c:554 src/language/lexer/lexer.c:571 +#: src/language/lexer/lexer.c:562 src/language/lexer/lexer.c:579 #, c-format msgid "expecting `%s'" msgstr "" -#: src/language/lexer/lexer.c:613 +#: src/language/lexer/lexer.c:621 msgid "expecting number" msgstr "" -#: src/language/lexer/lexer.c:627 +#: src/language/lexer/lexer.c:635 msgid "expecting identifier" msgstr "" -#: src/language/lexer/lexer.c:1003 +#: src/language/lexer/lexer.c:1020 msgid "binary" msgstr "" -#: src/language/lexer/lexer.c:1008 +#: src/language/lexer/lexer.c:1025 msgid "octal" msgstr "" -#: src/language/lexer/lexer.c:1013 +#: src/language/lexer/lexer.c:1030 msgid "hex" msgstr "" -#: src/language/lexer/lexer.c:1023 +#: src/language/lexer/lexer.c:1040 #, c-format msgid "String of %s digits has %d characters, which is not a multiple of %d." msgstr "" -#: src/language/lexer/lexer.c:1052 +#: src/language/lexer/lexer.c:1069 #, c-format msgid "`%c' is not a valid %s digit." msgstr "" -#: src/language/lexer/lexer.c:1083 +#: src/language/lexer/lexer.c:1100 msgid "Unterminated string constant." msgstr "" -#: src/language/lexer/lexer.c:1137 +#: src/language/lexer/lexer.c:1154 msgid "Unexpected end of file in string concatenation." msgstr "" -#: src/language/lexer/lexer.c:1145 +#: src/language/lexer/lexer.c:1162 msgid "String expected following `+'." msgstr "" -#: src/language/lexer/lexer.c:1158 +#: src/language/lexer/lexer.c:1175 #, c-format msgid "String exceeds 255 characters in length (%d characters)." msgstr "" -#: src/language/lexer/lexer.c:1173 +#: src/language/lexer/lexer.c:1190 msgid "" "Sorry, literal strings may not contain null characters. Replacing with " "spaces." @@ -2459,17 +2459,17 @@ msgstr "" msgid "Closing `%s': %s." msgstr "" -#: src/language/line-buffer.c:447 +#: src/language/line-buffer.c:446 #, c-format msgid "opening \"%s\" as syntax file" msgstr "" -#: src/language/line-buffer.c:452 +#: src/language/line-buffer.c:451 #, c-format msgid "Opening `%s': %s." msgstr "" -#: src/language/line-buffer.c:465 +#: src/language/line-buffer.c:464 #, c-format msgid "Reading `%s': %s." msgstr "" diff --git a/po/pspp.pot b/po/pspp.pot index 9b1eaa0ed3..99ea521f1f 100644 --- a/po/pspp.pot +++ b/po/pspp.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: pspp-dev@gnu.org\n" -"POT-Creation-Date: 2006-10-26 14:25+0800\n" +"POT-Creation-Date: 2006-10-26 16:30+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1069,7 +1069,7 @@ msgstr "" #: src/language/command.c:802 src/language/data-io/matrix-data.c:539 #: src/language/data-io/print-space.c:75 src/language/dictionary/vector.c:203 -#: src/language/lexer/lexer.c:448 src/language/stats/autorecode.c:154 +#: src/language/lexer/lexer.c:456 src/language/stats/autorecode.c:154 #: src/language/xforms/select-if.c:62 msgid "expecting end of command" msgstr "" @@ -1114,16 +1114,16 @@ msgid "" "specified." msgstr "" -#: src/language/control/repeat.c:393 +#: src/language/control/repeat.c:399 #, c-format msgid "%ld TO %ld is an invalid range." msgstr "" -#: src/language/control/repeat.c:429 +#: src/language/control/repeat.c:435 msgid "String expected." msgstr "" -#: src/language/control/repeat.c:448 +#: src/language/control/repeat.c:454 msgid "No matching DO REPEAT." msgstr "" @@ -1233,27 +1233,27 @@ msgid "" "by itself on a single line with exactly one space between words." msgstr "" -#: src/language/data-io/data-reader.c:206 -#: src/language/data-io/data-reader.c:218 +#: src/language/data-io/data-reader.c:207 +#: src/language/data-io/data-reader.c:219 #, c-format msgid "Error reading file %s: %s." msgstr "" -#: src/language/data-io/data-reader.c:221 +#: src/language/data-io/data-reader.c:222 #, c-format msgid "%s: Partial record at end of file." msgstr "" -#: src/language/data-io/data-reader.c:272 +#: src/language/data-io/data-reader.c:273 #, c-format msgid "Attempt to read beyond end-of-file on file %s." msgstr "" -#: src/language/data-io/data-reader.c:275 +#: src/language/data-io/data-reader.c:276 msgid "Attempt to read beyond END DATA." msgstr "" -#: src/language/data-io/data-reader.c:433 +#: src/language/data-io/data-reader.c:434 msgid "" "This command is not valid here since the current input program does not " "access the inline file." @@ -2031,11 +2031,11 @@ msgid "" "s." msgstr "" -#: src/language/dictionary/value-labels.c:158 src/language/lexer/lexer.c:585 +#: src/language/dictionary/value-labels.c:158 src/language/lexer/lexer.c:593 msgid "expecting string" msgstr "" -#: src/language/dictionary/value-labels.c:167 src/language/lexer/lexer.c:599 +#: src/language/dictionary/value-labels.c:167 src/language/lexer/lexer.c:607 msgid "expecting integer" msgstr "" @@ -2264,94 +2264,94 @@ msgstr "" msgid "expecting format type" msgstr "" -#: src/language/lexer/lexer.c:259 +#: src/language/lexer/lexer.c:267 #, c-format msgid "%s does not form a valid number." msgstr "" -#: src/language/lexer/lexer.c:363 +#: src/language/lexer/lexer.c:371 #, c-format msgid "Bad character in input: `%c'." msgstr "" -#: src/language/lexer/lexer.c:365 +#: src/language/lexer/lexer.c:373 #, c-format msgid "Bad character in input: `\\%o'." msgstr "" -#: src/language/lexer/lexer.c:396 +#: src/language/lexer/lexer.c:404 #, c-format msgid "Subcommand %s may only be specified once." msgstr "" -#: src/language/lexer/lexer.c:404 +#: src/language/lexer/lexer.c:412 #, c-format msgid "missing required subcommand %s" msgstr "" -#: src/language/lexer/lexer.c:433 +#: src/language/lexer/lexer.c:441 #, c-format msgid "Syntax error %s at %s." msgstr "" -#: src/language/lexer/lexer.c:436 +#: src/language/lexer/lexer.c:444 #, c-format msgid "Syntax error at %s." msgstr "" -#: src/language/lexer/lexer.c:554 src/language/lexer/lexer.c:571 +#: src/language/lexer/lexer.c:562 src/language/lexer/lexer.c:579 #, c-format msgid "expecting `%s'" msgstr "" -#: src/language/lexer/lexer.c:613 +#: src/language/lexer/lexer.c:621 msgid "expecting number" msgstr "" -#: src/language/lexer/lexer.c:627 +#: src/language/lexer/lexer.c:635 msgid "expecting identifier" msgstr "" -#: src/language/lexer/lexer.c:1003 +#: src/language/lexer/lexer.c:1020 msgid "binary" msgstr "" -#: src/language/lexer/lexer.c:1008 +#: src/language/lexer/lexer.c:1025 msgid "octal" msgstr "" -#: src/language/lexer/lexer.c:1013 +#: src/language/lexer/lexer.c:1030 msgid "hex" msgstr "" -#: src/language/lexer/lexer.c:1023 +#: src/language/lexer/lexer.c:1040 #, c-format msgid "String of %s digits has %d characters, which is not a multiple of %d." msgstr "" -#: src/language/lexer/lexer.c:1052 +#: src/language/lexer/lexer.c:1069 #, c-format msgid "`%c' is not a valid %s digit." msgstr "" -#: src/language/lexer/lexer.c:1083 +#: src/language/lexer/lexer.c:1100 msgid "Unterminated string constant." msgstr "" -#: src/language/lexer/lexer.c:1137 +#: src/language/lexer/lexer.c:1154 msgid "Unexpected end of file in string concatenation." msgstr "" -#: src/language/lexer/lexer.c:1145 +#: src/language/lexer/lexer.c:1162 msgid "String expected following `+'." msgstr "" -#: src/language/lexer/lexer.c:1158 +#: src/language/lexer/lexer.c:1175 #, c-format msgid "String exceeds 255 characters in length (%d characters)." msgstr "" -#: src/language/lexer/lexer.c:1173 +#: src/language/lexer/lexer.c:1190 msgid "" "Sorry, literal strings may not contain null characters. Replacing with " "spaces." @@ -2458,17 +2458,17 @@ msgstr "" msgid "Closing `%s': %s." msgstr "" -#: src/language/line-buffer.c:447 +#: src/language/line-buffer.c:446 #, c-format msgid "opening \"%s\" as syntax file" msgstr "" -#: src/language/line-buffer.c:452 +#: src/language/line-buffer.c:451 #, c-format msgid "Opening `%s': %s." msgstr "" -#: src/language/line-buffer.c:465 +#: src/language/line-buffer.c:464 #, c-format msgid "Reading `%s': %s." msgstr "" diff --git a/src/language/ChangeLog b/src/language/ChangeLog index 2d49a13b8d..69f3be37f3 100644 --- a/src/language/ChangeLog +++ b/src/language/ChangeLog @@ -1,3 +1,8 @@ +Sat Oct 28 16:15:56 WST 2006 John Darrington + + * linebuffer.c linebuffer.h: Moved getl_buf from here, into + lexer/lexer.c + Thu Oct 26 20:19:00 2006 Ben Pfaff * command.def: Add DEBUG FLOAT FORMAT. diff --git a/src/language/control/ChangeLog b/src/language/control/ChangeLog index c245942610..50707bd4f2 100644 --- a/src/language/control/ChangeLog +++ b/src/language/control/ChangeLog @@ -1,3 +1,7 @@ +Sat Oct 28 16:18:48 WST 2006 John Darrington + + * repeat.c: Eliminated references to extern variable getl_buf. + Sun May 7 18:18:33 2006 Ben Pfaff Fix memory leaks. diff --git a/src/language/control/repeat.c b/src/language/control/repeat.c index 285acd7cd4..d812c12fc7 100644 --- a/src/language/control/repeat.c +++ b/src/language/control/repeat.c @@ -281,9 +281,10 @@ parse_lines (struct repeat_block *block) const char *cur_file_name; int cur_line_number; struct line_list *line; + struct string cur_line_copy; bool dot; - if (!getl_read_line (NULL)) + if (! lex_get_line_raw ()) return false; /* If the current file has changed then record the fact. */ @@ -292,27 +293,32 @@ parse_lines (struct repeat_block *block) || !strcmp (cur_file_name, previous_file_name)) previous_file_name = pool_strdup (block->pool, cur_file_name); - ds_rtrim (&getl_buf, ss_cstr (CC_SPACES)); - dot = ds_chomp (&getl_buf, get_endcmd ()); - if (recognize_do_repeat (ds_cstr (&getl_buf))) + ds_init_string (&cur_line_copy, lex_entire_line_ds () ); + ds_rtrim (&cur_line_copy, ss_cstr (CC_SPACES)); + dot = ds_chomp (&cur_line_copy, get_endcmd ()); + + if (recognize_do_repeat (ds_cstr (&cur_line_copy))) nesting_level++; - else if (recognize_end_repeat (ds_cstr (&getl_buf), &block->print)) + else if (recognize_end_repeat (ds_cstr (&cur_line_copy), &block->print)) { if (nesting_level-- == 0) { lex_discard_line (); + ds_destroy (&cur_line_copy); return true; } } if (dot) - ds_put_char (&getl_buf, get_endcmd ()); + ds_put_char (&cur_line_copy, get_endcmd ()); line = *last_line = pool_alloc (block->pool, sizeof *line); line->next = NULL; line->file_name = previous_file_name; line->line_number = cur_line_number; - line->line = pool_strdup (block->pool, ds_cstr (&getl_buf)); + line->line = pool_strdup (block->pool, ds_cstr (&cur_line_copy) ); last_line = &line->next; + + ds_destroy (&cur_line_copy); } lex_discard_line (); @@ -463,7 +469,8 @@ find_substitution (struct repeat_block *block, const char *name, size_t length) return NULL; } -/* Makes appropriate DO REPEAT macro substitutions within getl_buf. */ +/* Makes appropriate DO REPEAT macro substitutions within the + repeated lines. */ static void do_repeat_filter (struct string *line, void *block_) { diff --git a/src/language/data-io/ChangeLog b/src/language/data-io/ChangeLog index 0fb80cbc9c..24c932ab37 100644 --- a/src/language/data-io/ChangeLog +++ b/src/language/data-io/ChangeLog @@ -1,3 +1,7 @@ +Sat Oct 28 16:19:57 WST 2006 John Darrington + + * data-reader.c: Eliminated references to extern variable getl_buf + Sat Aug 5 08:25:07 2006 Ben Pfaff Fix bug #17329 in REREAD parsing, reported by John Darrington. diff --git a/src/language/data-io/data-reader.c b/src/language/data-io/data-reader.c index 6cd92882eb..6458a82172 100644 --- a/src/language/data-io/data-reader.c +++ b/src/language/data-io/data-reader.c @@ -170,7 +170,7 @@ read_inline_record (struct dfm_reader *r) getl_set_prompt_style (GETL_PROMPT_DATA); } - if (!getl_read_line (NULL)) + if (!lex_get_line_raw ()) { msg (SE, _("Unexpected end-of-file while reading data in BEGIN " "DATA. This probably indicates " @@ -180,14 +180,15 @@ read_inline_record (struct dfm_reader *r) return false; } - if (ds_length (&getl_buf) >= 8 - && !strncasecmp (ds_cstr (&getl_buf), "end data", 8)) + if (ds_length (lex_entire_line_ds() ) >= 8 + && !strncasecmp (lex_entire_line (), "end data", 8)) { - lex_set_prog (ds_end (&getl_buf)); + lex_discard_line (); return false; } - ds_assign_string (&r->line, &getl_buf); + ds_assign_string (&r->line, lex_entire_line_ds () ); + return true; } diff --git a/src/language/lexer/ChangeLog b/src/language/lexer/ChangeLog index 7172c1b8e2..cee1fd94ca 100644 --- a/src/language/lexer/ChangeLog +++ b/src/language/lexer/ChangeLog @@ -1,3 +1,8 @@ +Sat Oct 28 16:17:18 WST 2006 John Darrington + + * lexer.c lexer.h: Added a line_buffer (previously an external + reference called getl_buf). + Thu Oct 26 20:18:03 2006 Ben Pfaff * lexer.c (parse_string): Make lexing of binary, hex, and octal diff --git a/src/language/lexer/lexer.c b/src/language/lexer/lexer.c index 9f9e433815..a1300418a8 100644 --- a/src/language/lexer/lexer.c +++ b/src/language/lexer/lexer.c @@ -61,7 +61,7 @@ struct string tokstr; /* Static variables. */ -/* Pointer to next token in getl_buf. */ +/* Pointer to next token in line_buffer. */ static char *prog; /* True only if this line ends with a terminal dot. */ @@ -95,12 +95,19 @@ static void dump_token (void); /* Initialization. */ +static struct string line_buffer; + +static bool (*lex_read_line) (struct string *, bool *); + /* Initializes the lexer. */ void -lex_init (void) +lex_init (bool (*read_line_func) (struct string *, bool *)) { ds_init_empty (&tokstr); ds_init_empty (&put_tokstr); + ds_init_empty (&line_buffer); + lex_read_line = read_line_func; + if (!lex_get_line ()) eof = true; } @@ -110,6 +117,7 @@ lex_done (void) { ds_destroy (&put_tokstr); ds_destroy (&tokstr); + ds_destroy (&line_buffer); } @@ -700,7 +708,13 @@ lex_put_back_id (const char *id) const char * lex_entire_line (void) { - return ds_cstr (&getl_buf); + return ds_cstr (&line_buffer); +} + +const struct string * +lex_entire_line_ds (void) +{ + return &line_buffer; } /* As lex_entire_line(), but only returns the part of the current line @@ -720,18 +734,12 @@ lex_rest_of_line (int *end_dot) void lex_discard_line (void) { - prog = ds_end (&getl_buf); + ds_cstr (&line_buffer); /* Ensures ds_end points to something valid */ + prog = ds_end (&line_buffer); dot = false; put_token = 0; } -/* Sets the current position in the current line to P, which must be - in getl_buf. */ -void -lex_set_prog (char *p) -{ - prog = p; -} /* Discards the rest of the current command. When we're reading commands from a file, we skip tokens until @@ -802,16 +810,24 @@ strip_comments (struct string *string) } } +/* Reads a line, without performing any preprocessing */ +bool +lex_get_line_raw (void) +{ + bool dummy; + return lex_read_line (&line_buffer, &dummy); +} + /* Reads a line for use by the tokenizer, and preprocesses it by removing comments, stripping trailing whitespace and the terminal dot, and removing leading indentors. */ bool lex_get_line (void) { - struct string *line = &getl_buf; + struct string *line = &line_buffer; bool interactive; - if (!getl_read_line (&interactive)) + if (!lex_read_line (line, &interactive)) return false; strip_comments (line); @@ -976,7 +992,8 @@ lex_skip_comment (void) if (put_token == '.') break; - prog = ds_end (&getl_buf); + ds_cstr (&line_buffer); /* Ensures ds_end will point to a valid char */ + prog = ds_end (&line_buffer); if (dot) break; } diff --git a/src/language/lexer/lexer.h b/src/language/lexer/lexer.h index 2ffd01c3e2..c367bbb116 100644 --- a/src/language/lexer/lexer.h +++ b/src/language/lexer/lexer.h @@ -35,7 +35,7 @@ extern struct string tokstr; #include /* Initialization. */ -void lex_init (void); +void lex_init (bool (*)(struct string *, bool*)); void lex_done (void); /* Common functions. */ @@ -71,13 +71,14 @@ void lex_put_back_id (const char *tokid); /* Weird line processing functions. */ const char *lex_entire_line (void); +const struct string *lex_entire_line_ds (void); const char *lex_rest_of_line (int *end_dot); void lex_discard_line (void); -void lex_set_prog (char *p); void lex_discard_rest_of_command (void); /* Weird line reading functions. */ bool lex_get_line (void); +bool lex_get_line_raw (void); /* Token names. */ const char *lex_token_name (int); diff --git a/src/language/line-buffer.c b/src/language/line-buffer.c index 146ca00a92..0dcb70f949 100644 --- a/src/language/line-buffer.c +++ b/src/language/line-buffer.c @@ -98,7 +98,6 @@ static struct getl_source *last_source; static struct string getl_include_path; -struct string getl_buf; static void close_source (void); @@ -106,16 +105,17 @@ static void init_prompts (void); static void uninit_prompts (void); static enum getl_prompt_style get_prompt_style (void); + /* Initialize getl. */ void getl_initialize (void) { ds_init_cstr (&getl_include_path, fn_getenv_default ("STAT_INCLUDE_PATH", include_path)); - ds_init_empty (&getl_buf); init_prompts (); } + /* Delete everything from the include path. */ void getl_clear_include_path (void) @@ -387,7 +387,6 @@ getl_uninitialize (void) { while (cur_source != NULL) close_source (); - ds_destroy (&getl_buf); ds_destroy (&getl_include_path); free(file_loc); file_loc = NULL; @@ -502,7 +501,7 @@ read_line_from_source (struct string *line, struct getl_source *s) If INTERACTIVE is non-null, then when true is returned *INTERACTIVE will be set to true if the line was obtained interactively, false otherwise. */ -static bool +bool do_read_line (struct string *line, bool *interactive) { while (cur_source != NULL) @@ -525,16 +524,6 @@ do_read_line (struct string *line, bool *interactive) return false; } -/* Reads a single line into getl_buf. - Returns true when a line has been read, false at end of input. - If INTERACTIVE is non-null, then when true is returned - *INTERACTIVE will be set to true if the line was obtained - interactively, false otherwise. */ -bool -getl_read_line (bool *interactive) -{ - return do_read_line (&getl_buf, interactive); -} /* Current prompts in each style. */ static char *prompts[GETL_PROMPT_CNT]; diff --git a/src/language/line-buffer.h b/src/language/line-buffer.h index 25845ca836..ee3db55905 100644 --- a/src/language/line-buffer.h +++ b/src/language/line-buffer.h @@ -31,9 +31,6 @@ enum getl_prompt_style GETL_PROMPT_CNT }; -/* Current line. This line may be modified by modules other than - getl.c, and by lexer.c in particular. (Ugh.) */ -extern struct string getl_buf; void getl_initialize (void); void getl_uninitialize (void); @@ -66,5 +63,7 @@ void get_msg_location (struct msg_locator *loc); void getl_location (const char **fn, int *ln); +bool do_read_line (struct string *line, bool *interactive); + #endif /* line-buffer.h */ diff --git a/src/ui/terminal/main.c b/src/ui/terminal/main.c index 6a861b7026..6a7decd9d9 100644 --- a/src/ui/terminal/main.c +++ b/src/ui/terminal/main.c @@ -100,7 +100,7 @@ main (int argc, char **argv) if (parse_command_line (argc, argv)) { outp_read_devices (); - lex_init (); + lex_init (do_read_line); for (;;) { diff --git a/tests/command/do-repeat.sh b/tests/command/do-repeat.sh index 990704fe7c..0a702633c1 100755 --- a/tests/command/do-repeat.sh +++ b/tests/command/do-repeat.sh @@ -66,9 +66,9 @@ END REPEAT. VECTOR v(6). COMPUTE #idx = 0. -DO REPEAT a = 1 TO 2. - DO REPEAT b = 3 TO 5. - COMPUTE #x = a + b. +DO REPEAT i = 1 TO 2. + DO REPEAT j = 3 TO 5. + COMPUTE #x = i + j. COMPUTE #idx = #idx + 1. COMPUTE v(#idx) = #x. END REPEAT. @@ -80,7 +80,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE >/dev/null 2>&1 +$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare results"