2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $TOG: AsciiSpc.c /main/6 1999/02/24 12:04:30 mgreess $ */
24 /************************************<+>*************************************
25 ****************************************************************************
29 ** Project: Cde Help Library
31 ** Description: This file resolves an <spc> spec into an ascii
32 ** representation of the special character.
34 ** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992 Hewlett-Packard Company
36 ** (c) Copyright 1993, 1994 Hewlett-Packard Company
37 ** (c) Copyright 1993, 1994 International Business Machines Corp.
38 ** (c) Copyright 1993, 1994 Sun Microsystems, Inc.
39 ** (c) Copyright 1993, 1994 Novell, Inc.
40 ****************************************************************************
41 ************************************<+>*************************************/
51 #include "AsciiSpcI.h"
56 /******** Private Function Declarations ********/
58 /******** End Public Function Declarations ********/
60 /******************************************************************************
62 * Private variables and defines.
64 *****************************************************************************/
67 const char *spc_string;
71 static SpecialSymbolTable SpcTable[] =
74 * comment out the entries that map to a blank.
75 * The last entry will catch them and map them to a blank
76 * anyway. This will shorten the table by quite a bit.
78 /*{"[aacute]", " " }, *ISOlat1, small a, acute accent */
79 /*{"[acirc ]", " " }, *ISOlat1, small a, circumflex */
80 /*{"[aelig ]", " " }, *ISOlat1, small ae diphthong */
81 /*{"[agrave]", " " }, *ISOlat1, small a, grave accent */
82 /*{"[alpha ]", " " }, *ISOgrk3, Greek, small alpha */
83 /*{"[aleph ]", " " }, *ISOtech, aleph, Hebrews */
84 {"[amp ]", "&" }, /*ISOnum , ampersand */
85 {"[and ]", "^" }, /*ISOtech, wedge, logical and */
86 /*{"[ang ]", " " }, *ISOamso, angle */
87 /*{"[angst ]", " " }, *ISOtech, Angstrom, cap A, ring */
88 {"[ap ]", "~=" }, /*ISOtech, approximately equal */
89 {"[apos ]", "'" }, /*ISOnum , apostrophe */
90 /*{"[aring ]", " " }, *ISOlat1, small a, ring */
91 {"[ast ]", "*" }, /*ISOnum , asterisk */
92 /*{"[atilde]", " " }, *ISOlat1, small a, tilde */
93 /*{"[auml ]", " " }, *ISOlat1, small a, umlaut mark */
94 /*{"[beta ]", " " }, *ISOgrk3, Greek, small beta */
95 /*{"[blank ]", " " }, *ISOpub , significant blank */
96 /*{"[bottom]", " " }, *ISOtech, bottom symbol */
97 {"[bsol ]", "\\" }, /*ISOnum , backslash, rev solidus*/
98 {"[bull ]", "*" }, /*ISOpub , round bullet,filled */
99 /*{"[brvbar]", "|" }, *ISOnum , broken vertical bar */
100 /*{"[cap ]", " " }, *ISOtech, intersection */
101 /*{"[ccedil]", " " }, *ISOlat1, small c, cedilla */
102 /*{"[cent ]", " " }, *ISOnum , cent sign */
103 /*{"[chi ]", " " }, *ISOgrk3, Greek, small chi */
104 /*{"[clubs ]", " " }, *ISOpub , clubs suit symbol */
105 {"[colon ]", ":" }, /*ISOnum , colon */
106 {"[comma ]", "," }, /*ISOnum , comma */
107 {"[commat]", "@" }, /*ISOnum , commercial at */
108 /*{"[cong ]", " " }, *ISOtech, congruent with */
109 /*{"[copy ]", " " }, *ISOnum , copyright symbol */
110 {"[cup ]", "U" }, /*ISOtech, union or logical sum */
111 /*{"[curren]", " " }, *ISOnum , general currency sign */
112 /*{"[darr ]", " " }, *ISOnum , downward arrow */
113 /*{"[dArr ]", " " }, *ISOamsa, down double arrow */
114 {"[dash ]", "-" }, /*ISOpub , dash */
115 /*{"[deg ]", " " }, *ISOnum , degree sign */
116 /*{"[delta ]", " " }, *ISOgrk3, Greek, small delta */
117 /*{"[diams ]", " " }, *ISOpub , diamond suit symbol */
118 {"[divide]", "/" }, /*ISOnum , divide sign */
119 {"[dollar]", "$" }, /*ISOnum , dollar sign */
120 /*{"[eacute]", " " }, *ISOlat1, small e, acute accent */
121 /*{"[ecirc ]", " " }, *ISOlat1, small e, circumflex */
122 /*{"[egrave]", " " }, *ISOlat1, small e, grave accent */
123 /*{"[empty ]", " " }, *ISOamso, empty string, o/slash */
124 /*{"[epsiv ]", " " }, *ISOgrk3, Greek,sm epsilon, var */
125 {"[equals]", "=" }, /*ISOnum , equals sign */
126 /*{"[equiv ]", " " }, *ISOtech, identical with */
127 /*{"[eta ]", " " }, *ISOgrk3, Greek, small eta */
128 /*{"[eth ]", " " }, *ISOlat1, small eth, Icelandic */
129 /*{"[euml ]", " " }, *ISOlat1, small e, umlaut mark */
130 {"[excl ]", "!" }, /*ISOnum , exclamation mark */
131 /*{"[exist ]", " " }, *ISOtech, at least one exists */
132 /*{"[forall]", " " }, *ISOtech, for all */
133 {"[frac12]", "1/2" }, /*ISOnum , fraction one-half */
134 {"[frac13]", "1/3" }, /*ISOnum , fraction one-third */
135 {"[frac14]", "1/4" }, /*ISOnum , fraction one-quarter */
136 {"[frac15]", "1/5" }, /*ISOnum , fraction one-fifth */
137 {"[frac16]", "1/6" }, /*ISOnum , fraction one-sixth */
138 {"[frac18]", "1/8" }, /*ISOnum , fraction one-eight */
139 {"[frac23]", "2/3" }, /*ISOnum , fraction two-thirds */
140 {"[frac25]", "2/5" }, /*ISOnum , fraction two-fifths */
141 {"[frac34]", "3/4" }, /*ISOnum , fraction three-quarter*/
142 {"[frac35]", "3/5" }, /*ISOnum , fraction three-fifths */
143 {"[frac38]", "3/8" }, /*ISOnum , fraction three-eights */
144 {"[frac45]", "4/5" }, /*ISOnum , fraction four-fifths */
145 {"[frac56]", "5/6" }, /*ISOnum , fraction five-sixths */
146 {"[frac58]", "5/8" }, /*ISOnum , fraction five-eights */
147 {"[frac78]", "7/8" }, /*ISOnum , fraction seven-eights */
148 /*{"[gamma ]", " " }, *ISOgrk3, Greek, small gamma */
149 {"[ge ]", ">=" }, /*ISOtech, greater-than-or-equal */
150 {"[gt ]", ">" }, /*ISOnum , greater than sign */
151 {"[half ]", "1/2" }, /*ISOnum , fraction one-half */
152 {"[harr ]", "<-->" }, /*ISOamsa, left & right arrow */
153 {"[hArr ]", "<<==>>" }, /*ISOamsa, l & r double arrow */
154 /*{"[hearts]", " " }, *ISOpub , hearts suit symbol */
155 {"[hellip]", "..." }, /*ISOpub , ellipsis(horizontal) */
156 {"[horbar]", "--" }, /*ISOnum , horizontal bar */
157 {"[hyphen]", "-" }, /*ISOnum , hyphen */
158 /*{"[iacute]", " " }, *ISOlat1, small i, acute accent */
159 /*{"[icirc ]", " " }, *ISOlat1, small i, circumflex */
160 /*{"[iexcl ]", " " }, *ISOnum , inverted ! mark */
161 /*{"[igrave]", " " }, *ISOlat1, small i, grave accent */
162 /*{"[image ]", " " }, *ISOamso,imaginary number symbol*/
163 /*{"[infin ]", " " }, *ISOtech, infinity */
164 /*{"[int ]", " " }, *ISOtech, intergral operator */
165 /*{"[iota ]", " " }, *ISOgrk3, Greek, small iota */
166 /*{"[iquest]", " " }, *ISOnum , inverted ? mark */
167 /*{"[isin ]", " " }, *ISOtech, set membership */
168 /*{"[iuml ]", " " }, *ISOlat1, small i, umlaut mark */
169 /*{"[kappa ]", " " }, *ISOgrk3, Greek, small kappa */
170 /*{"[lambda]", " " }, *ISOgrk3, Greek, small lambda */
171 /*{"[lang ]", " " }, *ISOtech, left angle bracket */
172 {"[laquo ]", "<<" }, /*ISOnum , left angle quotation */
173 {"[larr ]", "<--" }, /*ISOnum , leftward arrow */
174 {"[lArr ]", "<==" }, /*ISOtech, is implied by */
175 {"[lcub ]", "{" }, /*ISOnum , left curly brace */
176 {"[ldquo ]", "\"" }, /*ISOnum , left double quote */
177 {"[le ]", "=<" }, /*ISOtech, less-than-or-equal */
178 {"[lowbar]", "_" }, /*ISOnum , low line */
179 {"[lpar ]", "(" }, /*ISOnum , left parenthesis */
180 {"[lsqb ]", "[" }, /*ISOnum , left square bracket */
181 {"[lsquo ]", "`" }, /*ISOnum , left single quote */
182 {"[lsquor]", "," }, /*ISOnum,rising single quote(low)*/
183 {"[lt ]", "<" }, /*ISOnum , less-than sign */
184 {"[mdash ]", "--" }, /*ISOpub , em dash(long dash) */
185 /*{"[micro ]", " " }, *ISOnum , micro */
186 /*{"[middot]", " " }, *ISOnum , middle dot */
187 {"[minus ]", "-" }, /*ISOtech, minus sign */
188 {"[mldr ]", "...." }, /*ISOpub , em leader */
189 {"[mnplus]", "-/+" }, /*ISOtech, minus-or-plus sign */
190 /*{"[mu ]", " " }, *ISOgrk3, Greek, small mu */
191 /*{"[nabla ]", " " }, *ISOtech, del, Hamilton operator*/
192 {"[nbsp ]", " " }, /*ISOnum , no break space */
193 {"[ndash ]", "-" }, /*ISOpub , en dash(short dash) */
194 {"[ne ]", "!=" }, /*ISOtech, not equal */
195 /*{"[ni ]", " " }, *ISOtech, contains */
196 {"[nldr ]", ".." }, /*ISOpub , double baseline dot */
197 /*{"[not ]", " " }, *ISOnum , not */
198 /*{"[notin ]", " " }, *ISOtech, negated set membership*/
199 /*{"[ntilde]", " " }, *ISOlat1, small N, tilde */
200 /*{"[nu ]", " " }, *ISOgrk3, Greek, small nu */
201 {"[num ]", "#" }, /*ISOnum , number sign */
202 /*{"[oacute]", " " }, *ISOlat1, small o, acute accent */
203 /*{"[ocirc ]", " " }, *ISOlat1, small o, circumflex */
204 /*{"[ograve]", " " }, *ISOlat1, small o, grave accent */
205 /*{"[ohm ]", " " }, *ISOnum , ohm */
206 /*{"[omega ]", " " }, *ISOgrk3, Greek, small omega */
207 /*{"[oplus ]", " " }, *ISOamsb, plus sign in circle */
208 {"[or ]", "V" }, /*ISOtech, vee, logical or */
209 /*{"[ordf ]", " " }, *ISOnum , ordinal indicator, fem*/
210 /*{"[ordm ]", " " }, *ISOnum , ordinal indicator,male*/
211 /*{"[oslash]", " " }, *ISOlat1, small o, slash */
212 /*{"[osol ]", " " }, *ISOamsb, slash in circle */
213 /*{"[otilde]", " " }, *ISOlat1, small o, tilde */
214 /*{"[otimes]", " " }, *ISOamsb,multiply sign in circle*/
215 /*{"[ouml ]", " " }, *ISOlat1, small o, umlaut mark */
216 /*{"[over ]", " " }, *made up, over symbol */
217 {"[par ]", "||" }, /*ISOtech, parallel */
218 /*{"[para ]", " " }, *ISOnum , paragraph sign */
219 /*{"[part ]", " " }, *ISOtech, partial differential */
220 {"[percnt]", "%" }, /*ISOnum , percent sign */
221 {"[period]", "." }, /*ISOnum , full stop, period */
222 /*{"[perp ]", " " }, *ISOtech, perpendicular */
223 /*{"[phis ]", " " }, *ISOgrk3, Greek, small phi */
224 /*{"[pi ]", " " }, *ISOgrk3, Greek, small pi */
225 /*{"[piv ]", " " }, *ISOgrk3, Greek, small pi, var */
226 {"[plus ]", "+" }, /*ISOnum , plus sign */
227 {"[plusmn]", "+/-" }, /*ISOnum , plus or minus sign */
228 {"[pound ]", "#" }, /*ISOnum , pound sign */
229 {"[prime ]", "\'" }, /*ISOtech, prime or minute */
230 /*{"[prop ]", " " }, *ISOtech, proportional to */
231 /*{"[psi ]", " " }, *ISOgrk3, Greek, small psi */
232 {"[quest ]", "?" }, /*ISOnum , question mark */
233 {"[quot ]", "'" }, /*ISOnum , quote mark */
234 /*{"[radic ]", " " }, *ISOtech, radical */
235 /*{"[rang ]", " " }, *ISOtech, right angle bracket */
236 {"[raquo ]", ">>" }, /*ISOnum , right angle quotation */
237 {"[rarr ]", "-->" }, /*ISOnum , rightward arrow */
238 {"[rArr ]", "==>>" }, /*ISOtech, right double arrow */
239 {"[rcub ]", "}" }, /*ISOnum , right curly brace */
240 {"[rdquo ]", "\"" }, /*ISOnum , right double quote */
241 /*{"[real ]", " " }, *ISOamso, real number symbol */
242 /*{"[reg ]", " " }, *ISOnum,circledR,registered sign*/
243 /*{"[rho ]", " " }, *ISOgrk3, Greek, small rho */
244 {"[rpar ]", ")" }, /*ISOnum , right parenthesis */
245 {"[rsqb ]", "]" }, /*ISOnum , right square bracket */
246 {"[rsquo ]", "'" }, /*ISOnum , right single quote */
247 /*{"[sect ]", " " }, *ISOnum , section sign */
248 {"[semi ]", ";" }, /*ISOnum , semicolon */
249 {"[shy ]", "-" }, /*ISOnum , soft hypen */
250 /*{"[sigma ]", " " }, *ISOgrk3, Greek, small sigma */
251 {"[sim ]", "~" }, /*ISOtech, similar to */
252 {"[sime ]", "~=" }, /*ISOtech, similar, equals */
253 {"[sol ]", "/" }, /*ISOnum , solidus */
254 /*{"[spades]", " " }, *ISOpub , spades suit symbol */
255 /*{"[sub ]", " " }, *ISOtech, subset/is implied by */
256 /*{"[sung ]", " " }, *ISOnum , musical note(sung txt)*/
257 /*{"[sube ]", " " }, *ISOtech, subset, equals */
258 /*{"[sup ]", " " }, *ISOtech, superset or implies */
259 /*{"[sup1 ]", " " }, *ISOnum , superscript one */
260 /*{"[sup2 ]", " " }, *ISOnum , superscript two */
261 /*{"[sup3 ]", " " }, *ISOnum , superscript three */
262 /*{"[supe ]", " " }, *ISOtech, superset, equals */
263 /*{"[szlig ]", " " }, *ISOlat1, small sharp s, German */
264 /*{"[tau ]", " " }, *ISOgrk3, Greek, small tau */
265 /*{"[there4]", " " }, *ISOtech, therefore */
266 /*{"[thetas]", " " }, *ISOgrk3, Greek, small theta */
267 /*{"[thetav]", " " }, *ISOgrk3, Greek, small theta,var*/
268 /*{"[thorn ]", " " }, *ISOlat1, small thorn, Icelandic*/
269 {"[times ]", "x" }, /*ISOnum , multipy sign */
270 {"[tprime]", "'''" }, /*ISOtech, triple prime */
271 /*{"[trade ]", " " }, *ISOnum , trade mark sign */
272 /*{"[uacute]", " " }, *ISOlat1, small u, acute accent */
273 /*{"[ucirc ]", " " }, *ISOlat1, small u, circumflex */
274 /*{"[ugrave]", " " }, *ISOlat1, small u, grave accent */
275 /*{"[uarr ]", " " }, *ISOnum , upward arrow */
276 /*{"[uArr ]", " " }, *ISOamsa, up double arrow */
277 /*{"[upsi ]", " " }, *ISOgrk3, Greek, small upsilon */
278 /*{"[uuml ]", " " }, *ISOlat1, small u, umlaut mark */
279 {"[vellip]", ".\n.\n.\n" }, /*ISOpub , vertical ellipsis */
280 {"[verbar]", "|" }, /*ISOnum , vertical bar */
281 /*{"[weierp]", " " }, *ISOamso, Weierstrass p */
282 /*{"[xi ]", " " }, *ISOgrk3, Greek, small xi */
283 /*{"[yacute]", " " }, *ISOlat1, small y, acute accent */
284 /*{"[yen ]", " " }, *ISOnum , yen sign */
285 /*{"[yuml ]", " " }, *ISOlat1, small y, umlaut mark */
286 /*{"[zeta ]", " " }, *ISOgrk3, Greek, small zeta */
287 /*{"[Aacute]", " " }, *ISOlat1, capital a,acute accent*/
288 /*{"[Acirc ]", " " }, *ISOlat1, capital a,circumflex */
289 /*{"[AElig ]", " " }, *ISOlat1, capital ae diphthong */
290 /*{"[Agrave]", " " }, *ISOlat1, capital a,grave accent*/
291 /*{"[Aring ]", " " }, *ISOlat1, capital a,ring */
292 /*{"[Atilde]", " " }, *ISOlat1, capital a,tilde */
293 /*{"[Auml ]", " " }, *ISOlat1, capital a,umlaut mark */
294 /*{"[Ccedil]", " " }, *ISOlat1, capital c, cedilla */
295 /*{"[Delta ]", " " }, *ISOgrk3, Greek, large delta */
296 /*{"[Dot ]", " " }, *ISOtech, dieresis or umlaut mrk*/
297 /*{"[DotDot]", " " }, *ISOtech, four dots above */
298 /*{"[Eacute]", " " }, *ISOlat1, capital E,acute accent*/
299 /*{"[Ecirc ]", " " }, *ISOlat1, capital E,circumflex */
300 /*{"[Egrave]", " " }, *ISOlat1, capital E,grave accent*/
301 /*{"[ETH ]", " " }, *ISOlat1, capital Eth, Icelandic*/
302 /*{"[Euml ]", " " }, *ISOlat1, capital E,umlaut mark */
303 /*{"[Gamma ]", " " }, *ISOgrk3, Greek, large gamma */
304 /*{"[Iacute]", " " }, *ISOlat1, capital I,acute accent*/
305 /*{"[Icirc ]", " " }, *ISOlat1, capital I,circumflex */
306 /*{"[Igrave]", " " }, *ISOlat1, capital I,grave accent*/
307 /*{"[Iuml ]", " " }, *ISOlat1, capital I,umlaut mark */
308 /*{"[Lambda]", " " }, *ISOgrk3, Greek, large lambda */
309 /*{"[Ntilde]", " " }, *ISOlat1, capital N, tilde */
310 /*{"[Oacute]", " " }, *ISOlat1, capital O,acute accent*/
311 /*{"[Ocirc ]", " " }, *ISOlat1, capital O,circumflex */
312 /*{"[Ograve]", " " }, *ISOlat1, capital O,grave accent*/
313 /*{"[Omega ]", " " }, *ISOgrk3, Greek, large omega */
314 /*{"[Oslash]", " " }, *ISOlat1, capital O, slash */
315 /*{"[Otilde]", " " }, *ISOlat1, capital O, tilde */
316 /*{"[Ouml ]", " " }, *ISOlat1, capital O,umlaut mark */
317 /*{"[Pi ]", " " }, *ISOgrk3, Greek, large pi */
318 {"[Prime ]", "\"" }, /*ISOtech, double prime/second */
319 /*{"[Phi ]", " " }, *ISOgrk3, Greek, large phi */
320 /*{"[Psi ]", " " }, *ISOgrk3, Greek, large psi */
321 /*{"[Sigma ]", " " }, *ISOgrk3, Greek, large sigma */
322 /*{"[Theta ]", " " }, *ISOgrk3, Greek, large theta */
323 /*{"[THORN ]", " " }, *ISOlat1,capital THORN,Icelandic*/
324 /*{"[Uacute]", " " }, *ISOgrk3, Greek, large theta */
325 /*{"[Ucirc ]", " " }, *ISOlat1, capital U,acute accent*/
326 /*{"[Ugrave]", " " }, *ISOlat1, capital U,circumflex */
327 /*{"[Upsi ]", " " }, *ISOgrk3, Greek, large upsilon */
328 /*{"[Uuml ]", " " }, *ISOlat1, capital U,umlaut mark */
329 {"[Verbar]", "||" }, /*ISOtech, dbl vertical bar */
330 /*{"[Xi ]", " " }, *ISOgrk3, Greek, large xi */
331 /*{"[Yacute]", " " }, *ISOlat1, capital Y,acute accent*/
332 { NULL , " " }, /* default character to use */
335 /******************************************************************************
337 * Semi Public functions
339 ******************************************************************************/
340 /*****************************************************************************
341 * Function: const char *_DtHelpCeResolveSpcToAscii ();
349 *****************************************************************************/
351 _DtHelpCeResolveSpcToAscii (
352 const char *spc_symbol)
356 if (NULL == spc_symbol)
359 while (NULL != SpcTable[i].symbol &&
360 0 != strcmp(SpcTable[i].symbol, spc_symbol))
363 if (SpcTable[i].symbol != NULL)
364 return (SpcTable[i].spc_string);