#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>
function;
/* INTERACTIVE. */
- bool (*interactive) (struct string *line, const char *prompt);
+ bool (*interactive) (struct string *line, enum getl_prompt_style);
}
u;
static void init_prompts (void);
static void uninit_prompts (void);
-static const char *get_prompt (void);
+static enum getl_prompt_style get_prompt_style (void);
/* Initialize getl. */
void
/* Creates an interactive source with the given FUNCTION. */
static struct getl_source *
create_interactive_source (bool (*function) (struct string *line,
- const char *prompt))
+ enum getl_prompt_style))
{
struct getl_source *s = xmalloc (sizeof *s);
s->fn = NULL;
obtained or false at end of file. */
void
getl_append_interactive (bool (*function) (struct string *line,
- const char *prompt))
+ enum getl_prompt_style))
{
append_source (create_interactive_source (function));
}
/* File locator stack. */
static const struct msg_locator **file_loc;
+
static int nfile_loc, mfile_loc;
\f
/* Close getl. */
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];
case FUNCTION:
return s->u.function.read (line, &s->fn, &s->ln, s->u.function.aux);
case INTERACTIVE:
- return s->u.interactive (line, get_prompt ());
+ return s->u.interactive (line, get_prompt_style ());
}
- abort ();
+ NOT_REACHED ();
}
/* Reads a single line into LINE.
}
/* Returns the current prompt. */
-static const char *
-get_prompt (void)
+static enum getl_prompt_style
+get_prompt_style (void)
{
- return prompts[current_style];
+ return current_style;
}