/* PSPPIRE - a graphical interface for PSPP.
- Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
return true;
}
-struct getl_interface *
-create_syntax_string_source (const char *format, ...)
+static struct syntax_string_source *
+create_syntax_string_source__ (void)
{
- va_list args;
-
struct syntax_string_source *sss = xzalloc (sizeof *sss);
sss->posn = 0;
- ds_init_empty (&sss->buffer);
-
- va_start (args, format);
- ds_put_vformat (&sss->buffer, format, args);
- va_end (args);
-
sss->parent.interactive = always_false;
sss->parent.close = do_close;
sss->parent.read = read_single_line;
sss->parent.name = name;
sss->parent.location = location;
+ return sss;
+}
+
+struct getl_interface *
+create_syntax_string_source (const char *s)
+{
+ struct syntax_string_source *sss = create_syntax_string_source__ ();
+ ds_init_cstr (&sss->buffer, s);
+ return &sss->parent;
+}
+
+struct getl_interface *
+create_syntax_format_source (const char *format, ...)
+{
+ struct syntax_string_source *sss;
+ va_list args;
+
+ sss = create_syntax_string_source__ ();
+
+ ds_init_empty (&sss->buffer);
+
+ va_start (args, format);
+ ds_put_vformat (&sss->buffer, format, args);
+ va_end (args);
return &sss->parent;
}
/* PSPPIRE - a graphical interface for PSPP.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#ifndef SYNTAX_STRING_SOURCE_H
#define SYNTAX_STRING_SOURCE_H
+#include "libpspp/compiler.h"
+
struct getl_interface;
struct syntax_string_source;
-struct getl_interface * create_syntax_string_source (const char *fmt, ...);
+struct getl_interface *create_syntax_string_source (const char *);
+struct getl_interface *create_syntax_format_source (const char *, ...)
+ PRINTF_FORMAT (1, 2);
const char * syntax_string_source_get_syntax (const struct syntax_string_source *s);
g_free (native_file_name);
- sss = create_syntax_string_source ("GET FILE=%s.",
+ sss = create_syntax_format_source ("GET FILE=%s.",
ds_cstr (&filename));
ds_destroy (&filename);
if ( de->save_as_portable )
{
- sss = create_syntax_string_source ("EXPORT OUTFILE=%s.",
+ sss = create_syntax_format_source ("EXPORT OUTFILE=%s.",
ds_cstr (&filename));
}
else
{
- sss = create_syntax_string_source ("SAVE OUTFILE=%s.",
+ sss = create_syntax_format_source ("SAVE OUTFILE=%s.",
ds_cstr (&filename));
}
g_free (native_file_name);
- sss = create_syntax_string_source ("SYSFILE INFO %s.",
+ sss = create_syntax_format_source ("SYSFILE INFO %s.",
ds_cstr (&filename));
execute_syntax (sss);
}