Patch #5884.
[pspp-builds.git] / src / language / syntax-string-source.c
index 85478bf7c0ef033264194f7457783adf45166d67..c3e8d4ffd1713718ea3a0a3e7a27d9258c9a5e94 100644 (file)
@@ -18,6 +18,8 @@
   02110-1301, USA. */
 
 
+#include <config.h>
+
 #include <libpspp/getl.h>
 #include <libpspp/alloc.h>
 #include <libpspp/compiler.h>
@@ -58,7 +60,7 @@ location (const struct getl_interface *i UNUSED)
 
 
 static void
-close (struct getl_interface *i )
+do_close (struct getl_interface *i )
 {
   struct syntax_string_source *sss = (struct syntax_string_source *) i;
 
@@ -114,7 +116,7 @@ create_syntax_string_source (const char *format, ...)
   va_end (args);
 
   sss->parent.interactive = always_false;
-  sss->parent.close = close;
+  sss->parent.close = do_close;
   sss->parent.read = read_single_line;
 
   sss->parent.name = name;
@@ -123,3 +125,11 @@ create_syntax_string_source (const char *format, ...)
 
   return (struct getl_interface *) sss;
 }
+
+/* Return the syntax currently contained in S.
+   Primarily usefull for debugging */
+const char *
+syntax_string_source_get_syntax (const struct syntax_string_source *s)
+{
+  return ds_cstr (&s->buffer);
+}