try to handle Beof in the macros (Michael Teichgräber)

This commit is contained in:
rsc 2007-03-25 18:32:51 +00:00
parent ff3dce55bf
commit 79049567a0
3 changed files with 15 additions and 15 deletions

View file

@ -685,7 +685,7 @@ gotop(int c)
char *a, *b; char *a, *b;
op_ptr = optmp; op_ptr = optmp;
*op_ptr++ = c; *op_ptr++ = c;
while (isop(( *op_ptr = getch())))op_ptr++; while (isop((uchar)( *op_ptr = getch())))op_ptr++;
if(!strict)unget(*op_ptr); if(!strict)unget(*op_ptr);
else if (*op_ptr != ' ')unget( *op_ptr); else if (*op_ptr != ' ')unget( *op_ptr);
*op_ptr = '\0'; *op_ptr = '\0';
@ -845,7 +845,7 @@ lookup(char *first, char *last)
ptr = key; ptr = key;
while ((ckey = ptr->name) != 0){ while ((ckey = ptr->name) != 0){
for (k = cptr; (*ckey == *k && *ckey != '\0'); k++, ckey++); for (k = cptr; (*ckey == *k && *ckey != '\0'); k++, ckey++);
if(*ckey=='\0' && (k==last|| (k<last && !isalnum(*k)))){ if(*ckey=='\0' && (k==last|| (k<last && !isalnum((uchar)*k)))){
opflag = 1; opflag = 1;
lastlook = 0; lastlook = 0;
return(ptr); return(ptr);
@ -955,7 +955,7 @@ getnext(int must){
} }
tp = lastplace; tp = lastplace;
if(inswitch && tptr <= lastplace) if(inswitch && tptr <= lastplace)
if (isalnum(*lastplace)||ispunct(*lastplace)||isop(*lastplace))return(lastplace); if (isalnum((uchar)*lastplace)||ispunct((uchar)*lastplace)||isop((uchar)*lastplace))return(lastplace);
space: space:
while(isspace(c=Bgetc(input)))puttmp(c,1); while(isspace(c=Bgetc(input)))puttmp(c,1);
beg = tp; beg = tp;

View file

@ -1,6 +1,6 @@
#include "cbtype.h" #include "cbtype.h"
unsigned char _cbtype_[] = { unsigned char _cbtype_[257] = {
0, 0,
_C, _C, _C, _C, _C, _C, _C, _C, _C, _C, _C, _C, _C, _C, _C, _C,
_C, _C|_S, _C|_S, _C|_S, _C|_S, _C|_S, _C, _C, _C, _C|_S, _C|_S, _C|_S, _C|_S, _C|_S, _C, _C,

View file

@ -34,17 +34,17 @@ extern unsigned char _cbtype_[]; /* in /usr/src/libc/gen/ctype_.c */
#undef tolower #undef tolower
#undef toascii #undef toascii
#define isop(c) ((_cbtype_+1)[(uchar)(c)]&_O) #define isop(c) ((_cbtype_+1)[c]&_O)
#define isalpha(c) ((_cbtype_+1)[(uchar)(c)]&(_U|_L)) #define isalpha(c) ((_cbtype_+1)[c]&(_U|_L))
#define isupper(c) ((_cbtype_+1)[(uchar)(c)]&_U) #define isupper(c) ((_cbtype_+1)[c]&_U)
#define islower(c) ((_cbtype_+1)[(uchar)(c)]&_L) #define islower(c) ((_cbtype_+1)[c]&_L)
#define isdigit(c) ((_cbtype_+1)[(uchar)(c)]&_N) #define isdigit(c) ((_cbtype_+1)[c]&_N)
#define isxdigit(c) ((_cbtype_+1)[(uchar)(c)]&(_N|_X)) #define isxdigit(c) ((_cbtype_+1)[c]&(_N|_X))
#define isspace(c) ((_cbtype_+1)[(uchar)(c)]&_S) #define isspace(c) ((_cbtype_+1)[c]&_S)
#define ispunct(c) ((_cbtype_+1)[(uchar)(c)]&_P) #define ispunct(c) ((_cbtype_+1)[c]&_P)
#define isalnum(c) ((_cbtype_+1)[(uchar)(c)]&(_U|_L|_N)) #define isalnum(c) ((_cbtype_+1)[c]&(_U|_L|_N))
#define isprint(c) ((_cbtype_+1)[(uchar)(c)]&(_P|_U|_L|_N)) #define isprint(c) ((_cbtype_+1)[c]&(_P|_U|_L|_N))
#define iscntrl(c) ((_cbtype_+1)[(uchar)(c)]&_C) #define iscntrl(c) ((_cbtype_+1)[c]&_C)
#define isascii(c) ((unsigned)(c)<=0177) #define isascii(c) ((unsigned)(c)<=0177)
#define toupper(c) ((c)-'a'+'A') #define toupper(c) ((c)-'a'+'A')
#define tolower(c) ((c)-'A'+'a') #define tolower(c) ((c)-'A'+'a')