/[gcl]/gcl/binutils/libiberty/hex.c
ViewVC logotype

Diff of /gcl/binutils/libiberty/hex.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.1.1 by camm, Fri Aug 9 05:36:28 2002 UTC revision 1.1.1.1.20.1 by camm, Fri Sep 30 02:10:43 2005 UTC
# Line 19  Boston, MA 02111-1307, USA.  */ Line 19  Boston, MA 02111-1307, USA.  */
19    
20  #include <stdio.h>  /* for EOF */  #include <stdio.h>  /* for EOF */
21  #include "libiberty.h"  #include "libiberty.h"
22    #include "safe-ctype.h" /* for HOST_CHARSET_ASCII */
23    
24    #if EOF != -1
25     #error "hex.c requires EOF == -1"
26    #endif
27    
28  /*  /*
29    
# Line 39  or zero if it is not.  Note that the val Line 44  or zero if it is not.  Note that the val
44    
45  @end deftypefn  @end deftypefn
46    
47  @deftypefn Extension int hex_value (int @var{c})  @deftypefn Extension {unsigned int} hex_value (int @var{c})
48    
49  Returns the numeric equivalent of the given character when interpreted  Returns the numeric equivalent of the given character when interpreted
50  as a hexidecimal digit.  The result is undefined if you pass an  as a hexidecimal digit.  The result is undefined if you pass an
51  invalid hex digit.  Note that the value you pass will be cast to  invalid hex digit.  Note that the value you pass will be cast to
52  @code{unsigned char} within the macro.  @code{unsigned char} within the macro.
53    
54    The @code{hex_value} macro returns @code{unsigned int}, rather than
55    signed @code{int}, to make it easier to use in parsing addresses from
56    hex dump files: a signed @code{int} would be sign-extended when
57    converted to a wider unsigned type --- like @code{bfd_vma}, on some
58    systems.
59    
60  @end deftypefn  @end deftypefn
61    
62  @undocumented _hex_array_size  @undocumented _hex_array_size
# Line 56  invalid hex digit.  Note that the value Line 67  invalid hex digit.  Note that the value
67    
68    
69  /* Are we ASCII? */  /* Are we ASCII? */
70  #if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \  #if HOST_CHARSET == HOST_CHARSET_ASCII
   && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21 \  
   && EOF == -1  
71    
72  const char _hex_value[_hex_array_size] =  const unsigned char _hex_value[_hex_array_size] =
73  {  {
74    _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* NUL SOH STX ETX */    _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* NUL SOH STX ETX */
75    _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* EOT ENQ ACK BEL */    _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* EOT ENQ ACK BEL */
# Line 139  const char _hex_value[_hex_array_size] = Line 148  const char _hex_value[_hex_array_size] =
148    
149  #else  #else
150    
151  char _hex_value[_hex_array_size];  unsigned char _hex_value[_hex_array_size];
152    
153  #endif /* not ASCII */  #endif /* not ASCII */
154    

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.1.20.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26