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.
7 * See the Ragel online documentation for additional
8 * information about the format of this file.
10 * Written by Marc Liyanage <http://www.entropy.ch>
17 #include <sys/types.h>
22 #define STACKDEPTH 600
23 #define MAXTAGLENGTH 100
27 /* bit field flags for the return value, to indicate state to the caller */
33 ERROR_ALREADY_BALANCED_HERE = 16
36 char (*findCompletion(char *data, int len, int cursor, int *result, int tagpositions[]))[];
45 pos = data = (char *)malloc(40000);
48 char (*resultstack)[MAXTAGLENGTH];
50 while ((readlen = read(0, pos, 40000)) > 0) {
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]);