X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire.c;h=d4008659feb8943556551dcde9ee18fc37e7d49c;hb=9e24f9a5c52650da0700066e8d9e72261c6492ad;hp=e61269164046cfaa6792f2ece2b390d2d23bc3b9;hpb=d0b91eae59319ab2756d0d43b9cb15eb9cd3c234;p=pspp-builds.git diff --git a/src/ui/gui/psppire.c b/src/ui/gui/psppire.c index e6126916..d4008659 100644 --- a/src/ui/gui/psppire.c +++ b/src/ui/gui/psppire.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2004, 2005, 2006, 2009, 2010 Free Software Foundation + Copyright (C) 2004, 2005, 2006, 2009, 2010, 2011 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,8 +16,6 @@ #include -#include "ui/gui/psppire.h" - #include #include #include @@ -25,22 +23,23 @@ #include #include "data/casereader.h" +#include "data/dataset.h" #include "data/datasheet.h" #include "data/file-handle-def.h" #include "data/file-name.h" #include "data/por-file-reader.h" -#include "data/procedure.h" #include "data/settings.h" #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" + #include "output/driver.h" #include "output/journal.h" #include "output/message-item.h" + #include "ui/gui/dict-display.h" #include "ui/gui/executor.h" #include "ui/gui/psppire-data-store.h" @@ -56,6 +55,7 @@ #include "ui/source-init-opts.h" #include "ui/syntax-gen.h" +#include "gl/configmake.h" #include "gl/xalloc.h" #include "gl/relocatable.h" @@ -65,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 @@ -86,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; @@ -95,13 +93,11 @@ initialize (struct source_stream *ss, const char *data_file) preregister_widgets (); gsl_set_error_handler_off (); - settings_init (&viewer_width, &viewer_length); + settings_init (); fh_init (); - the_dataset = create_dataset (); - - the_source_stream = ss; - msg_init (ss, handle_msg); + the_dataset = dataset_create (); + psppire_set_lexer (NULL); dictionary = psppire_dict_new_from_dict (dataset_dict (the_dataset)); @@ -131,7 +127,7 @@ initialize (struct source_stream *ss, const char *data_file) if (data_file != NULL) load_data_file (data_file); - execute_syntax (create_syntax_string_source ("")); + execute_const_syntax_string (""); gtk_widget_show (the_data_window); } @@ -140,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 (); @@ -267,7 +262,7 @@ load_data_file (const char *arg) utf8 = g_locale_to_utf8 (arg, -1, NULL, &written, &err); if ( NULL == utf8) { - g_warning ("Cannot convert filename from local encoding \"%s\" to UTF-8: %s", + g_warning ("Cannot convert filename from local encoding `%s' to UTF-8: %s", local_encoding, err->message); g_clear_error (&err); @@ -297,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); }