1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-25 06:31:25 +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;
zpaddr = 0;
invasc = FALSE;
mskasc = FALSE;
fcase = FALSE;
}

View File

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

View File

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

View File

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