X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire.c;h=0d41932adc0e6cd51036420908ba439418e33250;hb=9ade26c8349b4434008c46cf09bc7473ec743972;hp=bb6006d111be872bb67aa29a9c0716bc4d2c6a50;hpb=afdf3096926b561f4e6511c10fcf73fc6796b9d2;p=pspp-builds.git diff --git a/src/ui/gui/psppire.c b/src/ui/gui/psppire.c index bb6006d1..0d41932a 100644 --- a/src/ui/gui/psppire.c +++ b/src/ui/gui/psppire.c @@ -32,9 +32,6 @@ #include "data/sys-file-reader.h" #include "language/lexer/lexer.h" -#include "language/syntax-string-source.h" - -#include "libpspp/getl.h" #include "libpspp/i18n.h" #include "libpspp/message.h" #include "libpspp/version.h" @@ -68,12 +65,10 @@ PsppireVarStore *the_var_store = 0; static void create_icon_factory (void); -struct source_stream *the_source_stream ; struct dataset * the_dataset = NULL; static GtkWidget *the_data_window; -static void handle_msg (const struct msg *); static void load_data_file (const char *); static void @@ -89,7 +84,7 @@ replace_casereader (struct casereader *s) void -initialize (struct source_stream *ss, const char *data_file) +initialize (const char *data_file) { PsppireDict *dictionary = 0; @@ -102,9 +97,7 @@ initialize (struct source_stream *ss, const char *data_file) fh_init (); the_dataset = create_dataset (); - - the_source_stream = ss; - msg_init (ss, handle_msg); + psppire_set_lexer (NULL); dictionary = psppire_dict_new_from_dict (dataset_dict (the_dataset)); @@ -143,7 +136,6 @@ initialize (struct source_stream *ss, const char *data_file) void de_initialize (void) { - destroy_source_stream (the_source_stream); settings_done (); output_close (); i18n_done (); @@ -300,7 +292,25 @@ load_data_file (const char *arg) } static void -handle_msg (const struct msg *m) +handle_msg (const struct msg *m_, void *lexer_) +{ + struct lexer *lexer = lexer_; + struct msg m = *m_; + + if (lexer != NULL && m.file_name == NULL) + { + m.file_name = CONST_CAST (char *, lex_get_file_name (lexer)); + m.first_line = lex_get_first_line_number (lexer, 0); + m.last_line = lex_get_last_line_number (lexer, 0); + m.first_column = lex_get_first_column (lexer, 0); + m.last_column = lex_get_last_column (lexer, 0); + } + + message_item_submit (message_item_create (&m)); +} + +void +psppire_set_lexer (struct lexer *lexer) { - message_item_submit (message_item_create (m)); + msg_set_handler (handle_msg, lexer); }