* spew.c (YYCHAR): Uppercase macro parameter and add
[official-gcc.git] / libiberty / hex.c
blob3ba04ba83deaf431a6a902b13815f1115f7b1b3b
1 /* Hex character manipulation support.
2 Copyright (C) 1995, 2001 Free Software Foundation, Inc.
4 This file is part of the libiberty library.
5 Libiberty is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 Libiberty is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with libiberty; see the file COPYING.LIB. If
17 not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
20 #include <stdio.h> /* for EOF */
21 #include "libiberty.h"
23 /* Provided for ABI compatibility. */
24 void
25 hex_init ()
29 /* Are we ASCII? */
30 #if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
31 && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21 \
32 && EOF == -1
34 const char _hex_value[_hex_array_size] =
36 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* NUL SOH STX ETX */
37 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* EOT ENQ ACK BEL */
38 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* BS HT LF VT */
39 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* FF CR SO SI */
40 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* DLE DC1 DC2 DC3 */
41 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* DC4 NAK SYN ETB */
42 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* CAN EM SUB ESC */
43 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* FS GS RS US */
45 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* SP ! " # */
46 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* $ % & ' */
47 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* ( ) * + */
48 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* , - . / */
49 0, 1, 2, 3, /* 0 1 2 3 */
50 4, 5, 6, 7, /* 4 5 6 7 */
51 8, 9, _hex_bad, _hex_bad, /* 8 9 : ; */
52 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* < = > ? */
54 _hex_bad, 10, 11, 12, /* @ A B C */
55 13, 14, 15, _hex_bad, /* D E F G */
56 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* H I J K */
57 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* L M N O */
58 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* P Q R S */
59 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* T U V W */
60 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* X Y Z [ */
61 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* \ ] ^ _ */
63 _hex_bad, 10, 11, 12, /* ` a b c */
64 13, 14, 15, _hex_bad, /* d e f g */
65 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* h i j k */
66 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* l m n o */
67 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* p q r s */
68 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* t u v w */
69 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* x y z { */
70 _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* | } ~ DEL */
72 /* The high half of unsigned char, all values are _hex_bad. */
73 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
74 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
75 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
76 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
77 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
78 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
79 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
80 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
82 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
83 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
84 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
85 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
86 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
87 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
88 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
89 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
91 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
92 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
93 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
94 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
95 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
96 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
97 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
98 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
100 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
101 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
102 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
103 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
104 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
105 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
106 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
107 _hex_bad, _hex_bad, _hex_bad, _hex_bad,
109 #else
110 #error "Unsupported host character set"
111 #endif /* not ASCII */