msgstr ""
"Project-Id-Version: PSPP 0.4.2\n"
"Report-Msgid-Bugs-To: pspp-dev@gnu.org\n"
-"POT-Creation-Date: 2006-11-29 09:30+0800\n"
+"POT-Creation-Date: 2006-11-29 18:57+0800\n"
"PO-Revision-Date: 2006-05-26 17:49+0800\n"
"Last-Translator: John Darrington <john@darrington.wattle.id.au>\n"
"Language-Team: German <pspp-dev@gnu.org>\n"
msgid "This command may not follow ELSE in DO IF...END IF."
msgstr ""
-#: src/language/control/repeat.c:144
+#: src/language/control/repeat.c:156
#, c-format
msgid "Dummy variable name \"%s\" hides dictionary variable \"%s\"."
msgstr ""
-#: src/language/control/repeat.c:150
+#: src/language/control/repeat.c:162
#, c-format
msgid "Dummy variable name \"%s\" is given twice."
msgstr ""
-#: src/language/control/repeat.c:196
+#: src/language/control/repeat.c:209
#, c-format
msgid ""
"Dummy variable \"%s\" had %d substitutions, so \"%s\" must also, but %d were "
"specified."
msgstr ""
-#: src/language/control/repeat.c:401
+#: src/language/control/repeat.c:415
#, c-format
msgid "%ld TO %ld is an invalid range."
msgstr ""
-#: src/language/control/repeat.c:437
+#: src/language/control/repeat.c:451
msgid "String expected."
msgstr ""
-#: src/language/control/repeat.c:456
+#: src/language/control/repeat.c:470
msgid "No matching DO REPEAT."
msgstr ""
msgid "I/O error occurred writing data file \"%s\"."
msgstr ""
-#: src/language/data-io/file-handle.q:69
+#: src/language/data-io/file-handle.q:68
#, c-format
msgid ""
"File handle %s is already defined. Use CLOSE FILE HANDLE before redefining "
"a file handle."
msgstr ""
-#: src/language/data-io/file-handle.q:101
+#: src/language/data-io/file-handle.q:100
#, c-format
msgid ""
"Fixed-length records were specified on /RECFORM, but record length was not "
"specified on /LRECL. Assuming %d-character records."
msgstr ""
-#: src/language/data-io/file-handle.q:106
+#: src/language/data-io/file-handle.q:105
#, c-format
msgid ""
"Record length (%ld) must be at least one byte. Assuming %d-character "
"records."
msgstr ""
-#: src/language/data-io/file-handle.q:152
+#: src/language/data-io/file-handle.q:151
msgid "file"
msgstr ""
-#: src/language/data-io/file-handle.q:154
+#: src/language/data-io/file-handle.q:153
msgid "inline file"
msgstr ""
-#: src/language/data-io/file-handle.q:156
+#: src/language/data-io/file-handle.q:155
msgid "scratch file"
msgstr ""
-#: src/language/data-io/file-handle.q:177
+#: src/language/data-io/file-handle.q:176
msgid "expecting a file name or handle name"
msgstr ""
-#: src/language/data-io/file-handle.q:204
+#: src/language/data-io/file-handle.q:203
#, c-format
msgid "Handle for %s not allowed here."
msgstr ""
msgid "%s is a PSPP extension."
msgstr ""
-#: src/language/expressions/parse.c:1244 src/ui/terminal/command-line.c:131
-#: src/ui/terminal/command-line.c:150 src/ui/terminal/command-line.c:162
+#: src/language/expressions/parse.c:1244 src/ui/terminal/command-line.c:132
+#: src/ui/terminal/command-line.c:151 src/ui/terminal/command-line.c:163
#, c-format
msgid "%s is not yet implemented."
msgstr ""
msgid "Bad bounds in use of TO convention."
msgstr ""
-#: src/language/line-buffer.c:251
-#, c-format
-msgid "Can't find `%s' in include file search path."
-msgstr ""
-
-#: src/language/line-buffer.c:335
-#, c-format
-msgid "Closing `%s': %s."
-msgstr ""
-
-#: src/language/line-buffer.c:446
-#, c-format
-msgid "opening \"%s\" as syntax file"
-msgstr ""
-
-#: src/language/line-buffer.c:451
-#, c-format
-msgid "Opening `%s': %s."
-msgstr ""
-
-#: src/language/line-buffer.c:464
-#, c-format
-msgid "Reading `%s': %s."
-msgstr ""
-
#: src/language/stats/aggregate.c:218
msgid "while expecting COLUMNWISE"
msgstr ""
msgid "%s & %s"
msgstr ""
+#: src/language/syntax-file.c:88
+#, c-format
+msgid "opening \"%s\" as syntax file"
+msgstr ""
+
+#: src/language/syntax-file.c:93
+#, c-format
+msgid "Opening `%s': %s."
+msgstr ""
+
+#: src/language/syntax-file.c:106
+#, c-format
+msgid "Reading `%s': %s."
+msgstr ""
+
+#: src/language/syntax-file.c:126
+#, c-format
+msgid "Closing `%s': %s."
+msgstr ""
+
#: src/language/tests/float-format.c:127
#, c-format
msgid "%d-byte string needed but %d-byte string supplied."
msgid "Only USE ALL is currently implemented."
msgstr ""
-#: src/language/utilities/include.c:43
+#: src/language/utilities/include.c:49
msgid "expecting file name"
msgstr ""
+#: src/language/utilities/include.c:65
+#, c-format
+msgid "Can't find `%s' in include file search path."
+msgstr ""
+
#: src/language/utilities/permissions.c:77
#, c-format
msgid "Expecting %s or %s."
msgid "Font Selection"
msgstr "Schriftwahlung"
-#: src/ui/gui/message-dialog.c:136
+#: src/ui/gui/message-dialog.c:128
msgid "Script Error"
msgstr "Skript Fehler"
-#: src/ui/gui/message-dialog.c:140
+#: src/ui/gui/message-dialog.c:132
msgid "Data File Error"
msgstr "Datei Fehler"
-#: src/ui/gui/message-dialog.c:145
+#: src/ui/gui/message-dialog.c:137
msgid "PSPP Error"
msgstr "PSPP Fehler"
msgid "Incorrect range specification"
msgstr "Falshe Spannweitebeschreibung"
-#: src/ui/gui/psppire.c:70
+#: src/ui/gui/psppire.c:71
msgid "Sorry. The help system hasn't yet been implemented."
msgstr "Es gibt noch nicht kein Helpsysteme. Schade!"
msgid "Scale"
msgstr "Skalwert"
-#: src/ui/terminal/command-line.c:219
+#: src/ui/terminal/command-line.c:221
#, c-format
msgid ""
"PSPP, a program for statistical analysis of sample data.\n"
"\n"
msgstr ""
-#: src/ui/terminal/command-line.c:254
+#: src/ui/terminal/command-line.c:256
#, c-format
msgid ""
"\n"
"Report bugs to <%s>.\n"
msgstr ""
-#: src/ui/terminal/main.c:117
+#: src/ui/terminal/main.c:120
msgid ""
"Stopping syntax file processing here to avoid a cascade of dependent command "
"failures."
msgstr ""
-#: src/ui/terminal/msg-ui.c:62
+#: src/ui/terminal/msg-ui.c:66
#, c-format
msgid "Cannot open %s (%s). Writing errors to stdout instead.\n"
msgstr ""
-#: src/ui/terminal/msg-ui.c:89
+#: src/ui/terminal/msg-ui.c:93
msgid "Terminating execution of syntax file due to error."
msgstr ""
-#: src/ui/terminal/msg-ui.c:91
+#: src/ui/terminal/msg-ui.c:95
#, c-format
msgid "Errors (%d) exceeds limit (%d)."
msgstr ""
-#: src/ui/terminal/msg-ui.c:94
+#: src/ui/terminal/msg-ui.c:98
#, c-format
msgid "Warnings (%d) exceed limit (%d)."
msgstr ""
-#: src/ui/terminal/msg-ui.c:143
+#: src/ui/terminal/msg-ui.c:147
msgid "error"
msgstr "Fehler"
-#: src/ui/terminal/msg-ui.c:144
+#: src/ui/terminal/msg-ui.c:148
msgid "warning"
msgstr "Warnung"
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: pspp-dev@gnu.org\n"
-"POT-Creation-Date: 2006-11-29 09:30+0800\n"
+"POT-Creation-Date: 2006-11-29 18:57+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgid "This command may not follow ELSE in DO IF...END IF."
msgstr ""
-#: src/language/control/repeat.c:144
+#: src/language/control/repeat.c:156
#, c-format
msgid "Dummy variable name \"%s\" hides dictionary variable \"%s\"."
msgstr ""
-#: src/language/control/repeat.c:150
+#: src/language/control/repeat.c:162
#, c-format
msgid "Dummy variable name \"%s\" is given twice."
msgstr ""
-#: src/language/control/repeat.c:196
+#: src/language/control/repeat.c:209
#, c-format
msgid ""
"Dummy variable \"%s\" had %d substitutions, so \"%s\" must also, but %d were "
"specified."
msgstr ""
-#: src/language/control/repeat.c:401
+#: src/language/control/repeat.c:415
#, c-format
msgid "%ld TO %ld is an invalid range."
msgstr ""
-#: src/language/control/repeat.c:437
+#: src/language/control/repeat.c:451
msgid "String expected."
msgstr ""
-#: src/language/control/repeat.c:456
+#: src/language/control/repeat.c:470
msgid "No matching DO REPEAT."
msgstr ""
msgid "I/O error occurred writing data file \"%s\"."
msgstr ""
-#: src/language/data-io/file-handle.q:69
+#: src/language/data-io/file-handle.q:68
#, c-format
msgid ""
"File handle %s is already defined. Use CLOSE FILE HANDLE before redefining "
"a file handle."
msgstr ""
-#: src/language/data-io/file-handle.q:101
+#: src/language/data-io/file-handle.q:100
#, c-format
msgid ""
"Fixed-length records were specified on /RECFORM, but record length was not "
"specified on /LRECL. Assuming %d-character records."
msgstr ""
-#: src/language/data-io/file-handle.q:106
+#: src/language/data-io/file-handle.q:105
#, c-format
msgid ""
"Record length (%ld) must be at least one byte. Assuming %d-character "
"records."
msgstr ""
-#: src/language/data-io/file-handle.q:152
+#: src/language/data-io/file-handle.q:151
msgid "file"
msgstr ""
-#: src/language/data-io/file-handle.q:154
+#: src/language/data-io/file-handle.q:153
msgid "inline file"
msgstr ""
-#: src/language/data-io/file-handle.q:156
+#: src/language/data-io/file-handle.q:155
msgid "scratch file"
msgstr ""
-#: src/language/data-io/file-handle.q:177
+#: src/language/data-io/file-handle.q:176
msgid "expecting a file name or handle name"
msgstr ""
-#: src/language/data-io/file-handle.q:204
+#: src/language/data-io/file-handle.q:203
#, c-format
msgid "Handle for %s not allowed here."
msgstr ""
msgid "%s is a PSPP extension."
msgstr ""
-#: src/language/expressions/parse.c:1244 src/ui/terminal/command-line.c:131
-#: src/ui/terminal/command-line.c:150 src/ui/terminal/command-line.c:162
+#: src/language/expressions/parse.c:1244 src/ui/terminal/command-line.c:132
+#: src/ui/terminal/command-line.c:151 src/ui/terminal/command-line.c:163
#, c-format
msgid "%s is not yet implemented."
msgstr ""
msgid "Bad bounds in use of TO convention."
msgstr ""
-#: src/language/line-buffer.c:251
-#, c-format
-msgid "Can't find `%s' in include file search path."
-msgstr ""
-
-#: src/language/line-buffer.c:335
-#, c-format
-msgid "Closing `%s': %s."
-msgstr ""
-
-#: src/language/line-buffer.c:446
-#, c-format
-msgid "opening \"%s\" as syntax file"
-msgstr ""
-
-#: src/language/line-buffer.c:451
-#, c-format
-msgid "Opening `%s': %s."
-msgstr ""
-
-#: src/language/line-buffer.c:464
-#, c-format
-msgid "Reading `%s': %s."
-msgstr ""
-
#: src/language/stats/aggregate.c:218
msgid "while expecting COLUMNWISE"
msgstr ""
msgid "%s & %s"
msgstr ""
+#: src/language/syntax-file.c:88
+#, c-format
+msgid "opening \"%s\" as syntax file"
+msgstr ""
+
+#: src/language/syntax-file.c:93
+#, c-format
+msgid "Opening `%s': %s."
+msgstr ""
+
+#: src/language/syntax-file.c:106
+#, c-format
+msgid "Reading `%s': %s."
+msgstr ""
+
+#: src/language/syntax-file.c:126
+#, c-format
+msgid "Closing `%s': %s."
+msgstr ""
+
#: src/language/tests/float-format.c:127
#, c-format
msgid "%d-byte string needed but %d-byte string supplied."
msgid "Only USE ALL is currently implemented."
msgstr ""
-#: src/language/utilities/include.c:43
+#: src/language/utilities/include.c:49
msgid "expecting file name"
msgstr ""
+#: src/language/utilities/include.c:65
+#, c-format
+msgid "Can't find `%s' in include file search path."
+msgstr ""
+
#: src/language/utilities/permissions.c:77
#, c-format
msgid "Expecting %s or %s."
msgid "Font Selection"
msgstr ""
-#: src/ui/gui/message-dialog.c:136
+#: src/ui/gui/message-dialog.c:128
msgid "Script Error"
msgstr ""
-#: src/ui/gui/message-dialog.c:140
+#: src/ui/gui/message-dialog.c:132
msgid "Data File Error"
msgstr ""
-#: src/ui/gui/message-dialog.c:145
+#: src/ui/gui/message-dialog.c:137
msgid "PSPP Error"
msgstr ""
msgid "Incorrect range specification"
msgstr ""
-#: src/ui/gui/psppire.c:70
+#: src/ui/gui/psppire.c:71
msgid "Sorry. The help system hasn't yet been implemented."
msgstr ""
msgid "Scale"
msgstr ""
-#: src/ui/terminal/command-line.c:219
+#: src/ui/terminal/command-line.c:221
#, c-format
msgid ""
"PSPP, a program for statistical analysis of sample data.\n"
"\n"
msgstr ""
-#: src/ui/terminal/command-line.c:254
+#: src/ui/terminal/command-line.c:256
#, c-format
msgid ""
"\n"
"Report bugs to <%s>.\n"
msgstr ""
-#: src/ui/terminal/main.c:117
+#: src/ui/terminal/main.c:120
msgid ""
"Stopping syntax file processing here to avoid a cascade of dependent command "
"failures."
msgstr ""
-#: src/ui/terminal/msg-ui.c:62
+#: src/ui/terminal/msg-ui.c:66
#, c-format
msgid "Cannot open %s (%s). Writing errors to stdout instead.\n"
msgstr ""
-#: src/ui/terminal/msg-ui.c:89
+#: src/ui/terminal/msg-ui.c:93
msgid "Terminating execution of syntax file due to error."
msgstr ""
-#: src/ui/terminal/msg-ui.c:91
+#: src/ui/terminal/msg-ui.c:95
#, c-format
msgid "Errors (%d) exceeds limit (%d)."
msgstr ""
-#: src/ui/terminal/msg-ui.c:94
+#: src/ui/terminal/msg-ui.c:98
#, c-format
msgid "Warnings (%d) exceed limit (%d)."
msgstr ""
-#: src/ui/terminal/msg-ui.c:143
+#: src/ui/terminal/msg-ui.c:147
msgid "error"
msgstr ""
-#: src/ui/terminal/msg-ui.c:144
+#: src/ui/terminal/msg-ui.c:148
msgid "warning"
msgstr ""
+Wed Nov 29 19:35:44 WST 2006 John Darrington <john@darrington.wattle.id.au>
+
+ * command.c: Updated to reflect changed function names.
+
+ * line-buffer.c line-buffer.h: Removed. Guts of it moved to
+ libpspp/getl.[ch] The rest moved to files listed below.
+
+ * syntax-file.c syntax-file.h prompt.c prompt.h: New files.
+
Wed Nov 22 06:26:42 2006 Ben Pfaff <blp@gnu.org>
* command.def: HOST command needs F_KEEP_FINAL_TOKEN.
noinst_LIBRARIES += src/language/liblanguage.a
src_language_liblanguage_a_SOURCES = \
- src/language/line-buffer.c \
- src/language/line-buffer.h \
+ src/language/syntax-file.c \
+ src/language/syntax-file.h \
+ src/language/prompt.c \
+ src/language/prompt.h \
src/language/command.c \
src/language/command.h \
src/language/command.def
#include <data/settings.h>
#include <data/variable.h>
#include <language/lexer/lexer.h>
-#include <language/line-buffer.h>
+#include <language/prompt.h>
#include <libpspp/alloc.h>
#include <libpspp/assertion.h>
#include <libpspp/compiler.h>
enum cmd_result result;
/* Read the command's first token. */
- getl_set_prompt_style (GETL_PROMPT_FIRST);
+ prompt_set_style (PROMPT_FIRST);
set_completion_state (state);
lex_get (lexer);
if (lex_token (lexer) == T_STOP)
/* Null commands can result from extra empty lines. */
return CMD_SUCCESS;
}
- getl_set_prompt_style (GETL_PROMPT_LATER);
+ prompt_set_style (PROMPT_LATER);
/* Parse the command name. */
command = parse_command_name (lexer);
#include <data/dictionary.h>
#include <data/procedure.h>
#include <data/settings.h>
+#include <libpspp/getl.h>
#include <language/command.h>
#include <language/lexer/lexer.h>
#include <language/lexer/variable-parser.h>
-#include <language/line-buffer.h>
#include <libpspp/alloc.h>
#include <libpspp/message.h>
-#include <libpspp/message.h>
#include <libpspp/misc.h>
#include <libpspp/pool.h>
#include <libpspp/str.h>
/* A DO REPEAT...END REPEAT block. */
struct repeat_block
{
+ struct getl_interface parent ;
+
struct pool *pool; /* Pool used for storage. */
struct dataset *ds; /* The dataset for this block */
struct line_list *first_line; /* First line in line buffer. */
static bool parse_lines (struct lexer *, struct repeat_block *);
static void create_vars (struct repeat_block *);
-static int parse_ids (struct lexer *, const struct dictionary *dict, struct repeat_entry *, struct pool *);
-static int parse_numbers (struct lexer *, struct repeat_entry *, struct pool *);
-static int parse_strings (struct lexer *, struct repeat_entry *, struct pool *);
+static int parse_ids (struct lexer *, const struct dictionary *dict,
+ struct repeat_entry *, struct pool *);
+
+static int parse_numbers (struct lexer *, struct repeat_entry *,
+ struct pool *);
+
+static int parse_strings (struct lexer *, struct repeat_entry *,
+ struct pool *);
+
+static void do_repeat_filter (struct getl_interface *, struct string *);
+static bool do_repeat_read (struct getl_interface *, struct string *);
+static void do_repeat_close (struct getl_interface *);
+static bool always_false (const struct getl_interface *i UNUSED);
-static void do_repeat_filter (struct string *line, void *block);
-static bool do_repeat_read (struct string *line, char **file_name,
- int *line_number, void *block);
-static void do_repeat_close (void *block);
int
cmd_do_repeat (struct lexer *lexer, struct dataset *ds)
block->cur_line = NULL;
block->loop_idx = -1;
- getl_include_filter (do_repeat_filter, do_repeat_close, block);
- getl_include_function (do_repeat_read, NULL, block);
+
+ block->parent.read = do_repeat_read;
+ block->parent.close = do_repeat_close;
+ block->parent.filter = do_repeat_filter;
+ block->parent.interactive = always_false;
+
+ getl_include_source ( (struct getl_interface *) block);
return CMD_SUCCESS;
for (iter = block->macros; iter != NULL; iter = iter->next)
if (!strcasecmp (iter->id, lex_tokid (lexer)))
{
- msg (SE, _("Dummy variable name \"%s\" is given twice."), lex_tokid (lexer));
+ msg (SE, _("Dummy variable name \"%s\" is given twice."),
+ lex_tokid (lexer));
return false;
}
for (;;)
{
- const char *cur_file_name;
- int cur_line_number;
+ const char *cur_file_name = getl_source_name ();
+ int cur_line_number = getl_source_location ();
struct line_list *line;
struct string cur_line_copy;
bool dot;
return false;
/* If the current file has changed then record the fact. */
- getl_location (&cur_file_name, &cur_line_number);
- if (previous_file_name == NULL
+ if (cur_file_name &&
+ (previous_file_name == NULL
|| !strcmp (cur_file_name, previous_file_name))
+ )
previous_file_name = pool_strdup (block->pool, cur_file_name);
ds_init_string (&cur_line_copy, lex_entire_line_ds (lexer) );
/* Makes appropriate DO REPEAT macro substitutions within the
repeated lines. */
static void
-do_repeat_filter (struct string *line, void *block_)
+do_repeat_filter (struct getl_interface *block_, struct string *line)
{
- struct repeat_block *block = block_;
+ struct repeat_block *block = (struct repeat_block *) block_;
bool in_apos, in_quote;
char *cp;
struct string output;
Puts the line in OUTPUT, sets the file name in *FILE_NAME and
line number in *LINE_NUMBER. Returns true if a line was
obtained, false if the source is exhausted. */
+#if 0
static bool
do_repeat_read (struct string *output, char **file_name, int *line_number,
void *block_)
+#endif
+static bool
+do_repeat_read (struct getl_interface *b, struct string *output)
{
- struct repeat_block *block = block_;
+ struct repeat_block *block = (struct repeat_block *) b;
struct line_list *line;
if (block->cur_line == NULL)
line = block->cur_line;
ds_assign_cstr (output, line->line);
+#if 0
*file_name = line->file_name;
*line_number = -line->line_number;
+#endif
block->cur_line = line->next;
return true;
}
/* Frees a DO REPEAT block.
Called by getl to close out the DO REPEAT block. */
static void
-do_repeat_close (void *block_)
+do_repeat_close (struct getl_interface *block_)
{
- struct repeat_block *block = block_;
+ struct repeat_block *block = (struct repeat_block *) block_;
pool_destroy (block->pool);
}
+
+
+static bool
+always_false (const struct getl_interface *i UNUSED)
+{
+ return false;
+}
#include <language/command.h>
#include <language/data-io/file-handle.h>
#include <language/lexer/lexer.h>
-#include <language/line-buffer.h>
+#include <language/prompt.h>
#include <libpspp/alloc.h>
#include <libpspp/assertion.h>
#include <libpspp/message.h>
lex_get (r->lexer);
if (!lex_force_match_id (r->lexer, "BEGIN") || !lex_force_match_id (r->lexer, "DATA"))
return false;
- getl_set_prompt_style (GETL_PROMPT_DATA);
+ prompt_set_style (PROMPT_DATA);
}
if (!lex_get_line_raw (r->lexer))
r->flags |= DFM_SAW_BEGIN_DATA;
/* Input procedure reads from inline file. */
- getl_set_prompt_style (GETL_PROMPT_DATA);
+ prompt_set_style (PROMPT_DATA);
ok = procedure (ds, NULL, NULL);
dfm_close_reader (r);
#include <data/file-name.h>
#include <language/command.h>
#include <language/lexer/lexer.h>
-#include <language/line-buffer.h>
#include <libpspp/assertion.h>
#include <libpspp/message.h>
#include <libpspp/magic.h>
#include <libpspp/assertion.h>
#include <language/command.h>
#include <libpspp/message.h>
-#include <language/line-buffer.h>
#include <libpspp/magic.h>
#include <data/settings.h>
+#include <libpspp/getl.h>
#include <libpspp/str.h>
#include "size_max.h"
#include <libpspp/alloc.h>
#include <language/command.h>
#include <libpspp/message.h>
-#include <language/line-buffer.h>
+#include <libpspp/getl.h>
+#include <language/syntax-file.h>
#include <language/lexer/lexer.h>
#include <libpspp/str.h>
+#include <data/file-name.h>
+
#include "gettext.h"
#define _(msgid) gettext (msgid)
int
cmd_include (struct lexer *lexer, struct dataset *ds UNUSED)
{
+ char *found_fn;
+ char *target_fn;
+
/* Skip optional FILE=. */
if (lex_match_id (lexer, "FILE"))
lex_match (lexer, '=');
lex_error (lexer, _("expecting file name"));
return CMD_CASCADING_FAILURE;
}
- getl_include_syntax_file (ds_cstr (lex_tokstr (lexer)));
+
+ target_fn = ds_cstr (lex_tokstr (lexer));
+
+ found_fn = fn_search_path (target_fn,
+ getl_include_path (),
+ NULL);
+
+ if (found_fn != NULL)
+ {
+ getl_include_source (create_syntax_file_source (found_fn));
+ free (found_fn);
+ }
+ else
+ msg (SE, _("Can't find `%s' in include file search path."),
+ target_fn);
lex_get (lexer);
return lex_end_of_command (lexer);
#include <language/command.h>
#include <language/lexer/format-parser.h>
#include <language/lexer/lexer.h>
-#include <language/line-buffer.h>
+#include <language/prompt.h>
#include <libpspp/alloc.h>
#include <libpspp/compiler.h>
#include <libpspp/copyleft.h>
do_cc (cmd.s_cce, FMT_CCE);
if (cmd.sbc_prompt)
- getl_set_prompt (GETL_PROMPT_FIRST, cmd.s_prompt);
+ prompt_set (PROMPT_FIRST, cmd.s_prompt);
if (cmd.sbc_cprompt)
- getl_set_prompt (GETL_PROMPT_LATER, cmd.s_cprompt);
+ prompt_set (PROMPT_LATER, cmd.s_cprompt);
if (cmd.sbc_dprompt)
- getl_set_prompt (GETL_PROMPT_DATA, cmd.s_dprompt);
+ prompt_set (PROMPT_DATA, cmd.s_dprompt);
if (cmd.sbc_decimal)
fmt_set_decimal (cmd.dec == STC_DOT ? '.' : ',');
+Wed Nov 29 19:35:44 WST 2006 John Darrington <john@darrington.wattle.id.au>
+
+ * getl.c getl.h: New files. Created interface from base of
+ language/line-buffer.[ch]
+
+ * msg-locator.c msg-locator.h: New files. Moved from
+ language/line-buffer.[ch]
+
Fri Nov 24 17:27:00 2006 Ben Pfaff <blp@gnu.org>
* misc.h: (min) Removed. All references updated to use MIN, from
src/libpspp/float-format.h \
src/libpspp/freaderror.c \
src/libpspp/freaderror.h \
+ src/libpspp/getl.h \
+ src/libpspp/getl.c \
src/libpspp/hash.c \
src/libpspp/hash.h \
src/libpspp/i18n.c \
src/libpspp/i18n.h \
src/libpspp/integer-format.c \
src/libpspp/integer-format.h \
+ src/libpspp/msg-locator.c \
+ src/libpspp/msg-locator.h \
src/libpspp/ll.c \
src/libpspp/ll.h \
src/libpspp/llx.c \
#include <config.h>
-#include <libpspp/message.h>
+#include "message.h"
+#include "msg-locator.h"
#include <assert.h>
#include <stdarg.h>
/* Message handler as set by msg_init(). */
static void (*msg_handler) (const struct msg *);
-static void (*msg_location) (struct msg_locator *);
-
/* Disables emitting messages if positive. */
static int messages_disabled;
}
void
-msg_init ( void (*handler) (const struct msg *),
- void (*location) (struct msg_locator *) )
+msg_init ( void (*handler) (const struct msg *) )
{
msg_handler = handler;
- msg_location = location;
}
void
void
msg_emit (struct msg *m)
{
- msg_location (&m->where);
+ get_msg_location (&m->where);
if (!messages_disabled)
msg_handler (m);
free (m->text);
};
/* Initialization. */
-void msg_init ( void (*handler) (const struct msg *),
- void (*location) (struct msg_locator *) ) ;
+void msg_init ( void (*handler) (const struct msg *) );
void msg_done (void);
#include <xalloc.h>
#include <assert.h>
#include "flexifile.h"
+#include <string.h>
#include <data/casefile.h>
#include <data/casefile-private.h>
#include <data/case.h>
#define N_(msgid) msgid
#include <libpspp/message.h>
+#include <libpspp/msg-locator.h>
#include "message-dialog.h"
#include "progname.h"
static GQueue *message_queue;
-static void
-msg_location (struct msg_locator *loc)
-{
- loc->file_name = NULL;
- loc->line_number = -1;
-}
-
-
void
message_dialog_init (void)
{
message_queue = g_queue_new();
- msg_init (enqueue_msg, msg_location);
+ msg_init (enqueue_msg);
}
-
void
message_dialog_done (void)
{
#include <libpspp/copyleft.h>
#include <data/format.h>
#include <data/settings.h>
+#include <libpspp/getl.h>
#include <getopt.h>
#include <gtk/gtk.h>
glade_init();
-
-
fmt_init();
settings_init();
-
+ getl_initialize ();
message_dialog_init();
the_dictionary = psppire_dict_new();
/* start the event loop */
gtk_main();
+ getl_uninitialize ();
message_dialog_done();
settings_done();
#include <libpspp/assertion.h>
#include <libpspp/copyleft.h>
#include <libpspp/message.h>
-#include <language/line-buffer.h>
+#include <language/syntax-file.h>
#include "progname.h"
#include <data/settings.h>
-#include "read-line.h"
#include <output/output.h>
#include <data/file-name.h>
+#include <libpspp/getl.h>
#include <libpspp/str.h>
#include <libpspp/version.h>
#include <libpspp/verbose-msg.h>
+#include "read-line.h"
#include "gettext.h"
#define _(msgid) gettext (msgid)
char *pspprc_fn = fn_search_path ("rc", config_path, NULL);
if (pspprc_fn != NULL)
{
- getl_append_syntax_file (pspprc_fn);
+ getl_append_source (create_syntax_file_source (pspprc_fn));
+
free (pspprc_fn);
}
}
outp_configure_macro (argv[i]);
else
{
- getl_append_syntax_file (argv[i]);
+ getl_append_source (create_syntax_file_source (argv[i]));
syntax_files++;
}
if (!syntax_files || interactive_mode)
- getl_append_interactive (readln_read);
+ getl_append_source (create_readln_source () );
return true;
}
#include "progname.h"
#include "read-line.h"
+
#include <data/dictionary.h>
#include <data/file-handle-def.h>
+#include <libpspp/getl.h>
#include <data/file-name.h>
#include <data/format.h>
#include <data/procedure.h>
#include <gsl/gsl_errno.h>
#include <language/command.h>
#include <language/lexer/lexer.h>
-#include <language/line-buffer.h>
+#include <language/prompt.h>
#include <libpspp/compiler.h>
#include <libpspp/message.h>
#include <libpspp/version.h>
fn_init ();
fh_init ();
getl_initialize ();
+ prompt_init ();
readln_initialize ();
settings_init ();
random_init ();
fh_done ();
lex_destroy (the_lexer);
getl_uninitialize ();
+ prompt_done ();
readln_uninitialize ();
outp_done ();
#include "exit.h"
#include "linebreak.h"
-#include <language/line-buffer.h>
+#include <libpspp/msg-locator.h>
+#include <libpspp/getl.h>
#include <data/settings.h>
#include <libpspp/message.h>
+#include <libpspp/str.h>
#include <errno.h>
+#include <stdio.h>
+
#include "gettext.h"
#define _(msgid) gettext (msgid)
msg_file = stdout;
}
}
- msg_init (handle_msg, get_msg_location);
+ msg_init (handle_msg);
}
void
#include "msg-ui.h"
-#include <data/file-name.h>
#include <data/file-name.h>
#include <data/settings.h>
#include <language/command.h>
#include <libpspp/message.h>
#include <libpspp/str.h>
#include <libpspp/version.h>
-#include <output/table.h>
+#include <language/prompt.h>
#include "xalloc.h"
static char **dont_complete (const char *, int, int);
#endif /* HAVE_READLINE */
+
+struct readln_source
+{
+ struct getl_interface parent ;
+
+ bool (*interactive_func) (struct string *line,
+ enum prompt_style) ;
+};
+
+
static bool initialised = false;
/* Initialize getl. */
initialised = false;
#if HAVE_READLINE && unix
- if (history_file != NULL)
+ if (history_file != NULL && false == get_testing_mode() )
write_history (history_file);
clear_history ();
free (history_file);
#endif
}
+
+static bool
+read_interactive (struct getl_interface *s, struct string *line)
+{
+ struct readln_source *is =
+ (struct readln_source *) s ;
+
+ return is->interactive_func (line, prompt_get_style ());
+}
+
+static bool
+always_true (const struct getl_interface *s UNUSED)
+{
+ return true;
+}
+
/* Display a welcoming message. */
static void
welcome (void)
#endif
}
+
+
+
+
+
/* Gets a line from the user and stores it into LINE.
Prompts the user with PROMPT.
Returns true if successful, false at end of file.
- Suitable for passing to getl_append_interactive(). */
-bool
-readln_read (struct string *line, enum getl_prompt_style style)
+ */
+static bool
+readln_read (struct string *line, enum prompt_style style)
{
- const char *prompt = getl_get_prompt (style);
+ const char *prompt = prompt_get (style);
#if HAVE_READLINE
char *string;
#endif
welcome ();
#if HAVE_READLINE
- rl_attempted_completion_function = (style == GETL_PROMPT_FIRST
+ rl_attempted_completion_function = (style == PROMPT_FIRST
? complete_command_name
: dont_complete);
string = readline (prompt);
#endif
}
+
+static void
+readln_close (struct getl_interface *i)
+{
+ free (i);
+}
+
+/* Creates a source which uses readln to get its line */
+struct getl_interface *
+create_readln_source (void)
+{
+ struct readln_source *rlns = xzalloc (sizeof (*rlns));
+
+ rlns->interactive_func = readln_read;
+
+ rlns->parent.interactive = always_true;
+ rlns->parent.read = read_interactive;
+ rlns->parent.close = readln_close;
+
+ return (struct getl_interface *) rlns;
+}
+
+
#if HAVE_READLINE
static char *command_generator (const char *text, int state);
#define READLN_H
#include <libpspp/str.h>
-#include <language/line-buffer.h>
+#include <libpspp/getl.h>
void readln_initialize (void);
void readln_uninitialize (void);
-bool readln_read (struct string *line, enum getl_prompt_style);
+
+struct getl_interface *create_readln_source (void);
+
+
#endif /* READLN_H */
# We use the stdinput here, because the bug seems to manifest itself only in
# interactive mode.
activity="run program"
-cat $TESTFILE | $SUPERVISOR $PSPP -o raw-ascii > /dev/null
+cat $TESTFILE | $SUPERVISOR $PSPP --testing-mode -o raw-ascii > /dev/null
if [ $? -ne 0 ] ; then fail ; fi
pass