]>
Commit | Line | Data |
---|---|---|
e9ce8d39 A |
1 | /* |
2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
734aad71 | 6 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. |
e9ce8d39 | 7 | * |
734aad71 A |
8 | * This file contains Original Code and/or Modifications of Original Code |
9 | * as defined in and that are subject to the Apple Public Source License | |
10 | * Version 2.0 (the 'License'). You may not use this file except in | |
11 | * compliance with the License. Please obtain a copy of the License at | |
12 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
13 | * file. | |
14 | * | |
15 | * The Original Code and all software distributed under the License are | |
16 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
e9ce8d39 A |
17 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
18 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
734aad71 A |
19 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
20 | * Please see the License for the specific language governing rights and | |
21 | * limitations under the License. | |
e9ce8d39 A |
22 | * |
23 | * @APPLE_LICENSE_HEADER_END@ | |
24 | */ | |
25 | /* | |
26 | * Copyright 1990, NeXT, Inc. | |
27 | */ | |
28 | ||
29 | #include "NXCType.h" | |
30 | #define FIXSIGNEDCHAR(i) if ((i & 0xFFFFFF80) == 0xFFFFFF80) i &= 0x000000FF | |
31 | ||
32 | unsigned char * | |
33 | NXToAscii(c) | |
34 | unsigned int c; | |
35 | { | |
36 | static unsigned char woops[] = " "; | |
37 | ||
38 | FIXSIGNEDCHAR(c); | |
39 | if (c < 128) { /* handle stuff already ASCII */ | |
40 | woops[0] = c; | |
41 | return (unsigned char *) woops; | |
42 | } | |
43 | switch (c) { | |
44 | case 128: /* Figspace */ | |
45 | return (unsigned char *) " "; | |
46 | case 129: /* Agrave */ | |
47 | case 130: /* Aacute */ | |
48 | case 131: /* Acircumflex */ | |
49 | case 132: /* Atilde */ | |
50 | case 133: /* Adieresis */ | |
51 | case 134: /* Aring */ | |
52 | return (unsigned char *) "A"; | |
53 | case 135: /* Ccedilla */ | |
54 | return (unsigned char *) "C"; | |
55 | case 136: /* Egrave */ | |
56 | case 137: /* Eacute */ | |
57 | case 138: /* Ecircumflex */ | |
58 | case 139: /* Edieresis */ | |
59 | return (unsigned char *) "E"; | |
60 | case 140: /* Igrave */ | |
61 | case 141: /* Iacute */ | |
62 | case 142: /* Icircumflex */ | |
63 | case 143: /* Idieresis */ | |
64 | return (unsigned char *) "I"; | |
65 | case 145: /* Ntilde */ | |
66 | return (unsigned char *) "N"; | |
67 | case 146: /* Ograve */ | |
68 | case 147: /* Oacute */ | |
69 | case 148: /* Ocircumflex */ | |
70 | case 149: /* Otilde */ | |
71 | case 150: /* Odieresis */ | |
72 | case 233: /* Oslash */ | |
73 | return (unsigned char *) "O"; | |
74 | case 151: /* Ugrave */ | |
75 | case 152: /* Uacute */ | |
76 | case 153: /* Ucircumflex */ | |
77 | case 154: /* Udieresis */ | |
78 | return (unsigned char *) "U"; | |
79 | case 155: /* Yacute */ | |
80 | return (unsigned char *) "Y"; | |
81 | case 230: /* eth */ | |
82 | case 144: /* Eth */ | |
83 | return (unsigned char *) "TH"; | |
84 | case 156: /* Thorn */ | |
85 | case 252: /* thorn */ | |
86 | return (unsigned char *) "th"; | |
87 | ||
88 | case 174: /* fi */ | |
89 | return (unsigned char *) "fi"; | |
90 | case 175: /* fl */ | |
91 | return (unsigned char *) "fl"; | |
92 | ||
93 | case 213: /* agrave */ | |
94 | case 214: /* aacute */ | |
95 | case 215: /* acircumflex */ | |
96 | case 216: /* atilde */ | |
97 | case 217: /* adieresis */ | |
98 | case 218: /* aring */ | |
99 | return (unsigned char *) "a"; | |
100 | case 219: /* ccedilla */ | |
101 | return (unsigned char *) "c"; | |
102 | case 220: /* egrave */ | |
103 | case 221: /* eacute */ | |
104 | case 222: /* ecircumflex */ | |
105 | case 223: /* edieresis */ | |
106 | return (unsigned char *) "e"; | |
107 | case 225: /* AE */ | |
108 | return (unsigned char *) "AE"; | |
109 | case 224: /* igrave */ | |
110 | case 226: /* iacute */ | |
111 | case 228: /* icircumflex */ | |
112 | case 229: /* idieresis */ | |
113 | return (unsigned char *) "i"; | |
114 | case 231: /* ntilde */ | |
115 | return (unsigned char *) "n"; | |
116 | case 232: /* Lslash */ | |
117 | return (unsigned char *) "L"; | |
118 | case 234: /* OE */ | |
119 | return (unsigned char *) "OE"; | |
120 | case 236: /* ograve */ | |
121 | case 237: /* oacute */ | |
122 | case 238: /* ocircumflex */ | |
123 | case 239: /* otilde */ | |
124 | case 240: /* odieresis */ | |
125 | case 249: /* oslash */ | |
126 | return (unsigned char *) "o"; | |
127 | case 241: /* ae */ | |
128 | return (unsigned char *) "ae"; | |
129 | case 242: /* ugrave */ | |
130 | case 243: /* uacute */ | |
131 | case 244: /* ucircumflex */ | |
132 | case 246: /* udieresis */ | |
133 | return (unsigned char *) "u"; | |
134 | case 245: /* dotlessi */ | |
135 | return (unsigned char *) "i"; | |
136 | case 247: /* yacute */ | |
137 | case 253: /* ydieresis */ | |
138 | return (unsigned char *) "y"; | |
139 | case 248: /* lslash */ | |
140 | return (unsigned char *) "l"; | |
141 | case 250: /* oe */ | |
142 | return (unsigned char *) "oe"; | |
143 | case 251: /* germandbls */ | |
144 | return (unsigned char *) "ss"; | |
145 | /* | |
146 | * non-letter cases: | |
147 | */ | |
148 | case 158: /* multiply */ | |
149 | return (unsigned char *) "x"; | |
150 | case 159: /* divide */ | |
151 | return (unsigned char *) "/"; | |
152 | ||
153 | case 161: /* exclamdown */ | |
154 | return (unsigned char *) "!"; | |
155 | case 169: /* quotesingle */ | |
156 | return (unsigned char *) "'"; | |
157 | ||
158 | case 170: /* quotedblleft */ | |
159 | case 186: /* quotedblright */ | |
160 | case 185: /* quotedblbase */ | |
161 | return (unsigned char *) "\""; | |
162 | case 171: /* guillemotleft */ | |
163 | return (unsigned char *) "<<"; | |
164 | case 187: /* guillemotright */ | |
165 | return (unsigned char *) ">>"; | |
166 | case 184: /* quotesinglbase */ | |
167 | return (unsigned char *) "'"; | |
168 | case 172: /* guilsinglleft */ | |
169 | return (unsigned char *) "<"; | |
170 | case 173: /* guilsinglright */ | |
171 | return (unsigned char *) ">"; | |
172 | case 180: /* periodcentered */ | |
173 | return (unsigned char *) "."; | |
174 | case 181: /* brokenbar */ | |
175 | return (unsigned char *) "|"; | |
176 | case 183: /* bullet */ | |
177 | return (unsigned char *) "*"; | |
178 | case 188: /* ellipsis */ | |
179 | return (unsigned char *) "..."; | |
180 | case 191: /* questiondown */ | |
181 | return (unsigned char *) "?"; | |
182 | case 192: /* onesuperior */ | |
183 | return (unsigned char *) "1"; | |
184 | case 201: /* twosuperior */ | |
185 | return (unsigned char *) "2"; | |
186 | case 204: /* threesuperior */ | |
187 | return (unsigned char *) "3"; | |
188 | case 208: /* emdash */ | |
189 | return (unsigned char *) "--"; | |
190 | case 209: /* plusminus */ | |
191 | return (unsigned char *) "+-"; | |
192 | case 210: /* onequarter */ | |
193 | return (unsigned char *) "1/4"; | |
194 | case 211: /* onehalf */ | |
195 | return (unsigned char *) "1/2"; | |
196 | case 212: /* threequarters */ | |
197 | return (unsigned char *) "3/4"; | |
198 | case 227: /* ordfeminine */ | |
199 | return (unsigned char *) "a"; | |
200 | case 235: /* ordmasculine */ | |
201 | return (unsigned char *) "o"; | |
202 | case 157: /* mu */ | |
203 | return (unsigned char *) "u"; | |
204 | case 160: /* copyright */ | |
205 | return (unsigned char *) "(C)"; | |
206 | case 163: /* sterling */ | |
207 | return (unsigned char *) "L"; | |
208 | case 164: /* fraction */ | |
209 | return (unsigned char *) "/"; | |
210 | case 165: /* yen */ | |
211 | return (unsigned char *) "Y"; | |
212 | case 166: /* florin */ | |
213 | return (unsigned char *) "f"; | |
214 | case 176: /* registered */ | |
215 | return (unsigned char *) "(R)"; | |
216 | case 190: /* logicalnot */ | |
217 | case 177: /* endash */ | |
218 | return (unsigned char *) "-"; | |
219 | case 178: /* dagger */ | |
220 | return (unsigned char *) "+"; | |
221 | case 179: /* daggerdbl */ | |
222 | return (unsigned char *) "++"; | |
223 | case 189: /* perthousand */ | |
224 | return (unsigned char *) "0/00"; | |
225 | case 193: /* grave */ | |
226 | return (unsigned char *) "`"; | |
227 | case 194: /* acute */ | |
228 | return (unsigned char *) "'"; | |
229 | case 195: /* circumflex */ | |
230 | return (unsigned char *) "^"; | |
231 | case 196: /* tilde */ | |
232 | return (unsigned char *) "~"; | |
233 | ||
234 | /* | |
235 | * Default & fallback cases: | |
236 | */ | |
237 | case 162: /* cent */ | |
238 | case 167: /* section */ | |
239 | case 168: /* currency */ | |
240 | case 182: /* paragraph */ | |
241 | case 197: /* macron */ | |
242 | case 198: /* breve */ | |
243 | case 199: /* dotaccent */ | |
244 | case 200: /* dieresis */ | |
245 | case 202: /* ring */ | |
246 | case 203: /* cedilla */ | |
247 | case 205: /* hungarumlaut */ | |
248 | case 206: /* ogonek */ | |
249 | case 207: /* caron */ | |
250 | default: | |
251 | return (unsigned char *) "_"; | |
252 | } | |
253 | } |