[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pspp-cvs] pspp/src ChangeLog message.c data/file-name.c l...
From: |
Ben Pfaff |
Subject: |
[Pspp-cvs] pspp/src ChangeLog message.c data/file-name.c l... |
Date: |
Tue, 25 Apr 2006 18:03:03 +0000 |
CVSROOT: /cvsroot/pspp
Module name: pspp
Branch:
Changes by: Ben Pfaff <address@hidden> 06/04/25 18:03:03
Modified files:
src : ChangeLog message.c
src/data : file-name.c
src/language : line-buffer.c
src/libpspp : ChangeLog automake.mk message.h
src/ui/gui : ChangeLog automake.mk message-dialog.c
message-dialog.h psppire.c
src/ui/terminal: ChangeLog automake.mk command-line.c main.c
read-line.c
Added files:
src/libpspp : verbose-msg.c verbose-msg.h
src/ui/terminal: msg-ui.c msg-ui.h
Log message:
Continue reforming error message support. In this phase, drop actual
message printing from core code, substituting a callback, and add the
callback to each UI. Also, move verbose_msg() into its own module.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/ChangeLog.diff?tr1=1.275&tr2=1.276&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/message.c.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/data/file-name.c.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/language/line-buffer.c.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/libpspp/ChangeLog.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/libpspp/automake.mk.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/libpspp/message.h.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/libpspp/verbose-msg.c?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/libpspp/verbose-msg.h?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/ui/gui/ChangeLog.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/ui/gui/automake.mk.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/ui/gui/message-dialog.c.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/ui/gui/message-dialog.h.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/ui/gui/psppire.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/ui/terminal/ChangeLog.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/ui/terminal/automake.mk.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/ui/terminal/command-line.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/ui/terminal/main.c.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/ui/terminal/msg-ui.c?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/ui/terminal/msg-ui.h?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/ui/terminal/read-line.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
Patches:
Index: pspp/src/ChangeLog
diff -u pspp/src/ChangeLog:1.275 pspp/src/ChangeLog:1.276
--- pspp/src/ChangeLog:1.275 Tue Apr 25 00:41:12 2006
+++ pspp/src/ChangeLog Tue Apr 25 18:03:03 2006
@@ -1,3 +1,32 @@
+Tue Apr 25 10:47:37 2006 Ben Pfaff <address@hidden>
+
+ Continue reforming error message support. In this phase, drop
+ actual message printing from core code, substituting a callback,
+ and add the callback to each UI. Also, move verbose_msg() into
+ its own module.
+
+ * message.c: (var err_error_count) Renamed error_count and moved
+ to ui/terminal/msg-ui.c.
+ (var err_warning_count) Renamed warning_count and moved to
+ ui/terminal/msg-ui.c.
+ (err_check_count) Renamed check_msg_count() and moved to
+ ui/terminal/msg-ui.c.
+ (dump_message) Rewrote to take stream instead of function pointer
+ and moved to ui/terminal/msg-ui.c.
+ (msg_emit) Moved its guts to ui/terminal/msg-ui.c as handle_msg()
+ and rewrote to just pass message to callback.
+
+ (var err_verbosity) Renamed "verbosity" and moved to
+ libpspp/verbose-msg.c.
+ (verbose_msg) Moved to libpspp/verbose-msg.c.
+
+ (var err_already_flagged) Removed.
+ (puts_stdout) Removed.
+
+ (var msg_handler) New static variable.
+ (msg_init) New function.
+ (msg_get_command_name) New function.
+
Mon Apr 24 17:40:08 2006 Ben Pfaff <address@hidden>
Continue reforming error message support. In this phase, rename
Index: pspp/src/data/file-name.c
diff -u pspp/src/data/file-name.c:1.3 pspp/src/data/file-name.c:1.4
--- pspp/src/data/file-name.c:1.3 Mon Apr 17 01:54:15 2006
+++ pspp/src/data/file-name.c Tue Apr 25 18:03:03 2006
@@ -18,19 +18,24 @@
02110-1301, USA. */
#include <config.h>
-#include <libpspp/message.h>
+
#include "file-name.h"
-#include <stdio.h>
-#include <stdlib.h>
+
#include <ctype.h>
#include <errno.h>
-#include <libpspp/alloc.h>
+#include <stdio.h>
+#include <stdlib.h>
+
#include "intprops.h"
+#include "settings.h"
+#include "xreadlink.h"
+
+#include <libpspp/alloc.h>
+#include <libpspp/message.h>
#include <libpspp/message.h>
#include <libpspp/str.h>
-#include "settings.h"
+#include <libpspp/verbose-msg.h>
#include <libpspp/version.h>
-#include "xreadlink.h"
#include "gettext.h"
#define _(msgid) gettext (msgid)
Index: pspp/src/language/line-buffer.c
diff -u pspp/src/language/line-buffer.c:1.9 pspp/src/language/line-buffer.c:1.10
--- pspp/src/language/line-buffer.c:1.9 Tue Apr 25 00:41:12 2006
+++ pspp/src/language/line-buffer.c Tue Apr 25 18:03:03 2006
@@ -18,21 +18,25 @@
02110-1301, USA. */
#include <config.h>
+
#include <language/line-buffer.h>
-#include <libpspp/message.h>
+
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
-#include <libpspp/alloc.h>
-#include <language/command.h>
-#include <libpspp/message.h>
+
#include <data/file-name.h>
-#include <language/lexer/lexer.h>
#include <data/settings.h>
-#include <libpspp/str.h>
-#include <output/table.h>
#include <data/variable.h>
+#include <language/command.h>
+#include <language/lexer/lexer.h>
+#include <libpspp/alloc.h>
+#include <libpspp/message.h>
+#include <libpspp/message.h>
+#include <libpspp/str.h>
+#include <libpspp/verbose-msg.h>
#include <libpspp/version.h>
+#include <output/table.h>
#include "gettext.h"
#define _(msgid) gettext (msgid)
Index: pspp/src/libpspp/ChangeLog
diff -u pspp/src/libpspp/ChangeLog:1.14 pspp/src/libpspp/ChangeLog:1.15
--- pspp/src/libpspp/ChangeLog:1.14 Tue Apr 25 00:41:12 2006
+++ pspp/src/libpspp/ChangeLog Tue Apr 25 18:03:03 2006
@@ -1,3 +1,17 @@
+Tue Apr 25 10:54:44 2006 Ben Pfaff <address@hidden>
+
+ Continue reforming error message support. In this phase, drop
+ actual message printing from core code, substituting a callback,
+ and add the callback to each UI. Also, move verbose_msg() into
+ its own module.
+
+ * automake.mk (src_libpspp_libpspp_a_SOURCES): Added
+ verbose-msg.c, verbose-msg.h.
+
+ * verbose-msg.c: New file.
+
+ * verbose-msg.h: New file.
+
Mon Apr 24 17:26:47 2006 Ben Pfaff <address@hidden>
Continue reforming error message support. In this phase, rename
Index: pspp/src/libpspp/automake.mk
diff -u pspp/src/libpspp/automake.mk:1.5 pspp/src/libpspp/automake.mk:1.6
--- pspp/src/libpspp/automake.mk:1.5 Sun Apr 16 04:46:41 2006
+++ pspp/src/libpspp/automake.mk Tue Apr 25 18:03:03 2006
@@ -27,6 +27,8 @@
src/libpspp/start-date.h \
src/libpspp/str.c \
src/libpspp/str.h \
+ src/libpspp/verbose-msg.c \
+ src/libpspp/verbose-msg.h \
src/libpspp/version.h
DISTCLEANFILES+=src/libpspp/version.c
Index: pspp/src/libpspp/message.h
diff -u pspp/src/libpspp/message.h:1.8 pspp/src/libpspp/message.h:1.9
--- pspp/src/libpspp/message.h:1.8 Tue Apr 25 00:41:12 2006
+++ pspp/src/libpspp/message.h Tue Apr 25 18:03:03 2006
@@ -85,35 +85,21 @@
char *text; /* Error text. */
};
-/* Number of errors, warnings reported. */
-extern int err_error_count;
-extern int err_warning_count;
-
-/* If number of allowable errors/warnings is exceeded, then a message
- is displayed and this flag is set to suppress subsequent
- messages. */
-extern int err_already_flagged;
-
-/* Nonnegative verbosity level. Higher value == more verbose. */
-extern int err_verbosity;
-
/* Initialization. */
+void msg_init (void (*handler) (const struct msg *));
void msg_done (void);
/* Emitting messages. */
void msg (enum msg_class, const char *format, ...)
PRINTF_FORMAT (2, 3);
-void msg_emit (const struct msg *);
-
-void verbose_msg (int level, const char *format, ...)
- PRINTF_FORMAT (2, 3);
+void msg_emit (struct msg *);
/* Error context. */
void msg_set_command_name (const char *);
+const char *msg_get_command_name (void);
void msg_push_msg_locator (const struct msg_locator *);
void msg_pop_msg_locator (const struct msg_locator *);
void msg_location (struct msg_locator *);
-void err_check_count (void);
/* Used in panic situations only. */
void request_bug_report_and_abort (const char *msg);
Index: pspp/src/message.c
diff -u pspp/src/message.c:1.12 pspp/src/message.c:1.13
--- pspp/src/message.c:1.12 Tue Apr 25 00:41:12 2006
+++ pspp/src/message.c Tue Apr 25 18:03:03 2006
@@ -18,35 +18,28 @@
02110-1301, USA. */
#include <config.h>
+
#include <libpspp/message.h>
+
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
-#include <libpspp/alloc.h>
+
#include <data/file-name.h>
-#include <language/line-buffer.h>
#include <language/lexer/lexer.h>
-#include <data/settings.h>
-#include <ui/terminal/read-line.h>
+#include <libpspp/alloc.h>
#include <libpspp/version.h>
-#include "exit.h"
-#include "linebreak.h"
-#include "progname.h"
-
-#include "gettext.h"
-#define _(msgid) gettext (msgid)
-#define N_(msgid) msgid
-int err_error_count;
-int err_warning_count;
+#include "progname.h"
+#include "xvasprintf.h"
-int err_already_flagged;
+/* Current command name as set by msg_set_command_name(). */
+static char *command_name;
-int err_verbosity;
+/* Message handler as set by msg_init(). */
+static void (*msg_handler) (const struct msg *);
-static char *command_name;
-
/* Public functions. */
/* Writes error message in CLASS, with text FORMAT, formatted with
@@ -67,197 +60,28 @@
msg_emit (&m);
}
-/* Writes MESSAGE formatted with printf, to stderr, if the
- verbosity level is at least LEVEL. */
-void
-verbose_msg (int level, const char *format, ...)
-{
- if (err_verbosity >= level)
- {
- va_list args;
-
- va_start (args, format);
- fprintf (stderr, "%s: ", program_name);
- vfprintf (stderr, format, args);
- putc ('\n', stderr);
- va_end (args);
- }
-}
-
-/* Checks whether we've had so many errors that it's time to quit
- processing this syntax file. */
void
-err_check_count (void)
+msg_init (void (*handler) (const struct msg *))
{
- if (get_errorbreak() && err_error_count)
- msg (MN, _("Terminating execution of syntax file due to error."));
- else if (err_error_count > get_mxerrs() )
- msg (MN, _("Errors (%d) exceeds limit (%d)."),
- err_error_count, get_mxerrs());
- else if (err_error_count + err_warning_count > get_mxwarns() )
- msg (MN, _("Warnings (%d) exceed limit (%d)."),
- err_error_count + err_warning_count, get_mxwarns() );
- else
- return;
-
- getl_abort_noninteractive ();
+ msg_handler = handler;
}
-static void puts_stdout (int line_indent, const char *line, size_t length);
-static void dump_message (char *msg,
- void (*func) (int line_indent,
- const char *line, size_t length),
- unsigned width, unsigned indent);
-
void
msg_done (void)
{
- lex_done();
- getl_uninitialize ();
- readln_uninitialize();
}
-/* Emits E as an error message.
- Frees `text' member in E. */
+/* Emits M as an error message.
+ Frees allocated data in M. */
void
-msg_emit (const struct msg *m)
+msg_emit (struct msg *m)
{
- struct category
- {
- bool show_command_name; /* Show command name with error? */
- bool show_file_location; /* Show syntax file location? */
- };
-
- static const struct category categories[] =
- {
- {false, false}, /* MSG_GENERAL. */
- {true, true}, /* MSG_SYNTAX. */
- {false, true}, /* MSG_DATA. */
- };
-
- struct severity
- {
- const char *name; /* How to identify this severity. */
- int *count; /* Number of msgs with this severity so far. */
- };
-
- static struct severity severities[] =
- {
- {N_("error"), &err_error_count}, /* MSG_ERROR. */
- {N_("warning"), &err_warning_count}, /* MSG_WARNING. */
- {NULL, NULL}, /* MSG_NOTE. */
- };
-
- const struct category *category = &categories[m->category];
- const struct severity *severity = &severities[m->severity];
- struct string string = DS_INITIALIZER;
-
- if (category->show_file_location && m->where.file_name)
- {
- ds_printf (&string, "%s:", m->where.file_name);
- if (m->where.line_number != -1)
- ds_printf (&string, "%d:", m->where.line_number);
- ds_putc (&string, ' ');
- }
-
- if (severity->name != NULL)
- ds_printf (&string, "%s: ", gettext (severity->name));
-
- if (severity->count != NULL)
- ++*severity->count;
-
- if (category->show_command_name && command_name != NULL)
- ds_printf (&string, "%s: ", command_name);
-
- ds_puts (&string, m->text);
-
- /* FIXME: Check set_messages and set_errors to determine where to
- send errors and messages. */
- dump_message (ds_c_str (&string), puts_stdout, get_viewwidth (), 8);
-
- ds_destroy (&string);
+ msg_handler (m);
free (m->text);
}
/* Private functions. */
-/* Write LINE_INDENT spaces, the LENGTH characters in LINE, then
- a new-line to stdout. */
-static void puts_stdout (int line_indent,
- const char *line, size_t length)
-{
- int i;
- for (i = 0; i < line_indent; i++)
- putchar (' ');
- fwrite (line, 1, length, stdout);
- putchar ('\n');
-}
-
-/* Divides MSG into lines of WIDTH width for the first line and
- WIDTH - INDENT width for each succeeding line. Each line is
- passed to FUNC as a null-terminated string (no new-line
- character is included in the string). */
-static void
-dump_message (char *msg,
- void (*func) (int line_indent, const char *line, size_t length),
- unsigned width, unsigned indent)
-{
- size_t length = strlen (msg);
- char *string, *breaks;
- int line_indent;
- size_t line_start, i;
-
- /* Allocate temporary buffers.
- If we can't get memory for them, then just dump the whole
- message. */
- string = strdup (msg);
- breaks = malloc (length);
- if (string == NULL || breaks == NULL)
- {
- free (string);
- free (breaks);
- func (0, msg, length);
- return;
- }
-
- /* Break into lines. */
- if (indent > width / 3)
- indent = width / 3;
- mbs_width_linebreaks (string, length,
- width - indent, -indent, 0,
- NULL, locale_charset (), breaks);
-
- /* Pass lines to FUNC. */
- line_start = 0;
- line_indent = 0;
- for (i = 0; i < length; i++)
- switch (breaks[i])
- {
- case UC_BREAK_POSSIBLE:
- /* Break before this character,
- and include this character in the next line. */
- func (line_indent, &string[line_start], i - line_start);
- line_start = i;
- line_indent = indent;
- break;
- case UC_BREAK_MANDATORY:
- /* Break before this character,
- but don't include this character in the next line
- (because it'string a new-line). */
- func (line_indent, &string[line_start], i - line_start);
- line_start = i + 1;
- line_indent = indent;
- break;
- default:
- break;
- }
- if (line_start < length)
- func (line_indent, &string[line_start], length - line_start);
-
- free (string);
- free (breaks);
-}
-
/* Sets COMMAND_NAME as the command name included in some kinds
of error messages. */
void
@@ -267,6 +91,13 @@
command_name = command_name_ ? xstrdup (command_name_) : NULL;
}
+/* Returns the current command name, or NULL if none. */
+const char *
+msg_get_command_name (void)
+{
+ return command_name;
+}
+
void
request_bug_report_and_abort(const char *msg )
{
Index: pspp/src/ui/gui/ChangeLog
diff -u pspp/src/ui/gui/ChangeLog:1.6 pspp/src/ui/gui/ChangeLog:1.7
--- pspp/src/ui/gui/ChangeLog:1.6 Mon Apr 24 05:10:00 2006
+++ pspp/src/ui/gui/ChangeLog Tue Apr 25 18:03:03 2006
@@ -1,3 +1,21 @@
+Tue Apr 25 10:56:53 2006 Ben Pfaff <address@hidden>
+
+ Continue reforming error message support. In this phase, drop
+ actual message printing from core code, substituting a callback,
+ and add the callback to each UI. Also, move verbose_msg() into
+ its own module.
+
+ * automake.mk: (src_ui_gui_psppire_SOURCES) Add src/message.c.
+
+ * message-dialog.c: (message_dialog_init) New function.
+ (vmsg) Rename handle_msg(), rewrite as callback function.
+ (msg) Removed.
+ (msg_emit) Removed.
+ (msg_assert_fail) Removed.
+ (verbose_msg) Removed.
+
+ * psppire.c: (main) Call message_dialog_init().
+
Sun Apr 23 22:07:49 2006 Ben Pfaff <address@hidden>
Continue reforming error message support. In this phase, get rid
Index: pspp/src/ui/gui/automake.mk
diff -u pspp/src/ui/gui/automake.mk:1.5 pspp/src/ui/gui/automake.mk:1.6
--- pspp/src/ui/gui/automake.mk:1.5 Tue Apr 4 03:18:33 2006
+++ pspp/src/ui/gui/automake.mk Tue Apr 25 18:03:03 2006
@@ -17,7 +17,7 @@
@LIBINTL@ @LIBREADLINE@
src_ui_gui_psppiredir = $(pkgdatadir)
-
+
dist_src_ui_gui_psppire_DATA = \
$(top_srcdir)/src/ui/gui/psppire.glade \
$(top_srcdir)/src/ui/gui/psppicon.png \
@@ -55,5 +55,5 @@
src/ui/gui/var-sheet.c \
src/ui/gui/var-sheet.h \
src/ui/gui/var-type-dialog.c \
- src/ui/gui/var-type-dialog.h
-
+ src/ui/gui/var-type-dialog.h \
+ src/message.c
Index: pspp/src/ui/gui/message-dialog.c
diff -u pspp/src/ui/gui/message-dialog.c:1.9
pspp/src/ui/gui/message-dialog.c:1.10
--- pspp/src/ui/gui/message-dialog.c:1.9 Tue Apr 25 00:41:12 2006
+++ pspp/src/ui/gui/message-dialog.c Tue Apr 25 18:03:03 2006
@@ -38,19 +38,24 @@
#define _(A) A
+static void handle_msg(const struct msg *);
-void
-vmsg(int klass, const char *fmt, va_list args)
+void
+message_dialog_init (void)
+{
+ msg_init(handle_msg);
+}
+
+static void
+handle_msg(const struct msg *m)
{
- gchar *msg = 0;
- gchar *text = g_strdup_vprintf (fmt, args);
+ GtkWindow *parent;
+ GtkWidget *dialog;
- GtkWindow *parent ;
- GtkWidget *dialog ;
-
gint message_type;
+ const char *msg;
- switch (msg_class_to_severity (klass))
+ switch (m->severity)
{
case MSG_ERROR:
message_type = GTK_MESSAGE_ERROR;
@@ -64,19 +69,19 @@
break;
};
- switch (msg_class_to_category (klass))
+ switch (m->category)
{
case MSG_SYNTAX:
- msg = g_strdup(_("Script Error"));
+ msg = _("Script Error");
break;
case MSG_DATA:
- msg = g_strdup(_("Data File Error"));
+ msg = _("Data File Error");
break;
case MSG_GENERAL:
default:
- msg = g_strdup(_("PSPP Error"));
+ msg = _("PSPP Error");
break;
};
@@ -88,50 +93,14 @@
GTK_BUTTONS_CLOSE,
msg);
- gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), text);
-
- g_free(text);
- g_free(msg);
+ gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+ "%s", m->text);
gtk_window_set_transient_for(GTK_WINDOW(dialog), parent);
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy (dialog);
-
-}
-
-
-void
-msg(enum msg_class klass, const char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
- vmsg(klass, fmt, ap);
- va_end(ap);
-}
-
-
-void
-msg_emit (const struct msg *m)
-{
- vmsg (msg_class_from_category_and_severity (m->category, m->severity),
- "%s", m->text);
-}
-
-
-void
-msg_assert_fail(const char *expr, const char *file, int line)
-{
- msg(ME, "Assertion failed: %s:%d; (%s)\n",file,line,expr);
-}
-
-/* Writes MESSAGE formatted with printf, to stderr, if the
- verbosity level is at least LEVEL. */
-void
-verbose_msg (int level, const char *format, ...)
-{
- /* Do nothing for now. */
}
/* FIXME: This is a stub .
Index: pspp/src/ui/gui/message-dialog.h
diff -u pspp/src/ui/gui/message-dialog.h:1.3
pspp/src/ui/gui/message-dialog.h:1.4
--- pspp/src/ui/gui/message-dialog.h:1.3 Mon Apr 17 03:49:48 2006
+++ pspp/src/ui/gui/message-dialog.h Tue Apr 25 18:03:03 2006
@@ -24,4 +24,6 @@
#include <libpspp/message.h>
+void message_dialog_init (void);
+
#endif
Index: pspp/src/ui/gui/psppire.c
diff -u pspp/src/ui/gui/psppire.c:1.4 pspp/src/ui/gui/psppire.c:1.5
--- pspp/src/ui/gui/psppire.c:1.4 Tue Apr 4 12:43:22 2006
+++ pspp/src/ui/gui/psppire.c Tue Apr 25 18:03:03 2006
@@ -39,6 +39,7 @@
#include "data-sheet.h"
#include "var-sheet.h"
#include "psppire-case-array.h"
+#include "message-dialog.h"
GladeXML *xml;
@@ -68,6 +69,8 @@
glade_init();
+ message_dialog_init();
+
the_dictionary = psppire_dict_new();
/* Create the model for the var_sheet */
Index: pspp/src/ui/terminal/ChangeLog
diff -u pspp/src/ui/terminal/ChangeLog:1.4 pspp/src/ui/terminal/ChangeLog:1.5
--- pspp/src/ui/terminal/ChangeLog:1.4 Tue Apr 25 16:41:33 2006
+++ pspp/src/ui/terminal/ChangeLog Tue Apr 25 18:03:03 2006
@@ -1,3 +1,27 @@
+Tue Apr 25 10:58:19 2006 Ben Pfaff <address@hidden>
+
+ Continue reforming error message support. In this phase, drop
+ actual message printing from core code, substituting a callback,
+ and add the callback to each UI. Also, move verbose_msg() into
+ its own module.
+
+ * automake.mk (src_ui_terminal_libui_a_SOURCES): Add msg-ui.c.
+
+ * command-line.c: (parse_command_line) Call
+ verbose_increment_level() instead of increment err_verbosity
+ directly, now that we have a little abstraction.
+
+ * msg-ui.c: New file.
+
+ * msg-ui.h: New file.
+
+ * main.c: (main) Call msg_ui_init(). Use any_errors().
+ (terminate) Call msg_ui_done(). Make termination order more
+ rational.
+
+ * read-line.c: (readln_read) Use reset_msg_count() now we have a
+ little abstraction.
+
Tue Apr 25 09:39:46 2006 Ben Pfaff <address@hidden>
* main.c: (terminate) Mark static and NO_RETURN. If called
Index: pspp/src/ui/terminal/automake.mk
diff -u pspp/src/ui/terminal/automake.mk:1.3
pspp/src/ui/terminal/automake.mk:1.4
--- pspp/src/ui/terminal/automake.mk:1.3 Wed Mar 15 03:29:11 2006
+++ pspp/src/ui/terminal/automake.mk Tue Apr 25 18:03:03 2006
@@ -3,16 +3,20 @@
noinst_LIBRARIES += src/ui/terminal/libui.a
src_ui_terminal_libui_a_SOURCES = \
- src/ui/terminal/command-line.c src/ui/terminal/command-line.h \
- src/ui/terminal/read-line.c src/ui/terminal/read-line.h \
- src/ui/terminal/main.c
+ src/ui/terminal/command-line.c \
+ src/ui/terminal/command-line.h \
+ src/ui/terminal/read-line.c \
+ src/ui/terminal/read-line.h \
+ src/ui/terminal/main.c \
+ src/ui/terminal/msg-ui.c
bin_PROGRAMS += src/ui/terminal/pspp
-src_ui_terminal_pspp_SOURCES = \
- src/message.c \
- src/procedure.c src/procedure.h
+src_ui_terminal_pspp_SOURCES = \
+ src/message.c \
+ src/procedure.c \
+ src/procedure.h
src_ui_terminal_pspp_LDADD = \
$(top_builddir)/src/language/expressions/libexpressions.a \
Index: pspp/src/ui/terminal/command-line.c
diff -u pspp/src/ui/terminal/command-line.c:1.4
pspp/src/ui/terminal/command-line.c:1.5
--- pspp/src/ui/terminal/command-line.c:1.4 Mon Apr 17 01:30:22 2006
+++ pspp/src/ui/terminal/command-line.c Tue Apr 25 18:03:03 2006
@@ -36,6 +36,7 @@
#include <data/file-name.h>
#include <libpspp/str.h>
#include <libpspp/version.h>
+#include <libpspp/verbose-msg.h>
#include "gettext.h"
#define _(msgid) gettext (msgid)
@@ -163,7 +164,7 @@
set_safer_mode ();
break;
case 'v':
- err_verbosity++;
+ verbose_increment_level ();
break;
case 'V':
puts (version);
Index: pspp/src/ui/terminal/main.c
diff -u pspp/src/ui/terminal/main.c:1.7 pspp/src/ui/terminal/main.c:1.8
--- pspp/src/ui/terminal/main.c:1.7 Tue Apr 25 16:41:33 2006
+++ pspp/src/ui/terminal/main.c Tue Apr 25 18:03:03 2006
@@ -18,25 +18,29 @@
02110-1301, USA. */
#include <config.h>
-#include <gsl/gsl_errno.h>
-#include <signal.h>
-#include <stdio.h>
+
#include "command-line.h"
-#include <language/command.h>
-#include <libpspp/compiler.h>
+#include "msg-ui.h"
+#include "progname.h"
+#include "read-line.h"
+
#include <data/dictionary.h>
-#include <libpspp/message.h>
#include <data/file-handle-def.h>
#include <data/file-name.h>
-#include <language/line-buffer.h>
-#include <language/lexer/lexer.h>
-#include <output/output.h>
-#include "progname.h"
-#include <math/random.h>
-#include "read-line.h"
#include <data/settings.h>
#include <data/variable.h>
+#include <gsl/gsl_errno.h>
+#include <language/command.h>
+#include <language/lexer/lexer.h>
+#include <language/line-buffer.h>
+#include <libpspp/compiler.h>
+#include <libpspp/message.h>
#include <libpspp/version.h>
+#include <math/random.h>
+#include <output/output.h>
+#include <signal.h>
+#include <stdio.h>
+
#if HAVE_FPU_CONTROL_H
#include <fpu_control.h>
@@ -82,6 +86,7 @@
gsl_set_error_handler_off ();
outp_init ();
+ msg_ui_init ();
fn_init ();
fh_init ();
getl_initialize ();
@@ -100,7 +105,7 @@
{
int retval;
- err_check_count ();
+ check_msg_count ();
retval = execute_command ();
if (retval == CMD_EOF)
@@ -110,7 +115,7 @@
}
}
- terminate (err_error_count == 0);
+ terminate (!any_errors ());
}
/* Parse and execute a command, returning its return code. */
@@ -252,9 +257,6 @@
{
terminating = true;
- msg_done ();
- outp_done ();
-
cancel_transformations ();
dict_destroy (default_dict);
@@ -264,6 +266,9 @@
lex_done ();
getl_uninitialize ();
readln_uninitialize ();
+
+ outp_done ();
+ msg_ui_done ();
}
exit (success ? EXIT_SUCCESS : EXIT_FAILURE);
}
Index: pspp/src/ui/terminal/read-line.c
diff -u pspp/src/ui/terminal/read-line.c:1.4
pspp/src/ui/terminal/read-line.c:1.5
--- pspp/src/ui/terminal/read-line.c:1.4 Mon Apr 17 01:30:22 2006
+++ pspp/src/ui/terminal/read-line.c Tue Apr 25 18:03:03 2006
@@ -19,20 +19,23 @@
#include <config.h>
+#include "read-line.h"
+
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>
#include <errno.h>
-#include "read-line.h"
-#include <language/command.h>
+#include "msg-ui.h"
+
#include <data/file-name.h>
-#include <libpspp/version.h>
-#include <libpspp/str.h>
-#include <output/table.h>
-#include <libpspp/message.h>
#include <data/file-name.h>
#include <data/settings.h>
+#include <language/command.h>
+#include <libpspp/message.h>
+#include <libpspp/str.h>
+#include <libpspp/version.h>
+#include <output/table.h>
#include "gettext.h"
#define _(msgid) gettext (msgid)
@@ -117,8 +120,7 @@
assert(initialised);
- err_error_count = err_warning_count = 0;
- err_already_flagged = 0;
+ reset_msg_count ();
welcome ();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pspp-cvs] pspp/src ChangeLog message.c data/file-name.c l...,
Ben Pfaff <=