projects
/
egate.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Changed header.
[egate.git]
/
fml
/
fmlcalls.c
diff --git
a/fml/fmlcalls.c
b/fml/fmlcalls.c
index
5e73f0e
..
2d07590
100644
(file)
--- a/
fml/fmlcalls.c
+++ b/
fml/fmlcalls.c
@@
-2,7
+2,15
@@
* FML interpreter. Europagate, 1995
*
* $Log: fmlcalls.c,v $
* FML interpreter. Europagate, 1995
*
* $Log: fmlcalls.c,v $
- * Revision 1.1 1995/02/09 16:06:07 adam
+ * Revision 1.4 1995/02/23 08:32:04 adam
+ * Changed header.
+ *
+ * Revision 1.2 1995/02/10 15:50:55 adam
+ * MARC interface implemented. Minor bugs fixed. fmltest can
+ * be used to format single MARC records. New function '\list'
+ * implemented.
+ *
+ * Revision 1.1 1995/02/09 16:06:07 adam
* FML can be called from the outside multiple times by the functions:
* fml_exec_call and fml_exec_call_str.
* An interactive parameter (-i) to fmltest starts a shell-like
* FML can be called from the outside multiple times by the functions:
* fml_exec_call and fml_exec_call_str.
* An interactive parameter (-i) to fmltest starts a shell-like
@@
-15,22
+23,46
@@
#include "fmlp.h"
#include "fmlp.h"
-static const char *str_ptr;
+static const char **str_args;
static int eof_mark;
static int str_reader (void)
{
static int eof_mark;
static int str_reader (void)
{
- if (!*str_ptr)
- return eof_mark;
- return *str_ptr++;
+ int c;
+ while (! (c = **str_args))
+ {
+ if (! str_args[1])
+ return eof_mark;
+ ++str_args;
+ }
+ ++ *str_args;
+ return c;
}
}
+void fml_exec_call_argv (Fml fml, const char **argv)
+{
+ int (*old_func)(void) = fml->read_func;
+
+ fml->read_func = str_reader;
+ str_args = argv;
+ eof_mark = fml->eof_mark;
+ fml_exec_call (fml);
+ fml->read_func = old_func;
+}
+
+
void fml_exec_call_str (Fml fml, const char *str)
{
int (*old_func)(void) = fml->read_func;
void fml_exec_call_str (Fml fml, const char *str)
{
int (*old_func)(void) = fml->read_func;
+ const char *argv[2];
+
+ argv[0] = str;
+ argv[1] = NULL;
fml->read_func = str_reader;
fml->read_func = str_reader;
- str_ptr = str;
+ str_args = argv;
eof_mark = fml->eof_mark;
fml_exec_call (fml);
fml->read_func = old_func;
}
eof_mark = fml->eof_mark;
fml_exec_call (fml);
fml->read_func = old_func;
}
+
+