📄 fbas.i
字号:
# 1 "fbas.c" # 1 "fbas.y" # 1 "../lib/stdlib.h" 1 typedef int size_t;void *malloc(int);void free(void *);void exit(int);void *realloc(void *,size_t);char *getenv(const char *name);int atoi(char *s); # 14 "fbas.y" 2# 1 "../lib/stdio.h" 1# 1 "../lib/stdarg.h" 1 typedef char *va_list;# 3 "../lib/stdio.h" 2typedef struct _FILE FILE;extern FILE *stdin,*stdout,*stderr;int vsprintf(char *buf, const char *fmt, va_list args);int sprintf(char * buf, const char *fmt, ...);void vfprintf(FILE *f,const char *fmt,va_list args);void fprintf(FILE *,const char *fmt,...);void printf(const char *fmt, ...);FILE *fopen(char *,char *);int fclose(FILE *);int fwrite(void *,size_t,size_t,FILE *);int fread(void *,size_t,size_t,FILE *);int fgetc(FILE *);int fputc(int,FILE *);int ferror(FILE *);# 15 "fbas.y" 2# 1 "../lib/string.h" 1char * strcpy(char * dest,const char *src);char * strncpy(char * dest,const char *src,size_t count);char * strcat(char * dest, const char * src);char * strncat(char *dest, const char *src, size_t count);int strcmp(const char * cs,const char * ct);int strncmp(const char * cs,const char * ct,size_t count);char * strchr(const char * s,char c);size_t strlen(const char * s);size_t strnlen(const char * s, size_t count);size_t strspn(const char *s, const char *accept);char * strpbrk(const char * cs,const char * ct);char * strtok(char * s,const char * ct);void * memset(void * s,char c,size_t count);char * bcopy(const char * src, char * dest, int count);void * memcpy(void * dest,const void *src,size_t count);void * memmove(void * dest,const void *src,size_t count);int memcmp(const void * cs,const void * ct,size_t count);void * memscan(void * addr, unsigned char c, size_t size);# 17 "fbas.y" 2# 1 "../lib/getopt.h" 1 extern char *optarg; extern int optind; extern int opterr; extern int optopt; struct option{ const char *name; int has_arg; int *flag; int val;}; extern int getopt ();extern int getopt_long (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind);extern int getopt_long_only (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind); extern int _getopt_internal (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind, int long_only);# 18 "fbas.y" 2# 1 "../fbvm/fbvmspec.h" 1 enum { ld_b=1, ld_ub, ld_w, ld_uw, ld_i, st_b, st_w, st_i, add_i, sub_i, mul_i, mul_ui, div_i, div_ui, mod_i, mod_ui, neg_i, cmplt_i, cmple_i, cmpge_i, cmpgt_i, cmpeq_i, cmpne_i, cmplt_ui, cmple_ui, cmpge_ui, cmpgt_ui, and_i, or_i, xor_i, not_i, shl_i, shr_i, shr_ui, cvt_i_b, cvt_i_ub, cvt_i_w, cvt_i_uw, cvt_b_i, cvt_w_i, li_i, libp_i, jeq_i, jne_i, switch_i, jmp, jsr, rts, dup, pop, addsp, libcall,};# 20 "fbas.y" 2# 1 "../fbvm/fbvminstr.h" 1char *vm_instr_str[]={ "zero", "ld_b", "ld_ub", "ld_w", "ld_uw", "ld_i", "st_b", "st_w", "st_i", "add_i", "sub_i", "mul_i", "mul_ui", "div_i", "div_ui", "mod_i", "mod_ui", "neg_i", "cmplt_i", "cmple_i", "cmpge_i", "cmpgt_i", "cmpeq_i", "cmpne_i", "cmplt_ui", "cmple_ui", "cmpge_ui", "cmpgt_ui", "and_i", "or_i", "xor_i", "not_i", "shl_i", "shr_i", "shr_ui", "cvt_i_b", "cvt_i_ub", "cvt_i_w", "cvt_i_uw", "cvt_b_i", "cvt_w_i", "li_i", "libp_i", "jeq_i", "jne_i", "switch_i", "jmp", "jsr", "rts", "dup", "pop", "addsp", "libcall", ((void *)0) ,};# 21 "fbas.y" 2 int lex_linenum; void yyerror(char *format,...);int yylex(void); int seg_cur;unsigned char *seg_data[2 ]; int seg_maxsize[2 ];int seg_offset[2 ];void Seg_Init(void); void Seg_PutByte(int c);void Seg_PutSym(int data,char *sym); typedef struct _SYM_ENT { char name[256 ]; int value; int seg; int sym_type; int reloc_nb; struct _SYM_ENT *hash_next; struct _RELOC_ENT *reloc_first;} SYM_ENT;typedef struct _RELOC_ENT { int seg; int offset; struct _RELOC_ENT *next;} RELOC_ENT; SYM_ENT *hash_tab[1001 ]; void Hash_Init(void);SYM_ENT *Hash_New(char *name,int sym_type);SYM_ENT *Hash_Search(char *name); void Sym_Declare(char *name,int seg,int val);void Sym_NewPrivate(void); typedef union { int lex_num; char *lex_ident;} YYSTYPEDEF; typedef struct yyltype { int timestamp; int first_line; int first_column; int last_line; int last_column; char *text; } yyltype;# 1 "../lib/stdio.h" 1# 34 "../lib/stdio.h"# 115 "fbas.y" 2static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 19, 17, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};# 177 "fbas.y"# 190 "fbas.y"static const short yyr1[] = { 0, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 23, 23, 23};static const short yyr2[] = { 0, 1, 2, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 1, 1, 0, 3, 1, 1, 3};static const short yydefact[] = { 0, 3, 4, 0, 0, 0, 0, 0, 0, 0, 13, 14, 15, 0, 0, 1, 5, 12, 18, 17, 7, 6, 8, 9, 0, 0, 11, 2, 0, 0, 16, 19, 10, 0, 0};static const short yydefgoto[] = { 14, 15, 25, 20};static const short yypact[] = { 13,-32768,-32768, 14, 16, -14, 17, 18, 19, 21,-32768,-32768,-32768, 11, 0,-32768,-32768,-32768, 20,-32768,-32768,-32768,-32768,-32768, 15, -14,-32768,-32768, 22, 24,-32768,-32768,-32768, 37,-32768};static const short yypgoto[] = {-32768, 27,-32768, 23};static const short yytable[] = { 33, 18, 19, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 26, 16, 17, 29, 21, 22, 23, 24, 34, 31, 28, 32, 27, 0, 0, 0, 0, 0, 0, 30};static const short yycheck[] = { 0, 15, 16, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 16, 15, 17, 16, 16, 16, 15, 0, 16, 19, 16, 14, -1, -1, -1, -1, -1, -1, 25}; # 2 "/usr/lib/bison.simple" # 49 "/usr/lib/bison.simple" # 84 "/usr/lib/bison.simple" int yychar; YYSTYPEDEF yylval; int yynerrs; static void__yy_bcopy (from, to, count) char *from; char *to; int count;{ register char *f = from; register char *t = to; register int i = count; while (i-- > 0) *t++ = *f++;}# 180 "/usr/lib/bison.simple"# 183 "/usr/lib/bison.simple"intyyparse(){ register int yystate; register int yyn; register short *yyssp; register YYSTYPEDEF *yyvsp; int yyerrstatus; int yychar1 = 0; short yyssa[200 ]; YYSTYPEDEF yyvsa[200 ]; short *yyss = yyssa; YYSTYPEDEF *yyvs = yyvsa; int yystacksize = 200 ; YYSTYPEDEF yyval; int yylen; yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = -2 ; yyssp = yyss - 1; yyvsp = yyvs; yynewstate: *++yyssp = yystate; if (yyssp >= yyss + yystacksize - 1) { YYSTYPEDEF *yyvs1 = yyvs; short *yyss1 = yyss; int size = yyssp - yyss + 1;# 290 "/usr/lib/bison.simple" if (yystacksize >= 10000 ) { yyerror("parser stack overflow"); return 2; } yystacksize *= 2; if (yystacksize > 10000 ) yystacksize = 10000 ; yyss = (short *) malloc (yystacksize * sizeof (*yyssp)); __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp)); yyvs = (YYSTYPEDEF *) malloc (yystacksize * sizeof (*yyvsp)); __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp)); yyssp = yyss + size - 1; yyvsp = yyvs + size - 1; if (yyssp >= yyss + yystacksize - 1) return(1) ; } goto yybackup; yybackup: yyn = yypact[yystate]; if (yyn == -32768 ) goto yydefault; if (yychar == -2 ) { yychar = yylex() ; } if (yychar <= 0) { yychar1 = 0; yychar = 0 ; } else { yychar1 = ((unsigned)( yychar ) <= 271 ? yytranslate[ yychar ] : 24) ;# 384 "/usr/lib/bison.simple" } yyn += yychar1; if (yyn < 0 || yyn > 48 || yycheck[yyn] != yychar1) goto yydefault; yyn = yytable[yyn]; if (yyn < 0) { if (yyn == -32768 ) goto yyerrlab; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrlab; if (yyn == 34 ) return(0) ; if (yychar != 0 ) yychar = -2 ; *++yyvsp = yylval; if (yyerrstatus) yyerrstatus--; yystate = yyn; goto yynewstate; yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; yyreduce: yylen = yyr2[yyn]; if (yylen > 0) yyval = yyvsp[1-yylen]; # 461 "/usr/lib/bison.simple" switch (yyn) {case 3:# 121 "fbas.y"{ seg_cur= 0 ; ; break;}case 4:# 125 "fbas.y"{ seg_cur= 1 ;; break;}case 5:# 129 "fbas.y"{ Seg_PutByte(yyvsp[0].lex_num);; break;}case 6:# 133 "fbas.y"{ int c; c=yyvsp[0].lex_num; Seg_PutByte(c & 0xFF); Seg_PutByte((c >> 8) & 0xFF);; break;}case 7:# 145 "fbas.y"{ ; break;}case 8:# 147 "fbas.y"{ int i,size; size=yyvsp[0].lex_num; for(i=0;i<size;i++) Seg_PutByte(0);; break;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -