Ignore:
Timestamp:
Apr 27, 2004, 8:39:34 PM (21 years ago)
Author:
bird
Message:

GCC v3.3.3 sources.

Location:
branches/GNU/src/gcc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/gcc

    • Property svn:ignore
      •  

        old new  
        2626configure.vr
        2727configure.vrs
         28dir.info
        2829Makefile
        29 dir.info
        3030lost+found
        3131update.out
  • branches/GNU/src/gcc/libiberty/hex.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r1390 r1391  
    2121#include "libiberty.h"
    2222
    23 /* Provided for ABI compatibility.  */
    24 void
    25 hex_init ()
    26 {
    27 }
     23/*
     24
     25@deftypefn Extension void hex_init (void)
     26
     27Initializes the array mapping the current character set to
     28corresponding hex values.  This function must be called before any
     29call to @code{hex_p} or @code{hex_value}.  If you fail to call it, a
     30default ASCII-based table will normally be used on ASCII systems.
     31
     32@end deftypefn
     33
     34@deftypefn Extension int hex_p (int @var{c})
     35
     36Evaluates to non-zero if the given character is a valid hex character,
     37or zero if it is not.  Note that the value you pass will be cast to
     38@code{unsigned char} within the macro.
     39
     40@end deftypefn
     41
     42@deftypefn Extension int hex_value (int @var{c})
     43
     44Returns the numeric equivalent of the given character when interpreted
     45as a hexidecimal digit.  The result is undefined if you pass an
     46invalid hex digit.  Note that the value you pass will be cast to
     47@code{unsigned char} within the macro.
     48
     49@end deftypefn
     50
     51@undocumented _hex_array_size
     52@undocumented _hex_bad
     53@undocumented _hex_value
     54
     55*/
     56
    2857
    2958/* Are we ASCII? */
     
    107136  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
    108137};
     138#define HEX_TABLE_INITIALIZED
     139
    109140#else
    110  #error "Unsupported host character set"
     141
     142char _hex_value[_hex_array_size];
     143
    111144#endif /* not ASCII */
     145
     146void
     147hex_init ()
     148{
     149#ifndef HEX_TABLE_INITIALIZED
     150  int i;
     151
     152  for (i=0; i<_hex_array_size; i++)
     153    {
     154      switch (i)
     155        {
     156        case '0': _hex_value[i] = 0; break;
     157        case '1': _hex_value[i] = 1; break;
     158        case '2': _hex_value[i] = 2; break;
     159        case '3': _hex_value[i] = 3; break;
     160        case '4': _hex_value[i] = 4; break;
     161        case '5': _hex_value[i] = 5; break;
     162        case '6': _hex_value[i] = 6; break;
     163        case '7': _hex_value[i] = 7; break;
     164        case '8': _hex_value[i] = 8; break;
     165        case '9': _hex_value[i] = 9; break;
     166
     167        case 'a': case 'A': _hex_value[i] = 10; break;
     168        case 'b': case 'B': _hex_value[i] = 11; break;
     169        case 'c': case 'C': _hex_value[i] = 12; break;
     170        case 'd': case 'D': _hex_value[i] = 13; break;
     171        case 'e': case 'E': _hex_value[i] = 14; break;
     172        case 'f': case 'F': _hex_value[i] = 15; break;
     173
     174        default:
     175          _hex_value[i] = _hex_bad;
     176          break;
     177        }
     178    }
     179#endif
     180}
Note: See TracChangeset for help on using the changeset viewer.