From 897cec8000d45a5afc618fdb9e8fdd597c7b81ba Mon Sep 17 00:00:00 2001 From: John Darrington Date: Thu, 7 Dec 2006 11:34:17 +0000 Subject: [PATCH] Removed mutual dependency between libpspp and data --- src/libpspp/ChangeLog | 5 +++++ src/libpspp/getl.c | 9 +++++---- src/libpspp/getl.h | 2 +- src/ui/gui/psppire.c | 10 +++++++--- src/ui/terminal/main.c | 11 +++++++---- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/libpspp/ChangeLog b/src/libpspp/ChangeLog index c561caf6..45158bdb 100644 --- a/src/libpspp/ChangeLog +++ b/src/libpspp/ChangeLog @@ -1,3 +1,8 @@ +Thu Dec 7 20:33:23 WST 2006 John Darrington + + * getl.c getl.h : Changed signature of create function to take a + string indicating the initial include path. + Sun Dec 3 11:36:10 2006 Ben Pfaff * str.h (SS_LITERAL_INITIALIZER): Cast the string literal to "char diff --git a/src/libpspp/getl.c b/src/libpspp/getl.c index 4a320960..4a3f9deb 100644 --- a/src/libpspp/getl.c +++ b/src/libpspp/getl.c @@ -18,7 +18,6 @@ 02110-1301, USA. */ #include - #include #include "getl.h" @@ -28,8 +27,6 @@ #include #include -#include - struct getl_source { struct getl_source *included_from; /* File that this is nested inside. */ @@ -62,12 +59,16 @@ current_source (const struct source_stream *ss) /* Initialize getl. */ struct source_stream * -create_source_stream (void) +create_source_stream (const char *initial_include_path) { struct source_stream *ss = xzalloc (sizeof (*ss)); ll_init (&ss->sources); +#if 0 ds_init_cstr (&ss->the_include_path, fn_getenv_default ("STAT_INCLUDE_PATH", include_path)); +#endif + ds_init_cstr (&ss->the_include_path, initial_include_path); + return ss; } diff --git a/src/libpspp/getl.h b/src/libpspp/getl.h index f39f559c..f0b8585f 100644 --- a/src/libpspp/getl.h +++ b/src/libpspp/getl.h @@ -73,7 +73,7 @@ struct getl_interface struct source_stream; -struct source_stream * create_source_stream (void); +struct source_stream * create_source_stream (const char *); void destroy_source_stream (struct source_stream *); void getl_clear_include_path (struct source_stream *); diff --git a/src/ui/gui/psppire.c b/src/ui/gui/psppire.c index e8142199..3b4181ac 100644 --- a/src/ui/gui/psppire.c +++ b/src/ui/gui/psppire.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -118,7 +119,10 @@ main(int argc, char *argv[]) fmt_init(); settings_init(); - the_source_stream = create_source_stream (); + the_source_stream = create_source_stream ( + fn_getenv_default ("STAT_INCLUDE_PATH", include_path) + ); + message_dialog_init (the_source_stream); the_dictionary = psppire_dict_new(); @@ -138,7 +142,7 @@ main(int argc, char *argv[]) if ( !xml ) return 1; data_editor = get_widget_assert(xml, "data_editor"); - gtk_window_set_icon_from_file(GTK_WINDOW(data_editor), + gtk_window_set_icon_from_file(GTK_WINDOW(data_editor), PKGDATADIR "/psppicon.png",0); /* connect the signals in the interface */ @@ -148,7 +152,7 @@ main(int argc, char *argv[]) data_sheet = GTK_SHEET(get_widget_assert(xml, "data_sheet")); gtk_sheet_set_model(var_sheet, G_SHEET_MODEL(var_store)); - + gtk_sheet_set_model(data_sheet, G_SHEET_MODEL(data_store)); if (filename) diff --git a/src/ui/terminal/main.c b/src/ui/terminal/main.c index f1dd21d3..15d5e46c 100644 --- a/src/ui/terminal/main.c +++ b/src/ui/terminal/main.c @@ -97,14 +97,17 @@ main (int argc, char **argv) outp_init (); fn_init (); fh_init (); - the_source_stream = create_source_stream (); + the_source_stream = + create_source_stream ( + fn_getenv_default ("STAT_INCLUDE_PATH", include_path) + ); prompt_init (); readln_initialize (); settings_init (); random_init (); the_dataset = create_dataset (); - if (parse_command_line (argc, argv, the_source_stream)) + if (parse_command_line (argc, argv, the_source_stream)) { msg_ui_init (the_source_stream); outp_read_devices (); @@ -112,12 +115,12 @@ main (int argc, char **argv) for (;;) { - int result = cmd_parse (the_lexer, the_dataset, + int result = cmd_parse (the_lexer, the_dataset, proc_has_source (the_dataset) ? CMD_STATE_DATA : CMD_STATE_INITIAL); if (result == CMD_EOF || result == CMD_FINISH) break; - if (result == CMD_CASCADING_FAILURE && + if (result == CMD_CASCADING_FAILURE && !getl_is_interactive (the_source_stream)) { msg (SE, _("Stopping syntax file processing here to avoid " -- 2.30.2