projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Delete trailing whitespace at end of lines.
[pspp-builds.git]
/
src
/
ui
/
terminal
/
msg-ui.c
diff --git
a/src/ui/terminal/msg-ui.c
b/src/ui/terminal/msg-ui.c
index 7cb652c021df77b3b42fe3ab70de9eeb4d7e582a..adb14b9bc09037b09c26ed6483ee553ebabc08cb 100644
(file)
--- a/
src/ui/terminal/msg-ui.c
+++ b/
src/ui/terminal/msg-ui.c
@@
-1,6
+1,5
@@
/* PSPP - computes sample statistics.
Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
/* PSPP - computes sample statistics.
Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
- Written by Ben Pfaff <blp@gnu.org>.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@
-21,7
+20,6
@@
#include "msg-ui.h"
#include "msg-ui.h"
-#include "exit.h"
#include "linebreak.h"
#include <libpspp/msg-locator.h>
#include "linebreak.h"
#include <libpspp/msg-locator.h>
@@
-31,7
+29,7
@@
#include <libpspp/str.h>
#include <errno.h>
#include <stdio.h>
#include <libpspp/str.h>
#include <errno.h>
#include <stdio.h>
-
+#include <stdlib.h>
#include "gettext.h"
#define _(msgid) gettext (msgid)
#include "gettext.h"
#define _(msgid) gettext (msgid)
@@
-46,48
+44,48
@@
static void handle_msg (const struct msg *);
static FILE *msg_file ;
static FILE *msg_file ;
-void
+void
msg_ui_set_error_file (const char *filename)
{
error_file = filename;
}
void
msg_ui_set_error_file (const char *filename)
{
error_file = filename;
}
void
-msg_ui_init (
void)
+msg_ui_init (
struct source_stream *ss)
{
msg_file = stdout;
{
msg_file = stdout;
- if ( error_file )
+ if ( error_file )
{
msg_file = fopen (error_file, "a");
{
msg_file = fopen (error_file, "a");
- if ( NULL == msg_file )
+ if ( NULL == msg_file )
{
int err = errno;
printf ( _("Cannot open %s (%s). "
{
int err = errno;
printf ( _("Cannot open %s (%s). "
- "Writing errors to stdout instead.\n"),
+ "Writing errors to stdout instead.\n"),
error_file, strerror(err) );
msg_file = stdout;
}
}
error_file, strerror(err) );
msg_file = stdout;
}
}
- msg_init (handle_msg);
+ msg_init (
ss,
handle_msg);
}
void
}
void
-msg_ui_done (void)
+msg_ui_done (void)
{
msg_done ();
{
msg_done ();
-
+ msg_locator_done ();
+
if ( msg_file ) /* FIXME: do we really want to close stdout ?? */
fclose (msg_file);
}
if ( msg_file ) /* FIXME: do we really want to close stdout ?? */
fclose (msg_file);
}
-
/* Checks whether we've had so many errors that it's time to quit
processing this syntax file. */
void
/* Checks whether we've had so many errors that it's time to quit
processing this syntax file. */
void
-check_msg_count (
void
)
+check_msg_count (
struct source_stream *ss
)
{
{
- if (!getl_is_interactive (
))
+ if (!getl_is_interactive (
ss))
{
if (get_errorbreak () && error_count)
msg (MN, _("Terminating execution of syntax file due to error."));
{
if (get_errorbreak () && error_count)
msg (MN, _("Terminating execution of syntax file due to error."));
@@
-100,18
+98,18
@@
check_msg_count (void)
else
return;
else
return;
- getl_abort_noninteractive (
);
+ getl_abort_noninteractive (
ss);
}
}
void
}
}
void
-reset_msg_count (void)
+reset_msg_count (void)
{
error_count = warning_count = 0;
}
bool
{
error_count = warning_count = 0;
}
bool
-any_errors (void)
+any_errors (void)
{
return error_count > 0;
}
{
return error_count > 0;
}
@@
-123,26
+121,26
@@
static void dump_line (int line_indent, const char *line, size_t length,
static void
handle_msg (const struct msg *m)
{
static void
handle_msg (const struct msg *m)
{
- struct category
+ struct category
{
bool show_command_name; /* Show command name with error? */
bool show_file_location; /* Show syntax file location? */
};
{
bool show_command_name; /* Show command name with error? */
bool show_file_location; /* Show syntax file location? */
};
- static const struct category categories[] =
+ static const struct category categories[] =
{
{false, false}, /* MSG_GENERAL. */
{true, true}, /* MSG_SYNTAX. */
{false, true}, /* MSG_DATA. */
};
{
{false, false}, /* MSG_GENERAL. */
{true, true}, /* MSG_SYNTAX. */
{false, true}, /* MSG_DATA. */
};
- struct severity
+ struct severity
{
const char *name; /* How to identify this severity. */
int *count; /* Number of msgs with this severity so far. */
};
{
const char *name; /* How to identify this severity. */
int *count; /* Number of msgs with this severity so far. */
};
-
- static struct severity severities[] =
+
+ static struct severity severities[] =
{
{N_("error"), &error_count}, /* MSG_ERROR. */
{N_("warning"), &warning_count}, /* MSG_WARNING. */
{
{N_("error"), &error_count}, /* MSG_ERROR. */
{N_("warning"), &warning_count}, /* MSG_WARNING. */
@@
-163,10
+161,10
@@
handle_msg (const struct msg *m)
if (severity->name != NULL)
ds_put_format (&string, "%s: ", gettext (severity->name));
if (severity->name != NULL)
ds_put_format (&string, "%s: ", gettext (severity->name));
-
+
if (severity->count != NULL)
++*severity->count;
if (severity->count != NULL)
++*severity->count;
-
+
if (category->show_command_name && msg_get_command_name () != NULL)
ds_put_format (&string, "%s: ", msg_get_command_name ());
if (category->show_command_name && msg_get_command_name () != NULL)
ds_put_format (&string, "%s: ", msg_get_command_name ());
@@
-214,7
+212,7
@@
dump_message (char *msg, unsigned width, unsigned indent, FILE *stream)
line_start = 0;
line_indent = 0;
for (i = 0; i < length; i++)
line_start = 0;
line_indent = 0;
for (i = 0; i < length; i++)
- switch (breaks[i])
+ switch (breaks[i])
{
case UC_BREAK_POSSIBLE:
/* Break before this character,
{
case UC_BREAK_POSSIBLE:
/* Break before this character,