1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-29 01:49:19 +00:00

Change #PRAGMA ASCII MASK to #PRAGMA ASCII HIGH

This commit is contained in:
Curtis F Kaylor 2018-02-17 13:53:02 -05:00
parent dfedddab72
commit a75f5c8344
2 changed files with 10 additions and 9 deletions

View File

@ -77,7 +77,7 @@ void pascii()
getwrd(); //Get Pragma Subdirective getwrd(); //Get Pragma Subdirective
if (wordis("INVERT")) if (wordis("INVERT"))
invasc = TRUE; invasc = TRUE;
if (wordis("MASK")) if (wordis("HIGH"))
mskasc = TRUE; mskasc = TRUE;
else { else {
fprintf(stderr, "Unrecognized option '%s'\n", word); fprintf(stderr, "Unrecognized option '%s'\n", word);

17
parse.c
View File

@ -34,9 +34,13 @@ int isspc() {return isspace(nxtchr);}
int isvpre() {return TF(isalph() || iscpre());} int isvpre() {return TF(isalph() || iscpre());}
int isxpre() {return TF(isvpre() || match('-'));} int isxpre() {return TF(isvpre() || match('-'));}
/* Conversion Functions */ /* Process ASCII Character */
char invchr(char c) {return isalpha(c)?(islower(c)?toupper(c):tolower(c)):c;} char prcchr(char c) {
char mskchr(char c) {return c | 0x80;} if (invasc) c = isalpha(c) ? (islower(c)?toupper(c):tolower(c)) : c;
if (mskasc) c = c | 0x80;
if (invasc || mskasc) DEBUG("Character converted to '%c'\n", c);
return c;
}
/* if Word is s then return TRUE else return FALSE*/ /* if Word is s then return TRUE else return FALSE*/
int wordis(char *s) int wordis(char *s)
@ -170,8 +174,7 @@ void getstr() {
if (match('\\')) if (match('\\'))
escnxt = TRUE; escnxt = TRUE;
else else
if (invasc) nxtchr = invchr(nxtchr); word[wrdlen++] = prcchr(nxtchr);
word[wrdlen++] = nxtchr;
skpchr(); skpchr();
} }
} }
@ -268,9 +271,7 @@ int prschr()
word[wrdlen++] = getnxt(); word[wrdlen++] = getnxt();
c = getnxt(); c = getnxt();
DEBUG("Extracted character %c\n", c); DEBUG("Extracted character %c\n", c);
if (invasc) c = invchr(c); word[wrdlen++] = prcchr(c);
if (mskasc) c = mskchr(c);
word[wrdlen++] = c;
expect('\''); expect('\'');
word[wrdlen++] = '\''; word[wrdlen++] = '\'';
word[wrdlen] = 0; word[wrdlen] = 0;