02110-1301, USA. */
#include <config.h>
+
#include <language/line-buffer.h>
-#include <libpspp/message.h>
+
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
-#include <libpspp/alloc.h>
+
+#include <data/file-name.h>
+#include <data/settings.h>
+#include <data/variable.h>
#include <language/command.h>
-#include <libpspp/message.h>
-#include <data/filename.h>
#include <language/lexer/lexer.h>
-#include <data/settings.h>
+#include <libpspp/alloc.h>
+#include <libpspp/message.h>
+#include <libpspp/message.h>
#include <libpspp/str.h>
-#include <output/table.h>
-#include <data/variable.h>
+#include <libpspp/verbose-msg.h>
#include <libpspp/version.h>
+#include <output/table.h>
#include "gettext.h"
#define _(msgid) gettext (msgid)
struct getl_source *next; /* Next file in list. */
/* Current location. */
- char *fn; /* Filename. */
+ char *fn; /* File name. */
int ln; /* Line number. */
enum getl_source_type
void
getl_initialize (void)
{
- ds_create (&getl_include_path,
- fn_getenv_default ("STAT_INCLUDE_PATH", include_path));
- ds_init (&getl_buf, 256);
+ ds_init_cstr (&getl_include_path,
+ fn_getenv_default ("STAT_INCLUDE_PATH", include_path));
+ ds_init_empty (&getl_buf);
init_prompts ();
}
getl_add_include_dir (const char *path)
{
if (ds_length (&getl_include_path))
- ds_putc (&getl_include_path, PATH_DELIMITER);
+ ds_put_char (&getl_include_path, ':');
- ds_puts (&getl_include_path, path);
+ ds_put_cstr (&getl_include_path, path);
}
/* Appends source S to the list of source files. */
append_source (create_syntax_file_source (fn));
}
-/* Inserts the given file with filename FN into the current file after
- the current line. */
+/* Inserts the given file with name FN into the current file
+ after the current line. */
void
getl_include_syntax_file (const char *fn)
{
if (cur_source != NULL)
{
- char *found_fn = fn_search_path (fn, ds_c_str (&getl_include_path),
+ char *found_fn = fn_search_path (fn, ds_cstr (&getl_include_path),
fn_dir_name (cur_source->fn));
if (found_fn != NULL)
{
}
/* File locator stack. */
-static const struct file_locator **file_loc;
+static const struct msg_locator **file_loc;
static int nfile_loc, mfile_loc;
\f
/* Close getl. */
/* Pushes F onto the stack of file locations. */
void
-err_push_file_locator (const struct file_locator *f)
+msg_push_msg_locator (const struct msg_locator *loc)
{
if (nfile_loc >= mfile_loc)
{
file_loc = xnrealloc (file_loc, mfile_loc, sizeof *file_loc);
}
- file_loc[nfile_loc++] = f;
+ file_loc[nfile_loc++] = loc;
}
/* Pops F off the stack of file locations.
Argument F is only used for verification that that is actually the
item on top of the stack. */
void
-err_pop_file_locator (const struct file_locator *f)
+msg_pop_msg_locator (const struct msg_locator *loc)
{
- assert (nfile_loc >= 0 && file_loc[nfile_loc - 1] == f);
+ assert (nfile_loc >= 0 && file_loc[nfile_loc - 1] == loc);
nfile_loc--;
}
/* Puts the current file and line number in F, or NULL and -1 if
none. */
void
-err_location (struct file_locator *f)
+msg_location (struct msg_locator *loc)
{
if (nfile_loc)
- *f = *file_loc[nfile_loc - 1];
+ *loc = *file_loc[nfile_loc - 1];
else
- getl_location (&f->filename, &f->line_number);
+ getl_location (&loc->file_name, &loc->line_number);
}
/* Reads a line from syntax file source S into LINE.
do
{
s->ln++;
- if (!ds_gets (line, s->u.syntax_file))
+ if (!ds_read_line (line, s->u.syntax_file))
{
if (ferror (s->u.syntax_file))
msg (ME, _("Reading `%s': %s."), s->fn, strerror (errno));
}
ds_chomp (line, '\n');
}
- while (s->ln == 1 && !memcmp (ds_c_str (line), "#!", 2));
+ while (s->ln == 1 && !memcmp (ds_cstr (line), "#!", 2));
/* Echo to listing file, if configured to do so. */
if (get_echo ())
- tab_output_text (TAB_LEFT | TAB_FIX, ds_c_str (line));
+ tab_output_text (TAB_LEFT | TAB_FIX, ds_cstr (line));
return true;
}