2 * FML interpreter. Europagate, 1995
5 * Revision 1.7 1995/02/23 08:32:06 adam
8 * Revision 1.5 1995/02/10 15:50:56 adam
9 * MARC interface implemented. Minor bugs fixed. fmltest can
10 * be used to format single MARC records. New function '\list'
13 * Revision 1.4 1995/02/09 16:06:08 adam
14 * FML can be called from the outside multiple times by the functions:
15 * fml_exec_call and fml_exec_call_str.
16 * An interactive parameter (-i) to fmltest starts a shell-like
17 * interface to FML by using the fml_exec_call_str function.
19 * Revision 1.3 1995/02/09 13:07:15 adam
20 * Nodes are freed now. Many bugs fixed.
22 * Revision 1.2 1995/02/07 16:09:24 adam
23 * The \ character is no longer INCLUDED when terminating a token.
24 * Major changes in tokenization routines. Bug fixes in expressions
25 * with lists (fml_sub0).
27 * Revision 1.1.1.1 1995/02/06 13:48:10 adam
28 * First version of the FML interpreter. It's slow and memory isn't
29 * freed properly. In particular, the FML nodes aren't released yet.
41 static int inf_read (void)
46 int main (int argc, char **argv)
51 Iso2709Rec rec = NULL;
59 if (argv[0][1] == 'd')
61 else if (argv[0][1] == 'm')
63 else if (argv[0][1] == 'i')
65 else if (argv[0][1] == '2')
74 inf = fopen (*argv, "r");
77 fprintf (stderr, "cannot open record `%s'\n", *argv);
80 if ((buf = iso2709_read (inf)))
82 rec = iso2709_cvt (buf);
87 fprintf (stderr, "no record in `%s'\n", *argv);
95 fprintf (stderr, "unknown option `%s'\n", *argv);
102 inf = fopen (*argv, "r");
105 fprintf (stderr, "cannot open FML file `%s'\n", *argv);
108 fml->read_func = inf_read;
109 fml_preprocess (fml);
116 fml_preprocess (fml);
128 const char *nargv[4];
133 if (!fgets (arg, 127, stdin))
135 if ((cp = strchr (arg, '\n')))
137 if (*arg == '!' && rec)
141 nargv[2] = marc_to_str (fml, rec);
142 printf ("passing '%s'\n", nargv[2]);
150 fml_exec_call_argv (fml, nargv);