diff options
author | mmcc <mmcc@cvs.openbsd.org> | 2015-11-19 23:34:57 +0000 |
---|---|---|
committer | mmcc <mmcc@cvs.openbsd.org> | 2015-11-19 23:34:57 +0000 |
commit | 4c7f82bc78b991c6b20f5686ab7eb71065ec54ed (patch) | |
tree | 671e2ccd03351031d4c2381a4b6d7ca598c27d11 /usr.bin/lex | |
parent | b28f441103fbcc39cc45760802a62c2e8035edba (diff) |
Replace Char (defined as unsigned char) with u_char.
ok tedu@
Diffstat (limited to 'usr.bin/lex')
-rw-r--r-- | usr.bin/lex/ecs.c | 8 | ||||
-rw-r--r-- | usr.bin/lex/flexdef.h | 29 | ||||
-rw-r--r-- | usr.bin/lex/initscan.c | 12 | ||||
-rw-r--r-- | usr.bin/lex/main.c | 4 | ||||
-rw-r--r-- | usr.bin/lex/misc.c | 34 | ||||
-rw-r--r-- | usr.bin/lex/scan.l | 12 | ||||
-rw-r--r-- | usr.bin/lex/scanopt.c | 10 | ||||
-rw-r--r-- | usr.bin/lex/sym.c | 12 | ||||
-rw-r--r-- | usr.bin/lex/tblcmp.c | 4 |
9 files changed, 62 insertions, 63 deletions
diff --git a/usr.bin/lex/ecs.c b/usr.bin/lex/ecs.c index 569b445e36f..09ba90e4c33 100644 --- a/usr.bin/lex/ecs.c +++ b/usr.bin/lex/ecs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecs.c,v 1.7 2015/11/19 19:43:40 tedu Exp $ */ +/* $OpenBSD: ecs.c,v 1.8 2015/11/19 23:34:56 mmcc Exp $ */ /* ecs - equivalence class routines */ @@ -102,9 +102,9 @@ int cre8ecs (fwd, bck, num) /* mkeccl - update equivalence classes based on character class xtions * * synopsis - * Char ccls[]; + * u_char ccls[]; * int lenccl, fwd[llsiz], bck[llsiz], llsiz, NUL_mapping; - * void mkeccl( Char ccls[], int lenccl, int fwd[llsiz], int bck[llsiz], + * void mkeccl( u_char ccls[], int lenccl, int fwd[llsiz], int bck[llsiz], * int llsiz, int NUL_mapping ); * * ccls contains the elements of the character class, lenccl is the @@ -115,7 +115,7 @@ int cre8ecs (fwd, bck, num) */ void mkeccl (ccls, lenccl, fwd, bck, llsiz, NUL_mapping) - Char ccls[]; + u_char ccls[]; int lenccl, fwd[], bck[], llsiz, NUL_mapping; { int cclp, oldec, newec; diff --git a/usr.bin/lex/flexdef.h b/usr.bin/lex/flexdef.h index 106255cf749..f44f0fb8991 100644 --- a/usr.bin/lex/flexdef.h +++ b/usr.bin/lex/flexdef.h @@ -1,4 +1,4 @@ -/* $OpenBSD: flexdef.h,v 1.12 2015/11/19 23:20:34 tedu Exp $ */ +/* $OpenBSD: flexdef.h,v 1.13 2015/11/19 23:34:56 mmcc Exp $ */ /* flexdef - definitions file for flex */ @@ -110,7 +110,6 @@ char *alloca (); /* Always be prepared to generate an 8-bit scanner. */ #define CSIZE 256 -#define Char unsigned char /* Size of input alphabet - should be size of ASCII set. */ #ifndef DEFAULT_CSIZE @@ -635,7 +634,7 @@ extern int end_of_buffer_state; extern int lastccl, *cclmap, *ccllen, *cclng, cclreuse; extern int current_maxccls, current_max_ccl_tbl_size; -extern Char *ccltbl; +extern u_char *ccltbl; /* Variables for miscellaneous information: @@ -705,10 +704,10 @@ void *reallocate_array PROTO ((void *, int, size_t)); (char *) reallocate_array( (void *) array, size, sizeof( char ) ) #define allocate_Character_array(size) \ - (Char *) allocate_array( size, sizeof( Char ) ) + (u_char *) allocate_array( size, sizeof( u_char ) ) #define reallocate_Character_array(array,size) \ - (Char *) reallocate_array( (void *) array, size, sizeof( Char ) ) + (u_char *) reallocate_array( (void *) array, size, sizeof( u_char ) ) /* Used to communicate between scanner and parser. The type should really @@ -761,7 +760,7 @@ extern void ccl2ecl PROTO ((void)); extern int cre8ecs PROTO ((int[], int[], int)); /* Update equivalence classes based on character class transitions. */ -extern void mkeccl PROTO ((Char[], int, int[], int[], int, int)); +extern void mkeccl PROTO ((u_char[], int, int[], int[], int, int)); /* Create equivalence class for single character. */ extern void mkechar PROTO ((int, int[], int[])); @@ -840,13 +839,13 @@ extern int intcmp PROTO ((const void *, const void *)); extern void check_char PROTO ((int c)); /* Replace upper-case letter to lower-case. */ -extern Char clower PROTO ((int)); +extern u_char clower PROTO ((int)); /* Returns a dynamically allocated copy of a string. */ extern char *copy_string PROTO ((const char *)); /* Returns a dynamically allocated copy of a (potentially) unsigned string. */ -extern Char *copy_unsigned_string PROTO ((Char *)); +extern u_char *copy_unsigned_string PROTO ((u_char *)); /* Compare two characters for use by qsort with '\0' sorting last. */ extern int cclcmp PROTO ((const void *, const void *)); @@ -885,7 +884,7 @@ extern void flexfatal PROTO ((const char *)); #endif /* ! HAVE_DECL___func__ */ /* Convert a hexadecimal digit string to an integer value. */ -extern int htoi PROTO ((Char[])); +extern int htoi PROTO ((u_char[])); /* Report an error message formatted with one integer argument. */ extern void lerrif PROTO ((const char *, int)); @@ -916,10 +915,10 @@ extern void mkdata PROTO ((int)); /* generate a data statement */ extern int myctoi PROTO ((const char *)); /* Return character corresponding to escape sequence. */ -extern Char myesc PROTO ((Char[])); +extern u_char myesc PROTO ((u_char[])); /* Convert an octal digit string to an integer value. */ -extern int otoi PROTO ((Char[])); +extern int otoi PROTO ((u_char[])); /* Output a (possibly-formatted) string to the generated scanner. */ extern void out PROTO ((const char *)); @@ -1031,13 +1030,13 @@ extern int yywrap PROTO ((void)); /* from file sym.c */ /* Save the text of a character class. */ -extern void cclinstal PROTO ((Char[], int)); +extern void cclinstal PROTO ((u_char[], int)); /* Lookup the number associated with character class. */ -extern int ccllookup PROTO ((Char[])); +extern int ccllookup PROTO ((u_char[])); -extern void ndinstal PROTO ((const char *, Char[])); /* install a name definition */ -extern Char *ndlookup PROTO ((const char *)); /* lookup a name definition */ +extern void ndinstal PROTO ((const char *, u_char[])); /* install a name definition */ +extern u_char *ndlookup PROTO ((const char *)); /* lookup a name definition */ /* Increase maximum number of SC's. */ extern void scextend PROTO ((void)); diff --git a/usr.bin/lex/initscan.c b/usr.bin/lex/initscan.c index c154f29b97f..61169447afe 100644 --- a/usr.bin/lex/initscan.c +++ b/usr.bin/lex/initscan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: initscan.c,v 1.16 2015/11/19 23:20:34 tedu Exp $ */ +/* $OpenBSD: initscan.c,v 1.17 2015/11/19 23:34:56 mmcc Exp $ */ #line 3 "scan.c" @@ -2233,7 +2233,7 @@ YY_DECL int doing_codeblock = false; int i, brace_depth=0, brace_start_line=0; - Char nmdef[MAXLINE]; + u_char nmdef[MAXLINE]; #line 2239 "scan.c" @@ -3382,7 +3382,7 @@ YY_RULE_SETUP * The reason it was disabled is so yacc/bison can parse * ccl operations, such as ccl difference and union. */ - && (cclval = ccllookup( (Char *) nmstr )) != 0 ) + && (cclval = ccllookup( (u_char *) nmstr )) != 0 ) { if ( input() != ']' ) synerr( _( "bad character class" ) ); @@ -3396,7 +3396,7 @@ YY_RULE_SETUP /* We fudge a bit. We know that this ccl will * soon be numbered as lastccl + 1 by cclinit. */ - cclinstal( (Char *) nmstr, lastccl + 1 ); + cclinstal( (u_char *) nmstr, lastccl + 1 ); /* Push back everything but the leading bracket * so the ccl can be rescanned. @@ -3427,7 +3427,7 @@ case 157: YY_RULE_SETUP #line 663 "scan.l" { - Char *nmdefptr; + u_char *nmdefptr; int end_is_ws, end_ch; end_ch = yytext[yyleng-1]; @@ -4066,7 +4066,7 @@ case 245: YY_RULE_SETUP #line 949 "scan.l" { - yylval = myesc( (Char *) yytext ); + yylval = myesc( (u_char *) yytext ); if ( YY_START == FIRSTCCL ) BEGIN(CCL); diff --git a/usr.bin/lex/main.c b/usr.bin/lex/main.c index 61ef8ed5ee1..5acbff63dcb 100644 --- a/usr.bin/lex/main.c +++ b/usr.bin/lex/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.20 2015/11/19 23:20:34 tedu Exp $ */ +/* $OpenBSD: main.c,v 1.21 2015/11/19 23:34:56 mmcc Exp $ */ /* flex - tool to generate fast lexical analyzers */ @@ -93,7 +93,7 @@ int *accsiz, *dhash, numas; int numsnpairs, jambase, jamstate; int lastccl, *cclmap, *ccllen, *cclng, cclreuse; int current_maxccls, current_max_ccl_tbl_size; -Char *ccltbl; +u_char *ccltbl; char nmstr[MAXLINE]; int sectnum, nummt, hshcol, dfaeql, numeps, eps2, num_reallocs; int tmpuses, totnst, peakpairs, numuniq, numdup, hshsave; diff --git a/usr.bin/lex/misc.c b/usr.bin/lex/misc.c index 6dec7c09294..59685661fba 100644 --- a/usr.bin/lex/misc.c +++ b/usr.bin/lex/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.18 2015/11/19 23:20:34 tedu Exp $ */ +/* $OpenBSD: misc.c,v 1.19 2015/11/19 23:34:56 mmcc Exp $ */ /* misc - miscellaneous flex routines */ @@ -195,7 +195,7 @@ all_lower(str) char *str; { while (*str) { - if (!isascii((Char) * str) || !islower((Char) * str)) + if (!isascii((u_char) * str) || !islower((u_char) * str)) return 0; ++str; } @@ -211,7 +211,7 @@ all_upper(str) char *str; { while (*str) { - if (!isascii((Char) * str) || !isupper((Char) * str)) + if (!isascii((u_char) * str) || !isupper((u_char) * str)) return 0; ++str; } @@ -252,11 +252,11 @@ check_char(c) /* clower - replace upper-case letter to lower-case */ -Char +u_char clower(c) int c; { - return (Char) ((isascii(c) && isupper(c)) ? tolower(c) : c); + return (u_char) ((isascii(c) && isupper(c)) ? tolower(c) : c); } @@ -291,12 +291,12 @@ copy_string(str) * returns a dynamically allocated copy of a (potentially) unsigned string */ -Char * +u_char * copy_unsigned_string(str) - Char *str; + u_char *str; { - Char *c; - Char *copy; + u_char *c; + u_char *copy; /* find length */ for (c = str; *c; ++c); @@ -314,12 +314,12 @@ copy_unsigned_string(str) int cclcmp(const void *a, const void *b) { - if (!*(const Char *) a) + if (!*(const u_char *) a) return 1; - else if (!*(const Char *) b) + else if (!*(const u_char *) b) return -1; else - return *(const Char *) a - *(const Char *) b; + return *(const u_char *) a - *(const u_char *) b; } @@ -393,7 +393,7 @@ flexfatal(msg) int htoi(str) - Char str[]; + u_char str[]; { unsigned int result; @@ -594,11 +594,11 @@ myctoi(array) /* myesc - return character corresponding to escape sequence */ -Char +u_char myesc(array) - Char array[]; + u_char array[]; { - Char c, esc_char; + u_char c, esc_char; switch (array[1]) { case 'b': @@ -687,7 +687,7 @@ myesc(array) int otoi(str) - Char str[]; + u_char str[]; { unsigned int result; diff --git a/usr.bin/lex/scan.l b/usr.bin/lex/scan.l index dfd8b8b3a5d..5d31cbc56a3 100644 --- a/usr.bin/lex/scan.l +++ b/usr.bin/lex/scan.l @@ -1,4 +1,4 @@ -/* $OpenBSD: scan.l,v 1.11 2015/11/19 23:20:34 tedu Exp $ */ +/* $OpenBSD: scan.l,v 1.12 2015/11/19 23:34:56 mmcc Exp $ */ /* scan.l - scanner for flex input -*-C-*- */ @@ -137,7 +137,7 @@ M4QEND "]]" int doing_codeblock = false; int i, brace_depth=0, brace_start_line=0; - Char nmdef[MAXLINE]; + u_char nmdef[MAXLINE]; <INITIAL>{ @@ -630,7 +630,7 @@ M4QEND "]]" * The reason it was disabled is so yacc/bison can parse * ccl operations, such as ccl difference and union. */ - && (cclval = ccllookup( (Char *) nmstr )) != 0 ) + && (cclval = ccllookup( (u_char *) nmstr )) != 0 ) { if ( input() != ']' ) synerr( _( "bad character class" ) ); @@ -644,7 +644,7 @@ M4QEND "]]" /* We fudge a bit. We know that this ccl will * soon be numbered as lastccl + 1 by cclinit. */ - cclinstal( (Char *) nmstr, lastccl + 1 ); + cclinstal( (u_char *) nmstr, lastccl + 1 ); /* Push back everything but the leading bracket * so the ccl can be rescanned. @@ -664,7 +664,7 @@ M4QEND "]]" * context. */ "{"{NAME}"}"[[:space:]]? { - Char *nmdefptr; + u_char *nmdefptr; int end_is_ws, end_ch; end_ch = yytext[yyleng-1]; @@ -950,7 +950,7 @@ nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */ } <SECT2,QUOTE,FIRSTCCL,CCL>{ESCSEQ} { - yylval = myesc( (Char *) yytext ); + yylval = myesc( (u_char *) yytext ); if ( YY_START == FIRSTCCL ) BEGIN(CCL); diff --git a/usr.bin/lex/scanopt.c b/usr.bin/lex/scanopt.c index 992216fc5ab..c3b9f6d3c0b 100644 --- a/usr.bin/lex/scanopt.c +++ b/usr.bin/lex/scanopt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scanopt.c,v 1.2 2015/11/19 22:16:43 tedu Exp $ */ +/* $OpenBSD: scanopt.c,v 1.3 2015/11/19 23:34:56 mmcc Exp $ */ /* flex - tool to generate fast lexical analyzers */ @@ -191,7 +191,7 @@ scanopt_t *scanopt_init (options, argc, argv, flags) s->aux = (struct _aux *) malloc (s->optc * sizeof (struct _aux)); for (i = 0; i < s->optc; i++) { - const Char *p, *pname; + const u_char *p, *pname; const struct optspec_t *opt; struct _aux *aux; @@ -202,11 +202,11 @@ scanopt_t *scanopt_init (options, argc, argv, flags) if (opt->opt_fmt[0] == '-' && opt->opt_fmt[1] == '-') { aux->flags |= IS_LONG; - pname = (const Char *)(opt->opt_fmt + 2); + pname = (const u_char *)(opt->opt_fmt + 2); s->has_long = 1; } else { - pname = (const Char *)(opt->opt_fmt + 1); + pname = (const u_char *)(opt->opt_fmt + 1); s->has_short = 1; } aux->printlen = strlen (opt->opt_fmt); @@ -483,7 +483,7 @@ int scanopt_usage (scanner, fp, usage) while (*p && n < maxlen[1] && *p != '\n') { - if (isspace ((Char)(*p)) + if (isspace ((u_char)(*p)) || *p == '-') lastws = p; n++; diff --git a/usr.bin/lex/sym.c b/usr.bin/lex/sym.c index b000e807e99..a201432d903 100644 --- a/usr.bin/lex/sym.c +++ b/usr.bin/lex/sym.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sym.c,v 1.8 2015/11/19 23:20:34 tedu Exp $ */ +/* $OpenBSD: sym.c,v 1.9 2015/11/19 23:34:56 mmcc Exp $ */ /* sym - symbol table routines */ @@ -122,7 +122,7 @@ static int addsym (sym, str_def, int_def, table, table_size) /* cclinstal - save the text of a character class */ void cclinstal (ccltxt, cclnum) - Char ccltxt[]; + u_char ccltxt[]; int cclnum; { /* We don't bother checking the return status because we are not @@ -140,7 +140,7 @@ void cclinstal (ccltxt, cclnum) */ int ccllookup (ccltxt) - Char ccltxt[]; + u_char ccltxt[]; { return findsym ((char *) ccltxt, ccltab, CCL_HASH_SIZE)->int_val; } @@ -195,7 +195,7 @@ static int hashfunct (str, hash_size) void ndinstal (name, definition) const char *name; - Char definition[]; + u_char definition[]; { if (addsym (copy_string (name), @@ -210,10 +210,10 @@ void ndinstal (name, definition) * Returns a nil pointer if the name definition does not exist. */ -Char *ndlookup (nd) +u_char *ndlookup (nd) const char *nd; { - return (Char *) findsym (nd, ndtbl, NAME_TABLE_HASH_SIZE)->str_val; + return (u_char *) findsym (nd, ndtbl, NAME_TABLE_HASH_SIZE)->str_val; } diff --git a/usr.bin/lex/tblcmp.c b/usr.bin/lex/tblcmp.c index e03dc853549..1f6e6e9d878 100644 --- a/usr.bin/lex/tblcmp.c +++ b/usr.bin/lex/tblcmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tblcmp.c,v 1.9 2015/11/19 23:04:51 tedu Exp $ */ +/* $OpenBSD: tblcmp.c,v 1.10 2015/11/19 23:34:56 mmcc Exp $ */ /* tblcmp - table compression routines */ @@ -705,7 +705,7 @@ mktemplate(state, statenum, comstate) int state[], statenum, comstate; { int i, numdiff, tmpbase, tmp[CSIZE + 1]; - Char transset[CSIZE + 1]; + u_char transset[CSIZE + 1]; int tsptr; ++numtemps; |