The \ character is no longer INCLUDED when terminating a token.
[egate.git] / fml / fmltest.c
1 /*
2  * FML interpreter. Europagate, 1995
3  *
4  * $Log: fmltest.c,v $
5  * Revision 1.2  1995/02/07 16:09:24  adam
6  * The \ character is no longer INCLUDED when terminating a token.
7  * Major changes in tokenization routines. Bug fixes in expressions
8  * with lists (fml_sub0).
9  *
10  * Revision 1.1.1.1  1995/02/06  13:48:10  adam
11  * First version of the FML interpreter. It's slow and memory isn't
12  * freed properly. In particular, the FML nodes aren't released yet.
13  *
14  */
15
16 #include <stdio.h>
17 #include "fml.h"
18
19 static FILE *inf;
20
21 static int inf_read (void)
22 {
23     return getc (inf);
24 }
25
26 int main (int argc, char **argv)
27 {
28     Fml fml;
29     int nfiles = 0;
30
31     fml = fml_open ();
32     while (-- argc > 0)
33     {
34         ++argv;
35         if (**argv == '-')
36         {
37             if (argv[0][1] == 'd')
38                 fml->debug = 1;
39             else
40             {
41                 fprintf (stderr, "uknown option `%s'\n", *argv);
42                 exit (1);
43             }
44         }
45         else
46         {
47             nfiles++;
48             inf = fopen (*argv, "r");
49             if (!inf)
50             {
51                 fprintf (stderr, "cannot open `%s'\n", *argv);
52                 exit (1);
53             }
54             fml->read_func = inf_read;
55             fml_preprocess (fml);
56             fml_exec (fml);
57             fclose (inf);
58         }
59     }
60     if (!nfiles)
61     {
62         fml_preprocess (fml);
63         fml_exec (fml);
64     }
65     return 0;
66 }