#include <language/command.h>
#include <language/lexer/lexer.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <libpspp/message.h>
#include <libpspp/message.h>
#include <libpspp/str.h>
static struct string getl_include_path;
-struct string getl_buf;
static void close_source (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)
/* File locator stack. */
static const struct msg_locator **file_loc;
+
static int nfile_loc, mfile_loc;
\f
/* Close getl. */
{
while (cur_source != NULL)
close_source ();
- ds_destroy (&getl_buf);
ds_destroy (&getl_include_path);
free(file_loc);
file_loc = NULL;
nfile_loc--;
}
-/* Puts the current file and line number in F, or NULL and -1 if
+/* Puts the current file and line number into LOC, or NULL and -1 if
none. */
void
-msg_location (struct msg_locator *loc)
+get_msg_location (struct msg_locator *loc)
{
if (nfile_loc)
*loc = *file_loc[nfile_loc - 1];
return s->u.interactive (line, get_prompt_style ());
}
- abort ();
+ NOT_REACHED ();
}
/* Reads a single line into LINE.
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)
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);
-}
\f
/* Current prompts in each style. */
static char *prompts[GETL_PROMPT_CNT];