X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCC.lex;h=4f9b51887143ffac7c794b995ac355ef74005628;hb=1f6f478ebf8fd533e2819f9558e90de1b6bee503;hp=c7bb9181c0d6ff9a0a45fe88a0dd6ff30d4c013f;hpb=4db4740164fed3cb25145cfdaadb986fc0690507;p=fw%2Fsdcc diff --git a/src/SDCC.lex b/src/SDCC.lex index c7bb9181..4f9b5188 100644 --- a/src/SDCC.lex +++ b/src/SDCC.lex @@ -122,6 +122,8 @@ _?"_asm" { "eeprom" { count(); TKEYWORDSDCC(EEPROM); } "__eeprom" { count(); TKEYWORD(EEPROM); } "float" { count(); return(FLOAT); } +"fixed16x16" { count(); TKEYWORDSDCC(FIXED16X16); } +"__fixed16x16" { count(); TKEYWORD(FIXED16X16); } "flash" { count(); TKEYWORDSDCC(CODE); } "__flash" { count(); TKEYWORD(CODE); } "for" { count(); return(FOR); } @@ -282,7 +284,7 @@ static int checkCurrFile (char *s) /* get the line number */ lNum = strtol(s, &tptr, 10); - if (tptr == s || !isspace(*tptr)) + if (tptr == s || !isspace((unsigned char)*tptr)) return 0; s = tptr; @@ -469,7 +471,9 @@ enum pragma_id { P_STD_C89, P_STD_C99, P_STD_SDCC89, - P_STD_SDCC99 + P_STD_SDCC99, + P_CODESEG, + P_CONSTSEG }; @@ -685,6 +689,28 @@ static void doPragma(int op, char *cp) options.std_c99 = 1; options.std_sdcc = 1; break; + + case P_CODESEG: + { + char str[9]; + char *segname = Safe_malloc(15); + sscanf(cp, " %8s", str); + str[8] = '\0'; + sprintf(segname, "%-8.8s(CODE)", str); + options.code_seg = segname; + } + break; + + case P_CONSTSEG: + { + char str[9]; + char *segname = Safe_malloc(15); + sscanf(cp, " %8s", str); + str[8] = '\0'; + sprintf(segname, "%-8.8s(CODE)", str); + options.const_seg = segname; + } + break; } } @@ -719,10 +745,12 @@ static int process_pragma(char *s) { "opt_code_speed", P_OPTCODESPEED, 0 }, { "opt_code_size", P_OPTCODESIZE, 0 }, { "opt_code_balanced", P_OPTCODEBALANCED, 0 }, - { "std_c89", P_STD_C89, 0 }, - { "std_c99", P_STD_C99, 0 }, - { "std_sdcc89", P_STD_SDCC89, 0 }, - { "std_sdcc99", P_STD_SDCC99, 0 }, + { "std_c89", P_STD_C89, 0 }, + { "std_c99", P_STD_C99, 0 }, + { "std_sdcc89", P_STD_SDCC89, 0 }, + { "std_sdcc99", P_STD_SDCC99, 0 }, + { "codeseg", P_CODESEG, 0 }, + { "constseg", P_CONSTSEG, 0 }, /* * The following lines are deprecated pragmas, @@ -755,16 +783,16 @@ static int process_pragma(char *s) s += PRAGMA_LEN; /* look for the directive */ - while(isspace(*s)) + while(isspace((unsigned char)*s)) s++; cp = s; /* look for the end of the directive */ - while ((!isspace(*s)) && (*s != '\n')) + while ((!isspace((unsigned char)*s)) && (*s != '\n')) s++ ; /* skip separating whitespace */ - while (isspace(*s) && (*s != '\n')) + while (isspace((unsigned char)*s) && (*s != '\n')) s++; /* First give the port a chance */