annotate src/xmu.c @ 434:9d177e8d4150 r21-2-25

Import from CVS: tag r21-2-25
author cvs
date Mon, 13 Aug 2007 11:30:53 +0200
parents 3ecd8885ac67
children abe6d1db359e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* This file contains compatibility routines for systems without Xmu.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 * You would be better served by installing Xmu on your machine or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 * yelling at your vendor to ship it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 /* XEmacs changes: rindex -> strrchr */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 #ifndef HAVE_XMU
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 * Copyright 1989 Massachusetts Institute of Technology
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 * Permission to use, copy, modify, and distribute this software and its
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 * documentation for any purpose and without fee is hereby granted, provided
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 * that the above copyright notice appear in all copies and that both that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 * copyright notice and this permission notice appear in supporting
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 * documentation, and that the name of M.I.T. not be used in advertising
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 * or publicity pertaining to distribution of the software without specific,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 * written prior permission. M.I.T. makes no representations about the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 * suitability of this software for any purpose. It is provided "as is"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 * without express or implied warranty.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #include <X11/cursorfont.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 #include <X11/Xlib.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 #include <X11/Xutil.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 #include <X11/Intrinsic.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 /* for XmuCopyISOLatin1Lowered */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 #define XK_LATIN1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 #include <X11/keysymdef.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 #undef XK_LATIN1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 #if (XtSpecificationRelease >= 5)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 * Don't know why, but this works with X11R5, not X11R4.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 * Anyway, _XExtension is defined in Xlib.h in X11R4, so we do not need
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 * Xlibint in that case...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 #include <X11/Xlibint.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 #include <X11/Xproto.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 #include <stdio.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 #include <ctype.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 int XmuCursorNameToIndex (CONST char *name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 static CONST struct _CursorName {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 CONST char *name;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 unsigned int shape;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 } cursor_names[] = {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 {"x_cursor", XC_X_cursor},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 {"arrow", XC_arrow},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 {"based_arrow_down", XC_based_arrow_down},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 {"based_arrow_up", XC_based_arrow_up},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 {"boat", XC_boat},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 {"bogosity", XC_bogosity},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 {"bottom_left_corner", XC_bottom_left_corner},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 {"bottom_right_corner", XC_bottom_right_corner},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 {"bottom_side", XC_bottom_side},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 {"bottom_tee", XC_bottom_tee},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 {"box_spiral", XC_box_spiral},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 {"center_ptr", XC_center_ptr},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 {"circle", XC_circle},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 {"clock", XC_clock},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 {"coffee_mug", XC_coffee_mug},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 {"cross", XC_cross},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 {"cross_reverse", XC_cross_reverse},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 {"crosshair", XC_crosshair},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 {"diamond_cross", XC_diamond_cross},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 {"dot", XC_dot},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 {"dotbox", XC_dotbox},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 {"double_arrow", XC_double_arrow},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 {"draft_large", XC_draft_large},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 {"draft_small", XC_draft_small},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 {"draped_box", XC_draped_box},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 {"exchange", XC_exchange},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 {"fleur", XC_fleur},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 {"gobbler", XC_gobbler},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 {"gumby", XC_gumby},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 {"hand1", XC_hand1},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 {"hand2", XC_hand2},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 {"heart", XC_heart},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 {"icon", XC_icon},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 {"iron_cross", XC_iron_cross},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 {"left_ptr", XC_left_ptr},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 {"left_side", XC_left_side},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 {"left_tee", XC_left_tee},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 {"leftbutton", XC_leftbutton},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 {"ll_angle", XC_ll_angle},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 {"lr_angle", XC_lr_angle},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 {"man", XC_man},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 {"middlebutton", XC_middlebutton},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 {"mouse", XC_mouse},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 {"pencil", XC_pencil},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 {"pirate", XC_pirate},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 {"plus", XC_plus},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 {"question_arrow", XC_question_arrow},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 {"right_ptr", XC_right_ptr},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 {"right_side", XC_right_side},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 {"right_tee", XC_right_tee},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 {"rightbutton", XC_rightbutton},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 {"rtl_logo", XC_rtl_logo},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 {"sailboat", XC_sailboat},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 {"sb_down_arrow", XC_sb_down_arrow},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 {"sb_h_double_arrow", XC_sb_h_double_arrow},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 {"sb_left_arrow", XC_sb_left_arrow},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 {"sb_right_arrow", XC_sb_right_arrow},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 {"sb_up_arrow", XC_sb_up_arrow},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 {"sb_v_double_arrow", XC_sb_v_double_arrow},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 {"shuttle", XC_shuttle},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 {"sizing", XC_sizing},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 {"spider", XC_spider},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 {"spraycan", XC_spraycan},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 {"star", XC_star},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 {"target", XC_target},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 {"tcross", XC_tcross},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 {"top_left_arrow", XC_top_left_arrow},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 {"top_left_corner", XC_top_left_corner},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 {"top_right_corner", XC_top_right_corner},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 {"top_side", XC_top_side},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 {"top_tee", XC_top_tee},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 {"trek", XC_trek},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 {"ul_angle", XC_ul_angle},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 {"umbrella", XC_umbrella},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 {"ur_angle", XC_ur_angle},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 {"watch", XC_watch},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 {"xterm", XC_xterm},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 CONST struct _CursorName *table;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 int i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 char tmp[40];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 if (strlen (name) >= sizeof tmp) return -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 for (i=0; i<strlen(name); i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 if (isupper((unsigned char) name[i]))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 tmp[i] = tolower((unsigned char) name[i]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 tmp[i] = name[i];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 tmp[i] = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 for (i=0, table=cursor_names; i < XtNumber(cursor_names); i++, table++ ) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 if (strcmp(tmp, table->name) == 0) return table->shape;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 return -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 * Based on an optimized version provided by Jim Becker, August 5, 1988.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 #define MAX_SIZE 255
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 /* shared data for the image read/parse logic */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 static short hexTable[256]; /* conversion value */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 static int hex_initialized; /* easier to fill in at run time */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 * Table index for the hex values. Initialized once, first time.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 * Used for translation value or delimiter significance lookup.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 static void initHexTable (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 * We build the table at run time for several reasons:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 * 1. portable to non-ASCII machines.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 * 2. still reentrant since we set the init flag after setting table.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 * 3. easier to extend.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 * 4. less prone to bugs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 hexTable['0'] = 0; hexTable['1'] = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 hexTable['2'] = 2; hexTable['3'] = 3;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 hexTable['4'] = 4; hexTable['5'] = 5;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 hexTable['6'] = 6; hexTable['7'] = 7;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 hexTable['8'] = 8; hexTable['9'] = 9;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 hexTable['A'] = 10; hexTable['B'] = 11;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 hexTable['C'] = 12; hexTable['D'] = 13;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 hexTable['E'] = 14; hexTable['F'] = 15;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 hexTable['a'] = 10; hexTable['b'] = 11;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 hexTable['c'] = 12; hexTable['d'] = 13;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 hexTable['e'] = 14; hexTable['f'] = 15;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 /* delimiters of significance are flagged w/ negative value */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 hexTable[' '] = -1; hexTable[','] = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 hexTable['}'] = -1; hexTable['\n'] = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 hexTable['\t'] = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 hex_initialized = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 * read next hex value in the input stream, return -1 if EOF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 static int NextInt (FILE *fstream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 int ch;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 int value = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 int gotone = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 int done = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 /* loop, accumulate hex value until find delimiter */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 /* skip any initial delimiters found in read stream */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 while (!done) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 ch = getc(fstream);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 if (ch == EOF) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 value = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 done++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 } else {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 /* trim high bits, check type and accumulate */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 ch &= 0xff;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 if (isascii(ch) && isxdigit(ch)) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 value = (value << 4) + hexTable[ch];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 gotone++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 } else if ((hexTable[ch]) < 0 && gotone)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 done++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 return value;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 * The data returned by the following routine is always in left-most byte
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 * first and left-most bit first. If it doesn't return BitmapSuccess then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 * its arguments won't have been touched. This routine should look as much
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 * like the Xlib routine XReadBitmapfile as possible.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 int XmuReadBitmapData (
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 FILE *fstream, /* handle on file */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 unsigned int *width, /* RETURNED */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 unsigned int *height, /* RETURNED */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 unsigned char **datap, /* RETURNED */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 int *x_hot, int *y_hot) /* RETURNED */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 unsigned char *data = NULL; /* working variable */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 char line[MAX_SIZE]; /* input line from file */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 int size; /* number of bytes of data */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 char name_and_type[MAX_SIZE]; /* an input line */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 char *type; /* for parsing */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 int value; /* from an input line */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 int version10p; /* boolean, old format */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 int padding; /* to handle alignment */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 int bytes_per_line; /* per scanline of data */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 unsigned int ww = 0; /* width */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 unsigned int hh = 0; /* height */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 int hx = -1; /* x hotspot */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 int hy = -1; /* y hotspot */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 #ifndef Xmalloc
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 #define Xmalloc(size) malloc(size)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 /* first time initialization */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 if (!hex_initialized) initHexTable();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 /* error cleanup and return macro */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 #define RETURN(code) { if (data) free (data); return code; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 while (fgets(line, MAX_SIZE, fstream)) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 if (strlen(line) == MAX_SIZE-1) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 RETURN (BitmapFileInvalid);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 if (sscanf(line,"#define %s %d",name_and_type,&value) == 2) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 if (!(type = strrchr(name_and_type, '_')))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 type = name_and_type;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 type++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 if (!strcmp("width", type))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 ww = (unsigned int) value;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 if (!strcmp("height", type))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 hh = (unsigned int) value;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 if (!strcmp("hot", type)) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 if (type-- == name_and_type || type-- == name_and_type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 if (!strcmp("x_hot", type))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 hx = value;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 if (!strcmp("y_hot", type))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 hy = value;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 if (sscanf(line, "static short %s = {", name_and_type) == 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 version10p = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 else if (sscanf(line,"static unsigned char %s = {",name_and_type) == 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 version10p = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 else if (sscanf(line, "static char %s = {", name_and_type) == 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 version10p = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 if (!(type = strrchr(name_and_type, '_')))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 type = name_and_type;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 type++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 if (strcmp("bits[]", type))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 if (!ww || !hh)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 RETURN (BitmapFileInvalid);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 if ((ww % 16) && ((ww % 16) < 9) && version10p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 padding = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 padding = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 bytes_per_line = (ww+7)/8 + padding;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 size = bytes_per_line * hh;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 data = (unsigned char *) Xmalloc ((unsigned int) size);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 if (!data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 RETURN (BitmapNoMemory);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 if (version10p) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 unsigned char *ptr;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 int bytes;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 for (bytes=0, ptr=data; bytes<size; (bytes += 2)) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 if ((value = NextInt(fstream)) < 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 RETURN (BitmapFileInvalid);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 *(ptr++) = value;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 if (!padding || ((bytes+2) % bytes_per_line))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 *(ptr++) = value >> 8;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 } else {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 unsigned char *ptr;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 int bytes;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 for (bytes=0, ptr=data; bytes<size; bytes++, ptr++) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 if ((value = NextInt(fstream)) < 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 RETURN (BitmapFileInvalid);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 *ptr=value;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 } /* end while */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 if (data == NULL) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 RETURN (BitmapFileInvalid);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 *datap = data;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 data = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 *width = ww;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 *height = hh;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 if (x_hot) *x_hot = hx;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 if (y_hot) *y_hot = hy;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 RETURN (BitmapSuccess);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 int XmuReadBitmapDataFromFile (CONST char *filename,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 /* Remaining args are RETURNED */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 unsigned int *width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 unsigned int *height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 unsigned char **datap,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 int *x_hot, int *y_hot)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 FILE *fstream;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 int status;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 if ((fstream = fopen (filename, "r")) == NULL) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 return BitmapOpenFailed;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 status = XmuReadBitmapData (fstream, width, height, datap, x_hot, y_hot);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 fclose (fstream);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 return status;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 * XmuPrintDefaultErrorMessage - print a nice error that looks like the usual
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 * message. Return 1 if the caller should consider exiting, else 0.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 int XmuPrintDefaultErrorMessage (Display *dpy, XErrorEvent *event, FILE *fp)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 char buffer[BUFSIZ];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 char mesg[BUFSIZ];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 char number[32];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 char *mtype = "XlibMessage";
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 _XExtension *ext = (_XExtension *)NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 XGetErrorText(dpy, event->error_code, buffer, BUFSIZ);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 fprintf(fp, "%s: %s\n ", mesg, buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 mesg, BUFSIZ);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 fprintf(fp, mesg, event->request_code);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 if (event->request_code < 128) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 sprintf(number, "%d", event->request_code);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 } else {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 /* XXX this is non-portable */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 for (ext = dpy->ext_procs;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 ext && (ext->codes.major_opcode != event->request_code);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 ext = ext->next)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 if (ext)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 strcpy(buffer, ext->name);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 buffer[0] = '\0';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 fprintf(fp, " (%s)", buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 fputs("\n ", fp);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 #if (XtSpecificationRelease >= 5)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423 if (event->request_code >= 128) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 mesg, BUFSIZ);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 fprintf(fp, mesg, event->minor_code);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 if (ext) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 sprintf(mesg, "%s.%d", ext->name, event->minor_code);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 fprintf(fp, " (%s)", buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 fputs("\n ", fp);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 if (event->error_code >= 128) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 /* let extensions try to print the values */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 /* XXX this is non-portable code */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437 for (ext = dpy->ext_procs; ext; ext = ext->next) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 if (ext->error_values)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 (*ext->error_values)(dpy, event, fp);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 /* the rest is a fallback, providing a simple default */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 /* kludge, try to find the extension that caused it */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 buffer[0] = '\0';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 for (ext = dpy->ext_procs; ext; ext = ext->next) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 if (ext->error_string)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 (*ext->error_string)(dpy, event->error_code, &ext->codes,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 buffer, BUFSIZ);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 if (buffer[0])
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 if (buffer[0])
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 sprintf(buffer, "%s.%d", ext->name,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 event->error_code - ext->codes.first_error);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 strcpy(buffer, "Value");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 XGetErrorDatabaseText(dpy, mtype, buffer, "", mesg, BUFSIZ);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 if (*mesg) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 fprintf(fp, mesg, event->resourceid);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 fputs("\n ", fp);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 } else if ((event->error_code == BadWindow) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 (event->error_code == BadPixmap) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 (event->error_code == BadCursor) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 (event->error_code == BadFont) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 (event->error_code == BadDrawable) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 (event->error_code == BadColor) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 (event->error_code == BadGC) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 (event->error_code == BadIDChoice) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 (event->error_code == BadValue) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 (event->error_code == BadAtom)) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 if (event->error_code == BadValue)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 mesg, BUFSIZ);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 else if (event->error_code == BadAtom)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 mesg, BUFSIZ);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 mesg, BUFSIZ);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 fprintf(fp, mesg, event->resourceid);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 fputs("\n ", fp);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 #elif (XtSpecificationRelease == 4)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 mesg, BUFSIZ);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 fprintf(fp, mesg, event->minor_code);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 fputs("\n ", fp);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 if (ext) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 sprintf(mesg, "%s.%d", ext->name, event->minor_code);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 fprintf(fp, " (%s)", buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 mesg, BUFSIZ);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 fprintf(fp, mesg, event->resourceid);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 fputs("\n ", fp);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 ERROR! Unsupported release of X11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501 mesg, BUFSIZ);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 fprintf(fp, mesg, event->serial);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 fputs("\n ", fp);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504 XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%d",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 mesg, BUFSIZ);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506 fprintf(fp, mesg, NextRequest(dpy)-1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 fputs("\n", fp);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 if (event->error_code == BadImplementation) return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 * XmuSimpleErrorHandler - ignore errors for XQueryTree, XGetWindowAttributes,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 * and XGetGeometry; print a message for everything else. In all case, do
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 * not exit.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 int XmuSimpleErrorHandler (Display *dpy, XErrorEvent *errorp)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 switch (errorp->request_code) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521 case X_QueryTree:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 case X_GetWindowAttributes:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 if (errorp->error_code == BadWindow) return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 case X_GetGeometry:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 if (errorp->error_code == BadDrawable) return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 /* got a "real" X error */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 return XmuPrintDefaultErrorMessage (dpy, errorp, stderr);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 void XmuCopyISOLatin1Lowered(char *dst, CONST char *src)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 unsigned char *dest = (unsigned char *) dst;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 unsigned char *source = (unsigned char *) src;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 for ( ; *source; source++, dest++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 if ((*source >= XK_A) && (*source <= XK_Z))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 *dest = *source + (XK_a - XK_A);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 else if ((*source >= XK_Agrave) && (*source <= XK_Odiaeresis))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 *dest = *source + (XK_agrave - XK_Agrave);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544 else if ((*source >= XK_Ooblique) && (*source <= XK_Thorn))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545 *dest = *source + (XK_oslash - XK_Ooblique);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 *dest = *source;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549 *dest = '\0';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551 #endif /* !HAVE_XMU */