Commit faf31866 by Kaveh R. Ghazi Committed by Kaveh Ghazi

c-lex.c (lex_number): Use ISXDIGIT/hex_value.

	* c-lex.c (lex_number): Use ISXDIGIT/hex_value.
	* vax/xm-vms.h (FILE_NAME_NONDIRECTORY): Use ISUPPER/TOLOWER.
	* fold-const.c (real_hex_to_f): Use hex_value.
	* real.c (asctoeg): Use hex_value & ISXDIGIT.
	* toplev.c (toplev_main): Call hex_init.
	* tradcpp.c (main): Call hex_init.

From-SVN: r48068
parent 15bc166f
2001-12-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* c-lex.c (lex_number): Use ISXDIGIT/hex_value.
* vax/xm-vms.h (FILE_NAME_NONDIRECTORY): Use ISUPPER/TOLOWER.
* fold-const.c (real_hex_to_f): Use hex_value.
* real.c (asctoeg): Use hex_value & ISXDIGIT.
* toplev.c (toplev_main): Call hex_init.
* tradcpp.c (main): Call hex_init.
* nextstep-protos.h: New file.
* nextstep.c: Include "rtl.h", "output.h" & "tm_p.h".
* nextstep.h (INCLUDE_DEFAULTS): Delete LOCAL_INCLUDE_DIR and
......
......@@ -904,9 +904,10 @@ lex_number (str, len)
/* It is not a decimal point.
It should be a digit (perhaps a hex digit). */
if (ISDIGIT (c))
if (ISDIGIT (c)
|| (base == 16 && ISXDIGIT (c)))
{
n = c - '0';
n = hex_value (c);
}
else if (base <= 10 && (c == 'e' || c == 'E'))
{
......@@ -919,14 +920,6 @@ lex_number (str, len)
floatflag = AFTER_EXPON;
break; /* start of exponent */
}
else if (base == 16 && c >= 'a' && c <= 'f')
{
n = c - 'a' + 10;
}
else if (base == 16 && c >= 'A' && c <= 'F')
{
n = c - 'A' + 10;
}
else
{
p--;
......
......@@ -66,7 +66,7 @@ Boston, MA 02111-1307, USA. */
char * pnt_ = (C), * pnt1_; \
pnt1_ = pnt_ - 1; \
while (*++pnt1_) \
if ((*pnt1_ >= 'A' && *pnt1_ <= 'Z')) *pnt1_ |= 0x20; \
if (ISUPPER (*pnt1_)) *pnt1_ = TOLOWER (*pnt1_); \
pnt1_ = strrchr (pnt_, ']'); \
pnt1_ = (pnt1_ == 0 ? strrchr (pnt_, '>') : pnt1_); \
pnt1_ = (pnt1_ == 0 ? strrchr (pnt_, ':') : pnt1_); \
......
Sun Dec 16 08:52:48 2001 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* lex.c (ffelex_backslash_, ffelex_cfebackslash_): Use hex_value.
* target.c (ffetarget_integerhex, ffetarget_typeless_hex): Use
hex_p/hex_value.
2001-12-14 Roger Sayle <roger@eyesopen.com>
* com-rt.def: Use __builtin_sqrt instead of __builtin_fsqrt.
......
......@@ -396,13 +396,7 @@ ffelex_backslash_ (int c, ffewhereColumnNumber col)
case 2:
if (ISXDIGIT (c))
{
code *= 16;
if (c >= 'a' && c <= 'f')
code += c - 'a' + 10;
if (c >= 'A' && c <= 'F')
code += c - 'A' + 10;
if (ISDIGIT (c))
code += c - '0';
code = (code * 16) + hex_value (c);
if (code != 0 || count != 0)
{
if (count == 0)
......@@ -603,13 +597,7 @@ ffelex_cfebackslash_ (int *use_d, int *d, FILE *finput)
*d = c;
break;
}
code *= 16;
if (c >= 'a' && c <= 'f')
code += c - 'a' + 10;
if (c >= 'A' && c <= 'F')
code += c - 'A' + 10;
if (ISDIGIT (c))
code += c - '0';
code = (code * 16) + hex_value (c);
if (code != 0 || count != 0)
{
if (count == 0)
......
......@@ -1447,12 +1447,8 @@ ffetarget_integerhex (ffetargetIntegerDefault *val, ffelexToken integer)
bad_digit = FALSE;
while (c != '\0')
{
if ((c >= 'A') && (c <= 'F'))
c = c - 'A' + 10;
else if ((c >= 'a') && (c <= 'f'))
c = c - 'a' + 10;
else if (ISDIGIT (c))
c -= '0';
if (hex_p (c))
c = hex_value (c);
else
{
bad_digit = TRUE;
......@@ -2482,12 +2478,8 @@ ffetarget_typeless_hex (ffetargetTypeless *xvalue, ffelexToken token)
new_value <<= 4;
if ((new_value >> 4) != value)
overflow = TRUE;
if (ISDIGIT (c))
new_value += c - '0';
else if ((c >= 'A') && (c <= 'F'))
new_value += c - 'A' + 10;
else if ((c >= 'a') && (c <= 'f'))
new_value += c - 'a' + 10;
if (hex_p (c))
new_value += hex_value (c);
else
bad_digit = TRUE;
value = new_value;
......
......@@ -1170,13 +1170,7 @@ real_hex_to_f (s, mode)
{
if (ISXDIGIT (c))
{
k = c & CHARMASK;
if (k >= 'a' && k <= 'f')
k = k - 'a' + 10;
else if (k >= 'A')
k = k - 'A' + 10;
else
k = k - '0';
k = hex_value (c & CHARMASK);
if ((high & 0xf0000000) == 0)
{
......
2001-12-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* lex.c (java_read_unicode, java_lex): Use hex_p/hex_value.
2001-12-16 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
* decl.c (java_init_decl_processing): Build otable_type correctly.
......
......@@ -567,10 +567,8 @@ java_read_unicode (lex, unicode_escape_p)
{
if ((c = java_read_char (lex)) == UEOF)
return UEOF;
if (ISDIGIT (c))
unicode |= (unicode_t)((c-'0') << shift);
else if ((c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'))
unicode |= (unicode_t)((10+(c | 0x20)-'a') << shift);
if (hex_p (c))
unicode |= (unicode_t)(hex_value (c) << shift);
else
java_lex_error ("Non hex digit in Unicode escape sequence", 0);
}
......@@ -1064,7 +1062,7 @@ java_lex (java_lval)
{
/* We store in a string (in case it turns out to be a FP) and in
PARTS if we have to process a integer literal. */
int numeric = (ISDIGIT (c) ? c-'0' : 10 +(c|0x20)-'a');
int numeric = hex_value (c);
int count;
/* Remember when we find a valid hexadecimal digit */
......
......@@ -5190,12 +5190,7 @@ asctoeg (ss, y, oprec)
trail = 0;
nxtcom:
if (ISDIGIT (*s))
k = *s - '0';
else if (*s >= 'a' && *s <= 'f')
k = 10 + *s - 'a';
else
k = 10 + *s - 'A';
k = hex_value(*s);
if ((k >= 0) && (k < base))
{
/* Ignore leading zeros */
......@@ -5205,9 +5200,7 @@ asctoeg (ss, y, oprec)
if ((trail == 0) && (decflg != 0))
{
sp = s;
while (ISDIGIT (*sp)
|| (base == 16 && ((*sp >= 'a' && *sp <= 'f')
|| (*sp >= 'A' && *sp <= 'F'))))
while (ISDIGIT (*sp) || (base == 16 && ISXDIGIT (*sp)))
++sp;
/* Check for syntax error */
c = *sp & CHARMASK;
......
......@@ -5154,6 +5154,8 @@ toplev_main (argc, argv)
int argc;
char **argv;
{
hex_init ();
/* Initialization of GCC's environment, and diagnostics. */
general_init (argv [0]);
......
......@@ -515,6 +515,8 @@ main (argc, argv)
pending_dir *pend = (pending_dir *) xcalloc (argc, sizeof (pending_dir));
int no_standard_includes = 0;
hex_init ();
#ifdef RLIMIT_STACK
/* Get rid of any avoidable limit on stack size. */
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment