projects
/
pspp-builds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6c30159
)
Applied patch #5611
author
John Darrington
<john@darrington.wattle.id.au>
Tue, 5 Dec 2006 11:27:42 +0000
(11:27 +0000)
committer
John Darrington
<john@darrington.wattle.id.au>
Tue, 5 Dec 2006 11:27:42 +0000
(11:27 +0000)
18 files changed:
src/language/control/repeat.c
patch
|
blob
|
history
src/language/lexer/lexer.c
patch
|
blob
|
history
src/language/lexer/lexer.h
patch
|
blob
|
history
src/language/utilities/include.c
patch
|
blob
|
history
src/libpspp/getl.c
patch
|
blob
|
history
src/libpspp/getl.h
patch
|
blob
|
history
src/libpspp/message.c
patch
|
blob
|
history
src/libpspp/message.h
patch
|
blob
|
history
src/libpspp/msg-locator.c
patch
|
blob
|
history
src/libpspp/msg-locator.h
patch
|
blob
|
history
src/ui/gui/message-dialog.c
patch
|
blob
|
history
src/ui/gui/message-dialog.h
patch
|
blob
|
history
src/ui/gui/psppire.c
patch
|
blob
|
history
src/ui/terminal/command-line.c
patch
|
blob
|
history
src/ui/terminal/command-line.h
patch
|
blob
|
history
src/ui/terminal/main.c
patch
|
blob
|
history
src/ui/terminal/msg-ui.c
patch
|
blob
|
history
src/ui/terminal/msg-ui.h
patch
|
blob
|
history
diff --git
a/src/language/control/repeat.c
b/src/language/control/repeat.c
index 200b6bce80dd307dcc07a08ae01c0cd6a2614b50..0a7da0a6cb3237d95b2ac6f3758af60d75a3214e 100644
(file)
--- a/
src/language/control/repeat.c
+++ b/
src/language/control/repeat.c
@@
-139,7
+139,7
@@
cmd_do_repeat (struct lexer *lexer, struct dataset *ds)
block->parent.location = do_repeat_location;
if (!ll_is_empty (&block->lines))
block->parent.location = do_repeat_location;
if (!ll_is_empty (&block->lines))
- getl_include_source (&block->parent);
+ getl_include_source (
lex_get_source_stream (lexer),
&block->parent);
else
pool_destroy (block->pool);
else
pool_destroy (block->pool);
@@
-310,7
+310,7
@@
parse_lines (struct lexer *lexer, struct repeat_block *block)
ds_init_string (&text, lex_entire_line_ds (lexer));
/* Record file name. */
ds_init_string (&text, lex_entire_line_ds (lexer));
/* Record file name. */
- cur_file_name = getl_source_name ();
+ cur_file_name = getl_source_name (
lex_get_source_stream (lexer)
);
if (cur_file_name != NULL &&
(previous_file_name == NULL
|| !strcmp (cur_file_name, previous_file_name)))
if (cur_file_name != NULL &&
(previous_file_name == NULL
|| !strcmp (cur_file_name, previous_file_name)))
@@
-319,7
+319,7
@@
parse_lines (struct lexer *lexer, struct repeat_block *block)
/* Create a line structure. */
line = pool_alloc (block->pool, sizeof *line);
line->file_name = previous_file_name;
/* Create a line structure. */
line = pool_alloc (block->pool, sizeof *line);
line->file_name = previous_file_name;
- line->line_number = getl_source_location ();
+ line->line_number = getl_source_location (
lex_get_source_stream (lexer)
);
ss_alloc_substring_pool (&line->text, ds_ss (&text), block->pool);
line->syntax = syntax;
ss_alloc_substring_pool (&line->text, ds_ss (&text), block->pool);
line->syntax = syntax;
diff --git
a/src/language/lexer/lexer.c
b/src/language/lexer/lexer.c
index 907a77cee6490f72a72ca9dc84585ea5856acb57..b1c05c81c4cd1ca091165f6ac077ee90720d1b63 100644
(file)
--- a/
src/language/lexer/lexer.c
+++ b/
src/language/lexer/lexer.c
@@
-49,7
+49,7
@@
struct lexer
{
struct string line_buffer;
{
struct string line_buffer;
-
bool (*read_line) (struct string *, enum getl_syntax *)
;
+
struct source_stream *ss
;
int token; /* Current token. */
double tokval; /* T_POS_NUM, T_NEG_NUM: the token's value. */
int token; /* Current token. */
double tokval; /* T_POS_NUM, T_NEG_NUM: the token's value. */
@@
-93,14
+93,14
@@
static void dump_token (void);
/* Initializes the lexer. */
struct lexer *
/* Initializes the lexer. */
struct lexer *
-lex_create (
bool (*read_line_func) (struct string *, enum getl_syntax *)
)
+lex_create (
struct source_stream *ss
)
{
struct lexer *lexer = xzalloc (sizeof (*lexer));
ds_init_empty (&lexer->tokstr);
ds_init_empty (&lexer->put_tokstr);
ds_init_empty (&lexer->line_buffer);
{
struct lexer *lexer = xzalloc (sizeof (*lexer));
ds_init_empty (&lexer->tokstr);
ds_init_empty (&lexer->put_tokstr);
ds_init_empty (&lexer->line_buffer);
- lexer->
read_line = read_line_func
;
+ lexer->
ss = ss
;
if (!lex_get_line (lexer))
lexer->eof = true;
if (!lex_get_line (lexer))
lexer->eof = true;
@@
-108,6
+108,13
@@
lex_create (bool (*read_line_func) (struct string *, enum getl_syntax *))
return lexer;
}
return lexer;
}
+struct source_stream *
+lex_get_source_stream (const struct lexer *lex)
+{
+ return lex->ss;
+}
+
+
void
lex_destroy (struct lexer *lexer)
{
void
lex_destroy (struct lexer *lexer)
{
@@
-752,7
+759,7
@@
lex_discard_line (struct lexer *lexer)
void
lex_discard_rest_of_command (struct lexer *lexer)
{
void
lex_discard_rest_of_command (struct lexer *lexer)
{
- if (!getl_is_interactive ())
+ if (!getl_is_interactive (
lexer->ss
))
{
while (lexer->token != T_STOP && lexer->token != '.')
lex_get (lexer);
{
while (lexer->token != T_STOP && lexer->token != '.')
lex_get (lexer);
@@
-842,7
+849,7
@@
bool
lex_get_line_raw (struct lexer *lexer, enum getl_syntax *syntax)
{
enum getl_syntax dummy;
lex_get_line_raw (struct lexer *lexer, enum getl_syntax *syntax)
{
enum getl_syntax dummy;
- bool ok =
lexer->read_line (
&lexer->line_buffer,
+ bool ok =
getl_read_line (lexer->ss,
&lexer->line_buffer,
syntax != NULL ? syntax : &dummy);
return ok;
}
syntax != NULL ? syntax : &dummy);
return ok;
}
@@
-976,13
+983,6
@@
lex_negative_to_dash (struct lexer *lexer)
}
}
}
}
-/* We're not at eof any more. */
-void
-lex_reset_eof (struct lexer *lexer)
-{
- lexer->eof = false;
-}
-
/* Skip a COMMENT command. */
void
lex_skip_comment (struct lexer *lexer)
/* Skip a COMMENT command. */
void
lex_skip_comment (struct lexer *lexer)
diff --git
a/src/language/lexer/lexer.h
b/src/language/lexer/lexer.h
index 509173d9f8a5a6f575346197657bcc2b3f6331d5..6d91645ce3b075e5ab9f761bcef710a0cbb0ac12 100644
(file)
--- a/
src/language/lexer/lexer.h
+++ b/
src/language/lexer/lexer.h
@@
-30,10
+30,10
@@
struct lexer;
/* Initialization. */
struct lexer;
/* Initialization. */
-struct lexer * lex_create (
bool (*)(struct string *, enum getl_syntax *)
);
+struct lexer * lex_create (
struct source_stream *
);
void lex_destroy (struct lexer *);
void lex_destroy (struct lexer *);
-
+struct source_stream * lex_get_source_stream (const struct lexer *);
/* Common functions. */
/* Common functions. */
@@
-93,7
+93,6
@@
const struct string *lex_tokstr (const struct lexer *);
/* Really weird functions. */
void lex_negative_to_dash (struct lexer *);
/* Really weird functions. */
void lex_negative_to_dash (struct lexer *);
-void lex_reset_eof (struct lexer *);
void lex_skip_comment (struct lexer *);
#endif /* !lexer_h */
void lex_skip_comment (struct lexer *);
#endif /* !lexer_h */
diff --git
a/src/language/utilities/include.c
b/src/language/utilities/include.c
index c812c97238a9588fddf3586ed366766248372f92..9f666747db6b99fe129ac24e7680beab3693eab1 100644
(file)
--- a/
src/language/utilities/include.c
+++ b/
src/language/utilities/include.c
@@
-36,6
+36,7
@@
int
cmd_include (struct lexer *lexer, struct dataset *ds UNUSED)
{
int
cmd_include (struct lexer *lexer, struct dataset *ds UNUSED)
{
+ struct source_stream *ss;
char *found_fn;
char *target_fn;
char *found_fn;
char *target_fn;
@@
-52,13
+53,12
@@
cmd_include (struct lexer *lexer, struct dataset *ds UNUSED)
target_fn = ds_cstr (lex_tokstr (lexer));
target_fn = ds_cstr (lex_tokstr (lexer));
- found_fn = fn_search_path (target_fn,
- getl_include_path (),
- NULL);
+ ss = lex_get_source_stream (lexer);
+ found_fn = fn_search_path (target_fn, getl_include_path ( ss ), NULL);
if (found_fn != NULL)
{
if (found_fn != NULL)
{
- getl_include_source (create_syntax_file_source (found_fn));
+ getl_include_source (
ss,
create_syntax_file_source (found_fn));
free (found_fn);
}
else
free (found_fn);
}
else
diff --git
a/src/libpspp/getl.c
b/src/libpspp/getl.c
index 200e07e36972ea5712f947d64836b306b7fe8bb1..4a320960226d8f2db2c7ec4c43bef6a931b1376d 100644
(file)
--- a/
src/libpspp/getl.c
+++ b/
src/libpspp/getl.c
@@
-40,66
+40,70
@@
struct getl_source
struct getl_interface *interface;
};
struct getl_interface *interface;
};
-/* List of source files. */
-static struct ll_list sources ;
+struct source_stream
+ {
+ struct ll_list sources ; /* List of source files. */
-static struct string the_include_path;
+ struct string the_include_path;
+ };
const char *
const char *
-getl_include_path (
void
)
+getl_include_path (
const struct source_stream *ss
)
{
{
- return ds_cstr (&the_include_path);
+ return ds_cstr (&
ss->
the_include_path);
}
static struct getl_source *
}
static struct getl_source *
-current_source (
struct ll_list *list
)
+current_source (
const struct source_stream *ss
)
{
{
- const struct ll *ll = ll_head (
list
);
+ const struct ll *ll = ll_head (
&ss->sources
);
return ll_data (ll, struct getl_source, ll );
}
/* Initialize getl. */
return ll_data (ll, struct getl_source, ll );
}
/* Initialize getl. */
-void
-
getl_initialize
(void)
+struct source_stream *
+
create_source_stream
(void)
{
{
- ll_init (&sources);
- ds_init_cstr (&the_include_path,
+ struct source_stream *ss = xzalloc (sizeof (*ss));
+ ll_init (&ss->sources);
+ ds_init_cstr (&ss->the_include_path,
fn_getenv_default ("STAT_INCLUDE_PATH", include_path));
fn_getenv_default ("STAT_INCLUDE_PATH", include_path));
+ return ss;
}
/* Delete everything from the include path. */
void
}
/* Delete everything from the include path. */
void
-getl_clear_include_path (
void
)
+getl_clear_include_path (
struct source_stream *ss
)
{
{
- ds_clear (&the_include_path);
+ ds_clear (&
ss->
the_include_path);
}
/* Add to the include path. */
void
}
/* Add to the include path. */
void
-getl_add_include_dir (const char *path)
+getl_add_include_dir (
struct source_stream *ss,
const char *path)
{
{
- if (ds_length (&the_include_path))
- ds_put_char (&the_include_path, ':');
+ if (ds_length (&
ss->
the_include_path))
+ ds_put_char (&
ss->
the_include_path, ':');
- ds_put_cstr (&the_include_path, path);
+ ds_put_cstr (&
ss->
the_include_path, path);
}
/* Appends source S to the list of source files. */
void
}
/* Appends source S to the list of source files. */
void
-getl_append_source (struct getl_interface *i)
+getl_append_source (struct
source_stream *ss, struct
getl_interface *i)
{
struct getl_source *s = xzalloc (sizeof ( struct getl_source ));
s->interface = i ;
{
struct getl_source *s = xzalloc (sizeof ( struct getl_source ));
s->interface = i ;
- ll_push_head (&sources, &s->ll);
+ ll_push_head (&s
s->s
ources, &s->ll);
}
/* Nests source S within the current source file. */
void
}
/* Nests source S within the current source file. */
void
-getl_include_source (struct getl_interface *i)
+getl_include_source (struct
source_stream *ss, struct
getl_interface *i)
{
{
- struct getl_source *current = current_source (
&source
s);
+ struct getl_source *current = current_source (
s
s);
struct getl_source *s = xzalloc (sizeof ( struct getl_source ));
s->interface = i;
struct getl_source *s = xzalloc (sizeof ( struct getl_source ));
s->interface = i;
@@
-108,23
+112,23
@@
getl_include_source (struct getl_interface *i)
s->includes = NULL;
current->includes = s;
s->includes = NULL;
current->includes = s;
- ll_push_head (&sources, &s->ll);
+ ll_push_head (&s
s->s
ources, &s->ll);
}
/* Closes the current source, and move the current source to the
next file in the chain. */
static void
}
/* Closes the current source, and move the current source to the
next file in the chain. */
static void
-close_source (
void
)
+close_source (
struct source_stream *ss
)
{
{
- struct getl_source *s = current_source (
&source
s);
+ struct getl_source *s = current_source (
s
s);
if ( s->interface->close )
s->interface->close (s->interface);
if ( s->interface->close )
s->interface->close (s->interface);
- ll_pop_head (&sources);
+ ll_pop_head (&s
s->s
ources);
if (s->included_from != NULL)
if (s->included_from != NULL)
- current_source (
&source
s)->includes = NULL;
+ current_source (
s
s)->includes = NULL;
free (s);
}
free (s);
}
@@
-132,25
+136,25
@@
close_source (void)
/* Closes all sources until an interactive source is
encountered. */
void
/* Closes all sources until an interactive source is
encountered. */
void
-getl_abort_noninteractive (
void
)
+getl_abort_noninteractive (
struct source_stream *ss
)
{
{
- while ( ! ll_is_empty (&sources))
+ while ( ! ll_is_empty (&s
s->s
ources))
{
{
- const struct getl_source *s = current_source (
&source
s);
+ const struct getl_source *s = current_source (
s
s);
if ( !s->interface->interactive (s->interface) )
if ( !s->interface->interactive (s->interface) )
- close_source ();
+ close_source (
ss
);
}
}
/* Returns true if the current source is interactive,
false otherwise. */
bool
}
}
/* Returns true if the current source is interactive,
false otherwise. */
bool
-getl_is_interactive (
void
)
+getl_is_interactive (
const struct source_stream *ss
)
{
{
- const struct getl_source *s = current_source (
&source
s);
+ const struct getl_source *s = current_source (
s
s);
- if (ll_is_empty (&sources) )
+ if (ll_is_empty (&s
s->s
ources) )
return false;
return s->interface->interactive (s->interface);
return false;
return s->interface->interactive (s->interface);
@@
-159,11
+163,11
@@
getl_is_interactive (void)
/* Returns the name of the current source, or NULL if there is no
current source */
const char *
/* Returns the name of the current source, or NULL if there is no
current source */
const char *
-getl_source_name (
void
)
+getl_source_name (
const struct source_stream *ss
)
{
{
- const struct getl_source *s = current_source (
&source
s);
+ const struct getl_source *s = current_source (
s
s);
- if ( ll_is_empty (&sources) )
+ if ( ll_is_empty (&s
s->s
ources) )
return NULL;
if ( ! s->interface->name )
return NULL;
if ( ! s->interface->name )
@@
-175,11
+179,11
@@
getl_source_name (void)
/* Returns the location within the current source, or -1 if there is
no current source */
int
/* Returns the location within the current source, or -1 if there is
no current source */
int
-getl_source_location (
void
)
+getl_source_location (
const struct source_stream *ss
)
{
{
- const struct getl_source *s = current_source (
&source
s);
+ const struct getl_source *s = current_source (
s
s);
- if ( ll_is_empty (&sources) )
+ if ( ll_is_empty (&s
s->s
ources) )
return -1;
if ( !s->interface->location )
return -1;
if ( !s->interface->location )
@@
-191,11
+195,13
@@
getl_source_location (void)
/* Close getl. */
void
/* Close getl. */
void
-
getl_uninitialize (void
)
+
destroy_source_stream (struct source_stream *ss
)
{
{
- while ( !ll_is_empty (&sources))
- close_source ();
- ds_destroy (&the_include_path);
+ while ( !ll_is_empty (&ss->sources))
+ close_source (ss);
+ ds_destroy (&ss->the_include_path);
+
+ free (ss);
}
}
@@
-203,11
+209,12
@@
getl_uninitialize (void)
Returns true when a line has been read, false at end of input.
On success, sets *SYNTAX to the style of the syntax read. */
bool
Returns true when a line has been read, false at end of input.
On success, sets *SYNTAX to the style of the syntax read. */
bool
-do_read_line (struct string *line, enum getl_syntax *syntax)
+getl_read_line (struct source_stream *ss, struct string *line,
+ enum getl_syntax *syntax)
{
{
- while (!ll_is_empty (&sources))
+ while (!ll_is_empty (&s
s->s
ources))
{
{
- struct getl_source *s = current_source (
&source
s);
+ struct getl_source *s = current_source (
s
s);
ds_clear (line);
if (s->interface->read (s->interface, line, syntax))
ds_clear (line);
if (s->interface->read (s->interface, line, syntax))
@@
-218,10
+225,10
@@
do_read_line (struct string *line, enum getl_syntax *syntax)
s->interface->filter (s->interface, line, *syntax);
s = s->included_from;
}
s->interface->filter (s->interface, line, *syntax);
s = s->included_from;
}
-
+
return true;
}
return true;
}
- close_source ();
+ close_source (
ss
);
}
return false;
}
return false;
diff --git
a/src/libpspp/getl.h
b/src/libpspp/getl.h
index 27faee6445818e1ca29f68e71a74daae4789c39f..f39f559cccc26ea5e583e6dac9b588dc011f0ab5 100644
(file)
--- a/
src/libpspp/getl.h
+++ b/
src/libpspp/getl.h
@@
-23,12
+23,12
@@
#include <stdbool.h>
#include <libpspp/ll.h>
#include <stdbool.h>
#include <libpspp/ll.h>
-struct string;
+struct string;
struct getl_source;
/* Syntax rules that apply to a given source line. */
struct getl_source;
/* Syntax rules that apply to a given source line. */
-enum getl_syntax
+enum getl_syntax
{
/* Each line that begins in column 1 starts a new command. A
`+' or `-' in column 1 is ignored to allow visual
{
/* Each line that begins in column 1 starts a new command. A
`+' or `-' in column 1 is ignored to allow visual
@@
-41,14
+41,14
@@
enum getl_syntax
GETL_INTERACTIVE
};
GETL_INTERACTIVE
};
-/* An abstract base class for objects which act as line buffers for the
+/* An abstract base class for objects which act as line buffers for the
PSPP. Ie anything which might contain content for the lexer */
PSPP. Ie anything which might contain content for the lexer */
-struct getl_interface
+struct getl_interface
{
/* Returns true if the interface is interactive, that is, if
it prompts a human user. This property is independent of
the syntax mode returned by the read member function. */
{
/* Returns true if the interface is interactive, that is, if
it prompts a human user. This property is independent of
the syntax mode returned by the read member function. */
- bool (*interactive) (const struct getl_interface *);
+ bool (*interactive) (const struct getl_interface *);
/* Read a line the intended syntax mode from the interface.
Returns true if succesful, false on failure or at end of
/* Read a line the intended syntax mode from the interface.
Returns true if succesful, false on failure or at end of
@@
-71,24
+71,25
@@
struct getl_interface
int (*location) (const struct getl_interface *);
};
int (*location) (const struct getl_interface *);
};
-void getl_initialize (void);
-void getl_uninitialize (void);
+struct source_stream;
-void getl_clear_include_path (void);
-void getl_add_include_dir (const char *);
-const char * getl_include_path (void);
+struct source_stream * create_source_stream (void);
+void destroy_source_stream (struct source_stream *);
-void getl_abort_noninteractive (void);
-bool getl_is_interactive (void);
+void getl_clear_include_path (struct source_stream *);
+void getl_add_include_dir (struct source_stream *, const char *);
+const char * getl_include_path (const struct source_stream *);
-bool getl_read_line (bool *interactive);
+void getl_abort_noninteractive (struct source_stream *);
+bool getl_is_interactive (const struct source_stream *);
-bool do_read_line (struct string *line, enum getl_syntax *syntax);
+bool getl_read_line (struct source_stream *, struct string *,
+ enum getl_syntax *);
-void getl_append_source (struct getl_interface *s) ;
-void getl_include_source (struct getl_interface *s) ;
+void getl_append_source (struct
source_stream *, struct
getl_interface *s) ;
+void getl_include_source (struct
source_stream *, struct
getl_interface *s) ;
-const char * getl_source_name (
void
);
-int getl_source_location (
void
);
+const char * getl_source_name (
const struct source_stream *
);
+int getl_source_location (
const struct source_stream *
);
#endif /* line-buffer.h */
#endif /* line-buffer.h */
diff --git
a/src/libpspp/message.c
b/src/libpspp/message.c
index 24bb8e874ba10d77dd29cf76e168af795cfaee8a..31a78d25e09d358e6250cc8200e14eb91701829d 100644
(file)
--- a/
src/libpspp/message.c
+++ b/
src/libpspp/message.c
@@
-63,9
+63,12
@@
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 *) )
+msg_init (
struct source_stream *ss,
void (*handler) (const struct msg *) )
{
{
+ s_stream = ss;
msg_handler = handler;
}
msg_handler = handler;
}
@@
-99,7
+102,7
@@
msg_destroy(struct msg *m)
void
msg_emit (struct msg *m)
{
void
msg_emit (struct msg *m)
{
- get_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);
diff --git
a/src/libpspp/message.h
b/src/libpspp/message.h
index ffafd999f6490d4b76789b2c2e9b643b782734f1..ba35b35104c9c67736dd52f21abe5130c1405ffa 100644
(file)
--- a/
src/libpspp/message.h
+++ b/
src/libpspp/message.h
@@
-85,8
+85,10
@@
struct msg
char *text; /* Error text. */
};
char *text; /* Error text. */
};
+struct source_stream ;
+
/* Initialization. */
/* Initialization. */
-void msg_init ( void (*handler) (const struct msg *) );
+void msg_init (
struct source_stream *,
void (*handler) (const struct msg *) );
void msg_done (void);
void msg_done (void);
diff --git
a/src/libpspp/msg-locator.c
b/src/libpspp/msg-locator.c
index 5f7e5dd0d87324525ade1a34fdab5f8d831629ee..2bd7877ce6d5dd0d5e53ba43d9cc80666d3e4ac6 100644
(file)
--- a/
src/libpspp/msg-locator.c
+++ b/
src/libpspp/msg-locator.c
@@
-71,7
+71,7
@@
msg_pop_msg_locator (const struct msg_locator *loc)
/* Puts the current file and line number into LOC, or NULL and -1 if
none. */
void
/* Puts the current file and line number into LOC, or NULL and -1 if
none. */
void
-get_msg_location (struct msg_locator *loc)
+get_msg_location (
const struct source_stream *ss,
struct msg_locator *loc)
{
if (nfile_loc)
{
{
if (nfile_loc)
{
@@
-79,7
+79,7
@@
get_msg_location (struct msg_locator *loc)
}
else
{
}
else
{
- loc->file_name = getl_source_name ();
- loc->line_number = getl_source_location ();
+ loc->file_name = getl_source_name (
ss
);
+ loc->line_number = getl_source_location (
ss
);
}
}
}
}
diff --git
a/src/libpspp/msg-locator.h
b/src/libpspp/msg-locator.h
index b39ea6d2f7e81839236d6c9c6842c026439aff98..63c2264b0d86e57bbee7a60f5a5b3a5acbf7010e 100644
(file)
--- a/
src/libpspp/msg-locator.h
+++ b/
src/libpspp/msg-locator.h
@@
-31,6
+31,7
@@
void msg_push_msg_locator (const struct msg_locator *loc);
item on top of the stack. */
void msg_pop_msg_locator (const struct msg_locator *loc);
item on top of the stack. */
void msg_pop_msg_locator (const struct msg_locator *loc);
+struct source_stream ;
/* Puts the current file and line number into LOC, or NULL and -1 if
none. */
/* Puts the current file and line number into LOC, or NULL and -1 if
none. */
-void get_msg_location (struct msg_locator *loc);
+void get_msg_location (
const struct source_stream *ss,
struct msg_locator *loc);
diff --git
a/src/ui/gui/message-dialog.c
b/src/ui/gui/message-dialog.c
index 77876b0f3a176f4c3adbfec699705ca32b5f7c37..6e5664f5cfda8474918f010f9170543a192200b6 100644
(file)
--- a/
src/ui/gui/message-dialog.c
+++ b/
src/ui/gui/message-dialog.c
@@
-51,10
+51,10
@@
static GQueue *message_queue;
void
void
-message_dialog_init (
void
)
+message_dialog_init (
struct source_stream *ss
)
{
message_queue = g_queue_new();
{
message_queue = g_queue_new();
- msg_init (enqueue_msg);
+ msg_init (
ss,
enqueue_msg);
}
void
}
void
diff --git
a/src/ui/gui/message-dialog.h
b/src/ui/gui/message-dialog.h
index 74882b54235f2c67e62ca7342511a75b4ab883fe..0b6c4bc6e2d02b0d5dea1ce4db2c5733e5903ed8 100644
(file)
--- a/
src/ui/gui/message-dialog.h
+++ b/
src/ui/gui/message-dialog.h
@@
-24,7
+24,9
@@
#include <libpspp/message.h>
#include <libpspp/message.h>
-void message_dialog_init (void);
+struct source_stream ;
+
+void message_dialog_init (struct source_stream *);
void message_dialog_done (void);
void popup_message(const struct msg *m);
void message_dialog_done (void);
void popup_message(const struct msg *m);
diff --git
a/src/ui/gui/psppire.c
b/src/ui/gui/psppire.c
index 6dd41b34156e82884bc7bfbb290749f2ee54913a..e814219952e70b0b3e00715dc64dde4d4b495225 100644
(file)
--- a/
src/ui/gui/psppire.c
+++ b/
src/ui/gui/psppire.c
@@
-77,6
+77,8
@@
PsppireVarStore *var_store = 0;
void create_icon_factory (void);
void create_icon_factory (void);
+static struct source_stream *the_source_stream ;
+
int
main(int argc, char *argv[])
{
int
main(int argc, char *argv[])
{
@@
-116,8
+118,8
@@
main(int argc, char *argv[])
fmt_init();
settings_init();
fmt_init();
settings_init();
-
getl_initialize
();
- message_dialog_init
(
);
+
the_source_stream = create_source_stream
();
+ message_dialog_init
(the_source_stream
);
the_dictionary = psppire_dict_new();
the_dictionary = psppire_dict_new();
@@
-168,7
+170,7
@@
main(int argc, char *argv[])
/* start the event loop */
gtk_main();
/* start the event loop */
gtk_main();
-
getl_uninitialize (
);
+
destroy_source_stream (the_source_stream
);
message_dialog_done();
settings_done();
message_dialog_done();
settings_done();
diff --git
a/src/ui/terminal/command-line.c
b/src/ui/terminal/command-line.c
index f7090a3eb44f18d5086ef8868da7bc7d2f26827e..ec7a9b22509132b5373916fd9dc53f5ad9a88c40 100644
(file)
--- a/
src/ui/terminal/command-line.c
+++ b/
src/ui/terminal/command-line.c
@@
-50,11
+50,12
@@
static void usage (void);
char *subst_vars (char *);
char *subst_vars (char *);
+
/* Parses the command line specified by ARGC and ARGV as received by
main(). Returns true if normal execution should proceed,
false if the command-line indicates that PSPP should exit. */
bool
/* Parses the command line specified by ARGC and ARGV as received by
main(). Returns true if normal execution should proceed,
false if the command-line indicates that PSPP should exit. */
bool
-parse_command_line (int argc, char **argv)
+parse_command_line (int argc, char **argv
, struct source_stream *ss
)
{
static struct option long_options[] =
{
{
static struct option long_options[] =
{
@@
-140,9
+141,9
@@
parse_command_line (int argc, char **argv)
break;
case 'I':
if (optarg == NULL || !strcmp (optarg, "-"))
break;
case 'I':
if (optarg == NULL || !strcmp (optarg, "-"))
- getl_clear_include_path ();
+ getl_clear_include_path (
ss
);
else
else
- getl_add_include_dir (optarg);
+ getl_add_include_dir (
ss,
optarg);
break;
case 'l':
outp_list_classes ();
break;
case 'l':
outp_list_classes ();
@@
-195,7
+196,7
@@
parse_command_line (int argc, char **argv)
char *pspprc_fn = fn_search_path ("rc", config_path, NULL);
if (pspprc_fn != NULL)
{
char *pspprc_fn = fn_search_path ("rc", config_path, NULL);
if (pspprc_fn != NULL)
{
- getl_append_source (create_syntax_file_source (pspprc_fn));
+ getl_append_source (
ss,
create_syntax_file_source (pspprc_fn));
free (pspprc_fn);
}
free (pspprc_fn);
}
@@
-206,12
+207,12
@@
parse_command_line (int argc, char **argv)
outp_configure_macro (argv[i]);
else
{
outp_configure_macro (argv[i]);
else
{
- getl_append_source (create_syntax_file_source (argv[i]));
+ getl_append_source (
ss,
create_syntax_file_source (argv[i]));
syntax_files++;
}
if (!syntax_files || interactive_mode)
syntax_files++;
}
if (!syntax_files || interactive_mode)
- getl_append_source (create_readln_source () );
+ getl_append_source (
ss,
create_readln_source () );
return true;
}
return true;
}
diff --git
a/src/ui/terminal/command-line.h
b/src/ui/terminal/command-line.h
index c103b696436576962d9d9d70635e485ee572acc4..b6058d1c2422fa161d487ef62324bc227f525302 100644
(file)
--- a/
src/ui/terminal/command-line.h
+++ b/
src/ui/terminal/command-line.h
@@
-22,6
+22,8
@@
#include <stdbool.h>
#include <stdbool.h>
-bool parse_command_line (int argc, char **argv);
+struct source_stream ;
+
+bool parse_command_line (int argc, char **argv, struct source_stream *);
#endif /* cmdline.h */
#endif /* cmdline.h */
diff --git
a/src/ui/terminal/main.c
b/src/ui/terminal/main.c
index 5b4ad2d3ac54d6002dbb81c51678375298406d36..f1dd21d35dd287d4195cde81fd24e05be4524cd7 100644
(file)
--- a/
src/ui/terminal/main.c
+++ b/
src/ui/terminal/main.c
@@
-76,6
+76,8
@@
void interrupt_handler(int sig);
static struct dataset * the_dataset = NULL;
static struct lexer *the_lexer;
static struct dataset * the_dataset = NULL;
static struct lexer *the_lexer;
+static struct source_stream *the_source_stream ;
+
/* Program entry point. */
int
/* Program entry point. */
int
@@
-95,18
+97,18
@@
main (int argc, char **argv)
outp_init ();
fn_init ();
fh_init ();
outp_init ();
fn_init ();
fh_init ();
-
getl_initialize
();
+
the_source_stream = create_source_stream
();
prompt_init ();
readln_initialize ();
settings_init ();
random_init ();
the_dataset = create_dataset ();
prompt_init ();
readln_initialize ();
settings_init ();
random_init ();
the_dataset = create_dataset ();
- if (parse_command_line (argc, argv))
+ if (parse_command_line (argc, argv
, the_source_stream
))
{
{
- msg_ui_init ();
+ msg_ui_init (
the_source_stream
);
outp_read_devices ();
outp_read_devices ();
- the_lexer = lex_create (
do_read_line
);
+ the_lexer = lex_create (
the_source_stream
);
for (;;)
{
for (;;)
{
@@
-115,14
+117,15
@@
main (int argc, char **argv)
? CMD_STATE_DATA : CMD_STATE_INITIAL);
if (result == CMD_EOF || result == CMD_FINISH)
break;
? CMD_STATE_DATA : CMD_STATE_INITIAL);
if (result == CMD_EOF || result == CMD_FINISH)
break;
- if (result == CMD_CASCADING_FAILURE && !getl_is_interactive ())
+ if (result == CMD_CASCADING_FAILURE &&
+ !getl_is_interactive (the_source_stream))
{
msg (SE, _("Stopping syntax file processing here to avoid "
"a cascade of dependent command failures."));
{
msg (SE, _("Stopping syntax file processing here to avoid "
"a cascade of dependent command failures."));
- getl_abort_noninteractive ();
+ getl_abort_noninteractive (
the_source_stream
);
}
else
}
else
- check_msg_count ();
+ check_msg_count (
the_source_stream
);
}
}
}
}
@@
-196,7
+199,7
@@
terminate (bool success)
settings_done ();
fh_done ();
lex_destroy (the_lexer);
settings_done ();
fh_done ();
lex_destroy (the_lexer);
-
getl_uninitialize (
);
+
destroy_source_stream (the_source_stream
);
prompt_done ();
readln_uninitialize ();
prompt_done ();
readln_uninitialize ();
diff --git
a/src/ui/terminal/msg-ui.c
b/src/ui/terminal/msg-ui.c
index 7cb652c021df77b3b42fe3ab70de9eeb4d7e582a..6a67a6f1187f2bdcd209e3ad121ae1d980507c4a 100644
(file)
--- a/
src/ui/terminal/msg-ui.c
+++ b/
src/ui/terminal/msg-ui.c
@@
-53,7
+53,7
@@
msg_ui_set_error_file (const char *filename)
}
void
}
void
-msg_ui_init (
void
)
+msg_ui_init (
struct source_stream *ss
)
{
msg_file = stdout;
{
msg_file = stdout;
@@
-69,7
+69,7
@@
msg_ui_init (void)
msg_file = stdout;
}
}
msg_file = stdout;
}
}
- msg_init (handle_msg);
+ msg_init (
ss,
handle_msg);
}
void
}
void
@@
-81,13
+81,12
@@
msg_ui_done (void)
fclose (msg_file);
}
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,7
+99,7
@@
check_msg_count (void)
else
return;
else
return;
- getl_abort_noninteractive ();
+ getl_abort_noninteractive (
ss
);
}
}
}
}
diff --git
a/src/ui/terminal/msg-ui.h
b/src/ui/terminal/msg-ui.h
index 4eeec2789ecaff638e8891a4a8971f12c2b1711c..165bffeda10154ec7ec019806d071cdae0d97bc4 100644
(file)
--- a/
src/ui/terminal/msg-ui.h
+++ b/
src/ui/terminal/msg-ui.h
@@
-22,10
+22,12
@@
#include <stdbool.h>
#include <stdbool.h>
+struct source_stream ;
+
void msg_ui_set_error_file (const char *filename);
void msg_ui_set_error_file (const char *filename);
-void msg_ui_init (
void
);
+void msg_ui_init (
struct source_stream *
);
void msg_ui_done (void);
void msg_ui_done (void);
-void check_msg_count (
void
);
+void check_msg_count (
struct source_stream *
);
void reset_msg_count (void);
bool any_errors (void);
void reset_msg_count (void);
bool any_errors (void);