Fixed buglet managing entries in the recent files lists.
[pspp-builds.git] / src / ui / gui / helper.c
index 09711f1bd1a39f4d51aa3f764fbba901ec862a58..0203999d653b38f6b0a343c82750cea1382f0f61 100644 (file)
@@ -40,7 +40,8 @@
 #include <data/procedure.h>
 #include <language/lexer/lexer.h>
 #include "psppire-data-store.h"
-
+#include <output/manager.h>
+#include "output-viewer.h"
 
 #include <gettext.h>
 
@@ -103,7 +104,7 @@ get_widget_assert (GladeXML *xml, const gchar *name)
   w = glade_xml_get_widget (xml, name);
 
   if ( !w )
-    g_warning ("Widget \"%s\" could not be found\n", name);
+    g_critical ("Widget \"%s\" could not be found\n", name);
 
   return w;
 }
@@ -167,8 +168,8 @@ extern PsppireDataStore *the_data_store;
 gboolean
 execute_syntax (struct getl_interface *sss)
 {
-  gboolean status;
   struct lexer *lexer;
+  gboolean retval = TRUE;
 
   struct casereader *reader = psppire_data_store_get_reader (the_data_store);
 
@@ -178,13 +179,21 @@ execute_syntax (struct getl_interface *sss)
 
   lexer = lex_create (the_source_stream);
 
-  getl_append_source (the_source_stream, sss);
+  getl_append_source (the_source_stream, sss, GETL_BATCH, ERRMODE_CONTINUE);
 
   for (;;)
     {
-      int result = cmd_parse (lexer, the_dataset);
+      enum cmd_result result = cmd_parse (lexer, the_dataset);
+
+      if ( cmd_result_is_failure (result))
+       {
+         retval = FALSE;
+         if ( source_stream_current_error_mode (the_source_stream)
+              == ERRMODE_STOP )
+           break;
+       }
 
-      if (result == CMD_EOF || result == CMD_FINISH)
+      if ( result == CMD_EOF || result == CMD_FINISH)
        break;
     }
 
@@ -192,11 +201,6 @@ execute_syntax (struct getl_interface *sss)
 
   lex_destroy (lexer);
 
-  /* GUI syntax needs this implicit EXECUTE command at the end of
-     every script.  Otherwise commands like GET could leave the GUI
-     without a datasheet. */
-  status = proc_execute (the_dataset);
-
   psppire_dict_replace_dictionary (the_data_store->dict,
                                   dataset_dict (the_dataset));
 
@@ -206,7 +210,13 @@ execute_syntax (struct getl_interface *sss)
     psppire_data_store_set_case_file (the_data_store, pcf);
   }
 
-  return status;
+  proc_set_active_file_data (the_dataset, NULL);
+
+  som_flush ();
+
+  reload_the_viewer ();
+
+  return retval;
 }