2 * FML interpreter. Europagate, 1995
5 * Revision 1.5 1995/02/10 15:50:56 adam
6 * MARC interface implemented. Minor bugs fixed. fmltest can
7 * be used to format single MARC records. New function '\list'
10 * Revision 1.4 1995/02/09 16:06:08 adam
11 * FML can be called from the outside multiple times by the functions:
12 * fml_exec_call and fml_exec_call_str.
13 * An interactive parameter (-i) to fmltest starts a shell-like
14 * interface to FML by using the fml_exec_call_str function.
16 * Revision 1.3 1995/02/09 13:07:15 adam
17 * Nodes are freed now. Many bugs fixed.
19 * Revision 1.2 1995/02/07 16:09:24 adam
20 * The \ character is no longer INCLUDED when terminating a token.
21 * Major changes in tokenization routines. Bug fixes in expressions
22 * with lists (fml_sub0).
24 * Revision 1.1.1.1 1995/02/06 13:48:10 adam
25 * First version of the FML interpreter. It's slow and memory isn't
26 * freed properly. In particular, the FML nodes aren't released yet.
38 static int inf_read (void)
43 int main (int argc, char **argv)
48 Iso2709Rec rec = NULL;
56 if (argv[0][1] == 'd')
58 else if (argv[0][1] == 'm')
60 else if (argv[0][1] == 'i')
62 else if (argv[0][1] == '2')
71 inf = fopen (*argv, "r");
74 fprintf (stderr, "cannot open record `%s'\n", *argv);
77 if ((buf = iso2709_read (inf)))
79 rec = iso2709_cvt (buf);
84 fprintf (stderr, "no record in `%s'\n", *argv);
92 fprintf (stderr, "unknown option `%s'\n", *argv);
99 inf = fopen (*argv, "r");
102 fprintf (stderr, "cannot open FML file `%s'\n", *argv);
105 fml->read_func = inf_read;
106 fml_preprocess (fml);
113 fml_preprocess (fml);
125 const char *nargv[4];
130 if (!fgets (arg, 127, stdin))
132 if ((cp = strchr (arg, '\n')))
134 if (*arg == '!' && rec)
138 nargv[2] = marc_to_str (fml, rec);
139 printf ("passing '%s'\n", nargv[2]);
147 fml_exec_call_argv (fml, nargv);