1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-06-26 05:29:32 +00:00

Added #pragma ascii mask

This commit is contained in:
Curtis F Kaylor 2018-02-14 23:40:57 -05:00
parent cac831bf5d
commit e92f6823cc
4 changed files with 7 additions and 2 deletions

1
c02.c
View File

@ -45,6 +45,7 @@ void init()
vrwrtn = FALSE; vrwrtn = FALSE;
zpaddr = 0; zpaddr = 0;
invasc = FALSE; invasc = FALSE;
mskasc = FALSE;
fcase = FALSE; fcase = FALSE;
} }

View File

@ -75,9 +75,10 @@ void pdefin()
void pascii() void pascii()
{ {
getwrd(); //Get Pragma Subdirective getwrd(); //Get Pragma Subdirective
if (wordis("INVERT")) { if (wordis("INVERT"))
invasc = TRUE; invasc = TRUE;
} if (wordis("MASK"))
mskasc = TRUE;
else { else {
fprintf(stderr, "Unrecognized option '%s'\n", word); fprintf(stderr, "Unrecognized option '%s'\n", word);
exterr(EXIT_FAILURE); exterr(EXIT_FAILURE);

View File

@ -36,6 +36,7 @@ int isxpre() {return TF(isvpre() || match('-'));}
/* Conversion Functions */ /* Conversion Functions */
char invchr(char c) {return isalpha(c)?(islower(c)?toupper(c):tolower(c)):c;} char invchr(char c) {return isalpha(c)?(islower(c)?toupper(c):tolower(c)):c;}
char mskchr(char c) {return c | 0x80;}
/* 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)
@ -268,6 +269,7 @@ int prschr()
c = getnxt(); c = getnxt();
DEBUG("Extracted character %c\n", c); DEBUG("Extracted character %c\n", c);
if (invasc) c = invchr(c); if (invasc) c = invchr(c);
if (mskasc) c = mskchr(c);
word[wrdlen++] = c; word[wrdlen++] = c;
expect('\''); expect('\'');
word[wrdlen++] = '\''; word[wrdlen++] = '\'';

View File

@ -20,6 +20,7 @@ int defcnt; //Number of Definitions Defined
int defidx; //Index into Definition Tables int defidx; //Index into Definition Tables
int invasc; //Invert ASCII Flag int invasc; //Invert ASCII Flag
int mskasc; //Set High Bit Flag
int match(char c); //Does Next Character match c int match(char c); //Does Next Character match c
int isalph(); //Is Next Character Alphabetic int isalph(); //Is Next Character Alphabetic