projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Need #include <limits.h>. Thanks to "John McCabe-Dansted"
[pspp]
/
src
/
libpspp
/
message.c
diff --git
a/src/libpspp/message.c
b/src/libpspp/message.c
index 1a4601fc18981b55bf3ed9f1422b1478d872e8ac..80ddef88691169f3913ef1b09202a07d47c483c1 100644
(file)
--- a/
src/libpspp/message.c
+++ b/
src/libpspp/message.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
@@
-19,7
+18,8
@@
#include <config.h>
#include <config.h>
-#include <libpspp/message.h>
+#include "message.h"
+#include "msg-locator.h"
#include <assert.h>
#include <stdarg.h>
#include <assert.h>
#include <stdarg.h>
@@
-39,8
+39,6
@@
static char *command_name;
/* Message handler as set by msg_init(). */
static void (*msg_handler) (const struct msg *);
/* Message handler as set by msg_init(). */
static void (*msg_handler) (const struct msg *);
-static void (*msg_location) (struct msg_locator *);
-
/* Disables emitting messages if positive. */
static int messages_disabled;
/* Disables emitting messages if positive. */
static int messages_disabled;
@@
-64,12
+62,13
@@
msg (enum msg_class class, const char *format, ...)
msg_emit (&m);
}
msg_emit (&m);
}
+static struct source_stream *s_stream;
+
void
void
-msg_init ( void (*handler) (const struct msg *),
- void (*location) (struct msg_locator *) )
+msg_init (struct source_stream *ss, void (*handler) (const struct msg *) )
{
{
+ s_stream = ss;
msg_handler = handler;
msg_handler = handler;
- msg_location = location;
}
void
}
void
@@
-102,7
+101,7
@@
msg_destroy(struct msg *m)
void
msg_emit (struct msg *m)
{
void
msg_emit (struct msg *m)
{
-
msg_location (
&m->where);
+
get_msg_location (s_stream,
&m->where);
if (!messages_disabled)
msg_handler (m);
free (m->text);
if (!messages_disabled)
msg_handler (m);
free (m->text);