diff --git a/compiler/libpc300/sc2.c b/compiler/libpc300/sc2.c index 5f7839d5..283a25f1 100755 --- a/compiler/libpc300/sc2.c +++ b/compiler/libpc300/sc2.c @@ -1270,7 +1270,7 @@ static int command(void) } /* while */ end=lptr; /* check pattern to match */ - if (!isalpha(*start) && *start!='_') { + if (!alpha(*start)) { error(74); /* pattern must start with an alphabetic character */ break; } /* if */ @@ -1321,7 +1321,7 @@ static int command(void) } /* while */ substitution[count]='\0'; /* check whether the definition already exists */ - for (prefixlen=0,start=(unsigned char*)pattern; isalpha(*start) || isdigit(*start) || *start=='_'; prefixlen++,start++) + for (prefixlen=0,start=(unsigned char*)pattern; alphanum(*start); prefixlen++,start++) /* nothing */; assert(prefixlen>0); if ((def=find_subst(pattern,prefixlen))!=NULL) { @@ -1485,7 +1485,7 @@ static int substpattern(unsigned char *line,size_t buffersize,char *pattern,char memset(args,0,sizeof args); /* check the length of the prefix */ - for (prefixlen=0,s=(unsigned char*)pattern; isalpha(*s) || isdigit(*s) || *s=='_'; prefixlen++,s++) + for (prefixlen=0,s=(unsigned char*)pattern; alphanum(*s); prefixlen++,s++) /* nothing */; assert(prefixlen>0); assert(strncmp((char*)line,pattern,prefixlen)==0); @@ -1645,7 +1645,7 @@ static void substallpatterns(unsigned char *line,int buffersize) /* find the start of a prefix (skip all non-alphabetic characters), * also skip strings */ - while (!isalpha(*start) && *start!='_' && *start!='\0') { + while (!alpha(*start) && *start!='\0') { /* skip strings */ if (is_startstring(start)) { start=(unsigned char *)skipstring(start); @@ -1663,7 +1663,7 @@ static void substallpatterns(unsigned char *line,int buffersize) while ((*start<=' ' && *start!='\0') || *start=='(') start++; /* skip the symbol behind it */ - while (isalpha(*start) || isdigit(*start) || *start=='_') + while (alphanum(*start)) start++; /* drop back into the main loop */ continue; @@ -1671,7 +1671,7 @@ static void substallpatterns(unsigned char *line,int buffersize) /* get the prefix (length), look for a matching definition */ prefixlen=0; end=start; - while (isalpha(*end) || isdigit(*end) || *end=='_') { + while (alphanum(*end)) { prefixlen++; end++; } /* while */ @@ -2512,7 +2512,7 @@ SC_FUNC void delete_symbols(symbol *root,int level,int delete_labels,int delete_ /* for user defined operators, also remove the "prototyped" flag, as * user-defined operators *must* be declared before use */ - if (sym->ident==iFUNCTN && !isalpha(*sym->name) && *sym->name!='_' && *sym->name!=PUBLIC_CHAR) + if (sym->ident==iFUNCTN && !alpha(*sym->name)) sym->usage &= ~uPROTOTYPED; root=sym; /* skip the symbol */ } /* if */ diff --git a/compiler/libpc300/sclist.c b/compiler/libpc300/sclist.c index 147ada14..57c82702 100755 --- a/compiler/libpc300/sclist.c +++ b/compiler/libpc300/sclist.c @@ -255,16 +255,16 @@ SC_FUNC void delete_pathtable(void) static stringpair substpair = { NULL, NULL, NULL}; /* list of substitution pairs */ -static stringpair *substindex['z'-'A'+1]; /* quick index to first character */ +static stringpair *substindex['z'-PUBLIC_CHAR+1]; /* quick index to first character */ static void adjustindex(char c) { stringpair *cur; - assert(c>='A' && c<='Z' || c>='a' && c<='z' || c=='_'); - assert('A'<'_' && '_'<'z'); + assert(c>='A' && c<='Z' || c>='a' && c<='z' || c=='_' || c==PUBLIC_CHAR); + assert(PUBLIC_CHAR<'A' && 'A'<'_' && '_'<'z'); for (cur=substpair.next; cur!=NULL && cur->first[0]!=c; cur=cur->next) /* nothing */; - substindex[(int)c-'A']=cur; + substindex[(int)c-PUBLIC_CHAR]=cur; } SC_FUNC stringpair *insert_subst(char *pattern,char *substitution,int prefixlen) @@ -304,8 +304,8 @@ SC_FUNC stringpair *find_subst(char *name,int length) stringpair *item; assert(name!=NULL); assert(length>0); - assert(*name>='A' && *name<='Z' || *name>='a' && *name<='z' || *name=='_'); - item=substindex[(int)*name-'A']; + assert(*name>='A' && *name<='Z' || *name>='a' && *name<='z' || *name=='_' || *name==PUBLIC_CHAR); + item=substindex[(int)*name-PUBLIC_CHAR]; if (item!=NULL) item=find_stringpair(item,name,length); @@ -334,8 +334,8 @@ SC_FUNC int delete_subst(char *name,int length) stringpair *item; assert(name!=NULL); assert(length>0); - assert(*name>='A' && *name<='Z' || *name>='a' && *name<='z' || *name=='_'); - item=substindex[(int)*name-'A']; + assert(*name>='A' && *name<='Z' || *name>='a' && *name<='z' || *name=='_' || *name==PUBLIC_CHAR); + item=substindex[(int)*name-PUBLIC_CHAR]; if (item!=NULL) item=find_stringpair(item,name,length); if (item==NULL)