version 3.1 checkin
[TestXSLT.git] / ragel_xmlscanner.h
1
2 /*
3  * This is an input file for the "Ragel" finite state machine compiler utility.
4  * It produces output code which implements a tag scanner for XML data.
5  * It is used for intelligent xml tag completion in an XML editor interface.
6  * 
7  * See the Ragel online documentation for additional
8  * information about the format of this file.
9  *
10  * Written by Marc Liyanage <http://www.entropy.ch>
11  *
12  */
13
14
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include <sys/types.h>
18 #include <sys/uio.h>
19 #include <unistd.h>
20 #include <strings.h>
21
22 #define STACKDEPTH 600
23 #define MAXTAGLENGTH 100
24 #define DEBUG 0
25
26
27 /* bit field flags for the return value, to indicate state to the caller */
28 enum {
29         ERROR_IN_TAG = 1,
30         ERROR_IN_COMMENT = 2,
31         ERROR_IN_CDATA = 4,
32         ERROR_NO_TAG = 8,
33         ERROR_ALREADY_BALANCED_HERE = 16
34 };
35
36 char (*findCompletion(char *data, int len, int cursor, int *result, int tagpositions[]))[];
37
38
39 /*
40
41 int main() {
42
43         char *data, *pos;
44
45         pos = data = (char *)malloc(40000);
46         int readlen = 0, i;
47         unsigned int result;
48         char (*resultstack)[MAXTAGLENGTH];
49
50         while ((readlen = read(0, pos, 40000)) > 0) {
51                 pos += readlen;
52         }
53
54
55         resultstack = findCompletion(data, pos - data, 1382, &result);
56         for (i = 0; resultstack && *(resultstack[i]); i++) {
57                 fprintf(stderr, "tag main (%p): '%s'\n", resultstack[i], resultstack[i]);
58         }
59
60         if (resultstack)
61                 free(resultstack);
62
63         exit(0);
64
65 }
66
67
68 */
69