From a75f5c8344144cee8dea3e6274a855e2c9568c68 Mon Sep 17 00:00:00 2001 From: Curtis F Kaylor Date: Sat, 17 Feb 2018 13:53:02 -0500 Subject: [PATCH] Change #PRAGMA ASCII MASK to #PRAGMA ASCII HIGH --- include.c | 2 +- parse.c | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/include.c b/include.c index dc06739..f1f2cfe 100644 --- a/include.c +++ b/include.c @@ -77,7 +77,7 @@ void pascii() getwrd(); //Get Pragma Subdirective if (wordis("INVERT")) invasc = TRUE; - if (wordis("MASK")) + if (wordis("HIGH")) mskasc = TRUE; else { fprintf(stderr, "Unrecognized option '%s'\n", word); diff --git a/parse.c b/parse.c index 9d02f97..18d11ba 100644 --- a/parse.c +++ b/parse.c @@ -34,9 +34,13 @@ int isspc() {return isspace(nxtchr);} int isvpre() {return TF(isalph() || iscpre());} 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;} +/* Process ASCII Character */ +char prcchr(char c) { + 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*/ int wordis(char *s) @@ -170,8 +174,7 @@ void getstr() { if (match('\\')) escnxt = TRUE; else - if (invasc) nxtchr = invchr(nxtchr); - word[wrdlen++] = nxtchr; + word[wrdlen++] = prcchr(nxtchr); skpchr(); } } @@ -268,9 +271,7 @@ int prschr() word[wrdlen++] = getnxt(); c = getnxt(); DEBUG("Extracted character %c\n", c); - if (invasc) c = invchr(c); - if (mskasc) c = mskchr(c); - word[wrdlen++] = c; + word[wrdlen++] = prcchr(c); expect('\''); word[wrdlen++] = '\''; word[wrdlen] = 0;