Need #include <limits.h>. Thanks to "John McCabe-Dansted"
[pspp] / src / libpspp / message.c
index 1a4601fc18981b55bf3ed9f1422b1478d872e8ac..80ddef88691169f3913ef1b09202a07d47c483c1 100644 (file)
@@ -1,6 +1,5 @@
 /* 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
@@ -19,7 +18,8 @@
 
 #include <config.h>
 
-#include <libpspp/message.h>
+#include "message.h"
+#include "msg-locator.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 *);
-static void (*msg_location) (struct msg_locator *);
-
 
 /* Disables emitting messages if positive. */
 static int messages_disabled;
@@ -64,12 +62,13 @@ msg (enum msg_class class, const char *format, ...)
   msg_emit (&m);
 }
 
+static struct source_stream *s_stream;
+
 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_location = location;
 }
 
 void
@@ -102,7 +101,7 @@ msg_destroy(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);