msgstr ""
"Project-Id-Version: PSPP 0.4.2\n"
"Report-Msgid-Bugs-To: pspp-dev@gnu.org\n"
-"POT-Creation-Date: 2006-12-16 13:22+0900\n"
+"POT-Creation-Date: 2006-12-16 15:49+0900\n"
"PO-Revision-Date: 2006-05-26 17:49+0800\n"
"Last-Translator: John Darrington <john@darrington.wattle.id.au>\n"
"Language-Team: German <pspp-dev@gnu.org>\n"
msgid "Style of bevel around the custom entry button"
msgstr ""
-#: src/ui/gui/menu-actions.c:63 src/ui/gui/syntax-editor.c:60
-#: src/ui/gui/syntax-editor.c:82
+#: src/ui/gui/menu-actions.c:63 src/ui/gui/syntax-editor.c:64
+#: src/ui/gui/syntax-editor.c:86
msgid "Untitled"
msgstr "Unbetitelt"
msgid "Portable Files (*.por) "
msgstr "Tragbardatein (*.por)"
-#: src/ui/gui/menu-actions.c:239 src/ui/gui/syntax-editor.c:121
-#: src/ui/gui/syntax-editor.c:377
+#: src/ui/gui/menu-actions.c:239 src/ui/gui/syntax-editor.c:125
+#: src/ui/gui/syntax-editor.c:416
msgid "All Files"
msgstr "Alle Datei"
msgid "PSPP Error"
msgstr "PSPP Fehler"
+#: src/ui/gui/message-dialog.c:149
+#, c-format
+msgid "%s (line %d) %s"
+msgstr ""
+
#: src/ui/gui/missing-val-dialog.c:117 src/ui/gui/missing-val-dialog.c:162
msgid "Incorrect value for variable type"
msgstr "Unpassend Wert für Variable"
msgid "Incorrect range specification"
msgstr "Falshe Spannweitebeschreibung"
-#: src/ui/gui/psppire.c:71
+#: src/ui/gui/psppire.c:74
msgid "Sorry. The help system hasn't yet been implemented."
msgstr "Es gibt noch nicht kein Helpsysteme. Schade!"
msgid "Criteria"
msgstr ""
-#: src/ui/gui/syntax-editor.c:59
+#: src/ui/gui/syntax-editor.c:63
#, c-format
msgid "Save contents of syntax editor to %s?"
msgstr ""
-#: src/ui/gui/syntax-editor.c:107
+#: src/ui/gui/syntax-editor.c:111
#, fuzzy
msgid "Save Syntax"
msgstr "Speichern unter"
-#: src/ui/gui/syntax-editor.c:115 src/ui/gui/syntax-editor.c:371
+#: src/ui/gui/syntax-editor.c:119 src/ui/gui/syntax-editor.c:410
#, fuzzy
msgid "Syntax Files (*.sps) "
msgstr "Systemedatein (*.sav)"
-#: src/ui/gui/syntax-editor.c:276
+#: src/ui/gui/syntax-editor.c:312
#, fuzzy, c-format
msgid "%s --- PSPP Syntax Editor"
msgstr "PSPP Dateiaufbereiter"
-#: src/ui/gui/syntax-editor.c:363
+#: src/ui/gui/syntax-editor.c:402
msgid "Open Syntax"
msgstr ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: pspp-dev@gnu.org\n"
-"POT-Creation-Date: 2006-12-16 13:22+0900\n"
+"POT-Creation-Date: 2006-12-16 15:49+0900\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgid "Style of bevel around the custom entry button"
msgstr ""
-#: src/ui/gui/menu-actions.c:63 src/ui/gui/syntax-editor.c:60
-#: src/ui/gui/syntax-editor.c:82
+#: src/ui/gui/menu-actions.c:63 src/ui/gui/syntax-editor.c:64
+#: src/ui/gui/syntax-editor.c:86
msgid "Untitled"
msgstr ""
msgid "Portable Files (*.por) "
msgstr ""
-#: src/ui/gui/menu-actions.c:239 src/ui/gui/syntax-editor.c:121
-#: src/ui/gui/syntax-editor.c:377
+#: src/ui/gui/menu-actions.c:239 src/ui/gui/syntax-editor.c:125
+#: src/ui/gui/syntax-editor.c:416
msgid "All Files"
msgstr ""
msgid "PSPP Error"
msgstr ""
+#: src/ui/gui/message-dialog.c:149
+#, c-format
+msgid "%s (line %d) %s"
+msgstr ""
+
#: src/ui/gui/missing-val-dialog.c:117 src/ui/gui/missing-val-dialog.c:162
msgid "Incorrect value for variable type"
msgstr ""
msgid "Incorrect range specification"
msgstr ""
-#: src/ui/gui/psppire.c:71
+#: src/ui/gui/psppire.c:74
msgid "Sorry. The help system hasn't yet been implemented."
msgstr ""
msgid "Criteria"
msgstr ""
-#: src/ui/gui/syntax-editor.c:59
+#: src/ui/gui/syntax-editor.c:63
#, c-format
msgid "Save contents of syntax editor to %s?"
msgstr ""
-#: src/ui/gui/syntax-editor.c:107
+#: src/ui/gui/syntax-editor.c:111
msgid "Save Syntax"
msgstr ""
-#: src/ui/gui/syntax-editor.c:115 src/ui/gui/syntax-editor.c:371
+#: src/ui/gui/syntax-editor.c:119 src/ui/gui/syntax-editor.c:410
msgid "Syntax Files (*.sps) "
msgstr ""
-#: src/ui/gui/syntax-editor.c:276
+#: src/ui/gui/syntax-editor.c:312
#, c-format
msgid "%s --- PSPP Syntax Editor"
msgstr ""
-#: src/ui/gui/syntax-editor.c:363
+#: src/ui/gui/syntax-editor.c:402
msgid "Open Syntax"
msgstr ""
+Sun Dec 17 08:26:10 WST 2006 John Darrington <john@darrington.wattle.id.au>
+
+ * syntax-editor-source.c syntax-editor-source.h syntax-editor.h:
+ New files.
+
+ * message-dialog.c : Now reports the filename and line number in
+ error messages.
+
+ * psppire.c psppire.glade syntax-editor.c: Added the ability to run
+ syntax from the syntax editor.
+
+
Sat Dec 16 14:13:07 2006 Ben Pfaff <blp@gnu.org>
* psppire-data-store.c (geometry_get_justification): Don't assume
-export-dynamic
src_ui_gui_psppire_LDADD = \
+ lib/gtksheet/libgtksheet.a \
+ src/language/liblanguage.a \
+ src/ui/libuicommon.a \
+ src/output/charts/libcharts.a \
+ src/output/liboutput.a \
+ src/math/libpspp_math.a \
+ src/math/linreg/libpspp_linreg.a \
+ lib/linreg/liblinreg.a \
+ lib/gsl-extras/libgsl-extras.a \
+ src/data/libdata.a \
+ src/libpspp/libpspp.a \
$(GTK_LIBS) \
$(GLADE_LIBS) \
- $(top_builddir)/lib/gtksheet/libgtksheet.a \
- $(top_builddir)/src/ui/libuicommon.a \
- $(top_builddir)/src/math/libpspp_math.a \
- $(top_builddir)/src/data/libdata.a \
- $(top_builddir)/src/libpspp/libpspp.a \
$(top_builddir)/gl/libgl.a \
@LIBINTL@ @LIBREADLINE@
src/ui/gui/sort-cases-dialog.c \
src/ui/gui/sort-cases-dialog.h \
src/ui/gui/syntax-editor.c \
+ src/ui/gui/syntax-editor.h \
+ src/ui/gui/syntax-editor-source.c \
+ src/ui/gui/syntax-editor-source.h \
src/ui/gui/val-labs-dialog.c \
src/ui/gui/val-labs-dialog.h \
src/ui/gui/var-sheet.c \
msg = _("PSPP Error");
break;
};
-
+
parent = GTK_WINDOW(get_widget_assert(xml, "data_editor"));
dialog = gtk_message_dialog_new(parent,
message_type,
GTK_BUTTONS_CLOSE,
msg);
-
+
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
- "%s", m->text);
-
+ _("%s (line %d) %s"),
+ m->where.file_name,
+ m->where.line_number,
+ m->text);
+
gtk_window_set_transient_for(GTK_WINDOW(dialog), parent);
gtk_dialog_run(GTK_DIALOG(dialog));
static void
psppire_dict_init (PsppireDict *psppire_dict)
{
- psppire_dict->dict = dict_create ();
-
- dict_set_callbacks (psppire_dict->dict, &gui_callbacks, psppire_dict);
-
psppire_dict->stamp = g_random_int();
}
-/**
- * psppire_dict_new:
- * @returns: a new #PsppireDict object
- *
- * Creates a new #PsppireDict.
- */
-PsppireDict*
-psppire_dict_new (void)
-{
- return g_object_new (G_TYPE_PSPPIRE_DICT, NULL);
-}
-
-
/**
* psppire_dict_new_from_dict:
* @returns: a new #PsppireDict object
PsppireDict *new_dict = g_object_new (G_TYPE_PSPPIRE_DICT, NULL);
new_dict->dict = d;
+ dict_set_callbacks (new_dict->dict, &gui_callbacks, new_dict);
+
return new_dict;
}
/* -- PsppireDict --- */
GType psppire_dict_get_type (void);
-PsppireDict* psppire_dict_new (void);
PsppireDict* psppire_dict_new_from_dict (struct dictionary *d);
void psppire_dict_set_name (PsppireDict* s, gint idx, const gchar *name);
void psppire_dict_delete_var (PsppireDict *s, gint idx);
#include <libpspp/version.h>
#include <libpspp/copyleft.h>
+#include <data/file-handle-def.h>
#include <data/format.h>
#include <data/settings.h>
#include <data/file-name.h>
+#include <data/procedure.h>
#include <libpspp/getl.h>
+#include <language/lexer/lexer.h>
#include <getopt.h>
#include <gtk/gtk.h>
void create_icon_factory (void);
-static struct source_stream *the_source_stream ;
+struct source_stream *the_source_stream ;
+struct lexer *the_lexer;
+struct dataset * the_dataset = NULL;
+
int
main(int argc, char *argv[])
fmt_init();
settings_init();
+ fh_init ();
the_source_stream = create_source_stream (
fn_getenv_default ("STAT_INCLUDE_PATH", include_path)
);
+ the_lexer = lex_create (the_source_stream);
+
+ the_dataset = create_dataset ();
+
message_dialog_init (the_source_stream);
- the_dictionary = psppire_dict_new();
+ the_dictionary =
+ psppire_dict_new_from_dict (
+ dataset_dict (the_dataset)
+ );
bind_textdomain_codeset(PACKAGE, "UTF-8");
<widget class="GtkMenu" id="run1_menu">
<child>
- <widget class="GtkMenuItem" id="all1">
+ <widget class="GtkMenuItem" id="run_all">
<property name="visible">True</property>
<property name="label" translatable="yes">All</property>
<property name="use_underline">True</property>
</child>
<child>
- <widget class="GtkMenuItem" id="selection1">
+ <widget class="GtkMenuItem" id="run_selection">
<property name="visible">True</property>
<property name="label" translatable="yes">Selection</property>
<property name="use_underline">True</property>
</child>
<child>
- <widget class="GtkMenuItem" id="current_line1">
+ <widget class="GtkMenuItem" id="run_current_line">
<property name="visible">True</property>
<property name="label" translatable="yes">Current Line</property>
<property name="use_underline">True</property>
</child>
<child>
- <widget class="GtkMenuItem" id="to_end1">
+ <widget class="GtkMenuItem" id="run_to_end">
<property name="visible">True</property>
<property name="label" translatable="yes">To End</property>
<property name="use_underline">True</property>
--- /dev/null
+/*
+ PSPPIRE --- A Graphical User Interface for PSPP
+ Copyright (C) 2006 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA. */
+
+
+#include <libpspp/getl.h>
+#include <libpspp/alloc.h>
+#include <libpspp/compiler.h>
+#include <libpspp/str.h>
+
+#include <stdlib.h>
+
+#include <gtk/gtk.h>
+
+#include "syntax-editor-source.h"
+#include "syntax-editor.h"
+
+struct syntax_editor_source
+ {
+ struct getl_interface parent;
+ const struct syntax_editor *se;
+ GtkTextIter i;
+ GtkTextIter end;
+ };
+
+
+static bool
+always_false (const struct getl_interface *i UNUSED)
+{
+ return false;
+}
+
+/* Returns the name of the source */
+static const char *
+name (const struct getl_interface *i)
+{
+ const struct syntax_editor_source *ses =
+ (const struct syntax_editor_source *) i;
+
+ return ses->se->name;
+}
+
+
+/* Returns the location within the source */
+static int
+location (const struct getl_interface *i)
+{
+ const struct syntax_editor_source *ses = (const struct syntax_editor_source *) i;
+
+ return gtk_text_iter_get_line (&ses->i);
+}
+
+
+static bool
+read_line_from_buffer (struct getl_interface *i,
+ struct string *line,
+ enum getl_syntax *syntax_rules)
+{
+ gchar *text;
+ GtkTextIter next_line;
+
+ struct syntax_editor_source *ses = (struct syntax_editor_source *) i;
+
+ if ( gtk_text_iter_compare (&ses->i, &ses->end) >= 0)
+ return false;
+
+ gtk_text_buffer_get_iter_at_line ( ses->se->buffer,
+ &next_line,
+ 1 + gtk_text_iter_get_line (&ses->i)
+ );
+
+ text = gtk_text_buffer_get_text (ses->se->buffer,
+ &ses->i, &next_line,
+ FALSE);
+ g_strchomp (text);
+
+ ds_assign_cstr (line, text);
+
+ g_free (text);
+
+ gtk_text_iter_forward_line (&ses->i);
+
+ return true;
+}
+
+
+static void
+close (struct getl_interface *i )
+{
+ free (i);
+}
+
+struct getl_interface *
+create_syntax_editor_source (const struct syntax_editor *se,
+ GtkTextIter start,
+ GtkTextIter stop
+ )
+{
+ struct syntax_editor_source *ses = xzalloc (sizeof *ses);
+
+ ses->se = se;
+ ses->i = start;
+ ses->end = stop;
+
+
+ ses->parent.interactive = always_false;
+ ses->parent.read = read_line_from_buffer;
+ ses->parent.close = close;
+
+ ses->parent.name = name;
+ ses->parent.location = location;
+
+
+ return (struct getl_interface *) ses;
+}
--- /dev/null
+/*
+ PSPPIRE --- A Graphical User Interface for PSPP
+ Copyright (C) 2006 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA. */
+
+#ifndef SYNTAX_EDITOR_SOURCE_H
+#define SYNTAX_EDITOR_SOURCE_H
+
+#include <gtk/gtk.h>
+struct getl_interface;
+
+struct syntax_editor;
+
+struct getl_interface *
+create_syntax_editor_source (const struct syntax_editor *se,
+ GtkTextIter start,
+ GtkTextIter stop
+ );
+
+
+
+#endif
#include <glade/glade.h>
#include <gtk/gtk.h>
#include <libpspp/message.h>
-
+#include <libpspp/getl.h>
#include "helper.h"
-extern GladeXML *xml;
-struct syntax_editor
-{
- GtkWidget *window; /* The top level window of the editor */
- GtkTextBuffer *buffer; /* The buffer which contains the text */
- gchar *name; /* The name of this syntax buffer/editor */
-};
+
+#include <language/command.h>
+#include <data/procedure.h>
+#include "syntax-editor.h"
+#include "syntax-editor-source.h"
+
+extern struct source_stream *the_source_stream ;
+extern struct lexer *the_lexer;
+extern struct dataset *the_dataset;
+
+extern GladeXML *xml;
static gboolean save_editor_to_file (struct syntax_editor *se,
const gchar *filename,
return FALSE;
}
+static void
+on_run_all (GtkMenuItem *menuitem, gpointer user_data)
+{
+ GtkTextIter begin, end;
+ struct syntax_editor *se = user_data;
+
+ gtk_text_buffer_get_iter_at_line (se->buffer, &begin, 0);
+ gtk_text_buffer_get_iter_at_line (se->buffer, &end, -1);
+
+ getl_append_source (the_source_stream,
+ create_syntax_editor_source (se, begin, end));
+ for (;;)
+ {
+ 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;
+ }
+}
+
+
void
new_syntax_window (GtkMenuItem *menuitem,
gpointer user_data);
gpointer user_data);
-/* Create a new syntax editor with NAME.
- If NAME is NULL, a name will be automatically assigned
+/*
+ Create a new syntax editor with NAME.
+ If NAME is NULL, a name will be automatically assigned
*/
static struct syntax_editor *
new_syntax_editor (const gchar *name)
G_CALLBACK(on_syntax_save_as),
se);
+
+ g_signal_connect (get_widget_assert (new_xml,"run_all"),
+ "activate",
+ G_CALLBACK(on_run_all),
+ se);
+
g_object_unref (new_xml);
g_signal_connect (se->window, "delete-event",
return se;
}
-/* Callback for the File->New->Syntax menuitem */
+/*
+ Callback for the File->New->Syntax menuitem
+*/
void
new_syntax_window (GtkMenuItem *menuitem,
gpointer user_data)
}
-/* Save BUFFER to the file called FILENAME.
- If successful, clears the buffer's modified flag */
+/*
+ Save BUFFER to the file called FILENAME.
+ If successful, clears the buffer's modified flag
+*/
static gboolean
save_editor_to_file (struct syntax_editor *se,
const gchar *filename,
}
-/* Loads the buffer from the file called FILENAME
+/*
+ Loads the buffer from the file called FILENAME
*/
static gboolean
load_editor_from_file (struct syntax_editor *se,
}
#endif
+
+
+
+
--- /dev/null
+/*
+ PSPPIRE --- A Graphical User Interface for PSPP
+ Copyright (C) 2006 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA. */
+
+
+#ifndef SYNTAX_EDITOR_H
+#define SYNTAX_EDITOR_H
+
+#include <gtk/gtk.h>
+
+
+
+struct syntax_editor
+{
+ GtkWidget *window; /* The top level window of the editor */
+ GtkTextBuffer *buffer; /* The buffer which contains the text */
+ gchar *name; /* The name of this syntax buffer/editor */
+};
+
+
+#endif