- if (last_period) //if we found one,
- *last_period = 0; //truncate the string there
- /* Register the current_filename */
- current_filename = filename;
- printf("lexer_lexfilename(%s)\n",fname);
- return lexer_lexfilename(fname);
-}
-
-uint8_t const* lexer_get_current_filepath
-()
-{ static uint8_t current_path[FPATH_MAX];
- static uint8_t const* last_filename;
- if ((!last_filename || last_filename != current_filename) &&
- ((uint8_t*) realpath((char*)current_filename, (char*)current_path) != (uint8_t*) current_path))
- { perror("realpath: ");
- return NULL;
- }
- return (const uint8_t*)current_path;
-}
-
-/* Scan filename and push the its tokens
- onto the stack */
-int lexer_lexfilename
-( uint8_t* str
-)
-{ int ntok, len;
- uint8_t *filepath;
-
-
- printf("|---- Begin lexerfilename on %s ----|\n", str);
-
- if(*str == 0)
- perror("Lexfilename:: str is NULL so fail\n");
-
- /* Determine the filetype of str */
- len = u8_strlen(str);
-
- ntok = lexer_lexstring(str, len);
-
- /* Pass back filepath as end of statment operator */
- filepath = u8_strdup(lexer_get_current_filepath());
- yylval.str = filepath;
- lexer_pushtok(NAME, yylval);
- printf("Pushing filepath %s\n", filepath);
- ntok++;
-
- printf("|---- Ending lexer_lexfilename on %s, %d tokens were lexed ----|\n", str, ntok);
- return ntok;
-}
-
-/**************************/
-/****Abandon All Hope******/
-/**************************/
-/*** ***/
-/*** ***/
-/*** ***/
-/*** ***/
-
-#if 0
-int
-lexer_lexelemap
-( uint8_t* str)
-{ int setname_len, elename_len, strlen;
- uint8_t* setname_end, *elename_end, *newstrt;
- uint8_t curr_setname[MAX_SETNAME_LEN] = {0};
- uint8_t curr_elename[MAX_ELENAME_LEN] = {0};
-
- newstrt = str;
-
- SET_CURR_SETNAME(newstrt);
- SET_CURR_ELENAME(newstrt);
- if(PREV_MAPFILE())
- { printf("Lexer_lexelemap:: previous file was mapfile*\n");
- SET_MAPSTR(newstrt);
- }
- else
- {
- if(SETNAME_MATCHES())
- { DEL_FTOK(newstrt);
- if(REF(newstrt))
- DEL_FTOK(newstrt);
- printf("Lexer_lexelemap:: setname matches\n");
- if(ELENAME_MATCHES())
- DEL_FTOK(newstrt);
- if(REF(newstrt))
- DEL_FTOK(newstrt);
- }
- }
-
- UPDATE_PREV_ELENAME(newstrt);
- UPDATE_PREV_SETNAME(newstrt);
-
- return newstrt - str;
-
-
-}
-
-int
-lexer_lexelemodel
-(uint8_t* str)
-{ int setname_len, elename_len;
- uint8_t* setname_end, *elename_end, *newstrt;
- uint8_t curr_setname[MAX_SETNAME_LEN] = {0};
- uint8_t curr_elename[MAX_ELENAME_LEN] = {0};
-
- printf("Lexer_lexelemodel:: Begin str is %s\n", str);
-
- newstrt = str;
-
- SET_CURR_SETNAME(newstrt);
- SET_CURR_ELENAME(newstrt);
- if(SETNAME_MATCHES())
- { printf("Lexer_lexelemodel:: curr_setname(%s) matches prev_setname (%s)\n", curr_setname, prev_setname);
- DEL_FTOK(newstrt);
- printf("Lexer_lexelemodel:: Deleted setname, newstrt is now %s\n", newstrt);
- if(REF(newstrt))
- DEL_FTOK(newstrt);
- if(ELENAME_MATCHES())
- { printf("Lexer_lexelemodel:: elename matches\n");
- DEL_FTOK(newstrt);
- if(REF(newstrt))
- DEL_FTOK(newstrt);
- }
- }
- UPDATE_PREV_ELENAME(newstrt);
- UPDATE_PREV_SETNAME(newstrt);
-
- return newstrt - str;
-}
-
-int
-lexer_lexsetmap
-(uint8_t* str)
-{ int setname_len, elename_len;
- uint8_t* setname_end, *elename_end, *newstrt;
- uint8_t curr_setname[MAX_SETNAME_LEN] = {0};
- uint8_t curr_elename[MAX_ELENAME_LEN] = {0};
-
- newstrt = str;
-
- SET_CURR_SETNAME(newstrt);
- if(PREV_MAPFILE())
- SET_MAPSTR(newstrt);
- else
- if( SETNAME_MATCHES())
- DEL_FTOK(newstrt);
- if(REF(newstrt))
- DEL_FTOK(newstrt);
-
- UPDATE_PREV_SETNAME(newstrt);
-
- return newstrt - str;
-}
-
-int
-lexer_lexsetmodel
-(uint8_t* str)
-{ int setname_len, elename_len;
- uint8_t* setname_end, *elename_end, *newstrt;
- uint8_t curr_setname[MAX_SETNAME_LEN] = {0};
- uint8_t curr_elename[MAX_ELENAME_LEN] = {0};
-
- newstrt = str;
-
- SET_CURR_SETNAME(newstrt);
- if( SETNAME_MATCHES())
- DEL_FTOK(newstrt);
- if(REF(newstrt))
- DEL_FTOK(newstrt);
- UPDATE_PREV_SETNAME(newstrt);
-
- return newstrt - str;
-
-}
-
-int
-lexer_lexsetvlink
-(uint8_t* str)
-{ int setname_len, elename_len;
- uint8_t* setname_end, *elename_end, *newstrt;
- uint8_t curr_setname[MAX_SETNAME_LEN] = {0};
- uint8_t curr_elename[MAX_ELENAME_LEN] = {0};
-
- newstrt = str;
-
- SET_CURR_SETNAME(newstrt);
- if( SETNAME_MATCHES())
- DEL_FTOK(newstrt);
- if(REF((NEXT_TOK(newstrt)))) //if NAME REF REF
- DEL_FTOK(newstrt);
- UPDATE_PREV_SETNAME(newstrt);
-
- return newstrt - str;
-
-}
-
-int
-lexer_lexelevlink
-(uint8_t* str)
-{ int setname_len, elename_len;
- uint8_t* setname_end, *elename_end, *newstrt;
- uint8_t curr_setname[MAX_SETNAME_LEN] = {0};
- uint8_t curr_elename[MAX_ELENAME_LEN] = {0};
-
- newstrt = str;
-
- SET_CURR_SETNAME(newstrt);
- SET_CURR_ELENAME(newstrt);
- if(SETNAME_MATCHES())
- { DEL_FTOK(newstrt);
- if(REF(NEXT_TOK(newstrt))) //NAME REF REF, where is set_label
- DEL_FTOK(newstrt);