diff --git a/src/meta/debug.c b/src/meta/debug.c index 50046ae7..8a2aa391 100644 --- a/src/meta/debug.c +++ b/src/meta/debug.c @@ -8,8 +8,8 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 1 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -47,7 +47,6 @@ typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; -typedef uint64_t flex_uint64_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; @@ -55,7 +54,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -86,27 +84,17 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#endif /* ! C99 */ + #endif /* ! FLEXINT_H */ -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* Returned upon end-of-file. */ @@ -142,7 +130,15 @@ typedef unsigned int flex_uint32_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -159,7 +155,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; typedef size_t yy_size_t; #endif -extern yy_size_t yyleng; +extern int yyleng; extern FILE *yyin, *yyout; @@ -168,6 +164,7 @@ extern FILE *yyin, *yyout; #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ @@ -197,12 +194,12 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - yy_size_t yy_buf_size; + int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -225,7 +222,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -253,7 +250,7 @@ struct yy_buffer_state /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -272,11 +269,11 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t yyleng; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; /* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; +static char *yy_c_buf_p = NULL; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ @@ -301,7 +298,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); void *yyalloc (yy_size_t ); void *yyrealloc (void *,yy_size_t ); @@ -335,7 +332,7 @@ void yyfree (void * ); typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +FILE *yyin = NULL, *yyout = NULL; typedef int yy_state_type; @@ -344,19 +341,22 @@ extern int yylineno; int yylineno = 1; extern char *yytext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif #define yytext_ptr yytext static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); +static void yynoreturn yy_fatal_error (yyconst char* msg ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - yyleng = (yy_size_t) (yy_cp - yy_bp); \ + yyleng = (int) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; @@ -419,7 +419,7 @@ static yyconst flex_int16_t yy_accept[411] = 48, 0, 0, 0, 24, 0, 0, 0, 59, 0 } ; -static yyconst flex_int32_t yy_ec[256] = +static yyconst YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, @@ -451,7 +451,7 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[61] = +static yyconst YY_CHAR yy_meta[61] = { 0, 1, 2, 2, 3, 4, 5, 5, 5, 5, 5, 5, 6, 1, 7, 7, 7, 7, 7, 7, 1, @@ -461,7 +461,7 @@ static yyconst flex_int32_t yy_meta[61] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 10 } ; -static yyconst flex_int16_t yy_base[454] = +static yyconst flex_uint16_t yy_base[454] = { 0, 371, 0, 338, 1976, 1976, 59, 61, 120, 179, 238, 297, 356, 64, 66, 415, 474, 71, 98, 37, 292, @@ -569,7 +569,7 @@ static yyconst flex_int16_t yy_def[454] = 410, 410, 410 } ; -static yyconst flex_int16_t yy_nxt[2037] = +static yyconst flex_uint16_t yy_nxt[2037] = { 0, 4, 4, 5, 4, 4, 6, 6, 6, 6, 6, 6, 4, 7, 8, 9, 10, 11, 6, 12, 13, @@ -1062,6 +1062,7 @@ char *yytext; /* process includes only the second time we parse this file. */ #include "common.h" +#include "meta/debug_private.h" #define debugtext yytext @@ -1097,7 +1098,7 @@ extern void set_halt_65c02(void); extern void clear_halt_65c02(void); extern void clear_halt_opcode(uint8_t opcode); extern void show_opcode_breakpts(void); -extern int debugger_go(stepping_struct_t s); +extern int debugger_go(stepping_struct_s s); extern void fb_sha1(void); /* @@ -1127,7 +1128,7 @@ extern void fb_sha1(void); (? | h{elp}) */ -#line 1131 "src/meta/debug.c" +#line 1132 "src/meta/debug.c" #define INITIAL 0 @@ -1160,19 +1161,19 @@ void yyset_extra (YY_EXTRA_TYPE user_defined ); FILE *yyget_in (void ); -void yyset_in (FILE * in_str ); +void yyset_in (FILE * _in_str ); FILE *yyget_out (void ); -void yyset_out (FILE * out_str ); +void yyset_out (FILE * _out_str ); -yy_size_t yyget_leng (void ); + int yyget_leng (void ); char *yyget_text (void ); int yyget_lineno (void ); -void yyset_lineno (int line_number ); +void yyset_lineno (int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1186,8 +1187,12 @@ extern int yywrap (void ); #endif #endif +#ifndef YY_NO_UNPUT + static void yyunput (int c,char *buf_ptr ); +#endif + #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif @@ -1208,7 +1213,12 @@ static int input (void ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -1216,7 +1226,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1227,7 +1237,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - yy_size_t n; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -1240,7 +1250,7 @@ static int input (void ); else \ { \ errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -1295,7 +1305,7 @@ extern int yylex (void); /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ @@ -1308,17 +1318,10 @@ extern int yylex (void); */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; -#line 103 "src/meta/debug.l" - - - - -#line 1321 "src/meta/debug.c" - if ( !(yy_init) ) { (yy_init) = 1; @@ -1345,7 +1348,15 @@ YY_DECL yy_load_buffer_state( ); } - while ( 1 ) /* loops until end-of-file is reached */ + { +#line 104 "src/meta/debug.l" + + + + +#line 1358 "src/meta/debug.c" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); @@ -1362,7 +1373,7 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -1374,7 +1385,7 @@ yy_match: if ( yy_current_state >= 411 ) yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 1976 ); @@ -1404,7 +1415,7 @@ do_action: /* This label is used only to access EOF actions. */ case 1: /* rule 1 can match eol */ YY_RULE_SETUP -#line 107 "src/meta/debug.l" +#line 108 "src/meta/debug.l" { /* mem */ int do_ascii = 0; @@ -1422,7 +1433,7 @@ YY_RULE_SETUP case 2: /* rule 2 can match eol */ YY_RULE_SETUP -#line 121 "src/meta/debug.l" +#line 122 "src/meta/debug.l" { /* mem // */ int do_ascii = 0; @@ -1443,7 +1454,7 @@ YY_RULE_SETUP case 3: /* rule 3 can match eol */ YY_RULE_SETUP -#line 138 "src/meta/debug.l" +#line 139 "src/meta/debug.l" { /* mem */ int do_ascii = 0; @@ -1460,7 +1471,7 @@ YY_RULE_SETUP case 4: /* rule 4 can match eol */ YY_RULE_SETUP -#line 151 "src/meta/debug.l" +#line 152 "src/meta/debug.l" { /* mem // */ int do_ascii = 0; @@ -1480,7 +1491,7 @@ YY_RULE_SETUP case 5: /* rule 5 can match eol */ YY_RULE_SETUP -#line 167 "src/meta/debug.l" +#line 168 "src/meta/debug.l" { /* mem + */ int do_ascii = 0; @@ -1498,7 +1509,7 @@ YY_RULE_SETUP case 6: /* rule 6 can match eol */ YY_RULE_SETUP -#line 181 "src/meta/debug.l" +#line 182 "src/meta/debug.l" { /* dump mem from current location */ int do_ascii = 0; @@ -1512,7 +1523,7 @@ YY_RULE_SETUP case 7: /* rule 7 can match eol */ YY_RULE_SETUP -#line 191 "src/meta/debug.l" +#line 192 "src/meta/debug.l" { /* dump mem from lc */ int do_ascii = 0; @@ -1534,7 +1545,7 @@ YY_RULE_SETUP case 8: /* rule 8 can match eol */ YY_RULE_SETUP -#line 209 "src/meta/debug.l" +#line 210 "src/meta/debug.l" { /* dump mem from lc // */ int do_ascii = 0; @@ -1560,7 +1571,7 @@ YY_RULE_SETUP case 9: /* rule 9 can match eol */ YY_RULE_SETUP -#line 231 "src/meta/debug.l" +#line 232 "src/meta/debug.l" { /* dump mem from lc */ int do_ascii = 0; @@ -1581,7 +1592,7 @@ YY_RULE_SETUP case 10: /* rule 10 can match eol */ YY_RULE_SETUP -#line 248 "src/meta/debug.l" +#line 249 "src/meta/debug.l" { /* dump mem from lc // */ int do_ascii = 0; @@ -1606,7 +1617,7 @@ YY_RULE_SETUP case 11: /* rule 11 can match eol */ YY_RULE_SETUP -#line 269 "src/meta/debug.l" +#line 270 "src/meta/debug.l" { /* disassemble at */ while (!isspace(*debugtext)) ++debugtext; @@ -1621,7 +1632,7 @@ YY_RULE_SETUP case 12: /* rule 12 can match eol */ YY_RULE_SETUP -#line 280 "src/meta/debug.l" +#line 281 "src/meta/debug.l" { /* disassemble at // */ while (*debugtext != '/') ++debugtext; @@ -1639,7 +1650,7 @@ YY_RULE_SETUP case 13: /* rule 13 can match eol */ YY_RULE_SETUP -#line 294 "src/meta/debug.l" +#line 295 "src/meta/debug.l" { /* disassemble at */ while (!isspace(*debugtext)) ++debugtext; @@ -1655,7 +1666,7 @@ YY_RULE_SETUP case 14: /* rule 14 can match eol */ YY_RULE_SETUP -#line 306 "src/meta/debug.l" +#line 307 "src/meta/debug.l" { /* disassemble at // */ while (*debugtext != '/') ++debugtext; @@ -1674,7 +1685,7 @@ YY_RULE_SETUP case 15: /* rule 15 can match eol */ YY_RULE_SETUP -#line 321 "src/meta/debug.l" +#line 322 "src/meta/debug.l" { /* disassemble current location + */ while (*debugtext != '+') ++debugtext; @@ -1688,7 +1699,7 @@ YY_RULE_SETUP case 16: /* rule 16 can match eol */ YY_RULE_SETUP -#line 331 "src/meta/debug.l" +#line 332 "src/meta/debug.l" { /* disassemble current location */ disasm(run_args.cpu65_pc, 256, 0, -1); @@ -1698,7 +1709,7 @@ YY_RULE_SETUP case 17: /* rule 17 can match eol */ YY_RULE_SETUP -#line 337 "src/meta/debug.l" +#line 338 "src/meta/debug.l" { /* disassemble language */ int lc; @@ -1717,7 +1728,7 @@ YY_RULE_SETUP case 18: /* rule 18 can match eol */ YY_RULE_SETUP -#line 352 "src/meta/debug.l" +#line 353 "src/meta/debug.l" { /* disassemble language // */ int lc; @@ -1741,7 +1752,7 @@ YY_RULE_SETUP case 19: /* rule 19 can match eol */ YY_RULE_SETUP -#line 372 "src/meta/debug.l" +#line 373 "src/meta/debug.l" { /* disassemble language */ int lc; @@ -1759,7 +1770,7 @@ YY_RULE_SETUP case 20: /* rule 20 can match eol */ YY_RULE_SETUP -#line 386 "src/meta/debug.l" +#line 387 "src/meta/debug.l" { /* disassemble language // */ int lc; @@ -1782,7 +1793,7 @@ YY_RULE_SETUP case 21: /* rule 21 can match eol */ YY_RULE_SETUP -#line 405 "src/meta/debug.l" +#line 406 "src/meta/debug.l" { /* show cpu state */ show_regs(); @@ -1792,7 +1803,7 @@ YY_RULE_SETUP case 22: /* rule 22 can match eol */ YY_RULE_SETUP -#line 411 "src/meta/debug.l" +#line 412 "src/meta/debug.l" { /* set memory : */ arg1 = (int)strtol(debugtext, &debugtext, 16); @@ -1807,7 +1818,7 @@ YY_RULE_SETUP case 23: /* rule 23 can match eol */ YY_RULE_SETUP -#line 422 "src/meta/debug.l" +#line 423 "src/meta/debug.l" { /* set LC memory lc1|lc2 : */ int lc; @@ -1826,7 +1837,7 @@ YY_RULE_SETUP case 24: /* rule 24 can match eol */ YY_RULE_SETUP -#line 437 "src/meta/debug.l" +#line 438 "src/meta/debug.l" { /* bload // */ FILE *fp = NULL; @@ -1867,10 +1878,10 @@ YY_RULE_SETUP case 25: /* rule 25 can match eol */ YY_RULE_SETUP -#line 474 "src/meta/debug.l" +#line 475 "src/meta/debug.l" { - stepping_struct_t s = { + stepping_struct_s s = { .step_type = STEPPING, .step_count = 1 }; @@ -1886,7 +1897,7 @@ YY_RULE_SETUP case 26: /* rule 26 can match eol */ YY_RULE_SETUP -#line 489 "src/meta/debug.l" +#line 490 "src/meta/debug.l" { while (!isspace(*debugtext)) ++debugtext; @@ -1894,7 +1905,7 @@ YY_RULE_SETUP arg1 = (int)strtol(debugtext, (char**)NULL, 16); if ((arg1 < 1) || (arg1 > 255)) arg1 = 255; - stepping_struct_t s = { + stepping_struct_s s = { .step_type = STEPPING, .step_count = arg1 }; @@ -1910,10 +1921,10 @@ YY_RULE_SETUP case 27: /* rule 27 can match eol */ YY_RULE_SETUP -#line 509 "src/meta/debug.l" +#line 510 "src/meta/debug.l" { - stepping_struct_t s = { + stepping_struct_s s = { .step_type = FINISHING, .step_frame = 1 }; @@ -1925,7 +1936,7 @@ YY_RULE_SETUP case 28: /* rule 28 can match eol */ YY_RULE_SETUP -#line 520 "src/meta/debug.l" +#line 521 "src/meta/debug.l" { /* step until PC == next instruction. good for finishing backward loops */ @@ -1955,9 +1966,12 @@ YY_RULE_SETUP case addr_j_indirect_x: delta = 3; break; + default: + assert(false); + break; } - stepping_struct_t s = { + stepping_struct_s s = { .step_type = UNTILING, .step_pc = run_args.cpu65_pc + delta }; @@ -1969,7 +1983,7 @@ YY_RULE_SETUP case 29: /* rule 29 can match eol */ YY_RULE_SETUP -#line 560 "src/meta/debug.l" +#line 564 "src/meta/debug.l" { /* jump to addrs and run while remaining in debugger console */ while (!isspace(*debugtext)) ++debugtext; @@ -1977,7 +1991,7 @@ YY_RULE_SETUP /* DANGEROUS! */ run_args.cpu65_pc = (int)strtol(debugtext, (char**)NULL, 16); - stepping_struct_t s = { + stepping_struct_s s = { .step_type = GOING }; @@ -1988,9 +2002,9 @@ YY_RULE_SETUP case 30: /* rule 30 can match eol */ YY_RULE_SETUP -#line 575 "src/meta/debug.l" +#line 579 "src/meta/debug.l" { - stepping_struct_t s = { + stepping_struct_s s = { .step_type = GOING }; @@ -2001,7 +2015,7 @@ YY_RULE_SETUP case 31: /* rule 31 can match eol */ YY_RULE_SETUP -#line 584 "src/meta/debug.l" +#line 588 "src/meta/debug.l" { /* set watchpoint */ set_halt(watchpoints, run_args.cpu65_pc); @@ -2011,7 +2025,7 @@ YY_RULE_SETUP case 32: /* rule 32 can match eol */ YY_RULE_SETUP -#line 590 "src/meta/debug.l" +#line 594 "src/meta/debug.l" { /* set watchpoint */ while (!isspace(*debugtext)) ++debugtext; @@ -2029,7 +2043,7 @@ YY_RULE_SETUP case 33: /* rule 33 can match eol */ YY_RULE_SETUP -#line 605 "src/meta/debug.l" +#line 609 "src/meta/debug.l" { /* set breakpoint */ set_halt(breakpoints, run_args.cpu65_pc); @@ -2039,7 +2053,7 @@ YY_RULE_SETUP case 34: /* rule 34 can match eol */ YY_RULE_SETUP -#line 611 "src/meta/debug.l" +#line 615 "src/meta/debug.l" { /* set breakpoint */ while (!isspace(*debugtext)) ++debugtext; @@ -2057,7 +2071,7 @@ YY_RULE_SETUP case 35: /* rule 35 can match eol */ YY_RULE_SETUP -#line 625 "src/meta/debug.l" +#line 629 "src/meta/debug.l" { /* set breakpoint */ while (!(*debugtext == 'p')) ++debugtext; @@ -2076,7 +2090,7 @@ YY_RULE_SETUP case 36: /* rule 36 can match eol */ YY_RULE_SETUP -#line 640 "src/meta/debug.l" +#line 644 "src/meta/debug.l" { /* set opcode breakpoints on 65c02 instructions */ set_halt_65c02(); @@ -2086,7 +2100,7 @@ YY_RULE_SETUP case 37: /* rule 37 can match eol */ YY_RULE_SETUP -#line 646 "src/meta/debug.l" +#line 650 "src/meta/debug.l" { /* ignore everything */ clear_halt(watchpoints, 0); @@ -2097,7 +2111,7 @@ YY_RULE_SETUP case 38: /* rule 38 can match eol */ YY_RULE_SETUP -#line 653 "src/meta/debug.l" +#line 657 "src/meta/debug.l" { /* ignore ... */ @@ -2118,7 +2132,7 @@ YY_RULE_SETUP case 39: /* rule 39 can match eol */ YY_RULE_SETUP -#line 671 "src/meta/debug.l" +#line 675 "src/meta/debug.l" { /* clear everything */ clear_halt(breakpoints, 0); @@ -2129,7 +2143,7 @@ YY_RULE_SETUP case 40: /* rule 40 can match eol */ YY_RULE_SETUP -#line 678 "src/meta/debug.l" +#line 682 "src/meta/debug.l" { /* clear ... */ while (!isspace(*debugtext)) ++debugtext; @@ -2149,7 +2163,7 @@ YY_RULE_SETUP case 41: /* rule 41 can match eol */ YY_RULE_SETUP -#line 694 "src/meta/debug.l" +#line 698 "src/meta/debug.l" { /* clear ... */ while (!(*debugtext == 'p')) ++debugtext; @@ -2171,7 +2185,7 @@ YY_RULE_SETUP case 42: /* rule 42 can match eol */ YY_RULE_SETUP -#line 712 "src/meta/debug.l" +#line 716 "src/meta/debug.l" { /* clear 65c02 ... */ clear_halt_65c02(); @@ -2181,7 +2195,7 @@ YY_RULE_SETUP case 43: /* rule 43 can match eol */ YY_RULE_SETUP -#line 718 "src/meta/debug.l" +#line 722 "src/meta/debug.l" { /* show breakpoints and watchpoints */ show_breakpts(); @@ -2191,7 +2205,7 @@ YY_RULE_SETUP case 44: /* rule 44 can match eol */ YY_RULE_SETUP -#line 724 "src/meta/debug.l" +#line 728 "src/meta/debug.l" { /* show opcode breakpoints */ show_opcode_breakpts(); @@ -2201,7 +2215,7 @@ YY_RULE_SETUP case 45: /* rule 45 can match eol */ YY_RULE_SETUP -#line 730 "src/meta/debug.l" +#line 734 "src/meta/debug.l" { /* search main memory for */ while (!isspace(*debugtext)) ++debugtext; @@ -2215,7 +2229,7 @@ YY_RULE_SETUP case 46: /* rule 46 can match eol */ YY_RULE_SETUP -#line 740 "src/meta/debug.l" +#line 744 "src/meta/debug.l" { /* search memory for */ while (*debugtext != '/') ++debugtext; @@ -2232,7 +2246,7 @@ YY_RULE_SETUP case 47: /* rule 47 can match eol */ YY_RULE_SETUP -#line 753 "src/meta/debug.l" +#line 757 "src/meta/debug.l" { /* search LC for */ int lc; @@ -2252,7 +2266,7 @@ YY_RULE_SETUP case 48: /* rule 48 can match eol */ YY_RULE_SETUP -#line 769 "src/meta/debug.l" +#line 773 "src/meta/debug.l" { /* search LC memory for */ int lc; @@ -2275,7 +2289,7 @@ YY_RULE_SETUP case 49: /* rule 49 can match eol */ YY_RULE_SETUP -#line 788 "src/meta/debug.l" +#line 792 "src/meta/debug.l" { /* type ASCII to emulator */ char buf[DEBUG_BUFSZ]; @@ -2288,7 +2302,7 @@ YY_RULE_SETUP buf[len] = '\r'; buf[len+1] = '\0'; - stepping_struct_t s = { + stepping_struct_s s = { .step_type = TYPING, .step_text = buf }; @@ -2301,7 +2315,7 @@ YY_RULE_SETUP case 50: /* rule 50 can match eol */ YY_RULE_SETUP -#line 810 "src/meta/debug.l" +#line 814 "src/meta/debug.l" { /* load/type ASCII */ FILE *fp = NULL; @@ -2322,7 +2336,7 @@ YY_RULE_SETUP while (fgets(buf, DEBUG_BUFSZ, fp)) { LOG("%s", buf); - stepping_struct_t s = { + stepping_struct_s s = { .step_type = LOADING, .step_text = buf }; @@ -2335,7 +2349,7 @@ YY_RULE_SETUP fclose(fp); if (ch == -1) { - stepping_struct_t s = { + stepping_struct_s s = { .step_type = GOING, }; debugger_go(s); @@ -2347,7 +2361,7 @@ YY_RULE_SETUP case 51: /* rule 51 can match eol */ YY_RULE_SETUP -#line 852 "src/meta/debug.l" +#line 856 "src/meta/debug.l" { #if CPU_TRACING char *buf = NULL; @@ -2362,7 +2376,7 @@ YY_RULE_SETUP case 52: /* rule 52 can match eol */ YY_RULE_SETUP -#line 863 "src/meta/debug.l" +#line 867 "src/meta/debug.l" { #if DISK_TRACING char *buf = NULL; @@ -2377,7 +2391,7 @@ YY_RULE_SETUP case 53: /* rule 53 can match eol */ YY_RULE_SETUP -#line 874 "src/meta/debug.l" +#line 878 "src/meta/debug.l" { /* display language card settings */ show_lc_info(); @@ -2387,7 +2401,7 @@ YY_RULE_SETUP case 54: /* rule 54 can match eol */ YY_RULE_SETUP -#line 880 "src/meta/debug.l" +#line 884 "src/meta/debug.l" { /* show disk settings */ show_disk_info(); @@ -2397,7 +2411,7 @@ YY_RULE_SETUP case 55: /* rule 55 can match eol */ YY_RULE_SETUP -#line 886 "src/meta/debug.l" +#line 890 "src/meta/debug.l" { /* show other VM softswitch settings */ show_misc_info(); @@ -2407,7 +2421,7 @@ YY_RULE_SETUP case 56: /* rule 56 can match eol */ YY_RULE_SETUP -#line 892 "src/meta/debug.l" +#line 896 "src/meta/debug.l" { /* refresh the screen */ clear_debugger_screen(); @@ -2416,7 +2430,7 @@ YY_RULE_SETUP case 57: /* rule 57 can match eol */ YY_RULE_SETUP -#line 897 "src/meta/debug.l" +#line 901 "src/meta/debug.l" { fb_sha1(); return FBSHA1; @@ -2425,7 +2439,7 @@ YY_RULE_SETUP case 58: /* rule 58 can match eol */ YY_RULE_SETUP -#line 902 "src/meta/debug.l" +#line 906 "src/meta/debug.l" { display_help(); return HELP; @@ -2434,7 +2448,7 @@ YY_RULE_SETUP case 59: /* rule 59 can match eol */ YY_RULE_SETUP -#line 907 "src/meta/debug.l" +#line 911 "src/meta/debug.l" { /* bsave // */ /* save memory dump to file */ @@ -2489,7 +2503,7 @@ YY_RULE_SETUP case 60: /* rule 60 can match eol */ YY_RULE_SETUP -#line 958 "src/meta/debug.l" +#line 962 "src/meta/debug.l" { /* log debugger output to file - not implemented */ return LOG; @@ -2498,7 +2512,7 @@ YY_RULE_SETUP case 61: /* rule 61 can match eol */ YY_RULE_SETUP -#line 963 "src/meta/debug.l" +#line 967 "src/meta/debug.l" { /* save apple2 state to a .img file - not implemented I'd like to * be compatible with the applePC emulator's .img format. anyone @@ -2510,20 +2524,20 @@ YY_RULE_SETUP case 62: /* rule 62 can match eol */ YY_RULE_SETUP -#line 972 "src/meta/debug.l" +#line 976 "src/meta/debug.l" /* ignore newlines */ YY_BREAK case 63: YY_RULE_SETUP -#line 974 "src/meta/debug.l" +#line 978 "src/meta/debug.l" /* ignore extraneous characters */ YY_BREAK case 64: YY_RULE_SETUP -#line 977 "src/meta/debug.l" +#line 981 "src/meta/debug.l" ECHO; YY_BREAK -#line 2527 "src/meta/debug.c" +#line 2541 "src/meta/debug.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -2654,6 +2668,7 @@ case YY_STATE_EOF(INITIAL): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ + } /* end of user's declarations */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer @@ -2665,9 +2680,9 @@ case YY_STATE_EOF(INITIAL): */ static int yy_get_next_buffer (void) { - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -2696,7 +2711,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -2709,21 +2724,21 @@ static int yy_get_next_buffer (void) else { - yy_size_t num_to_read = + int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { - yy_size_t new_size = b->yy_buf_size * 2; + int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -2736,7 +2751,7 @@ static int yy_get_next_buffer (void) } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -2778,9 +2793,9 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); @@ -2799,15 +2814,15 @@ static int yy_get_next_buffer (void) static yy_state_type yy_get_previous_state (void) { - register yy_state_type yy_current_state; - register char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 60); + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 60); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -2819,7 +2834,7 @@ static int yy_get_next_buffer (void) if ( yy_current_state >= 411 ) yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; } return yy_current_state; @@ -2832,10 +2847,10 @@ static int yy_get_next_buffer (void) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); + int yy_is_jam; + char *yy_cp = (yy_c_buf_p); - register YY_CHAR yy_c = 60; + YY_CHAR yy_c = 60; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -2847,15 +2862,17 @@ static int yy_get_next_buffer (void) if ( yy_current_state >= 411 ) yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; yy_is_jam = (yy_current_state == 410); - return yy_is_jam ? 0 : yy_current_state; + return yy_is_jam ? 0 : yy_current_state; } - static void yyunput (int c, register char * yy_bp ) +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp ) { - register char *yy_cp; + char *yy_cp; yy_cp = (yy_c_buf_p); @@ -2865,10 +2882,10 @@ static int yy_get_next_buffer (void) if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register yy_size_t number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + int number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = + char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) @@ -2877,7 +2894,7 @@ static int yy_get_next_buffer (void) yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); @@ -2890,6 +2907,8 @@ static int yy_get_next_buffer (void) (yy_c_buf_p) = yy_cp; } +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) @@ -2914,7 +2933,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + int offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -3041,7 +3060,7 @@ static void yy_load_buffer_state (void) if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - b->yy_buf_size = size; + b->yy_buf_size = (yy_size_t)size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. @@ -3076,10 +3095,6 @@ static void yy_load_buffer_state (void) yyfree((void *) b ); } -#ifndef __cplusplus -extern int isatty (int ); -#endif /* __cplusplus */ - /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. @@ -3192,7 +3207,7 @@ void yypop_buffer_state (void) */ static void yyensure_buffer_stack (void) { - yy_size_t num_to_alloc; + int num_to_alloc; if (!(yy_buffer_stack)) { @@ -3200,15 +3215,15 @@ static void yyensure_buffer_stack (void) * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ - num_to_alloc = 1; + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; @@ -3217,7 +3232,7 @@ static void yyensure_buffer_stack (void) if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; + yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc @@ -3237,7 +3252,7 @@ static void yyensure_buffer_stack (void) * @param base the character buffer * @param size the size in bytes of the character buffer * - * @return the newly allocated buffer state object. + * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { @@ -3247,7 +3262,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ - return 0; + return NULL; b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) @@ -3256,7 +3271,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; - b->yy_input_file = 0; + b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; @@ -3279,24 +3294,25 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) { - return yy_scan_bytes(yystr,strlen(yystr) ); + return yy_scan_bytes(yystr,(int) strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; - yy_size_t n, i; + yy_size_t n; + int i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; + n = (yy_size_t) (_yybytes_len + 2); buf = (char *) yyalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); @@ -3322,9 +3338,9 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len #define YY_EXIT_FAILURE 2 #endif -static void yy_fatal_error (yyconst char* msg ) +static void yynoreturn yy_fatal_error (yyconst char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -3352,7 +3368,7 @@ static void yy_fatal_error (yyconst char* msg ) */ int yyget_lineno (void) { - + return yylineno; } @@ -3375,7 +3391,7 @@ FILE *yyget_out (void) /** Get the length of the current token. * */ -yy_size_t yyget_leng (void) +int yyget_leng (void) { return yyleng; } @@ -3390,29 +3406,29 @@ char *yyget_text (void) } /** Set the current line number. - * @param line_number + * @param _line_number line number * */ -void yyset_lineno (int line_number ) +void yyset_lineno (int _line_number ) { - yylineno = line_number; + yylineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. - * @param in_str A readable stream. + * @param _in_str A readable stream. * * @see yy_switch_to_buffer */ -void yyset_in (FILE * in_str ) +void yyset_in (FILE * _in_str ) { - yyin = in_str ; + yyin = _in_str ; } -void yyset_out (FILE * out_str ) +void yyset_out (FILE * _out_str ) { - yyout = out_str ; + yyout = _out_str ; } int yyget_debug (void) @@ -3420,9 +3436,9 @@ int yyget_debug (void) return yy_flex_debug; } -void yyset_debug (int bdebug ) +void yyset_debug (int _bdebug ) { - yy_flex_debug = bdebug ; + yy_flex_debug = _bdebug ; } static int yy_init_globals (void) @@ -3431,10 +3447,10 @@ static int yy_init_globals (void) * This function is called from yylex_destroy(), so don't allocate here. */ - (yy_buffer_stack) = 0; + (yy_buffer_stack) = NULL; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; + (yy_c_buf_p) = NULL; (yy_init) = 0; (yy_start) = 0; @@ -3443,8 +3459,8 @@ static int yy_init_globals (void) yyin = stdin; yyout = stdout; #else - yyin = (FILE *) 0; - yyout = (FILE *) 0; + yyin = NULL; + yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by @@ -3482,7 +3498,8 @@ int yylex_destroy (void) #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { - register int i; + + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } @@ -3491,7 +3508,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { - register int n; + int n; for ( n = 0; s[n]; ++n ) ; @@ -3501,11 +3518,12 @@ static int yy_flex_strlen (yyconst char * s ) void *yyalloc (yy_size_t size ) { - return (void *) malloc( size ); + return malloc(size); } void *yyrealloc (void * ptr, yy_size_t size ) { + /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -3513,17 +3531,17 @@ void *yyrealloc (void * ptr, yy_size_t size ) * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ - return (void *) realloc( (char *) ptr, size ); + return realloc(ptr, size); } void yyfree (void * ptr ) { - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 977 "src/meta/debug.l" +#line 981 "src/meta/debug.l" diff --git a/src/meta/debug.h b/src/meta/debug.h index 4722eedd..50e74875 100644 --- a/src/meta/debug.h +++ b/src/meta/debug.h @@ -22,39 +22,7 @@ extern volatile bool is_debugging; typedef enum { - STEPPING = 0, - NEXTING, - FINISHING, - UNTILING, - TYPING, - LOADING, - GOING -} stepping_type_t; - -// FIXME TODO : make opaque type ... -typedef struct stepping_struct_t { - stepping_type_t step_type; - uint16_t step_count; - uint16_t step_frame; - uint16_t step_pc; - bool should_break; - time_t timeout; - const char *step_text; - const bool step_deterministically; -} stepping_struct_t; - -#define DEBUGGER_BUF_X 39 -#define DEBUGGER_BUF_Y 22 -#define MAX_BRKPTS 16 - -/* debugger commands */ -enum token_type { MEM, DIS, REGS, SETMEM, STEP, FINISH, UNTIL, GO, VM, - BREAK, WATCH, CLEAR, IGNORE, STATUS, OPCODES, LC, DRIVE, - SEARCH, HELP, LOG, BSAVE, BLOAD, SAVE, FBSHA1, TYPE, - LOAD, UNKNOWN }; - -typedef enum { - addr_implied, + addr_implied = 0, addr_accumulator, addr_immediate, addr_zeropage, @@ -68,16 +36,17 @@ typedef enum { addr_indirect_y, addr_j_indirect, /* non-zeropage indirects, used in JMP only */ addr_j_indirect_x, - addr_relative + addr_relative, + NUM_ADDRESSING_MODES, } addressing_mode_t; -struct opcode_struct -{ +typedef struct opcode_struct_s { const char *mnemonic; addressing_mode_t mode; -}; +} opcode_struct_s; -extern const struct opcode_struct *opcodes; +extern const struct opcode_struct_s *opcodes; +extern const char* const disasm_templates[NUM_ADDRESSING_MODES]; #ifdef INTERFACE_CLASSIC void c_interface_debugging(void); @@ -91,10 +60,4 @@ void c_debugger_set_timeout(const unsigned int secs); bool c_debugger_set_watchpoint(const uint16_t addr); void c_debugger_clear_watchpoints(void); -extern const struct opcode_struct opcodes_6502[256]; -extern const struct opcode_struct opcodes_65c02[256]; -extern const struct opcode_struct opcodes_undoc[256]; -extern const char* const disasm_templates[15]; -extern const uint8_t opcodes_65c02_numargs[256]; - #endif diff --git a/src/meta/debug.l b/src/meta/debug.l index d4b23ab7..625e9553 100644 --- a/src/meta/debug.l +++ b/src/meta/debug.l @@ -22,6 +22,7 @@ /* process includes only the second time we parse this file. */ #include "common.h" +#include "meta/debug_private.h" #define debugtext yytext @@ -57,7 +58,7 @@ extern void set_halt_65c02(void); extern void clear_halt_65c02(void); extern void clear_halt_opcode(uint8_t opcode); extern void show_opcode_breakpts(void); -extern int debugger_go(stepping_struct_t s); +extern int debugger_go(stepping_struct_s s); extern void fb_sha1(void); /* @@ -473,7 +474,7 @@ ADDRS [0-9a-fA-F]+ {BOS}(st?e?p?|ne?x?t?){EOS} { - stepping_struct_t s = { + stepping_struct_s s = { .step_type = STEPPING, .step_count = 1 }; @@ -493,7 +494,7 @@ ADDRS [0-9a-fA-F]+ arg1 = (int)strtol(debugtext, (char**)NULL, 16); if ((arg1 < 1) || (arg1 > 255)) arg1 = 255; - stepping_struct_t s = { + stepping_struct_s s = { .step_type = STEPPING, .step_count = arg1 }; @@ -508,7 +509,7 @@ ADDRS [0-9a-fA-F]+ {BOS}fi?n?i?s?h?{EOS} { - stepping_struct_t s = { + stepping_struct_s s = { .step_type = FINISHING, .step_frame = 1 }; @@ -546,9 +547,12 @@ ADDRS [0-9a-fA-F]+ case addr_j_indirect_x: delta = 3; break; + default: + assert(false); + break; } - stepping_struct_t s = { + stepping_struct_s s = { .step_type = UNTILING, .step_pc = run_args.cpu65_pc + delta }; @@ -564,7 +568,7 @@ ADDRS [0-9a-fA-F]+ /* DANGEROUS! */ run_args.cpu65_pc = (int)strtol(debugtext, (char**)NULL, 16); - stepping_struct_t s = { + stepping_struct_s s = { .step_type = GOING }; @@ -573,7 +577,7 @@ ADDRS [0-9a-fA-F]+ } {BOS}go?{EOS} { - stepping_struct_t s = { + stepping_struct_s s = { .step_type = GOING }; @@ -797,7 +801,7 @@ ADDRS [0-9a-fA-F]+ buf[len] = '\r'; buf[len+1] = '\0'; - stepping_struct_t s = { + stepping_struct_s s = { .step_type = TYPING, .step_text = buf }; @@ -827,7 +831,7 @@ ADDRS [0-9a-fA-F]+ while (fgets(buf, DEBUG_BUFSZ, fp)) { LOG("%s", buf); - stepping_struct_t s = { + stepping_struct_s s = { .step_type = LOADING, .step_text = buf }; @@ -840,7 +844,7 @@ ADDRS [0-9a-fA-F]+ fclose(fp); if (ch == -1) { - stepping_struct_t s = { + stepping_struct_s s = { .step_type = GOING, }; debugger_go(s); diff --git a/src/meta/debug_private.h b/src/meta/debug_private.h new file mode 100644 index 00000000..e9830bfd --- /dev/null +++ b/src/meta/debug_private.h @@ -0,0 +1,72 @@ +/* + * Apple // emulator for *ix + * + * This software package is subject to the GNU General Public License + * version 3 or later (your choice) as published by the Free Software + * Foundation. + * + * Copyright 2019 Aaron Culliney + * + */ + +#ifndef _DEBUG_PRIVATE_H_ +#define _DEBUG_PRIVATE_H_ 1 + +#define DEBUGGER_BUF_X 39 +#define DEBUGGER_BUF_Y 22 +#define MAX_BRKPTS 16 + +typedef enum stepping_type_t { + STEPPING = 0, + NEXTING, + FINISHING, + UNTILING, + TYPING, + LOADING, + GOING +} stepping_type_t; + +typedef struct stepping_struct_s { + stepping_type_t step_type; + uint16_t step_count; + uint16_t step_frame; + uint16_t step_pc; + bool should_break; + time_t timeout; + const char *step_text; + const bool step_deterministically; +} stepping_struct_s; + +// debugger commands +enum { + BLOAD, + BREAK, + BSAVE, + CLEAR, + DIS, + DRIVE, + FBSHA1, + FINISH, + GO, + HELP, + IGNORE, + LC, + LOAD, + LOG, + MEM, + OPCODES, + REGS, + SAVE, + SEARCH, + SETMEM, + STATUS, + STEP, + TYPE, + UNTIL, + VM, + WATCH, + // ... + UNKNOWN, +}; + +#endif diff --git a/src/meta/debugger.c b/src/meta/debugger.c index 80fa63f8..47826bad 100644 --- a/src/meta/debugger.c +++ b/src/meta/debugger.c @@ -12,6 +12,7 @@ */ #include "common.h" +#include "meta/debug_private.h" #include @@ -30,12 +31,10 @@ #define SW_DHIRES 0xC05E #define SW_IOUDIS 0xC07E -const struct opcode_struct *opcodes; - static char input_str[1024] = { 0 }; // ASCII values static bool input_deterministically = false; // slows down testing ... -static stepping_struct_t stepping_struct = { 0 }; +static stepping_struct_s stepping_struct = { 0 }; static unsigned int stepping_timeout = 0; volatile bool is_debugging = false; @@ -1265,7 +1264,7 @@ bool c_debugger_should_break() { /* ------------------------------------------------------------------------- debugger_go () - step into or step over commands ------------------------------------------------------------------------- */ -int debugger_go(stepping_struct_t s) { +int debugger_go(stepping_struct_s s) { memcpy(&stepping_struct, &s, sizeof(s)); int ch = begin_cpu_stepping(); @@ -1418,8 +1417,6 @@ void c_interface_debugging(void) { int ch; int command_pos = PROMPT_X; - opcodes = opcodes_65c02; - /* initialize the buffers */ for (i=0; i