Makefile v0.3
authorken <ken@mihrtec.com>
Fri, 16 Dec 2016 06:53:05 +0000 (22:53 -0800)
committerken <ken@mihrtec.com>
Fri, 16 Dec 2016 06:53:05 +0000 (22:53 -0800)
Makefile
src/lexer_fsm.c [deleted file]

index 1bc47b8..a1e743f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -36,7 +36,7 @@ hGEN  := $(ySRC:%.y=%.tab.h)
 cGEN  := $(strip $(ySRC:%.y=%.tab.c) $(rlSRC:%.rl=%.c))
 
 # Functions
-cGENDEP = $(if $(wildcard $1),$(subst src/,,$(filter-out $1 \ %:,$(shell $(CC) -MM -MG $1))),$(info fnf $1))
+cGENDEP = $(if $(wildcard $1),$(subst src/,,$(filter-out $1 \ %:,$(shell $(CC) -MM -MG $1))),$(info <$1>))
 ldFLAGS = $(strip $(LDFLAGS) $(LDLIBS) $(VA_ARGS))
 
 # Rules
@@ -57,3 +57,6 @@ apc-d apc: $$($$@SRC) | $(hGEN)
 
 %.c: %.rl
        $(strip $(RLCMD))
+
+clean: $(wildcard $(cGEN) $(hGEN) $(apcSRC) $(apc-dSRC))
+       rm $^
diff --git a/src/lexer_fsm.c b/src/lexer_fsm.c
deleted file mode 100644 (file)
index 1ae11bb..0000000
+++ /dev/null
@@ -1,1038 +0,0 @@
-
-#line 1 "lexer_fsm.rl"
-#include <stdio.h>
-#include <stdint.h>
-#include <apc/parser.tab.h>
-#include <unistdio.h>
-#include <unistr.h>
-
-extern void lexer_pushtok(int, YYSTYPE);
-extern int lexer_lexmapfile(int, int);
-extern int ipower(int, int);
-extern int ttov(uint8_t*, int);
-extern uint8_t* ttos(const uint8_t*, int); 
-
-int lexer_setdirection(uint8_t*, int);
-int lexer_lexstring(uint8_t*, int);
-int lexer_setstr(uint8_t*, int);
-
-#define $($)#$
-#define PUSHTOK(TOK,LFUNC,UTYPE)                       \
-  do {                                                 \
-    printf("Lexer_lexstring:: PUSHTOK(" $(TOK) $(LFUNC) $(UTYPE) ")\n");               \
-    tok_t = TOK;                                       \
-    yylval.UTYPE = LFUNC(ts, p-ts);                    \
-    lexer_pushtok(tok_t, yylval);                      \
-    ++ntok;                                            \
-    } while (0);
-
-
-#line 31 "lexer_fsm.c"
-static const char _lexstring_actions[] = {
-       0, 1, 0, 1, 1, 1, 2, 1, 
-       3, 1, 4, 1, 5, 1, 13, 1, 
-       14, 1, 15, 2, 0, 14, 2, 2, 
-       6, 2, 2, 7, 2, 2, 8, 2, 
-       2, 9, 2, 2, 10, 2, 2, 11, 
-       2, 2, 12
-};
-
-static const short _lexstring_key_offsets[] = {
-       0, 0, 12, 17, 22, 24, 28, 34, 
-       40, 48, 54, 63, 69, 75, 76, 82, 
-       83, 89, 95, 103, 111, 123, 135, 147, 
-       159, 171, 183, 195, 207, 219, 231, 243, 
-       255, 267, 279
-};
-
-static const char _lexstring_trans_keys[] = {
-       48, 69, 78, 83, 87, 126, 49, 57, 
-       65, 90, 97, 122, 0, 95, 120, 48, 
-       57, 0, 95, 120, 48, 57, 48, 57, 
-       0, 95, 48, 57, 0, 95, 65, 90, 
-       97, 122, 0, 95, 65, 90, 97, 122, 
-       0, 69, 87, 95, 65, 90, 97, 122, 
-       0, 95, 65, 90, 97, 122, 0, 69, 
-       83, 87, 95, 65, 90, 97, 122, 0, 
-       95, 65, 90, 97, 122, 0, 95, 65, 
-       90, 97, 122, 95, 35, 95, 65, 90, 
-       97, 122, 95, 0, 95, 65, 90, 97, 
-       122, 48, 57, 65, 90, 97, 122, 0, 
-       95, 48, 57, 65, 90, 97, 122, 0, 
-       95, 48, 57, 65, 90, 97, 122, 48, 
-       69, 78, 83, 87, 126, 49, 57, 65, 
-       90, 97, 122, 48, 69, 78, 83, 87, 
-       126, 49, 57, 65, 90, 97, 122, 48, 
-       69, 78, 83, 87, 126, 49, 57, 65, 
-       90, 97, 122, 48, 69, 78, 83, 87, 
-       126, 49, 57, 65, 90, 97, 122, 48, 
-       69, 78, 83, 87, 126, 49, 57, 65, 
-       90, 97, 122, 48, 69, 78, 83, 87, 
-       126, 49, 57, 65, 90, 97, 122, 48, 
-       69, 78, 83, 87, 126, 49, 57, 65, 
-       90, 97, 122, 48, 69, 78, 83, 87, 
-       126, 49, 57, 65, 90, 97, 122, 48, 
-       69, 78, 83, 87, 126, 49, 57, 65, 
-       90, 97, 122, 48, 69, 78, 83, 87, 
-       126, 49, 57, 65, 90, 97, 122, 48, 
-       69, 78, 83, 87, 126, 49, 57, 65, 
-       90, 97, 122, 48, 69, 78, 83, 87, 
-       126, 49, 57, 65, 90, 97, 122, 48, 
-       69, 78, 83, 87, 126, 49, 57, 65, 
-       90, 97, 122, 48, 69, 78, 83, 87, 
-       126, 49, 57, 65, 90, 97, 122, 48, 
-       69, 78, 83, 87, 126, 49, 57, 65, 
-       90, 97, 122, 0
-};
-
-static const char _lexstring_single_lengths[] = {
-       0, 6, 3, 3, 0, 2, 2, 2, 
-       4, 2, 5, 2, 2, 1, 2, 1, 
-       2, 0, 2, 2, 6, 6, 6, 6, 
-       6, 6, 6, 6, 6, 6, 6, 6, 
-       6, 6, 6
-};
-
-static const char _lexstring_range_lengths[] = {
-       0, 3, 1, 1, 1, 1, 2, 2, 
-       2, 2, 2, 2, 2, 0, 2, 0, 
-       2, 3, 3, 3, 3, 3, 3, 3, 
-       3, 3, 3, 3, 3, 3, 3, 3, 
-       3, 3, 3
-};
-
-static const short _lexstring_index_offsets[] = {
-       0, 0, 10, 15, 20, 22, 26, 31, 
-       36, 43, 48, 56, 61, 66, 68, 73, 
-       75, 80, 84, 90, 96, 106, 116, 126, 
-       136, 146, 156, 166, 176, 186, 196, 206, 
-       216, 226, 236
-};
-
-static const char _lexstring_indicies[] = {
-       0, 4, 5, 6, 7, 8, 2, 3, 
-       3, 1, 9, 9, 11, 10, 1, 9, 
-       9, 12, 10, 1, 13, 1, 14, 14, 
-       15, 1, 16, 16, 17, 17, 1, 16, 
-       18, 17, 17, 1, 16, 19, 19, 20, 
-       17, 17, 1, 16, 21, 17, 17, 1, 
-       16, 22, 23, 24, 25, 17, 17, 1, 
-       16, 26, 17, 17, 1, 16, 27, 17, 
-       17, 1, 28, 1, 29, 30, 17, 17, 
-       1, 31, 1, 16, 32, 17, 17, 1, 
-       33, 34, 34, 1, 35, 35, 36, 34, 
-       34, 1, 37, 37, 34, 34, 34, 1, 
-       0, 4, 5, 6, 7, 8, 2, 3, 
-       3, 1, 0, 4, 5, 6, 7, 8, 
-       2, 3, 3, 1, 0, 4, 5, 6, 
-       7, 8, 2, 3, 3, 1, 0, 4, 
-       5, 6, 7, 8, 2, 3, 3, 1, 
-       0, 4, 5, 6, 7, 8, 2, 3, 
-       3, 1, 0, 4, 5, 6, 7, 8, 
-       2, 3, 3, 1, 0, 4, 5, 6, 
-       7, 8, 2, 3, 3, 1, 0, 4, 
-       5, 6, 7, 8, 2, 3, 3, 1, 
-       0, 4, 5, 6, 7, 8, 2, 3, 
-       3, 1, 0, 4, 5, 6, 7, 8, 
-       2, 3, 3, 1, 0, 4, 5, 6, 
-       7, 8, 2, 3, 3, 1, 0, 4, 
-       5, 6, 7, 8, 2, 3, 3, 1, 
-       0, 4, 5, 6, 7, 8, 2, 3, 
-       3, 1, 0, 4, 5, 6, 7, 8, 
-       2, 3, 3, 1, 0, 4, 5, 6, 
-       7, 8, 2, 3, 3, 1, 0
-};
-
-static const char _lexstring_trans_targs[] = {
-       2, 0, 3, 6, 7, 8, 10, 12, 
-       13, 20, 3, 17, 4, 5, 21, 5, 
-       22, 6, 23, 9, 32, 24, 11, 14, 
-       16, 31, 25, 26, 27, 15, 29, 28, 
-       30, 18, 19, 33, 18, 34
-};
-
-static const char _lexstring_trans_actions[] = {
-       9, 0, 9, 9, 9, 9, 9, 9, 
-       0, 0, 0, 13, 13, 9, 0, 0, 
-       0, 0, 0, 0, 0, 0, 0, 0, 
-       0, 0, 0, 0, 0, 11, 0, 0, 
-       0, 9, 0, 0, 0, 0
-};
-
-static const char _lexstring_to_state_actions[] = {
-       0, 0, 0, 0, 0, 0, 0, 0, 
-       0, 0, 0, 0, 0, 0, 0, 17, 
-       0, 0, 0, 0, 3, 15, 5, 37, 
-       31, 40, 28, 7, 0, 11, 25, 22, 
-       34, 19, 1
-};
-
-static const int lexstring_start = 1;
-static const int lexstring_first_final = 20;
-static const int lexstring_error = 0;
-
-static const int lexstring_en_tok_lexer = 1;
-
-
-#line 114 "lexer_fsm.rl"
-
-
-int
-lexer_lexstring
-(uint8_t* str, int size)
-{ uint8_t *p; 
-  uint8_t *ts, *pe, *eof;
-  int cs, ntok, tok_t, direction;
-
-  ntok = direction = 0;
-  p = ts = str;
-  pe = p + size +1;
-
-  printf("|---Begin lexstring on p = %s, pe = %s.\n",p, pe);
-
-  
-#line 195 "lexer_fsm.c"
-       {
-       cs = lexstring_start;
-       }
-
-#line 130 "lexer_fsm.rl"
-  
-#line 202 "lexer_fsm.c"
-       {
-       int _klen;
-       unsigned int _trans;
-       const char *_acts;
-       unsigned int _nacts;
-       const char *_keys;
-
-       if ( p == pe )
-               goto _test_eof;
-       if ( cs == 0 )
-               goto _out;
-_resume:
-       _keys = _lexstring_trans_keys + _lexstring_key_offsets[cs];
-       _trans = _lexstring_index_offsets[cs];
-
-       _klen = _lexstring_single_lengths[cs];
-       if ( _klen > 0 ) {
-               const char *_lower = _keys;
-               const char *_mid;
-               const char *_upper = _keys + _klen - 1;
-               while (1) {
-                       if ( _upper < _lower )
-                               break;
-
-                       _mid = _lower + ((_upper-_lower) >> 1);
-                       if ( (*p) < *_mid )
-                               _upper = _mid - 1;
-                       else if ( (*p) > *_mid )
-                               _lower = _mid + 1;
-                       else {
-                               _trans += (unsigned int)(_mid - _keys);
-                               goto _match;
-                       }
-               }
-               _keys += _klen;
-               _trans += _klen;
-       }
-
-       _klen = _lexstring_range_lengths[cs];
-       if ( _klen > 0 ) {
-               const char *_lower = _keys;
-               const char *_mid;
-               const char *_upper = _keys + (_klen<<1) - 2;
-               while (1) {
-                       if ( _upper < _lower )
-                               break;
-
-                       _mid = _lower + (((_upper-_lower) >> 1) & ~1);
-                       if ( (*p) < _mid[0] )
-                               _upper = _mid - 2;
-                       else if ( (*p) > _mid[1] )
-                               _lower = _mid + 2;
-                       else {
-                               _trans += (unsigned int)((_mid - _keys)>>1);
-                               goto _match;
-                       }
-               }
-               _trans += _klen;
-       }
-
-_match:
-       _trans = _lexstring_indicies[_trans];
-       cs = _lexstring_trans_targs[_trans];
-
-       if ( _lexstring_trans_actions[_trans] == 0 )
-               goto _again;
-
-       _acts = _lexstring_actions + _lexstring_trans_actions[_trans];
-       _nacts = (unsigned int) *_acts++;
-       while ( _nacts-- > 0 )
-       {
-               switch ( *_acts++ )
-               {
-       case 4:
-#line 41 "lexer_fsm.rl"
-       { printf("Lexer_lexstring:: action:set_ts. ts = %s\n", p); ts = p; }
-       break;
-       case 5:
-#line 42 "lexer_fsm.rl"
-       { printf("Lexer_lexstring:: action:push_SS. p = %s\n",p);
-                          yylval.str = (uint8_t*) "SS";
-                          lexer_pushtok(SS, yylval);
-                         ntok++;
-                        }
-       break;
-       case 13:
-#line 79 "lexer_fsm.rl"
-       { printf("Lexer_lexstring:: action:push_height p = %s\n", p);
-                          PUSHTOK(HEIGHT, ttov, val);
-                        }
-       break;
-#line 294 "lexer_fsm.c"
-               }
-       }
-
-_again:
-       _acts = _lexstring_actions + _lexstring_to_state_actions[cs];
-       _nacts = (unsigned int) *_acts++;
-       while ( _nacts-- > 0 ) {
-               switch ( *_acts++ ) {
-       case 0:
-#line 31 "lexer_fsm.rl"
-       { PUSHTOK(REF, ttov, ref); }
-       break;
-       case 1:
-#line 32 "lexer_fsm.rl"
-       { PUSHTOK(NUM, ttov, val); }
-       break;
-       case 2:
-#line 33 "lexer_fsm.rl"
-       { printf("Lexer_lexstring:: action:push_name: from %s to %s\n", ts, p);
-                          PUSHTOK(NAME, ttos, str);
-                        }
-       break;
-       case 3:
-#line 36 "lexer_fsm.rl"
-       { printf("Lexer_lexstring:: action:push_map: pushing '~'\n");
-                          yylval.str = (uint8_t*) '~';
-                          lexer_pushtok(MOPEN, yylval);
-                         ntok++;
-                       }
-       break;
-       case 5:
-#line 42 "lexer_fsm.rl"
-       { printf("Lexer_lexstring:: action:push_SS. p = %s\n",p);
-                          yylval.str = (uint8_t*) "SS";
-                          lexer_pushtok(SS, yylval);
-                         ntok++;
-                        }
-       break;
-       case 6:
-#line 47 "lexer_fsm.rl"
-       { printf("Lexer_lexstring:: action:push_S. p = %s\n", p);
-                          yylval.val = 0;
-                         lexer_pushtok(D, yylval);
-                        }
-       break;
-       case 7:
-#line 51 "lexer_fsm.rl"
-       { printf("Lexer_lexstring:: action:push_SW. p = %s\n", p);
-                          yylval.val = 1;
-                         lexer_pushtok(D, yylval);
-                        }
-       break;
-       case 8:
-#line 55 "lexer_fsm.rl"
-       { printf("Lexer_lexstring:: action:push_W. p = %s\n", p);
-                          yylval.val = 2;
-                         lexer_pushtok(D, yylval);
-                        }
-       break;
-       case 9:
-#line 59 "lexer_fsm.rl"
-       { printf("Lexer_lexstring:: action:push_NW. p = %s\n", p);
-                          yylval.val = 3;
-                         lexer_pushtok(D, yylval);
-                        }
-       break;
-       case 10:
-#line 63 "lexer_fsm.rl"
-       { printf("Lexer_lexstring:: action:push_N. p = %s\n", p);
-                          yylval.val = 4;
-                         lexer_pushtok(D, yylval);
-                        }
-       break;
-       case 11:
-#line 71 "lexer_fsm.rl"
-       { printf("Lexer_lexstring:: action:push_N. p = %s\n", p);
-                          yylval.val = 6;
-                         lexer_pushtok(D, yylval);
-                        }
-       break;
-       case 12:
-#line 75 "lexer_fsm.rl"
-       { printf("Lexer_lexstring:: action:push_N. p = %s\n", p);
-                          yylval.val = 7;
-                         lexer_pushtok(D, yylval);
-                        }
-       break;
-       case 14:
-#line 82 "lexer_fsm.rl"
-       { printf("Lexer_lexstring:: action:push_height p = %s\n", p);
-                          PUSHTOK(WIDTH, ttov, val);
-                        }
-       break;
-       case 15:
-#line 85 "lexer_fsm.rl"
-       {yylval.str = (uint8_t*) '#'; lexer_pushtok(LINK),yylval); }
-       break;
-#line 392 "lexer_fsm.c"
-               }
-       }
-
-       if ( cs == 0 )
-               goto _out;
-       if ( ++p != pe )
-               goto _resume;
-       _test_eof: {}
-       _out: {}
-       }
-
-#line 131 "lexer_fsm.rl"
-
-   printf("Ending lexstring of file %s, pushed %d tokens.\n",str, ntok);
-
-  return ntok;
-}
-
-
-
-#line 413 "lexer_fsm.c"
-static const char _setdirection_actions[] = {
-       0, 1, 0, 1, 1, 1, 2, 1, 
-       3, 1, 4, 1, 5, 1, 6, 1, 
-       7
-};
-
-static const char _setdirection_key_offsets[] = {
-       0, 0, 6, 8, 12, 14, 16, 20, 
-       22, 24, 26, 26, 26, 26, 26, 26, 
-       26, 26
-};
-
-static const char _setdirection_trans_keys[] = {
-       0, 69, 78, 83, 87, 95, 0, 95, 
-       0, 69, 87, 95, 0, 95, 0, 95, 
-       0, 69, 87, 95, 0, 95, 0, 95, 
-       0, 95, 0
-};
-
-static const char _setdirection_single_lengths[] = {
-       0, 6, 2, 4, 2, 2, 4, 2, 
-       2, 2, 0, 0, 0, 0, 0, 0, 
-       0, 0
-};
-
-static const char _setdirection_range_lengths[] = {
-       0, 0, 0, 0, 0, 0, 0, 0, 
-       0, 0, 0, 0, 0, 0, 0, 0, 
-       0, 0
-};
-
-static const char _setdirection_index_offsets[] = {
-       0, 0, 7, 10, 15, 18, 21, 26, 
-       29, 32, 35, 36, 37, 38, 39, 40, 
-       41, 42
-};
-
-static const char _setdirection_indicies[] = {
-       0, 2, 3, 4, 5, 0, 1, 6, 
-       6, 1, 7, 8, 9, 7, 1, 10, 
-       10, 1, 11, 11, 1, 0, 12, 13, 
-       0, 1, 14, 14, 1, 15, 15, 1, 
-       16, 16, 1, 1, 1, 1, 1, 1, 
-       1, 1, 1, 0
-};
-
-static const char _setdirection_trans_targs[] = {
-       10, 0, 2, 3, 6, 9, 11, 12, 
-       4, 5, 13, 14, 7, 8, 15, 16, 
-       17
-};
-
-static const char _setdirection_trans_actions[] = {
-       0, 0, 0, 0, 0, 0, 0, 0, 
-       0, 0, 0, 0, 0, 0, 0, 0, 
-       0
-};
-
-static const char _setdirection_to_state_actions[] = {
-       0, 0, 0, 0, 0, 0, 0, 0, 
-       0, 0, 7, 5, 1, 9, 11, 13, 
-       15, 3
-};
-
-static const int setdirection_start = 1;
-static const int setdirection_first_final = 10;
-static const int setdirection_error = 0;
-
-static const int setdirection_en_main = 1;
-
-
-#line 166 "lexer_fsm.rl"
-
-
-int
-lexer_setdirection
-(uint8_t* str, int size)
-{ uint8_t *p, *pe, *eof;
-  int cs;
-
-
-  p = str;
-  pe = str + size + 1; 
-  
-  printf("|--- Begin lexer_setdirection str = %s, p = %s, pe = %s ---|\n", str,p,  pe);
-  
-  
-#line 501 "lexer_fsm.c"
-       {
-       cs = setdirection_start;
-       }
-
-#line 181 "lexer_fsm.rl"
-  
-#line 508 "lexer_fsm.c"
-       {
-       int _klen;
-       unsigned int _trans;
-       const char *_acts;
-       unsigned int _nacts;
-       const char *_keys;
-
-       if ( cs == 0 )
-               goto _out;
-_resume:
-       _keys = _setdirection_trans_keys + _setdirection_key_offsets[cs];
-       _trans = _setdirection_index_offsets[cs];
-
-       _klen = _setdirection_single_lengths[cs];
-       if ( _klen > 0 ) {
-               const char *_lower = _keys;
-               const char *_mid;
-               const char *_upper = _keys + _klen - 1;
-               while (1) {
-                       if ( _upper < _lower )
-                               break;
-
-                       _mid = _lower + ((_upper-_lower) >> 1);
-                       if ( (*p) < *_mid )
-                               _upper = _mid - 1;
-                       else if ( (*p) > *_mid )
-                               _lower = _mid + 1;
-                       else {
-                               _trans += (unsigned int)(_mid - _keys);
-                               goto _match;
-                       }
-               }
-               _keys += _klen;
-               _trans += _klen;
-       }
-
-       _klen = _setdirection_range_lengths[cs];
-       if ( _klen > 0 ) {
-               const char *_lower = _keys;
-               const char *_mid;
-               const char *_upper = _keys + (_klen<<1) - 2;
-               while (1) {
-                       if ( _upper < _lower )
-                               break;
-
-                       _mid = _lower + (((_upper-_lower) >> 1) & ~1);
-                       if ( (*p) < _mid[0] )
-                               _upper = _mid - 2;
-                       else if ( (*p) > _mid[1] )
-                               _lower = _mid + 2;
-                       else {
-                               _trans += (unsigned int)((_mid - _keys)>>1);
-                               goto _match;
-                       }
-               }
-               _trans += _klen;
-       }
-
-_match:
-       _trans = _setdirection_indicies[_trans];
-       cs = _setdirection_trans_targs[_trans];
-
-       _acts = _setdirection_actions + _setdirection_to_state_actions[cs];
-       _nacts = (unsigned int) *_acts++;
-       while ( _nacts-- > 0 ) {
-               switch ( *_acts++ ) {
-       case 0:
-#line 141 "lexer_fsm.rl"
-       {printf("Lexer_setdirection:: direction is north, returning 4\n"); return 4;; }
-       break;
-       case 1:
-#line 142 "lexer_fsm.rl"
-       { printf("Lexer_setdirection:: direction is west, returning 2\n");return 2;}
-       break;
-       case 2:
-#line 143 "lexer_fsm.rl"
-       { printf("Lexer_setdirection:: direction is east, returning 6\n");return 6;}
-       break;
-       case 3:
-#line 144 "lexer_fsm.rl"
-       { printf("Lexer_setdirection:: direction is south, returning 0\n");return 0;}
-       break;
-       case 4:
-#line 145 "lexer_fsm.rl"
-       { printf("Lexer_setdirection:: direction is northeast, returning 5\n");return 5 ;}
-       break;
-       case 5:
-#line 146 "lexer_fsm.rl"
-       { printf("Lexer_setdirection:: direction is northwest, returning 3\n");return 3;}
-       break;
-       case 6:
-#line 147 "lexer_fsm.rl"
-       { printf("Lexer_setdirection:: direction is southeast, returning 7\n");return 7;}
-       break;
-       case 7:
-#line 148 "lexer_fsm.rl"
-       { printf("Lexer_setdirection:: direction is southwest, returning 1\n");return 1;}
-       break;
-#line 607 "lexer_fsm.c"
-               }
-       }
-
-       if ( cs == 0 )
-               goto _out;
-       p += 1;
-       goto _resume;
-       _out: {}
-       }
-
-#line 182 "lexer_fsm.rl"
-
-  printf("|--- Error in: lexer_setdirection ---|\n");
-  
-  return -1;
-}
-
-
-
-/**************************/
-/****Abandon All Hope******/
-/**************************/
-/***                    ***/
-/***                    ***/       
-/***                    ***/
-/***                    ***/
-
-
-#if 0 
-
-#line 638 "lexer_fsm.c"
-static const char _setstr_actions[] = {
-       0, 1, 0, 1, 1, 1, 2, 1, 
-       3, 1, 4, 1, 5, 1, 6, 1, 
-       7, 1, 8
-};
-
-static const unsigned char _setstr_key_offsets[] = {
-       0, 0, 6, 7, 13, 20, 25, 33, 
-       34, 35, 36, 42, 50, 55, 60, 66, 
-       75, 79, 85, 86, 92, 99, 106, 111, 
-       115, 116, 117, 118, 124, 132, 137, 142, 
-       148, 157, 161, 167, 168, 174, 181, 184, 
-       185, 191, 195, 201, 202, 203, 209, 216, 
-       222, 231, 235, 241, 241, 241, 241, 241, 
-       241, 250, 251
-};
-
-static const char _setstr_trans_keys[] = {
-       48, 83, 65, 90, 97, 122, 120, 48, 
-       57, 65, 90, 97, 122, 0, 48, 57, 
-       65, 90, 97, 122, 95, 65, 90, 97, 
-       122, 35, 48, 83, 126, 65, 90, 97, 
-       122, 95, 48, 120, 48, 57, 65, 90, 
-       97, 122, 0, 95, 48, 57, 65, 90, 
-       97, 122, 83, 65, 90, 97, 122, 0, 
-       65, 90, 97, 122, 0, 83, 65, 90, 
-       97, 122, 0, 69, 78, 83, 87, 65, 
-       90, 97, 122, 65, 90, 97, 122, 69, 
-       87, 65, 90, 97, 122, 120, 48, 57, 
-       65, 90, 97, 122, 95, 48, 57, 65, 
-       90, 97, 122, 35, 83, 126, 65, 90, 
-       97, 122, 95, 65, 90, 97, 122, 35, 
-       48, 83, 126, 95, 48, 120, 48, 57, 
-       65, 90, 97, 122, 0, 95, 48, 57, 
-       65, 90, 97, 122, 83, 65, 90, 97, 
-       122, 0, 65, 90, 97, 122, 0, 83, 
-       65, 90, 97, 122, 0, 69, 78, 83, 
-       87, 65, 90, 97, 122, 65, 90, 97, 
-       122, 69, 87, 65, 90, 97, 122, 120, 
-       48, 57, 65, 90, 97, 122, 95, 48, 
-       57, 65, 90, 97, 122, 35, 83, 126, 
-       83, 83, 95, 65, 90, 97, 122, 65, 
-       90, 97, 122, 69, 87, 65, 90, 97, 
-       122, 48, 120, 48, 57, 65, 90, 97, 
-       122, 0, 48, 57, 65, 90, 97, 122, 
-       83, 95, 65, 90, 97, 122, 69, 78, 
-       83, 87, 95, 65, 90, 97, 122, 65, 
-       90, 97, 122, 69, 87, 65, 90, 97, 
-       122, 69, 78, 83, 87, 95, 65, 90, 
-       97, 122, 95, 0
-};
-
-static const char _setstr_single_lengths[] = {
-       0, 2, 1, 0, 1, 1, 4, 1, 
-       1, 1, 0, 2, 1, 1, 2, 5, 
-       0, 2, 1, 0, 1, 3, 1, 4, 
-       1, 1, 1, 0, 2, 1, 1, 2, 
-       5, 0, 2, 1, 0, 1, 3, 1, 
-       2, 0, 2, 1, 1, 0, 1, 2, 
-       5, 0, 2, 0, 0, 0, 0, 0, 
-       5, 1, 0
-};
-
-static const char _setstr_range_lengths[] = {
-       0, 2, 0, 3, 3, 2, 2, 0, 
-       0, 0, 3, 3, 2, 2, 2, 2, 
-       2, 2, 0, 3, 3, 2, 2, 0, 
-       0, 0, 0, 3, 3, 2, 2, 2, 
-       2, 2, 2, 0, 3, 3, 0, 0, 
-       2, 2, 2, 0, 0, 3, 3, 2, 
-       2, 2, 2, 0, 0, 0, 0, 0, 
-       2, 0, 0
-};
-
-static const short _setstr_index_offsets[] = {
-       0, 0, 5, 7, 11, 16, 20, 27, 
-       29, 31, 33, 37, 43, 47, 51, 56, 
-       64, 67, 72, 74, 78, 83, 89, 93, 
-       98, 100, 102, 104, 108, 114, 118, 122, 
-       127, 135, 138, 143, 145, 149, 154, 158, 
-       160, 165, 168, 173, 175, 177, 181, 186, 
-       191, 199, 202, 207, 208, 209, 210, 211, 
-       212, 220, 222
-};
-
-static const char _setstr_indicies[] = {
-       0, 3, 2, 2, 1, 4, 1, 5, 
-       5, 5, 1, 6, 5, 5, 5, 1, 
-       7, 2, 2, 1, 8, 9, 11, 12, 
-       10, 10, 1, 13, 1, 14, 1, 15, 
-       1, 16, 16, 16, 1, 17, 18, 16, 
-       16, 16, 1, 20, 19, 19, 1, 17, 
-       19, 19, 1, 17, 21, 19, 19, 1, 
-       17, 22, 23, 23, 22, 19, 19, 1, 
-       19, 19, 1, 22, 22, 19, 19, 1, 
-       24, 1, 25, 25, 25, 1, 26, 25, 
-       25, 25, 1, 8, 11, 12, 10, 10, 
-       1, 27, 10, 10, 1, 28, 29, 30, 
-       31, 1, 32, 1, 33, 1, 34, 1, 
-       35, 35, 35, 1, 36, 37, 35, 35, 
-       35, 1, 39, 38, 38, 1, 36, 38, 
-       38, 1, 36, 40, 38, 38, 1, 36, 
-       41, 42, 42, 41, 38, 38, 1, 38, 
-       38, 1, 41, 41, 38, 38, 1, 43, 
-       1, 44, 44, 44, 1, 45, 44, 44, 
-       44, 1, 28, 30, 31, 1, 46, 1, 
-       47, 27, 10, 10, 1, 10, 10, 1, 
-       48, 48, 10, 10, 1, 49, 1, 50, 
-       1, 51, 51, 51, 1, 52, 51, 51, 
-       51, 1, 53, 7, 2, 2, 1, 54, 
-       55, 55, 54, 7, 2, 2, 1, 2, 
-       2, 1, 54, 54, 2, 2, 1, 1, 
-       1, 1, 1, 1, 48, 56, 56, 48, 
-       27, 10, 10, 1, 57, 1, 1, 0
-};
-
-static const char _setstr_trans_targs[] = {
-       2, 0, 5, 47, 3, 4, 51, 6, 
-       7, 18, 22, 40, 57, 8, 9, 10, 
-       11, 52, 12, 13, 14, 15, 16, 17, 
-       19, 20, 21, 23, 24, 35, 39, 55, 
-       25, 26, 27, 28, 53, 29, 30, 31, 
-       32, 33, 34, 36, 37, 38, 54, 56, 
-       41, 44, 45, 46, 58, 48, 49, 50, 
-       42, 43
-};
-
-static const char _setstr_trans_actions[] = {
-       17, 0, 17, 17, 17, 17, 0, 0, 
-       0, 17, 17, 17, 0, 0, 17, 17, 
-       17, 0, 0, 17, 17, 17, 17, 17, 
-       17, 17, 0, 0, 0, 17, 0, 0, 
-       0, 17, 17, 17, 0, 0, 17, 17, 
-       17, 17, 17, 17, 17, 0, 0, 17, 
-       17, 17, 17, 17, 0, 17, 17, 17, 
-       17, 0
-};
-
-static const char _setstr_to_state_actions[] = {
-       0, 0, 0, 0, 13, 0, 0, 0, 
-       0, 0, 0, 0, 0, 0, 0, 0, 
-       0, 0, 0, 0, 0, 0, 0, 0, 
-       0, 0, 0, 0, 0, 0, 0, 0, 
-       0, 0, 0, 0, 0, 0, 0, 0, 
-       0, 0, 0, 0, 0, 0, 0, 0, 
-       0, 0, 0, 0, 1, 3, 9, 11, 
-       5, 7, 15
-};
-
-static const int setstr_start = 1;
-static const int setstr_first_final = 51;
-static const int setstr_error = 0;
-
-static const int setstr_en_main = 1;
-
-
-#line 260 "lexer_fsm.rl"
-
-
-int
-lexer_setstr
-(uint8_t* str, int size)
-{ uint8_t *p, *pe, *eof;
-  int cs, type, newstrt;
-
-  type = newstrt = 0;
-
-  p = str;
-  pe = str + size + 1;
-  
-  printf("|--- Begin lexer_setstr with str = %s, p = %s, pe = %s ---|\n", str,p,  pe);
-  
-  
-#line 812 "lexer_fsm.c"
-       {
-       cs = setstr_start;
-       }
-
-#line 276 "lexer_fsm.rl"
-  
-#line 819 "lexer_fsm.c"
-       {
-       int _klen;
-       unsigned int _trans;
-       const char *_acts;
-       unsigned int _nacts;
-       const char *_keys;
-
-       if ( cs == 0 )
-               goto _out;
-_resume:
-       _keys = _setstr_trans_keys + _setstr_key_offsets[cs];
-       _trans = _setstr_index_offsets[cs];
-
-       _klen = _setstr_single_lengths[cs];
-       if ( _klen > 0 ) {
-               const char *_lower = _keys;
-               const char *_mid;
-               const char *_upper = _keys + _klen - 1;
-               while (1) {
-                       if ( _upper < _lower )
-                               break;
-
-                       _mid = _lower + ((_upper-_lower) >> 1);
-                       if ( (*p) < *_mid )
-                               _upper = _mid - 1;
-                       else if ( (*p) > *_mid )
-                               _lower = _mid + 1;
-                       else {
-                               _trans += (unsigned int)(_mid - _keys);
-                               goto _match;
-                       }
-               }
-               _keys += _klen;
-               _trans += _klen;
-       }
-
-       _klen = _setstr_range_lengths[cs];
-       if ( _klen > 0 ) {
-               const char *_lower = _keys;
-               const char *_mid;
-               const char *_upper = _keys + (_klen<<1) - 2;
-               while (1) {
-                       if ( _upper < _lower )
-                               break;
-
-                       _mid = _lower + (((_upper-_lower) >> 1) & ~1);
-                       if ( (*p) < _mid[0] )
-                               _upper = _mid - 2;
-                       else if ( (*p) > _mid[1] )
-                               _lower = _mid + 2;
-                       else {
-                               _trans += (unsigned int)((_mid - _keys)>>1);
-                               goto _match;
-                       }
-               }
-               _trans += _klen;
-       }
-
-_match:
-       _trans = _setstr_indicies[_trans];
-       cs = _setstr_trans_targs[_trans];
-
-       if ( _setstr_trans_actions[_trans] == 0 )
-               goto _again;
-
-       _acts = _setstr_actions + _setstr_trans_actions[_trans];
-       _nacts = (unsigned int) *_acts++;
-       while ( _nacts-- > 0 )
-       {
-               switch ( *_acts++ )
-               {
-       case 8:
-#line 212 "lexer_fsm.rl"
-       {printf("p = %s \n",p);}
-       break;
-#line 895 "lexer_fsm.c"
-               }
-       }
-
-_again:
-       _acts = _setstr_actions + _setstr_to_state_actions[cs];
-       _nacts = (unsigned int) *_acts++;
-       while ( _nacts-- > 0 ) {
-               switch ( *_acts++ ) {
-       case 0:
-#line 204 "lexer_fsm.rl"
-       {printf("Lexer_setstr:: Returning setvlink filetype for %s\n", str); type =  5; newstrt = lexer_lexsetvlink(str); {p++; goto _out; }}
-       break;
-       case 1:
-#line 205 "lexer_fsm.rl"
-       {printf("Lexer_setstr:: Returning elevlink filetype for %s\n", str); type =  6; newstrt = lexer_lexelevlink(str); {p++; goto _out; }}
-       break;
-       case 2:
-#line 206 "lexer_fsm.rl"
-       {printf("Lexer_setstr:: Returning setmodel filetype\n"); newstrt = lexer_lexsetmodel(str); type =  1; {p++; goto _out; }}
-       break;
-       case 3:
-#line 207 "lexer_fsm.rl"
-       {printf("Lexer_setstr:: Returning setmap filetype\n"); newstrt = lexer_lexsetmap(str); type =  2; {p++; goto _out; }}
-       break;
-       case 4:
-#line 208 "lexer_fsm.rl"
-       {printf("Lexer_setstr:: Returning elemodel filetype for %s\n", str); newstrt = lexer_lexelemodel(str); type =  3; {p++; goto _out; }}
-       break;
-       case 5:
-#line 209 "lexer_fsm.rl"
-       {printf("Lexer_setstr:: Returning elemap filetype for %s\n", str); newstrt = lexer_lexelemap(str); type = 4; {p++; goto _out; }}
-       break;
-       case 6:
-#line 210 "lexer_fsm.rl"
-       { printf("Lexer_setstr:: Returning setolink filetype\n"); type = 8; newstrt = lexer_lexsetolink(str); {p++; goto _out; }}
-       break;
-       case 7:
-#line 211 "lexer_fsm.rl"
-       { printf("Lexer_setstr:: Returning eleolink filetype\n"); type = 7; newstrt = lexer_lexeleolink(str); {p++; goto _out; }}
-       break;
-#line 936 "lexer_fsm.c"
-               }
-       }
-
-       if ( cs == 0 )
-               goto _out;
-       p += 1;
-       goto _resume;
-       _out: {}
-       }
-
-#line 277 "lexer_fsm.rl"
-
-  printf("|--- End lexer_setstr. Incrementing str by %d, type is %d ---|\n", newstrt, type);
-  
-  return newstrt;
-}
-
-#endif
-
-
-/* %%{ */
-/*   machine file_matcher; */
-  
-/*   action call_ml { ts = p; fgoto set_hw ;} */
-/*   action call_tl { return 0;} */
-/*   action set_height {height = ttov(p, p-ts+1); ts = p;} */
-/*   action set_width { width = ttov(p, p-ts+1);} */
-/*   action call_lmf {lexer_lexmapfile(height, width); } */
-/*   action lex_error {printf("input error: character %c in filename %s is invalid\n  = %s\n", fc, str, p);} */
-  
-/*   #This machine determines the type of file we are lexing */
-/*   #and calls the appropriate machine to handle it. */
-
-/*   #TODO add mapping name */
-/*   width = digit+ %set_width; */
-/*   height = digit+ %set_height; */
-
-/*   set_hw :=  height . '_' . width [\0] %to(call_lmf); */
-
-/*   tok_segment = alnum; */
-/*   map_end = 'm' . '_' %to(call_ml); */
-/*   tok_end = alnum+  . [\0] %to(call_tl); */
-
-/*   file_matcher := (tok_segment+ . '_' )+ ( map_end | tok_end ); */
-
-/*   write data; */
-/* }%% */
-
-/* int */
-/* lexer_matchfile */
-/* (char* str, int size) */
-/* {  *p, *pe; */
-/*   char* ts; */
-/*   int  cs, ntok, height, width; */
-
-/*   p =  str; */
-/*   pe = p + size; */
-/*   height = width = 0; */
-
-/*   printf("Checking if filename is a map file:: filename = %s, p = %c, pe = %c\n", str, *p, *pe); */
-
-/*   %%write init; */
-/*   %%write exec noend; */
-
-/*   printf("Ending lexer_ismapfile on %s\n", str); */
-
-/*   return ntok; */
-/* } */
-
-/* %%{ */
-/*   machine vartype; */
-
-/*   action isele {return 0;} */
-/*   action ismodel {return 1;} */
-
-/*   set_name = alpha+; */
-/*   ele_name = alpha+; */
-/*   model_name = alpha+; */
-
-/*   ele = set_name  '_' model_name '_' ele_name %isele; */
-/*   model = set_name '_'  model_name [\0] %ismodel; */
-  
-
-/*   ismodel := (ele | model); */
-
-/*   write data; */
-
-/* }%% */
-
-/* int */
-/* lexer_ismodel */
-/* (uint8_t* str, int size) */
-/* { uint8_t *p, *pe, *eof; */
-/*   int cs; */
-
-/*   p = str; */
-/*   pe = p + size + 1; */
-
-/*   %%write init; */
-/*   %%write exec; */
-  
-
-/* } */