From: Vern Paxson Date: Mon, 5 Jul 1993 21:31:46 +0000 (+0000) Subject: Added check_char() X-Git-Tag: flex-2-5-5b~438 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7f39933ca43a57200c910a10439254eac1a80ab5;p=flex Added check_char() --- diff --git a/ccl.c b/ccl.c index 77adfae..2929fb9 100644 --- a/ccl.c +++ b/ccl.c @@ -41,6 +41,8 @@ int ch; { int ind, len, newpos, i; + check_char( ch ); + len = ccllen[cclp]; ind = cclmap[cclp]; @@ -121,7 +123,6 @@ void list_character_set( file, cset ) FILE *file; int cset[]; { - char *readable_form(); register int i; putc( '[', file ); diff --git a/misc.c b/misc.c index bb77474..abb6018 100644 --- a/misc.c +++ b/misc.c @@ -154,6 +154,24 @@ int v[], n; } +/* check_char - checks a character to make sure it's within the range + * we're expecting. If not, generates fatal error message + * and exits. + */ + +void check_char( int c ) + { + if ( c >= CSIZE ) + lerrsf( "bad character '%s' detected in check_char()", + readable_form( c ) ); + + if ( c >= csize ) + lerrsf( "scanner requires -8 flag to use the character '%s'", + readable_form( c ) ); + } + + + /* clower - replace upper-case letter to lower-case */ Char clower( c )