\r
\details The IR serves as a storage structure that is populated during the\r
parsing of the input directory structure. After parsing is complete,\r
- the IR will be condensed (removed of excess allocated space) and then\r
+ the IR will be condensed (removed of excess allocated space) and then \r
output as the input for the engine. In this file we describe the\r
semantic actions that are called at each step, and the memory buffers\r
that they populate. See parser.y for the description on how the input\r
typedef struct ir_class_t* ir_class;\r
typedef struct ir_setld_t* ir_setld;\r
typedef struct ir_classld_t* ir_classld;\r
+\r
+enum dtype { FSDAT, MSDAT, ADAT, LDAT, FBDAT };\r
+enum ltype { OLINK, MLINK, VLINK, ALINK };\r
/* Classes and Sets\r
Classes are rooted at a special root class, representing the current working\r
directory at scan-time, named ".". The root class can always be identified\r
ir_setdata ir_framesheet(uint8_t*, apc_facing, int,int);\r
ir_setdata ir_mapsheet(uint8_t*, apc_facing, int,int);\r
ir_setdata ir_audio(uint8_t*);\r
+ir_setdata ir_link(enum ltype, ir_setld, uint8_t*);\r
ir_setdata ir_link_odat(ir_setld);\r
ir_setdata ir_link_vdat(ir_setld,uint8_t*);\r
ir_setdata ir_link_mdat(ir_setld,uint8_t*);\r
}
exit(1);
}
- yypush_parse(apc_pstate, REF, &ref, apc_cstate);
+ tok_val.ref = ref;
+ yypush_parse(apc_pstate, REF, &tok_val, apc_cstate);
ntok++;
}
- action push_link { yypush_parse(apc_pstate, LINK, (YYSTYPE) 0, apc_cstate);}
+ action push_link { tok_val.val = 0; yypush_parse(apc_pstate, LINK, &tok_val , apc_cstate);}
action push_val { int val;
te = NULL; errno = 0;
val = strtoll((char*)ts,(char**)&te,10);
{ fprintf(stderr, "strtoll could not parse %s\n", (char*)str);
exit(1);
}
- yypush_parse(apc_pstate, NUM, &val, apc_cstate);
+ tok_val.val = val;
+ yypush_parse(apc_pstate, NUM, &tok_val, apc_cstate);
ntok++;
}
action push_name { printf("Lexer_lexstring:: action:push_name: from %s to %s\n", ts, p);
- yypush_parse( apc_pstate, NAME, strdndup(ts, p-ts), apc_cstate);
+ *p = '\0';
+ tok_val.str = ts;
+ yypush_parse( apc_pstate, NAME, &tok_val, apc_cstate);
ntok++;
}
action push_map { printf("Lexer_lexstring:: action:push_map: pushing map token\n");
- yypush_parse(apc_pstate, MAP, (uint8_t*) '~', apc_cstate);
+ tok_val.str = (uint8_t*) '~';
+ yypush_parse(apc_pstate, MAP, &tok_val, apc_cstate);
ntok++;
}
action set_ts { printf("Lexer_lexstring:: action:set_ts. ts = %s\n", p); ts = p; }
action push_SS { printf("Lexer_lexstring:: action:push_SS. p = %s\n",p);
- yypush_parse(apc_pstate, SS, (uint8_t*) "SS", apc_cstate);
+ tok_val.str = (uint8_t*) "SS";
+ yypush_parse(apc_pstate, SS, &tok_val, apc_cstate);
ntok++;
}
action push_S { printf("Lexer_lexstring:: action:push_S. p = %s\n", p);
- yypush_parse(apc_pstate, FACING, (YYSTYPE) 0, apc_cstate);
+ tok_val.val = 0;
+ yypush_parse(apc_pstate, FACING, &tok_val, apc_cstate);
ntok++;
}
action push_SW { printf("Lexer_lexstring:: action:push_SW. p = %s\n", p);
- yypush_parse(apc_pstate, FACING, (YYSTYPE) 1, apc_cstate);
+ tok_val.val = 1;
+ yypush_parse(apc_pstate, FACING, &tok_val, apc_cstate);
ntok++;
}
action push_W { printf("Lexer_lexstring:: action:push_W. p = %s\n", p);
- yypush_parse(apc_pstate, FACING, (YYSTYPE) 2, apc_cstate);
+ tok_val.val = 2;
+ yypush_parse(apc_pstate, FACING, &tok_val, apc_cstate);
ntok++;
}
action push_NW { printf("Lexer_lexstring:: action:push_NW. p = %s\n", p);
- yypush_parse(apc_pstate, FACING, (YYSTYPE) 3, apc_cstate);
+ tok_val.val = 3;
+ yypush_parse(apc_pstate, FACING, &tok_val, apc_cstate);
ntok++;
}
action push_N { printf("Lexer_lexstring:: action:push_N. p = %s\n", p);
- yypush_parse(apc_pstate, FACING, (YYSTYPE) 4, apc_cstate);
+ tok_val.val = 4;
+ yypush_parse(apc_pstate, FACING, &tok_val, apc_cstate);
ntok++;
}
action push_NE { printf("Lexer_lexstring:: action:push_NE. p = %s\n", p);
- yypush_parse(apc_pstate, FACING, (YYSTYPE) 5, apc_cstate);
+ tok_val.val = 5;
+ yypush_parse(apc_pstate, FACING, &tok_val, apc_cstate);
ntok++;
}
action push_E { printf("Lexer_lexstring:: action:push_N. p = %s\n", p);
- yypush_parse(apc_pstate, FACING, (YYSTYPE) 6, apc_cstate);
+ tok_val.val = 6;
+ yypush_parse(apc_pstate, FACING, &tok_val, apc_cstate);
ntok++;
}
action push_SE { printf("Lexer_lexstring:: action:push_N. p = %s\n", p);
- ypush_parse(apc_pstate, FACING, (YYSTYPE) 7, apc_cstate);
+ tok_val.val = 7;
+ yypush_parse(apc_pstate, FACING, &tok_val, apc_cstate);
ntok++;
}
action ref_error { printf("ref from %s to %s has an inappropriate amount of hex digits, it must have eight.\n", ts, p);
int size
)
{ uint8_t *p;
- uint8_t *ts, *pe, *te;
- int cs, ntok, eof;//, tok_t;
+ uint8_t *ts, *pe, *te, *eof;
+ int cs, ntok;
+ union YYSTYPE tok_val;
ntok = 0;
p = ts = str;
- pe = p + size + 1;
+ pe = eof = p + size + 1;
+
printf("|---Begin lexstring on p = %s, pe = %s.\n",p, pe);
SS NAME frame_spec { $$ = ir_framesheet($2,$3.d,$3.w,$3.h); }
| MAP NAME frame_spec { $$ = ir_mapsheet($2,$3.d,$3.w,$3.h); }
| AUDIO NAME { $$ = ir_audio($2); }
-| LINK set_ld { $$ = ir_link_odat($2); }
-| LINK set_ld MAP { $$ = ir_link_mdat($2,NULL); }
-| LINK set_ld MAP NAME { $$ = ir_link_mdat($2,$4); }
-| LINK set_ld SS { $$ = ir_link_vdat($2,NULL); }
-| LINK set_ld SS NAME { $$ = ir_link_vdat($2,$4); }
-| LINK set_ld AUDIO { $$ = ir_link_adat($2,NULL); }
-| LINK set_ld AUDIO NAME { $$ = ir_link_adat($2,$4); }
+| LINK set_ld { $$ = ir_link(OLINK, $2, NULL); }
+| LINK set_ld MAP { $$ = ir_link(MLINK, $2,NULL); }
+| LINK set_ld MAP NAME { $$ = ir_link(MLINK, $2,$4); }
+| LINK set_ld SS { $$ = ir_link(VLINK, $2,NULL); }
+| LINK set_ld SS NAME { $$ = ir_link(VLINK, $2,$4); }
+| LINK set_ld AUDIO { $$ = ir_link(ALINK, $2,NULL); }
+| LINK set_ld AUDIO NAME { $$ = ir_link(ALINK, $2,$4); }
;
set_spec: