X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fexecutor.c;h=24b80db2443d3163ee5978ba02b8417341fac102;hb=ced729f41f90e56a7c8ec12f6497f61c9b73b779;hp=711e9563b849f16bd973860642e52dd433a0c538;hpb=0d01f7bd35591882cd13b6352409858ea33d39f7;p=pspp diff --git a/src/ui/gui/executor.c b/src/ui/gui/executor.c index 711e9563b8..24b80db244 100644 --- a/src/ui/gui/executor.c +++ b/src/ui/gui/executor.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2007, 2009 Free Software Foundation + Copyright (C) 2007, 2009, 2010 Free Software Foundation 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 @@ -16,15 +16,18 @@ #include -#include "executor.h" -#include "psppire-data-store.h" -#include -#include -#include -#include -#include -#include -#include "psppire-output-window.h" +#include "ui/gui/executor.h" + +#include "data/lazy-casereader.h" +#include "data/procedure.h" +#include "language/command.h" +#include "language/lexer/lexer.h" +#include "language/syntax-string-source.h" +#include "libpspp/cast.h" +#include "libpspp/getl.h" +#include "output/driver.h" +#include "ui/gui/psppire-data-store.h" +#include "ui/gui/psppire-output-window.h" extern struct dataset *the_dataset; extern struct source_stream *the_source_stream; @@ -45,7 +48,7 @@ execute_syntax (struct getl_interface *sss) gboolean retval = TRUE; struct casereader *reader; - size_t value_cnt; + const struct caseproto *proto; casenumber case_cnt; unsigned long int lazy_serial; @@ -62,9 +65,9 @@ execute_syntax (struct getl_interface *sss) needed. If the data store casereader is never needed, then it is reused the next time syntax is run, without wrapping it in another layer. */ - value_cnt = psppire_data_store_get_value_count (the_data_store); + proto = psppire_data_store_get_proto (the_data_store); case_cnt = psppire_data_store_get_case_count (the_data_store); - reader = lazy_casereader_create (value_cnt, case_cnt, + reader = lazy_casereader_create (proto, case_cnt, create_casereader_from_data_store, the_data_store, &lazy_serial); proc_set_active_file_data (the_dataset, reader); @@ -95,6 +98,8 @@ execute_syntax (struct getl_interface *sss) lex_destroy (lexer); + proc_execute (the_dataset); + psppire_dict_replace_dictionary (the_data_store->dict, dataset_dict (the_dataset)); @@ -102,9 +107,23 @@ execute_syntax (struct getl_interface *sss) if (!lazy_casereader_destroy (reader, lazy_serial)) psppire_data_store_set_reader (the_data_store, reader); - som_flush (); - - psppire_output_window_reload (); + output_flush (); return retval; } + +/* Executes null-terminated string SYNTAX as syntax. + Returns SYNTAX. */ +gchar * +execute_syntax_string (gchar *syntax) +{ + execute_const_syntax_string (syntax); + return syntax; +} + +/* Executes null-terminated string SYNTAX as syntax. */ +void +execute_const_syntax_string (const gchar *syntax) +{ + execute_syntax (create_syntax_string_source (syntax)); +}