X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fexecutor.c;h=d6486ee4e7977b0b93fd188eaebf6a10dc1ec382;hb=53241f59ac766997bf67870639f70afb82396640;hp=8fb4c2603e37662c0753041b1221a131a0ee52cf;hpb=fe8dc2171009e90d2335f159d05f7e6660e24780;p=pspp diff --git a/src/ui/gui/executor.c b/src/ui/gui/executor.c index 8fb4c2603e..d6486ee4e7 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, 2010, 2011 Free Software Foundation + Copyright (C) 2007, 2009, 2010, 2011, 2012 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 @@ -26,7 +26,7 @@ #include "libpspp/cast.h" #include "output/driver.h" #include "ui/gui/psppire-data-store.h" -#include "ui/gui/psppire-output-window.h" +#include "ui/gui/psppire.h" /* Lazy casereader callback function used by execute_syntax. */ static struct casereader * @@ -36,6 +36,20 @@ create_casereader_from_data_store (void *data_store_) return psppire_data_store_get_reader (data_store); } +/* Ensures that dataset DS has a name, because some parts of the GUI insist + upon this. */ +static void +name_dataset_cb (struct dataset *ds, void *aux UNUSED) +{ + if (dataset_name (ds)[0] == '\0') + { + struct session *session = dataset_session (ds); + char *dataset_name = session_generate_dataset_name (session); + dataset_set_name (ds, dataset_name); + free (dataset_name); + } +} + static void new_pdw_cb (struct dataset *ds, void *aux UNUSED) { @@ -120,17 +134,19 @@ execute_syntax (PsppireDataWindow *window, struct lex_reader *lex_reader) struct dataset *ds = session_active_dataset (the_session); enum cmd_result result = cmd_parse (lexer, ds); - if ( cmd_result_is_failure (result)) + if (cmd_result_is_failure (result)) { retval = FALSE; - if ( lex_get_error_mode (lexer) == LEX_ERROR_STOP ) + if (lex_get_error_mode (lexer) == LEX_ERROR_STOP) break; } - if ( result == CMD_EOF || result == CMD_FINISH) + if (result == CMD_EOF || result == CMD_FINISH) break; } + session_for_each_dataset (the_session, name_dataset_cb, NULL); + ll_for_each_safe (pdw, next_pdw, PsppireDataWindow, ll, &all_data_windows) { struct dataset *ds; @@ -184,5 +200,5 @@ execute_syntax_string (PsppireDataWindow *window, gchar *syntax) void execute_const_syntax_string (PsppireDataWindow *window, const gchar *syntax) { - execute_syntax (window, lex_reader_for_string (syntax)); + execute_syntax (window, lex_reader_for_string (syntax, "UTF-8")); }