1 | /****************************************************************************
|
---|
2 | * Copyright (c) 1998,2004,2005 Free Software Foundation, Inc. *
|
---|
3 | * *
|
---|
4 | * Permission is hereby granted, free of charge, to any person obtaining a *
|
---|
5 | * copy of this software and associated documentation files (the *
|
---|
6 | * "Software"), to deal in the Software without restriction, including *
|
---|
7 | * without limitation the rights to use, copy, modify, merge, publish, *
|
---|
8 | * distribute, distribute with modifications, sublicense, and/or sell *
|
---|
9 | * copies of the Software, and to permit persons to whom the Software is *
|
---|
10 | * furnished to do so, subject to the following conditions: *
|
---|
11 | * *
|
---|
12 | * The above copyright notice and this permission notice shall be included *
|
---|
13 | * in all copies or substantial portions of the Software. *
|
---|
14 | * *
|
---|
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
---|
16 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
---|
17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
---|
18 | * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
---|
19 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
---|
20 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
---|
21 | * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
---|
22 | * *
|
---|
23 | * Except as contained in this notice, the name(s) of the above copyright *
|
---|
24 | * holders shall not be used in advertising or otherwise to promote the *
|
---|
25 | * sale, use or other dealings in this Software without prior written *
|
---|
26 | * authorization. *
|
---|
27 | ****************************************************************************/
|
---|
28 |
|
---|
29 | /****************************************************************************
|
---|
30 | * Author: Juergen Pfeifer, 1996 *
|
---|
31 | ****************************************************************************/
|
---|
32 |
|
---|
33 | /*
|
---|
34 | Version Control
|
---|
35 | $Id: gen.c,v 1.40 2005/01/22 17:03:48 tom Exp $
|
---|
36 | --------------------------------------------------------------------------*/
|
---|
37 | /*
|
---|
38 | This program generates various record structures and constants from the
|
---|
39 | ncurses header file for the Ada95 packages. Essentially it produces
|
---|
40 | Ada95 source on stdout, which is then merged using m4 into a template
|
---|
41 | to produce the real source.
|
---|
42 | */
|
---|
43 |
|
---|
44 | #include <stdlib.h>
|
---|
45 | #include <stddef.h>
|
---|
46 | #include <string.h>
|
---|
47 | #include <assert.h>
|
---|
48 | #include <ctype.h>
|
---|
49 |
|
---|
50 | #include <menu.h>
|
---|
51 | #include <form.h>
|
---|
52 |
|
---|
53 | #define RES_NAME "Reserved"
|
---|
54 |
|
---|
55 | static const char *model = "";
|
---|
56 | static int little_endian = 0;
|
---|
57 |
|
---|
58 | typedef struct
|
---|
59 | {
|
---|
60 | const char *name;
|
---|
61 | unsigned long attr;
|
---|
62 | }
|
---|
63 | name_attribute_pair;
|
---|
64 |
|
---|
65 | static int
|
---|
66 | find_pos(char *s, unsigned len, int *low, int *high)
|
---|
67 | {
|
---|
68 | unsigned int i, j;
|
---|
69 | int l = 0;
|
---|
70 |
|
---|
71 | *high = -1;
|
---|
72 | *low = 8 * len;
|
---|
73 |
|
---|
74 | for (i = 0; i < len; i++, s++)
|
---|
75 | {
|
---|
76 | if (*s)
|
---|
77 | {
|
---|
78 | for (j = 0; j < 8 * sizeof(char); j++)
|
---|
79 |
|
---|
80 | {
|
---|
81 | if (((little_endian && ((*s) & 0x01)) ||
|
---|
82 | (!little_endian && ((*s) & 0x80))))
|
---|
83 | {
|
---|
84 | if (l > *high)
|
---|
85 | *high = l;
|
---|
86 | if (l < *low)
|
---|
87 | *low = l;
|
---|
88 | }
|
---|
89 | l++;
|
---|
90 | if (little_endian)
|
---|
91 | *s >>= 1;
|
---|
92 | else
|
---|
93 | *s <<= 1;
|
---|
94 | }
|
---|
95 | }
|
---|
96 | else
|
---|
97 | l += 8;
|
---|
98 | }
|
---|
99 | return (*high >= 0 && (*low <= *high)) ? *low : -1;
|
---|
100 | }
|
---|
101 |
|
---|
102 | /*
|
---|
103 | * This helper routine generates a representation clause for a
|
---|
104 | * record type defined in the binding.
|
---|
105 | * We are only dealing with record types which are of 32 or 16
|
---|
106 | * bit size, i.e. they fit into an (u)int or a (u)short.
|
---|
107 | */
|
---|
108 | static void
|
---|
109 | gen_reps
|
---|
110 | (const name_attribute_pair * nap, /* array of name_attribute_pair records */
|
---|
111 | const char *name, /* name of the represented record type */
|
---|
112 | int len, /* size of the record in bytes */
|
---|
113 | int bias)
|
---|
114 | {
|
---|
115 | int i, n, l, cnt = 0, low, high;
|
---|
116 | int width = strlen(RES_NAME) + 3;
|
---|
117 | unsigned long a;
|
---|
118 | unsigned long mask = 0;
|
---|
119 |
|
---|
120 | assert(nap != NULL);
|
---|
121 |
|
---|
122 | for (i = 0; nap[i].name != (char *)0; i++)
|
---|
123 | {
|
---|
124 | cnt++;
|
---|
125 | l = strlen(nap[i].name);
|
---|
126 | if (l > width)
|
---|
127 | width = l;
|
---|
128 | }
|
---|
129 | assert(width > 0);
|
---|
130 |
|
---|
131 | printf(" type %s is\n", name);
|
---|
132 | printf(" record\n");
|
---|
133 | for (i = 0; nap[i].name != (char *)0; i++)
|
---|
134 | {
|
---|
135 | printf(" %-*s : Boolean;\n", width, nap[i].name);
|
---|
136 | }
|
---|
137 | printf(" end record;\n");
|
---|
138 | printf(" pragma Convention (C, %s);\n\n", name);
|
---|
139 |
|
---|
140 | printf(" for %s use\n", name);
|
---|
141 | printf(" record\n");
|
---|
142 |
|
---|
143 | for (i = 0; nap[i].name != (char *)0; i++)
|
---|
144 | {
|
---|
145 | a = nap[i].attr;
|
---|
146 | mask |= a;
|
---|
147 | l = find_pos((char *)&a, sizeof(a), &low, &high);
|
---|
148 | if (l >= 0)
|
---|
149 | printf(" %-*s at 0 range %2d .. %2d;\n", width, nap[i].name,
|
---|
150 | low - bias, high - bias);
|
---|
151 | }
|
---|
152 | i = 1;
|
---|
153 | n = cnt;
|
---|
154 | printf(" end record;\n");
|
---|
155 | printf(" for %s'Size use %d;\n", name, 8 * len);
|
---|
156 | printf(" -- Please note: this rep. clause is generated and may be\n");
|
---|
157 | printf(" -- different on your system.");
|
---|
158 | }
|
---|
159 |
|
---|
160 | static void
|
---|
161 | chtype_rep(const char *name, attr_t mask)
|
---|
162 | {
|
---|
163 | attr_t x = -1;
|
---|
164 | attr_t t = x & mask;
|
---|
165 | int low, high;
|
---|
166 | int l = find_pos((char *)&t, sizeof(t), &low, &high);
|
---|
167 |
|
---|
168 | if (l >= 0)
|
---|
169 | printf(" %-5s at 0 range %2d .. %2d;\n", name, low, high);
|
---|
170 | }
|
---|
171 |
|
---|
172 | static void
|
---|
173 | gen_chtype_rep(const char *name)
|
---|
174 | {
|
---|
175 | printf(" for %s use\n record\n", name);
|
---|
176 | chtype_rep("Ch", A_CHARTEXT);
|
---|
177 | chtype_rep("Color", A_COLOR);
|
---|
178 | chtype_rep("Attr", (A_ATTRIBUTES & ~A_COLOR));
|
---|
179 | printf(" end record;\n for %s'Size use %ld;\n",
|
---|
180 | name, (long)(8 * sizeof(chtype)));
|
---|
181 |
|
---|
182 | printf(" -- Please note: this rep. clause is generated and may be\n");
|
---|
183 | printf(" -- different on your system.\n");
|
---|
184 | }
|
---|
185 |
|
---|
186 | static void
|
---|
187 | mrep_rep(const char *name, void *rec)
|
---|
188 | {
|
---|
189 | int low, high;
|
---|
190 | int l = find_pos((char *)rec, sizeof(MEVENT), &low, &high);
|
---|
191 |
|
---|
192 | if (l >= 0)
|
---|
193 | printf(" %-7s at 0 range %3d .. %3d;\n", name, low, high);
|
---|
194 | }
|
---|
195 |
|
---|
196 | static void
|
---|
197 | gen_mrep_rep(const char *name)
|
---|
198 | {
|
---|
199 | MEVENT x;
|
---|
200 |
|
---|
201 | printf(" for %s use\n record\n", name);
|
---|
202 |
|
---|
203 | memset(&x, 0, sizeof(x));
|
---|
204 | x.id = -1;
|
---|
205 | mrep_rep("Id", &x);
|
---|
206 |
|
---|
207 | memset(&x, 0, sizeof(x));
|
---|
208 | x.x = -1;
|
---|
209 | mrep_rep("X", &x);
|
---|
210 |
|
---|
211 | memset(&x, 0, sizeof(x));
|
---|
212 | x.y = -1;
|
---|
213 | mrep_rep("Y", &x);
|
---|
214 |
|
---|
215 | memset(&x, 0, sizeof(x));
|
---|
216 | x.z = -1;
|
---|
217 | mrep_rep("Z", &x);
|
---|
218 |
|
---|
219 | memset(&x, 0, sizeof(x));
|
---|
220 | x.bstate = -1;
|
---|
221 | mrep_rep("Bstate", &x);
|
---|
222 |
|
---|
223 | printf(" end record;\n");
|
---|
224 | printf(" -- Please note: this rep. clause is generated and may be\n");
|
---|
225 | printf(" -- different on your system.\n");
|
---|
226 | }
|
---|
227 |
|
---|
228 | static void
|
---|
229 | gen_attr_set(const char *name)
|
---|
230 | {
|
---|
231 | /* All of the A_xxx symbols are defined in ncurses, but not all are nonzero
|
---|
232 | * if "configure --enable-widec" is specified.
|
---|
233 | */
|
---|
234 | static const name_attribute_pair nap[] =
|
---|
235 | {
|
---|
236 | #if A_STANDOUT
|
---|
237 | {"Stand_Out", A_STANDOUT},
|
---|
238 | #endif
|
---|
239 | #if A_UNDERLINE
|
---|
240 | {"Under_Line", A_UNDERLINE},
|
---|
241 | #endif
|
---|
242 | #if A_REVERSE
|
---|
243 | {"Reverse_Video", A_REVERSE},
|
---|
244 | #endif
|
---|
245 | #if A_BLINK
|
---|
246 | {"Blink", A_BLINK},
|
---|
247 | #endif
|
---|
248 | #if A_DIM
|
---|
249 | {"Dim_Character", A_DIM},
|
---|
250 | #endif
|
---|
251 | #if A_BOLD
|
---|
252 | {"Bold_Character", A_BOLD},
|
---|
253 | #endif
|
---|
254 | #if A_ALTCHARSET
|
---|
255 | {"Alternate_Character_Set", A_ALTCHARSET},
|
---|
256 | #endif
|
---|
257 | #if A_INVIS
|
---|
258 | {"Invisible_Character", A_INVIS},
|
---|
259 | #endif
|
---|
260 | #if A_PROTECT
|
---|
261 | {"Protected_Character", A_PROTECT},
|
---|
262 | #endif
|
---|
263 | #if A_HORIZONTAL
|
---|
264 | {"Horizontal", A_HORIZONTAL},
|
---|
265 | #endif
|
---|
266 | #if A_LEFT
|
---|
267 | {"Left", A_LEFT},
|
---|
268 | #endif
|
---|
269 | #if A_LOW
|
---|
270 | {"Low", A_LOW},
|
---|
271 | #endif
|
---|
272 | #if A_RIGHT
|
---|
273 | {"Right", A_RIGHT},
|
---|
274 | #endif
|
---|
275 | #if A_TOP
|
---|
276 | {"Top", A_TOP},
|
---|
277 | #endif
|
---|
278 | #if A_VERTICAL
|
---|
279 | {"Vertical", A_VERTICAL},
|
---|
280 | #endif
|
---|
281 | {(char *)0, 0}
|
---|
282 | };
|
---|
283 | chtype attr = A_ATTRIBUTES & ~A_COLOR;
|
---|
284 | int start = -1;
|
---|
285 | int len = 0;
|
---|
286 | int i, set;
|
---|
287 | for (i = 0; i < (int)(8 * sizeof(chtype)); i++)
|
---|
288 |
|
---|
289 | {
|
---|
290 | set = attr & 1;
|
---|
291 | if (set)
|
---|
292 | {
|
---|
293 | if (start < 0)
|
---|
294 | start = i;
|
---|
295 | if (start >= 0)
|
---|
296 | {
|
---|
297 | len++;
|
---|
298 | }
|
---|
299 | }
|
---|
300 | attr = attr >> 1;
|
---|
301 | }
|
---|
302 | gen_reps(nap, name, (len + 7) / 8, little_endian ? start : 0);
|
---|
303 | }
|
---|
304 |
|
---|
305 | static void
|
---|
306 | gen_trace(const char *name)
|
---|
307 | {
|
---|
308 | static const name_attribute_pair nap[] =
|
---|
309 | {
|
---|
310 | {"Times", TRACE_TIMES},
|
---|
311 | {"Tputs", TRACE_TPUTS},
|
---|
312 | {"Update", TRACE_UPDATE},
|
---|
313 | {"Cursor_Move", TRACE_MOVE},
|
---|
314 | {"Character_Output", TRACE_CHARPUT},
|
---|
315 | {"Calls", TRACE_CALLS},
|
---|
316 | {"Virtual_Puts", TRACE_VIRTPUT},
|
---|
317 | {"Input_Events", TRACE_IEVENT},
|
---|
318 | {"TTY_State", TRACE_BITS},
|
---|
319 | {"Internal_Calls", TRACE_ICALLS},
|
---|
320 | {"Character_Calls", TRACE_CCALLS},
|
---|
321 | {"Termcap_TermInfo", TRACE_DATABASE},
|
---|
322 | {(char *)0, 0}
|
---|
323 | };
|
---|
324 | gen_reps(nap, name, sizeof(int), 0);
|
---|
325 | }
|
---|
326 |
|
---|
327 | static void
|
---|
328 | gen_menu_opt_rep(const char *name)
|
---|
329 | {
|
---|
330 | static const name_attribute_pair nap[] =
|
---|
331 | {
|
---|
332 | #ifdef O_ONEVALUE
|
---|
333 | {"One_Valued", O_ONEVALUE},
|
---|
334 | #endif
|
---|
335 | #ifdef O_SHOWDESC
|
---|
336 | {"Show_Descriptions", O_SHOWDESC},
|
---|
337 | #endif
|
---|
338 | #ifdef O_ROWMAJOR
|
---|
339 | {"Row_Major_Order", O_ROWMAJOR},
|
---|
340 | #endif
|
---|
341 | #ifdef O_IGNORECASE
|
---|
342 | {"Ignore_Case", O_IGNORECASE},
|
---|
343 | #endif
|
---|
344 | #ifdef O_SHOWMATCH
|
---|
345 | {"Show_Matches", O_SHOWMATCH},
|
---|
346 | #endif
|
---|
347 | #ifdef O_NONCYCLIC
|
---|
348 | {"Non_Cyclic", O_NONCYCLIC},
|
---|
349 | #endif
|
---|
350 | {(char *)0, 0}
|
---|
351 | };
|
---|
352 | gen_reps(nap, name, sizeof(int), 0);
|
---|
353 | }
|
---|
354 |
|
---|
355 | static void
|
---|
356 | gen_item_opt_rep(const char *name)
|
---|
357 | {
|
---|
358 | static const name_attribute_pair nap[] =
|
---|
359 | {
|
---|
360 | #ifdef O_SELECTABLE
|
---|
361 | {"Selectable", O_SELECTABLE},
|
---|
362 | #endif
|
---|
363 | {(char *)0, 0}
|
---|
364 | };
|
---|
365 | gen_reps(nap, name, sizeof(int), 0);
|
---|
366 | }
|
---|
367 |
|
---|
368 | static void
|
---|
369 | gen_form_opt_rep(const char *name)
|
---|
370 | {
|
---|
371 | static const name_attribute_pair nap[] =
|
---|
372 | {
|
---|
373 | #ifdef O_NL_OVERLOAD
|
---|
374 | {"NL_Overload", O_NL_OVERLOAD},
|
---|
375 | #endif
|
---|
376 | #ifdef O_BS_OVERLOAD
|
---|
377 | {"BS_Overload", O_BS_OVERLOAD},
|
---|
378 | #endif
|
---|
379 | {(char *)0, 0}
|
---|
380 | };
|
---|
381 | gen_reps(nap, name, sizeof(int), 0);
|
---|
382 | }
|
---|
383 |
|
---|
384 | /*
|
---|
385 | * Generate the representation clause for the Field_Option_Set record
|
---|
386 | */
|
---|
387 | static void
|
---|
388 | gen_field_opt_rep(const char *name)
|
---|
389 | {
|
---|
390 | static const name_attribute_pair nap[] =
|
---|
391 | {
|
---|
392 | #ifdef O_VISIBLE
|
---|
393 | {"Visible", O_VISIBLE},
|
---|
394 | #endif
|
---|
395 | #ifdef O_ACTIVE
|
---|
396 | {"Active", O_ACTIVE},
|
---|
397 | #endif
|
---|
398 | #ifdef O_PUBLIC
|
---|
399 | {"Public", O_PUBLIC},
|
---|
400 | #endif
|
---|
401 | #ifdef O_EDIT
|
---|
402 | {"Edit", O_EDIT},
|
---|
403 | #endif
|
---|
404 | #ifdef O_WRAP
|
---|
405 | {"Wrap", O_WRAP},
|
---|
406 | #endif
|
---|
407 | #ifdef O_BLANK
|
---|
408 | {"Blank", O_BLANK},
|
---|
409 | #endif
|
---|
410 | #ifdef O_AUTOSKIP
|
---|
411 | {"Auto_Skip", O_AUTOSKIP},
|
---|
412 | #endif
|
---|
413 | #ifdef O_NULLOK
|
---|
414 | {"Null_Ok", O_NULLOK},
|
---|
415 | #endif
|
---|
416 | #ifdef O_PASSOK
|
---|
417 | {"Pass_Ok", O_PASSOK},
|
---|
418 | #endif
|
---|
419 | #ifdef O_STATIC
|
---|
420 | {"Static", O_STATIC},
|
---|
421 | #endif
|
---|
422 | {(char *)0, 0}
|
---|
423 | };
|
---|
424 | gen_reps(nap, name, sizeof(int), 0);
|
---|
425 | }
|
---|
426 |
|
---|
427 | /*
|
---|
428 | * Generate a single key code constant definition.
|
---|
429 | */
|
---|
430 | static void
|
---|
431 | keydef(const char *name, const char *old_name, int value, int mode)
|
---|
432 | {
|
---|
433 | if (mode == 0) /* Generate the new name */
|
---|
434 | printf(" %-30s : constant Special_Key_Code := 8#%3o#;\n", name, value);
|
---|
435 | else
|
---|
436 | { /* generate the old name, but only if it doesn't conflict with the old
|
---|
437 | * name (Ada95 isn't case sensitive!)
|
---|
438 | */
|
---|
439 | const char *s = old_name;
|
---|
440 | const char *t = name;
|
---|
441 |
|
---|
442 | while (*s && *t && (toupper(*s++) == toupper(*t++)));
|
---|
443 | if (*s || *t)
|
---|
444 | printf(" %-16s : Special_Key_Code renames %s;\n", old_name, name);
|
---|
445 | }
|
---|
446 | }
|
---|
447 |
|
---|
448 | /*
|
---|
449 | * Generate constants for the key codes. When called with mode==0, a
|
---|
450 | * complete list with nice constant names in proper casing style will
|
---|
451 | * be generated. Otherwise a list of old (i.e. C-style) names will be
|
---|
452 | * generated, given that the name wasn't already defined in the "nice"
|
---|
453 | * list.
|
---|
454 | */
|
---|
455 | static void
|
---|
456 | gen_keydefs(int mode)
|
---|
457 | {
|
---|
458 | char buf[16];
|
---|
459 | char obuf[16];
|
---|
460 | int i;
|
---|
461 |
|
---|
462 | #ifdef KEY_CODE_YES
|
---|
463 | keydef("Key_Code_Yes", "KEY_CODE_YES", KEY_CODE_YES, mode);
|
---|
464 | #endif
|
---|
465 | #ifdef KEY_MIN
|
---|
466 | keydef("Key_Min", "KEY_MIN", KEY_MIN, mode);
|
---|
467 | #endif
|
---|
468 | #ifdef KEY_BREAK
|
---|
469 | keydef("Key_Break", "KEY_BREAK", KEY_BREAK, mode);
|
---|
470 | #endif
|
---|
471 | #ifdef KEY_DOWN
|
---|
472 | keydef("Key_Cursor_Down", "KEY_DOWN", KEY_DOWN, mode);
|
---|
473 | #endif
|
---|
474 | #ifdef KEY_UP
|
---|
475 | keydef("Key_Cursor_Up", "KEY_UP", KEY_UP, mode);
|
---|
476 | #endif
|
---|
477 | #ifdef KEY_LEFT
|
---|
478 | keydef("Key_Cursor_Left", "KEY_LEFT", KEY_LEFT, mode);
|
---|
479 | #endif
|
---|
480 | #ifdef KEY_RIGHT
|
---|
481 | keydef("Key_Cursor_Right", "KEY_RIGHT", KEY_RIGHT, mode);
|
---|
482 | #endif
|
---|
483 | #ifdef KEY_HOME
|
---|
484 | keydef("Key_Home", "KEY_HOME", KEY_HOME, mode);
|
---|
485 | #endif
|
---|
486 | #ifdef KEY_BACKSPACE
|
---|
487 | keydef("Key_Backspace", "KEY_BACKSPACE", KEY_BACKSPACE, mode);
|
---|
488 | #endif
|
---|
489 | #ifdef KEY_F0
|
---|
490 | keydef("Key_F0", "KEY_F0", KEY_F0, mode);
|
---|
491 | #endif
|
---|
492 | #ifdef KEY_F
|
---|
493 | for (i = 1; i <= 24; i++)
|
---|
494 | {
|
---|
495 | sprintf(buf, "Key_F%d", i);
|
---|
496 | sprintf(obuf, "KEY_F%d", i);
|
---|
497 | keydef(buf, obuf, KEY_F(i), mode);
|
---|
498 | }
|
---|
499 | #endif
|
---|
500 | #ifdef KEY_DL
|
---|
501 | keydef("Key_Delete_Line", "KEY_DL", KEY_DL, mode);
|
---|
502 | #endif
|
---|
503 | #ifdef KEY_IL
|
---|
504 | keydef("Key_Insert_Line", "KEY_IL", KEY_IL, mode);
|
---|
505 | #endif
|
---|
506 | #ifdef KEY_DC
|
---|
507 | keydef("Key_Delete_Char", "KEY_DC", KEY_DC, mode);
|
---|
508 | #endif
|
---|
509 | #ifdef KEY_IC
|
---|
510 | keydef("Key_Insert_Char", "KEY_IC", KEY_IC, mode);
|
---|
511 | #endif
|
---|
512 | #ifdef KEY_EIC
|
---|
513 | keydef("Key_Exit_Insert_Mode", "KEY_EIC", KEY_EIC, mode);
|
---|
514 | #endif
|
---|
515 | #ifdef KEY_CLEAR
|
---|
516 | keydef("Key_Clear_Screen", "KEY_CLEAR", KEY_CLEAR, mode);
|
---|
517 | #endif
|
---|
518 | #ifdef KEY_EOS
|
---|
519 | keydef("Key_Clear_End_Of_Screen", "KEY_EOS", KEY_EOS, mode);
|
---|
520 | #endif
|
---|
521 | #ifdef KEY_EOL
|
---|
522 | keydef("Key_Clear_End_Of_Line", "KEY_EOL", KEY_EOL, mode);
|
---|
523 | #endif
|
---|
524 | #ifdef KEY_SF
|
---|
525 | keydef("Key_Scroll_1_Forward", "KEY_SF", KEY_SF, mode);
|
---|
526 | #endif
|
---|
527 | #ifdef KEY_SR
|
---|
528 | keydef("Key_Scroll_1_Backward", "KEY_SR", KEY_SR, mode);
|
---|
529 | #endif
|
---|
530 | #ifdef KEY_NPAGE
|
---|
531 | keydef("Key_Next_Page", "KEY_NPAGE", KEY_NPAGE, mode);
|
---|
532 | #endif
|
---|
533 | #ifdef KEY_PPAGE
|
---|
534 | keydef("Key_Previous_Page", "KEY_PPAGE", KEY_PPAGE, mode);
|
---|
535 | #endif
|
---|
536 | #ifdef KEY_STAB
|
---|
537 | keydef("Key_Set_Tab", "KEY_STAB", KEY_STAB, mode);
|
---|
538 | #endif
|
---|
539 | #ifdef KEY_CTAB
|
---|
540 | keydef("Key_Clear_Tab", "KEY_CTAB", KEY_CTAB, mode);
|
---|
541 | #endif
|
---|
542 | #ifdef KEY_CATAB
|
---|
543 | keydef("Key_Clear_All_Tabs", "KEY_CATAB", KEY_CATAB, mode);
|
---|
544 | #endif
|
---|
545 | #ifdef KEY_ENTER
|
---|
546 | keydef("Key_Enter_Or_Send", "KEY_ENTER", KEY_ENTER, mode);
|
---|
547 | #endif
|
---|
548 | #ifdef KEY_SRESET
|
---|
549 | keydef("Key_Soft_Reset", "KEY_SRESET", KEY_SRESET, mode);
|
---|
550 | #endif
|
---|
551 | #ifdef KEY_RESET
|
---|
552 | keydef("Key_Reset", "KEY_RESET", KEY_RESET, mode);
|
---|
553 | #endif
|
---|
554 | #ifdef KEY_PRINT
|
---|
555 | keydef("Key_Print", "KEY_PRINT", KEY_PRINT, mode);
|
---|
556 | #endif
|
---|
557 | #ifdef KEY_LL
|
---|
558 | keydef("Key_Bottom", "KEY_LL", KEY_LL, mode);
|
---|
559 | #endif
|
---|
560 | #ifdef KEY_A1
|
---|
561 | keydef("Key_Upper_Left_Of_Keypad", "KEY_A1", KEY_A1, mode);
|
---|
562 | #endif
|
---|
563 | #ifdef KEY_A3
|
---|
564 | keydef("Key_Upper_Right_Of_Keypad", "KEY_A3", KEY_A3, mode);
|
---|
565 | #endif
|
---|
566 | #ifdef KEY_B2
|
---|
567 | keydef("Key_Center_Of_Keypad", "KEY_B2", KEY_B2, mode);
|
---|
568 | #endif
|
---|
569 | #ifdef KEY_C1
|
---|
570 | keydef("Key_Lower_Left_Of_Keypad", "KEY_C1", KEY_C1, mode);
|
---|
571 | #endif
|
---|
572 | #ifdef KEY_C3
|
---|
573 | keydef("Key_Lower_Right_Of_Keypad", "KEY_C3", KEY_C3, mode);
|
---|
574 | #endif
|
---|
575 | #ifdef KEY_BTAB
|
---|
576 | keydef("Key_Back_Tab", "KEY_BTAB", KEY_BTAB, mode);
|
---|
577 | #endif
|
---|
578 | #ifdef KEY_BEG
|
---|
579 | keydef("Key_Beginning", "KEY_BEG", KEY_BEG, mode);
|
---|
580 | #endif
|
---|
581 | #ifdef KEY_CANCEL
|
---|
582 | keydef("Key_Cancel", "KEY_CANCEL", KEY_CANCEL, mode);
|
---|
583 | #endif
|
---|
584 | #ifdef KEY_CLOSE
|
---|
585 | keydef("Key_Close", "KEY_CLOSE", KEY_CLOSE, mode);
|
---|
586 | #endif
|
---|
587 | #ifdef KEY_COMMAND
|
---|
588 | keydef("Key_Command", "KEY_COMMAND", KEY_COMMAND, mode);
|
---|
589 | #endif
|
---|
590 | #ifdef KEY_COPY
|
---|
591 | keydef("Key_Copy", "KEY_COPY", KEY_COPY, mode);
|
---|
592 | #endif
|
---|
593 | #ifdef KEY_CREATE
|
---|
594 | keydef("Key_Create", "KEY_CREATE", KEY_CREATE, mode);
|
---|
595 | #endif
|
---|
596 | #ifdef KEY_END
|
---|
597 | keydef("Key_End", "KEY_END", KEY_END, mode);
|
---|
598 | #endif
|
---|
599 | #ifdef KEY_EXIT
|
---|
600 | keydef("Key_Exit", "KEY_EXIT", KEY_EXIT, mode);
|
---|
601 | #endif
|
---|
602 | #ifdef KEY_FIND
|
---|
603 | keydef("Key_Find", "KEY_FIND", KEY_FIND, mode);
|
---|
604 | #endif
|
---|
605 | #ifdef KEY_HELP
|
---|
606 | keydef("Key_Help", "KEY_HELP", KEY_HELP, mode);
|
---|
607 | #endif
|
---|
608 | #ifdef KEY_MARK
|
---|
609 | keydef("Key_Mark", "KEY_MARK", KEY_MARK, mode);
|
---|
610 | #endif
|
---|
611 | #ifdef KEY_MESSAGE
|
---|
612 | keydef("Key_Message", "KEY_MESSAGE", KEY_MESSAGE, mode);
|
---|
613 | #endif
|
---|
614 | #ifdef KEY_MOVE
|
---|
615 | keydef("Key_Move", "KEY_MOVE", KEY_MOVE, mode);
|
---|
616 | #endif
|
---|
617 | #ifdef KEY_NEXT
|
---|
618 | keydef("Key_Next", "KEY_NEXT", KEY_NEXT, mode);
|
---|
619 | #endif
|
---|
620 | #ifdef KEY_OPEN
|
---|
621 | keydef("Key_Open", "KEY_OPEN", KEY_OPEN, mode);
|
---|
622 | #endif
|
---|
623 | #ifdef KEY_OPTIONS
|
---|
624 | keydef("Key_Options", "KEY_OPTIONS", KEY_OPTIONS, mode);
|
---|
625 | #endif
|
---|
626 | #ifdef KEY_PREVIOUS
|
---|
627 | keydef("Key_Previous", "KEY_PREVIOUS", KEY_PREVIOUS, mode);
|
---|
628 | #endif
|
---|
629 | #ifdef KEY_REDO
|
---|
630 | keydef("Key_Redo", "KEY_REDO", KEY_REDO, mode);
|
---|
631 | #endif
|
---|
632 | #ifdef KEY_REFERENCE
|
---|
633 | keydef("Key_Reference", "KEY_REFERENCE", KEY_REFERENCE, mode);
|
---|
634 | #endif
|
---|
635 | #ifdef KEY_REFRESH
|
---|
636 | keydef("Key_Refresh", "KEY_REFRESH", KEY_REFRESH, mode);
|
---|
637 | #endif
|
---|
638 | #ifdef KEY_REPLACE
|
---|
639 | keydef("Key_Replace", "KEY_REPLACE", KEY_REPLACE, mode);
|
---|
640 | #endif
|
---|
641 | #ifdef KEY_RESTART
|
---|
642 | keydef("Key_Restart", "KEY_RESTART", KEY_RESTART, mode);
|
---|
643 | #endif
|
---|
644 | #ifdef KEY_RESUME
|
---|
645 | keydef("Key_Resume", "KEY_RESUME", KEY_RESUME, mode);
|
---|
646 | #endif
|
---|
647 | #ifdef KEY_SAVE
|
---|
648 | keydef("Key_Save", "KEY_SAVE", KEY_SAVE, mode);
|
---|
649 | #endif
|
---|
650 | #ifdef KEY_SBEG
|
---|
651 | keydef("Key_Shift_Begin", "KEY_SBEG", KEY_SBEG, mode);
|
---|
652 | #endif
|
---|
653 | #ifdef KEY_SCANCEL
|
---|
654 | keydef("Key_Shift_Cancel", "KEY_SCANCEL", KEY_SCANCEL, mode);
|
---|
655 | #endif
|
---|
656 | #ifdef KEY_SCOMMAND
|
---|
657 | keydef("Key_Shift_Command", "KEY_SCOMMAND", KEY_SCOMMAND, mode);
|
---|
658 | #endif
|
---|
659 | #ifdef KEY_SCOPY
|
---|
660 | keydef("Key_Shift_Copy", "KEY_SCOPY", KEY_SCOPY, mode);
|
---|
661 | #endif
|
---|
662 | #ifdef KEY_SCREATE
|
---|
663 | keydef("Key_Shift_Create", "KEY_SCREATE", KEY_SCREATE, mode);
|
---|
664 | #endif
|
---|
665 | #ifdef KEY_SDC
|
---|
666 | keydef("Key_Shift_Delete_Char", "KEY_SDC", KEY_SDC, mode);
|
---|
667 | #endif
|
---|
668 | #ifdef KEY_SDL
|
---|
669 | keydef("Key_Shift_Delete_Line", "KEY_SDL", KEY_SDL, mode);
|
---|
670 | #endif
|
---|
671 | #ifdef KEY_SELECT
|
---|
672 | keydef("Key_Select", "KEY_SELECT", KEY_SELECT, mode);
|
---|
673 | #endif
|
---|
674 | #ifdef KEY_SEND
|
---|
675 | keydef("Key_Shift_End", "KEY_SEND", KEY_SEND, mode);
|
---|
676 | #endif
|
---|
677 | #ifdef KEY_SEOL
|
---|
678 | keydef("Key_Shift_Clear_End_Of_Line", "KEY_SEOL", KEY_SEOL, mode);
|
---|
679 | #endif
|
---|
680 | #ifdef KEY_SEXIT
|
---|
681 | keydef("Key_Shift_Exit", "KEY_SEXIT", KEY_SEXIT, mode);
|
---|
682 | #endif
|
---|
683 | #ifdef KEY_SFIND
|
---|
684 | keydef("Key_Shift_Find", "KEY_SFIND", KEY_SFIND, mode);
|
---|
685 | #endif
|
---|
686 | #ifdef KEY_SHELP
|
---|
687 | keydef("Key_Shift_Help", "KEY_SHELP", KEY_SHELP, mode);
|
---|
688 | #endif
|
---|
689 | #ifdef KEY_SHOME
|
---|
690 | keydef("Key_Shift_Home", "KEY_SHOME", KEY_SHOME, mode);
|
---|
691 | #endif
|
---|
692 | #ifdef KEY_SIC
|
---|
693 | keydef("Key_Shift_Insert_Char", "KEY_SIC", KEY_SIC, mode);
|
---|
694 | #endif
|
---|
695 | #ifdef KEY_SLEFT
|
---|
696 | keydef("Key_Shift_Cursor_Left", "KEY_SLEFT", KEY_SLEFT, mode);
|
---|
697 | #endif
|
---|
698 | #ifdef KEY_SMESSAGE
|
---|
699 | keydef("Key_Shift_Message", "KEY_SMESSAGE", KEY_SMESSAGE, mode);
|
---|
700 | #endif
|
---|
701 | #ifdef KEY_SMOVE
|
---|
702 | keydef("Key_Shift_Move", "KEY_SMOVE", KEY_SMOVE, mode);
|
---|
703 | #endif
|
---|
704 | #ifdef KEY_SNEXT
|
---|
705 | keydef("Key_Shift_Next_Page", "KEY_SNEXT", KEY_SNEXT, mode);
|
---|
706 | #endif
|
---|
707 | #ifdef KEY_SOPTIONS
|
---|
708 | keydef("Key_Shift_Options", "KEY_SOPTIONS", KEY_SOPTIONS, mode);
|
---|
709 | #endif
|
---|
710 | #ifdef KEY_SPREVIOUS
|
---|
711 | keydef("Key_Shift_Previous_Page", "KEY_SPREVIOUS", KEY_SPREVIOUS, mode);
|
---|
712 | #endif
|
---|
713 | #ifdef KEY_SPRINT
|
---|
714 | keydef("Key_Shift_Print", "KEY_SPRINT", KEY_SPRINT, mode);
|
---|
715 | #endif
|
---|
716 | #ifdef KEY_SREDO
|
---|
717 | keydef("Key_Shift_Redo", "KEY_SREDO", KEY_SREDO, mode);
|
---|
718 | #endif
|
---|
719 | #ifdef KEY_SREPLACE
|
---|
720 | keydef("Key_Shift_Replace", "KEY_SREPLACE", KEY_SREPLACE, mode);
|
---|
721 | #endif
|
---|
722 | #ifdef KEY_SRIGHT
|
---|
723 | keydef("Key_Shift_Cursor_Right", "KEY_SRIGHT", KEY_SRIGHT, mode);
|
---|
724 | #endif
|
---|
725 | #ifdef KEY_SRSUME
|
---|
726 | keydef("Key_Shift_Resume", "KEY_SRSUME", KEY_SRSUME, mode);
|
---|
727 | #endif
|
---|
728 | #ifdef KEY_SSAVE
|
---|
729 | keydef("Key_Shift_Save", "KEY_SSAVE", KEY_SSAVE, mode);
|
---|
730 | #endif
|
---|
731 | #ifdef KEY_SSUSPEND
|
---|
732 | keydef("Key_Shift_Suspend", "KEY_SSUSPEND", KEY_SSUSPEND, mode);
|
---|
733 | #endif
|
---|
734 | #ifdef KEY_SUNDO
|
---|
735 | keydef("Key_Shift_Undo", "KEY_SUNDO", KEY_SUNDO, mode);
|
---|
736 | #endif
|
---|
737 | #ifdef KEY_SUSPEND
|
---|
738 | keydef("Key_Suspend", "KEY_SUSPEND", KEY_SUSPEND, mode);
|
---|
739 | #endif
|
---|
740 | #ifdef KEY_UNDO
|
---|
741 | keydef("Key_Undo", "KEY_UNDO", KEY_UNDO, mode);
|
---|
742 | #endif
|
---|
743 | #ifdef KEY_MOUSE
|
---|
744 | keydef("Key_Mouse", "KEY_MOUSE", KEY_MOUSE, mode);
|
---|
745 | #endif
|
---|
746 | #ifdef KEY_RESIZE
|
---|
747 | keydef("Key_Resize", "KEY_RESIZE", KEY_RESIZE, mode);
|
---|
748 | #endif
|
---|
749 | }
|
---|
750 |
|
---|
751 | /*
|
---|
752 | * Generate a constant with the given name. The second parameter
|
---|
753 | * is a reference to the ACS character in the acs_map[] array and
|
---|
754 | * will be translated into an index.
|
---|
755 | */
|
---|
756 | static void
|
---|
757 | acs_def(const char *name, chtype *a)
|
---|
758 | {
|
---|
759 | int c = a - &acs_map[0];
|
---|
760 |
|
---|
761 | printf(" %-24s : constant Character := ", name);
|
---|
762 | if (isprint(c) && (c != '`'))
|
---|
763 | printf("'%c';\n", c);
|
---|
764 | else
|
---|
765 | printf("Character'Val (%d);\n", c);
|
---|
766 | }
|
---|
767 |
|
---|
768 | /*
|
---|
769 | * Generate the constants for the ACS characters
|
---|
770 | */
|
---|
771 | static void
|
---|
772 | gen_acs(void)
|
---|
773 | {
|
---|
774 | #ifdef ACS_ULCORNER
|
---|
775 | acs_def("ACS_Upper_Left_Corner", &ACS_ULCORNER);
|
---|
776 | #endif
|
---|
777 | #ifdef ACS_LLCORNER
|
---|
778 | acs_def("ACS_Lower_Left_Corner", &ACS_LLCORNER);
|
---|
779 | #endif
|
---|
780 | #ifdef ACS_URCORNER
|
---|
781 | acs_def("ACS_Upper_Right_Corner", &ACS_URCORNER);
|
---|
782 | #endif
|
---|
783 | #ifdef ACS_LRCORNER
|
---|
784 | acs_def("ACS_Lower_Right_Corner", &ACS_LRCORNER);
|
---|
785 | #endif
|
---|
786 | #ifdef ACS_LTEE
|
---|
787 | acs_def("ACS_Left_Tee", &ACS_LTEE);
|
---|
788 | #endif
|
---|
789 | #ifdef ACS_RTEE
|
---|
790 | acs_def("ACS_Right_Tee", &ACS_RTEE);
|
---|
791 | #endif
|
---|
792 | #ifdef ACS_BTEE
|
---|
793 | acs_def("ACS_Bottom_Tee", &ACS_BTEE);
|
---|
794 | #endif
|
---|
795 | #ifdef ACS_TTEE
|
---|
796 | acs_def("ACS_Top_Tee", &ACS_TTEE);
|
---|
797 | #endif
|
---|
798 | #ifdef ACS_HLINE
|
---|
799 | acs_def("ACS_Horizontal_Line", &ACS_HLINE);
|
---|
800 | #endif
|
---|
801 | #ifdef ACS_VLINE
|
---|
802 | acs_def("ACS_Vertical_Line", &ACS_VLINE);
|
---|
803 | #endif
|
---|
804 | #ifdef ACS_PLUS
|
---|
805 | acs_def("ACS_Plus_Symbol", &ACS_PLUS);
|
---|
806 | #endif
|
---|
807 | #ifdef ACS_S1
|
---|
808 | acs_def("ACS_Scan_Line_1", &ACS_S1);
|
---|
809 | #endif
|
---|
810 | #ifdef ACS_S9
|
---|
811 | acs_def("ACS_Scan_Line_9", &ACS_S9);
|
---|
812 | #endif
|
---|
813 | #ifdef ACS_DIAMOND
|
---|
814 | acs_def("ACS_Diamond", &ACS_DIAMOND);
|
---|
815 | #endif
|
---|
816 | #ifdef ACS_CKBOARD
|
---|
817 | acs_def("ACS_Checker_Board", &ACS_CKBOARD);
|
---|
818 | #endif
|
---|
819 | #ifdef ACS_DEGREE
|
---|
820 | acs_def("ACS_Degree", &ACS_DEGREE);
|
---|
821 | #endif
|
---|
822 | #ifdef ACS_PLMINUS
|
---|
823 | acs_def("ACS_Plus_Minus", &ACS_PLMINUS);
|
---|
824 | #endif
|
---|
825 | #ifdef ACS_BULLET
|
---|
826 | acs_def("ACS_Bullet", &ACS_BULLET);
|
---|
827 | #endif
|
---|
828 | #ifdef ACS_LARROW
|
---|
829 | acs_def("ACS_Left_Arrow", &ACS_LARROW);
|
---|
830 | #endif
|
---|
831 | #ifdef ACS_RARROW
|
---|
832 | acs_def("ACS_Right_Arrow", &ACS_RARROW);
|
---|
833 | #endif
|
---|
834 | #ifdef ACS_DARROW
|
---|
835 | acs_def("ACS_Down_Arrow", &ACS_DARROW);
|
---|
836 | #endif
|
---|
837 | #ifdef ACS_UARROW
|
---|
838 | acs_def("ACS_Up_Arrow", &ACS_UARROW);
|
---|
839 | #endif
|
---|
840 | #ifdef ACS_BOARD
|
---|
841 | acs_def("ACS_Board_Of_Squares", &ACS_BOARD);
|
---|
842 | #endif
|
---|
843 | #ifdef ACS_LANTERN
|
---|
844 | acs_def("ACS_Lantern", &ACS_LANTERN);
|
---|
845 | #endif
|
---|
846 | #ifdef ACS_BLOCK
|
---|
847 | acs_def("ACS_Solid_Block", &ACS_BLOCK);
|
---|
848 | #endif
|
---|
849 | #ifdef ACS_S3
|
---|
850 | acs_def("ACS_Scan_Line_3", &ACS_S3);
|
---|
851 | #endif
|
---|
852 | #ifdef ACS_S7
|
---|
853 | acs_def("ACS_Scan_Line_7", &ACS_S7);
|
---|
854 | #endif
|
---|
855 | #ifdef ACS_LEQUAL
|
---|
856 | acs_def("ACS_Less_Or_Equal", &ACS_LEQUAL);
|
---|
857 | #endif
|
---|
858 | #ifdef ACS_GEQUAL
|
---|
859 | acs_def("ACS_Greater_Or_Equal", &ACS_GEQUAL);
|
---|
860 | #endif
|
---|
861 | #ifdef ACS_PI
|
---|
862 | acs_def("ACS_PI", &ACS_PI);
|
---|
863 | #endif
|
---|
864 | #ifdef ACS_NEQUAL
|
---|
865 | acs_def("ACS_Not_Equal", &ACS_NEQUAL);
|
---|
866 | #endif
|
---|
867 | #ifdef ACS_STERLING
|
---|
868 | acs_def("ACS_Sterling", &ACS_STERLING);
|
---|
869 | #endif
|
---|
870 | }
|
---|
871 |
|
---|
872 | #define GEN_EVENT(name,value) \
|
---|
873 | printf(" %-25s : constant Event_Mask := 8#%011lo#;\n", \
|
---|
874 | #name, value)
|
---|
875 |
|
---|
876 | #define GEN_MEVENT(name) \
|
---|
877 | printf(" %-25s : constant Event_Mask := 8#%011lo#;\n", \
|
---|
878 | #name, name)
|
---|
879 |
|
---|
880 | static
|
---|
881 | void
|
---|
882 | gen_mouse_events(void)
|
---|
883 | {
|
---|
884 | mmask_t all1 = 0;
|
---|
885 | mmask_t all2 = 0;
|
---|
886 | mmask_t all3 = 0;
|
---|
887 | mmask_t all4 = 0;
|
---|
888 |
|
---|
889 | #ifdef BUTTON1_RELEASED
|
---|
890 | GEN_MEVENT(BUTTON1_RELEASED);
|
---|
891 | all1 |= BUTTON1_RELEASED;
|
---|
892 | #endif
|
---|
893 | #ifdef BUTTON1_PRESSED
|
---|
894 | GEN_MEVENT(BUTTON1_PRESSED);
|
---|
895 | all1 |= BUTTON1_PRESSED;
|
---|
896 | #endif
|
---|
897 | #ifdef BUTTON1_CLICKED
|
---|
898 | GEN_MEVENT(BUTTON1_CLICKED);
|
---|
899 | all1 |= BUTTON1_CLICKED;
|
---|
900 | #endif
|
---|
901 | #ifdef BUTTON1_DOUBLE_CLICKED
|
---|
902 | GEN_MEVENT(BUTTON1_DOUBLE_CLICKED);
|
---|
903 | all1 |= BUTTON1_DOUBLE_CLICKED;
|
---|
904 | #endif
|
---|
905 | #ifdef BUTTON1_TRIPLE_CLICKED
|
---|
906 | GEN_MEVENT(BUTTON1_TRIPLE_CLICKED);
|
---|
907 | all1 |= BUTTON1_TRIPLE_CLICKED;
|
---|
908 | #endif
|
---|
909 | #ifdef BUTTON1_RESERVED_EVENT
|
---|
910 | GEN_MEVENT(BUTTON1_RESERVED_EVENT);
|
---|
911 | all1 |= BUTTON1_RESERVED_EVENT;
|
---|
912 | #endif
|
---|
913 | #ifdef BUTTON2_RELEASED
|
---|
914 | GEN_MEVENT(BUTTON2_RELEASED);
|
---|
915 | all2 |= BUTTON2_RELEASED;
|
---|
916 | #endif
|
---|
917 | #ifdef BUTTON2_PRESSED
|
---|
918 | GEN_MEVENT(BUTTON2_PRESSED);
|
---|
919 | all2 |= BUTTON2_PRESSED;
|
---|
920 | #endif
|
---|
921 | #ifdef BUTTON2_CLICKED
|
---|
922 | GEN_MEVENT(BUTTON2_CLICKED);
|
---|
923 | all2 |= BUTTON2_CLICKED;
|
---|
924 | #endif
|
---|
925 | #ifdef BUTTON2_DOUBLE_CLICKED
|
---|
926 | GEN_MEVENT(BUTTON2_DOUBLE_CLICKED);
|
---|
927 | all2 |= BUTTON2_DOUBLE_CLICKED;
|
---|
928 | #endif
|
---|
929 | #ifdef BUTTON2_TRIPLE_CLICKED
|
---|
930 | GEN_MEVENT(BUTTON2_TRIPLE_CLICKED);
|
---|
931 | all2 |= BUTTON2_TRIPLE_CLICKED;
|
---|
932 | #endif
|
---|
933 | #ifdef BUTTON2_RESERVED_EVENT
|
---|
934 | GEN_MEVENT(BUTTON2_RESERVED_EVENT);
|
---|
935 | all2 |= BUTTON2_RESERVED_EVENT;
|
---|
936 | #endif
|
---|
937 | #ifdef BUTTON3_RELEASED
|
---|
938 | GEN_MEVENT(BUTTON3_RELEASED);
|
---|
939 | all3 |= BUTTON3_RELEASED;
|
---|
940 | #endif
|
---|
941 | #ifdef BUTTON3_PRESSED
|
---|
942 | GEN_MEVENT(BUTTON3_PRESSED);
|
---|
943 | all3 |= BUTTON3_PRESSED;
|
---|
944 | #endif
|
---|
945 | #ifdef BUTTON3_CLICKED
|
---|
946 | GEN_MEVENT(BUTTON3_CLICKED);
|
---|
947 | all3 |= BUTTON3_CLICKED;
|
---|
948 | #endif
|
---|
949 | #ifdef BUTTON3_DOUBLE_CLICKED
|
---|
950 | GEN_MEVENT(BUTTON3_DOUBLE_CLICKED);
|
---|
951 | all3 |= BUTTON3_DOUBLE_CLICKED;
|
---|
952 | #endif
|
---|
953 | #ifdef BUTTON3_TRIPLE_CLICKED
|
---|
954 | GEN_MEVENT(BUTTON3_TRIPLE_CLICKED);
|
---|
955 | all3 |= BUTTON3_TRIPLE_CLICKED;
|
---|
956 | #endif
|
---|
957 | #ifdef BUTTON3_RESERVED_EVENT
|
---|
958 | GEN_MEVENT(BUTTON3_RESERVED_EVENT);
|
---|
959 | all3 |= BUTTON3_RESERVED_EVENT;
|
---|
960 | #endif
|
---|
961 | #ifdef BUTTON4_RELEASED
|
---|
962 | GEN_MEVENT(BUTTON4_RELEASED);
|
---|
963 | all4 |= BUTTON4_RELEASED;
|
---|
964 | #endif
|
---|
965 | #ifdef BUTTON4_PRESSED
|
---|
966 | GEN_MEVENT(BUTTON4_PRESSED);
|
---|
967 | all4 |= BUTTON4_PRESSED;
|
---|
968 | #endif
|
---|
969 | #ifdef BUTTON4_CLICKED
|
---|
970 | GEN_MEVENT(BUTTON4_CLICKED);
|
---|
971 | all4 |= BUTTON4_CLICKED;
|
---|
972 | #endif
|
---|
973 | #ifdef BUTTON4_DOUBLE_CLICKED
|
---|
974 | GEN_MEVENT(BUTTON4_DOUBLE_CLICKED);
|
---|
975 | all4 |= BUTTON4_DOUBLE_CLICKED;
|
---|
976 | #endif
|
---|
977 | #ifdef BUTTON4_TRIPLE_CLICKED
|
---|
978 | GEN_MEVENT(BUTTON4_TRIPLE_CLICKED);
|
---|
979 | all4 |= BUTTON4_TRIPLE_CLICKED;
|
---|
980 | #endif
|
---|
981 | #ifdef BUTTON4_RESERVED_EVENT
|
---|
982 | GEN_MEVENT(BUTTON4_RESERVED_EVENT);
|
---|
983 | all4 |= BUTTON4_RESERVED_EVENT;
|
---|
984 | #endif
|
---|
985 | #ifdef BUTTON_CTRL
|
---|
986 | GEN_MEVENT(BUTTON_CTRL);
|
---|
987 | #endif
|
---|
988 | #ifdef BUTTON_SHIFT
|
---|
989 | GEN_MEVENT(BUTTON_SHIFT);
|
---|
990 | #endif
|
---|
991 | #ifdef BUTTON_ALT
|
---|
992 | GEN_MEVENT(BUTTON_ALT);
|
---|
993 | #endif
|
---|
994 | #ifdef REPORT_MOUSE_POSITION
|
---|
995 | GEN_MEVENT(REPORT_MOUSE_POSITION);
|
---|
996 | #endif
|
---|
997 | #ifdef ALL_MOUSE_EVENTS
|
---|
998 | GEN_MEVENT(ALL_MOUSE_EVENTS);
|
---|
999 | #endif
|
---|
1000 |
|
---|
1001 | GEN_EVENT(BUTTON1_EVENTS, all1);
|
---|
1002 | GEN_EVENT(BUTTON2_EVENTS, all2);
|
---|
1003 | GEN_EVENT(BUTTON3_EVENTS, all3);
|
---|
1004 | GEN_EVENT(BUTTON4_EVENTS, all4);
|
---|
1005 | }
|
---|
1006 |
|
---|
1007 | /*
|
---|
1008 | * Output some comment lines indicating that the file is generated.
|
---|
1009 | * The name parameter is the name of the facility to be used in
|
---|
1010 | * the comment.
|
---|
1011 | */
|
---|
1012 | static void
|
---|
1013 | prologue(const char *name)
|
---|
1014 | {
|
---|
1015 | printf("-- %s binding.\n", name);
|
---|
1016 | printf("-- This module is generated. Please don't change it manually!\n");
|
---|
1017 | printf("-- Run the generator instead.\n-- |");
|
---|
1018 |
|
---|
1019 | printf("define(`M4_BIT_ORDER',`%s_Order_First')",
|
---|
1020 | little_endian ? "Low" : "High");
|
---|
1021 | }
|
---|
1022 |
|
---|
1023 | /*
|
---|
1024 | * Write the prologue for the curses facility and make sure that
|
---|
1025 | * KEY_MIN and KEY_MAX are defined for the rest of this source.
|
---|
1026 | */
|
---|
1027 | static void
|
---|
1028 | basedefs(void)
|
---|
1029 | {
|
---|
1030 | prologue("curses");
|
---|
1031 | #ifndef KEY_MAX
|
---|
1032 | # define KEY_MAX 0777
|
---|
1033 | #endif
|
---|
1034 | printf("define(`M4_KEY_MAX',`8#%o#')", KEY_MAX);
|
---|
1035 | #ifndef KEY_MIN
|
---|
1036 | # define KEY_MIN 0401
|
---|
1037 | #endif
|
---|
1038 | if (KEY_MIN == 256)
|
---|
1039 | {
|
---|
1040 | fprintf(stderr, "Unexpected value for KEY_MIN: %d\n", KEY_MIN);
|
---|
1041 | exit(1);
|
---|
1042 | }
|
---|
1043 | printf("define(`M4_SPECIAL_FIRST',`8#%o#')", KEY_MIN - 1);
|
---|
1044 | }
|
---|
1045 |
|
---|
1046 | /*
|
---|
1047 | * Write out the comment lines for the menu facility
|
---|
1048 | */
|
---|
1049 | static void
|
---|
1050 | menu_basedefs(void)
|
---|
1051 | {
|
---|
1052 | prologue("menu");
|
---|
1053 | }
|
---|
1054 |
|
---|
1055 | /*
|
---|
1056 | * Write out the comment lines for the form facility
|
---|
1057 | */
|
---|
1058 | static void
|
---|
1059 | form_basedefs(void)
|
---|
1060 | {
|
---|
1061 | prologue("form");
|
---|
1062 | }
|
---|
1063 |
|
---|
1064 | /*
|
---|
1065 | * Write out the comment lines for the mouse facility
|
---|
1066 | */
|
---|
1067 | static void
|
---|
1068 | mouse_basedefs(void)
|
---|
1069 | {
|
---|
1070 | prologue("mouse");
|
---|
1071 | }
|
---|
1072 |
|
---|
1073 | /*
|
---|
1074 | * Write the definition of a single color
|
---|
1075 | */
|
---|
1076 | static void
|
---|
1077 | color_def(const char *name, int value)
|
---|
1078 | {
|
---|
1079 | printf(" %-16s : constant Color_Number := %d;\n", name, value);
|
---|
1080 | }
|
---|
1081 |
|
---|
1082 | #define HAVE_USE_DEFAULT_COLORS 1
|
---|
1083 |
|
---|
1084 | /*
|
---|
1085 | * Generate all color definitions
|
---|
1086 | */
|
---|
1087 | static void
|
---|
1088 | gen_color(void)
|
---|
1089 | {
|
---|
1090 | #ifdef HAVE_USE_DEFAULT_COLORS
|
---|
1091 | color_def("Default_Color", -1);
|
---|
1092 | #endif
|
---|
1093 | #ifdef COLOR_BLACK
|
---|
1094 | color_def("Black", COLOR_BLACK);
|
---|
1095 | #endif
|
---|
1096 | #ifdef COLOR_RED
|
---|
1097 | color_def("Red", COLOR_RED);
|
---|
1098 | #endif
|
---|
1099 | #ifdef COLOR_GREEN
|
---|
1100 | color_def("Green", COLOR_GREEN);
|
---|
1101 | #endif
|
---|
1102 | #ifdef COLOR_YELLOW
|
---|
1103 | color_def("Yellow", COLOR_YELLOW);
|
---|
1104 | #endif
|
---|
1105 | #ifdef COLOR_BLUE
|
---|
1106 | color_def("Blue", COLOR_BLUE);
|
---|
1107 | #endif
|
---|
1108 | #ifdef COLOR_MAGENTA
|
---|
1109 | color_def("Magenta", COLOR_MAGENTA);
|
---|
1110 | #endif
|
---|
1111 | #ifdef COLOR_CYAN
|
---|
1112 | color_def("Cyan", COLOR_CYAN);
|
---|
1113 | #endif
|
---|
1114 | #ifdef COLOR_WHITE
|
---|
1115 | color_def("White", COLOR_WHITE);
|
---|
1116 | #endif
|
---|
1117 | }
|
---|
1118 |
|
---|
1119 | /*
|
---|
1120 | * Generate the linker options for the base facility
|
---|
1121 | */
|
---|
1122 | static void
|
---|
1123 | gen_linkopts(void)
|
---|
1124 | {
|
---|
1125 | printf(" pragma Linker_Options (\"-lncurses%s\");\n", model);
|
---|
1126 | }
|
---|
1127 |
|
---|
1128 | /*
|
---|
1129 | * Generate the linker options for the menu facility
|
---|
1130 | */
|
---|
1131 | static void
|
---|
1132 | gen_menu_linkopts(void)
|
---|
1133 | {
|
---|
1134 | printf(" pragma Linker_Options (\"-lmenu%s\");\n", model);
|
---|
1135 | }
|
---|
1136 |
|
---|
1137 | /*
|
---|
1138 | * Generate the linker options for the form facility
|
---|
1139 | */
|
---|
1140 | static void
|
---|
1141 | gen_form_linkopts(void)
|
---|
1142 | {
|
---|
1143 | printf(" pragma Linker_Options (\"-lform%s\");\n", model);
|
---|
1144 | }
|
---|
1145 |
|
---|
1146 | /*
|
---|
1147 | * Generate the linker options for the panel facility
|
---|
1148 | */
|
---|
1149 | static void
|
---|
1150 | gen_panel_linkopts(void)
|
---|
1151 | {
|
---|
1152 | printf(" pragma Linker_Options (\"-lpanel%s\");\n", model);
|
---|
1153 | }
|
---|
1154 |
|
---|
1155 | static void
|
---|
1156 | gen_version_info(void)
|
---|
1157 | {
|
---|
1158 | static const char *v1 =
|
---|
1159 | " NC_Major_Version : constant := %d; -- Major version of the library\n";
|
---|
1160 | static const char *v2 =
|
---|
1161 | " NC_Minor_Version : constant := %d; -- Minor version of the library\n";
|
---|
1162 | static const char *v3 =
|
---|
1163 | " NC_Version : constant String := %c%d.%d%c; -- Version of library\n";
|
---|
1164 |
|
---|
1165 | printf(v1, NCURSES_VERSION_MAJOR);
|
---|
1166 | printf(v2, NCURSES_VERSION_MINOR);
|
---|
1167 | printf(v3, '"', NCURSES_VERSION_MAJOR, NCURSES_VERSION_MINOR, '"');
|
---|
1168 | }
|
---|
1169 |
|
---|
1170 | static int
|
---|
1171 | eti_gen(char *buf, int code, const char *name, int *etimin, int *etimax)
|
---|
1172 | {
|
---|
1173 | sprintf(buf, " E_%-16s : constant Eti_Error := %d;\n", name, code);
|
---|
1174 | if (code < *etimin)
|
---|
1175 | *etimin = code;
|
---|
1176 | if (code > *etimax)
|
---|
1177 | *etimax = code;
|
---|
1178 | return strlen(buf);
|
---|
1179 | }
|
---|
1180 |
|
---|
1181 | #define GEN_OFFSET(member,itype) \
|
---|
1182 | if (sizeof(((WINDOW*)0)->member)==sizeof(itype)) { \
|
---|
1183 | o = offsetof(WINDOW, member); \
|
---|
1184 | if ((o%sizeof(itype) == 0)) { \
|
---|
1185 | printf(" Offset%-*s : constant Natural := %2ld; -- %s\n", \
|
---|
1186 | 12, #member, (long)(o/sizeof(itype)),#itype); \
|
---|
1187 | } \
|
---|
1188 | }
|
---|
1189 |
|
---|
1190 | static void
|
---|
1191 | gen_offsets(void)
|
---|
1192 | {
|
---|
1193 | long o;
|
---|
1194 | const char *s_bool = "";
|
---|
1195 |
|
---|
1196 | GEN_OFFSET(_maxy, short);
|
---|
1197 | GEN_OFFSET(_maxx, short);
|
---|
1198 | GEN_OFFSET(_begy, short);
|
---|
1199 | GEN_OFFSET(_begx, short);
|
---|
1200 | GEN_OFFSET(_cury, short);
|
---|
1201 | GEN_OFFSET(_curx, short);
|
---|
1202 | GEN_OFFSET(_yoffset, short);
|
---|
1203 | GEN_OFFSET(_pary, int);
|
---|
1204 | GEN_OFFSET(_parx, int);
|
---|
1205 | if (sizeof(bool) == sizeof(char))
|
---|
1206 | {
|
---|
1207 | GEN_OFFSET(_notimeout, char);
|
---|
1208 | GEN_OFFSET(_clear, char);
|
---|
1209 | GEN_OFFSET(_leaveok, char);
|
---|
1210 | GEN_OFFSET(_scroll, char);
|
---|
1211 | GEN_OFFSET(_idlok, char);
|
---|
1212 | GEN_OFFSET(_idcok, char);
|
---|
1213 | GEN_OFFSET(_immed, char);
|
---|
1214 | GEN_OFFSET(_sync, char);
|
---|
1215 | GEN_OFFSET(_use_keypad, char);
|
---|
1216 |
|
---|
1217 | s_bool = "char";
|
---|
1218 | }
|
---|
1219 | else if (sizeof(bool) == sizeof(short))
|
---|
1220 | {
|
---|
1221 | GEN_OFFSET(_notimeout, short);
|
---|
1222 | GEN_OFFSET(_clear, short);
|
---|
1223 | GEN_OFFSET(_leaveok, short);
|
---|
1224 | GEN_OFFSET(_scroll, short);
|
---|
1225 | GEN_OFFSET(_idlok, short);
|
---|
1226 | GEN_OFFSET(_idcok, short);
|
---|
1227 | GEN_OFFSET(_immed, short);
|
---|
1228 | GEN_OFFSET(_sync, short);
|
---|
1229 | GEN_OFFSET(_use_keypad, short);
|
---|
1230 |
|
---|
1231 | s_bool = "short";
|
---|
1232 | }
|
---|
1233 | else if (sizeof(bool) == sizeof(int))
|
---|
1234 | {
|
---|
1235 | GEN_OFFSET(_notimeout, int);
|
---|
1236 | GEN_OFFSET(_clear, int);
|
---|
1237 | GEN_OFFSET(_leaveok, int);
|
---|
1238 | GEN_OFFSET(_scroll, int);
|
---|
1239 | GEN_OFFSET(_idlok, int);
|
---|
1240 | GEN_OFFSET(_idcok, int);
|
---|
1241 | GEN_OFFSET(_immed, int);
|
---|
1242 | GEN_OFFSET(_sync, int);
|
---|
1243 | GEN_OFFSET(_use_keypad, int);
|
---|
1244 |
|
---|
1245 | s_bool = "int";
|
---|
1246 | }
|
---|
1247 | printf(" Sizeof%-*s : constant Natural := %2ld; -- %s\n",
|
---|
1248 | 12, "_bool", (long)sizeof(bool), "bool");
|
---|
1249 |
|
---|
1250 | /* In ncurses _maxy and _maxx needs an offset for the "public"
|
---|
1251 | * value
|
---|
1252 | */
|
---|
1253 | printf(" Offset%-*s : constant Natural := %2d; -- %s\n",
|
---|
1254 | 12, "_XY", 1, "int");
|
---|
1255 | printf("\n");
|
---|
1256 | printf(" type Curses_Bool is mod 2 ** Interfaces.C.%s'Size;\n", s_bool);
|
---|
1257 | }
|
---|
1258 |
|
---|
1259 | /*
|
---|
1260 | * main() expects two arguments on the commandline, both single characters.
|
---|
1261 | * The first character denotes the facility for which we generate output.
|
---|
1262 | * Possible values are
|
---|
1263 | * B - Base
|
---|
1264 | * M - Menus
|
---|
1265 | * F - Forms
|
---|
1266 | * P - Pointer Device (Mouse)
|
---|
1267 | * E - ETI base definitions
|
---|
1268 | *
|
---|
1269 | * The second character then denotes the specific output that should be
|
---|
1270 | * generated for the selected facility.
|
---|
1271 | */
|
---|
1272 | int
|
---|
1273 | main(int argc, char *argv[])
|
---|
1274 | {
|
---|
1275 | int x = 0x12345678;
|
---|
1276 | char *s = (char *)&x;
|
---|
1277 |
|
---|
1278 | if (*s == 0x78)
|
---|
1279 | little_endian = 1;
|
---|
1280 |
|
---|
1281 | if (argc != 4)
|
---|
1282 | exit(1);
|
---|
1283 | model = *++argv;
|
---|
1284 |
|
---|
1285 | switch (argv[1][0])
|
---|
1286 | {
|
---|
1287 | /* --------------------------------------------------------------- */
|
---|
1288 | case 'B': /* The Base facility */
|
---|
1289 | switch (argv[2][0])
|
---|
1290 | {
|
---|
1291 | case 'A': /* chtype translation into Ada95 record type */
|
---|
1292 | gen_attr_set("Character_Attribute_Set");
|
---|
1293 | break;
|
---|
1294 | case 'K': /* translation of keycodes */
|
---|
1295 | gen_keydefs(0);
|
---|
1296 | break;
|
---|
1297 | case 'B': /* write some initial comment lines */
|
---|
1298 | basedefs();
|
---|
1299 | break;
|
---|
1300 | case 'C': /* generate color constants */
|
---|
1301 | gen_color();
|
---|
1302 | break;
|
---|
1303 | case 'D': /* generate displacements of fields in WINDOW struct. */
|
---|
1304 | gen_offsets();
|
---|
1305 | break;
|
---|
1306 | case 'E': /* generate Mouse Event codes */
|
---|
1307 | gen_mouse_events();
|
---|
1308 | break;
|
---|
1309 | case 'M': /* generate constants for the ACS characters */
|
---|
1310 | gen_acs();
|
---|
1311 | break;
|
---|
1312 | case 'L': /* generate the Linker_Options pragma */
|
---|
1313 | gen_linkopts();
|
---|
1314 | break;
|
---|
1315 | case 'O': /* generate definitions of the old key code names */
|
---|
1316 | gen_keydefs(1);
|
---|
1317 | break;
|
---|
1318 | case 'R': /* generate representation clause for Attributed character */
|
---|
1319 | gen_chtype_rep("Attributed_Character");
|
---|
1320 | break;
|
---|
1321 | case 'V': /* generate version info */
|
---|
1322 | gen_version_info();
|
---|
1323 | break;
|
---|
1324 | case 'T': /* generate the Trace info */
|
---|
1325 | gen_trace("Trace_Attribute_Set");
|
---|
1326 | break;
|
---|
1327 | default:
|
---|
1328 | break;
|
---|
1329 | }
|
---|
1330 | break;
|
---|
1331 | /* --------------------------------------------------------------- */
|
---|
1332 | case 'M': /* The Menu facility */
|
---|
1333 | switch (argv[2][0])
|
---|
1334 | {
|
---|
1335 | case 'R': /* generate representation clause for Menu_Option_Set */
|
---|
1336 | gen_menu_opt_rep("Menu_Option_Set");
|
---|
1337 | break;
|
---|
1338 | case 'B': /* write some initial comment lines */
|
---|
1339 | menu_basedefs();
|
---|
1340 | break;
|
---|
1341 | case 'L': /* generate the Linker_Options pragma */
|
---|
1342 | gen_menu_linkopts();
|
---|
1343 | break;
|
---|
1344 | case 'I': /* generate representation clause for Item_Option_Set */
|
---|
1345 | gen_item_opt_rep("Item_Option_Set");
|
---|
1346 | break;
|
---|
1347 | default:
|
---|
1348 | break;
|
---|
1349 | }
|
---|
1350 | break;
|
---|
1351 | /* --------------------------------------------------------------- */
|
---|
1352 | case 'F': /* The Form facility */
|
---|
1353 | switch (argv[2][0])
|
---|
1354 | {
|
---|
1355 | case 'R': /* generate representation clause for Form_Option_Set */
|
---|
1356 | gen_form_opt_rep("Form_Option_Set");
|
---|
1357 | break;
|
---|
1358 | case 'B': /* write some initial comment lines */
|
---|
1359 | form_basedefs();
|
---|
1360 | break;
|
---|
1361 | case 'L': /* generate the Linker_Options pragma */
|
---|
1362 | gen_form_linkopts();
|
---|
1363 | break;
|
---|
1364 | case 'I': /* generate representation clause for Field_Option_Set */
|
---|
1365 | gen_field_opt_rep("Field_Option_Set");
|
---|
1366 | break;
|
---|
1367 | default:
|
---|
1368 | break;
|
---|
1369 | }
|
---|
1370 | break;
|
---|
1371 | /* --------------------------------------------------------------- */
|
---|
1372 | case 'P': /* The Pointer(=Mouse) facility */
|
---|
1373 | switch (argv[2][0])
|
---|
1374 | {
|
---|
1375 | case 'B': /* write some initial comment lines */
|
---|
1376 | mouse_basedefs();
|
---|
1377 | break;
|
---|
1378 | case 'M': /* generate representation clause for Mouse_Event */
|
---|
1379 | gen_mrep_rep("Mouse_Event");
|
---|
1380 | break;
|
---|
1381 | case 'L': /* generate the Linker_Options pragma */
|
---|
1382 | gen_panel_linkopts();
|
---|
1383 | break;
|
---|
1384 | default:
|
---|
1385 | break;
|
---|
1386 | }
|
---|
1387 | break;
|
---|
1388 | /* --------------------------------------------------------------- */
|
---|
1389 | case 'E': /* chtype size detection */
|
---|
1390 | switch (argv[2][0])
|
---|
1391 | {
|
---|
1392 | case 'C':
|
---|
1393 | {
|
---|
1394 | const char *fmt = " type C_Chtype is new %s;\n";
|
---|
1395 | const char *afmt = " type C_AttrType is new %s;\n";
|
---|
1396 |
|
---|
1397 | if (sizeof(chtype) == sizeof(int))
|
---|
1398 | {
|
---|
1399 | if (sizeof(int) == sizeof(long))
|
---|
1400 | printf(fmt, "C_ULong");
|
---|
1401 |
|
---|
1402 | else
|
---|
1403 | printf(fmt, "C_UInt");
|
---|
1404 | }
|
---|
1405 | else if (sizeof(chtype) == sizeof(long))
|
---|
1406 | {
|
---|
1407 | printf(fmt, "C_ULong");
|
---|
1408 | }
|
---|
1409 | else
|
---|
1410 | printf("Error\n");
|
---|
1411 |
|
---|
1412 | if (sizeof(attr_t) == sizeof(int))
|
---|
1413 | {
|
---|
1414 | if (sizeof(int) == sizeof(long))
|
---|
1415 | printf(afmt, "C_ULong");
|
---|
1416 |
|
---|
1417 | else
|
---|
1418 | printf(afmt, "C_UInt");
|
---|
1419 | }
|
---|
1420 | else if (sizeof(attr_t) == sizeof(long))
|
---|
1421 | {
|
---|
1422 | printf(afmt, "C_ULong");
|
---|
1423 | }
|
---|
1424 | else
|
---|
1425 | printf("Error\n");
|
---|
1426 |
|
---|
1427 | printf("define(`CF_CURSES_OK',`%d')", OK);
|
---|
1428 | printf("define(`CF_CURSES_ERR',`%d')", ERR);
|
---|
1429 | printf("define(`CF_CURSES_TRUE',`%d')", TRUE);
|
---|
1430 | printf("define(`CF_CURSES_FALSE',`%d')", FALSE);
|
---|
1431 | }
|
---|
1432 | break;
|
---|
1433 | case 'E':
|
---|
1434 | {
|
---|
1435 | char *buf = (char *)malloc(2048);
|
---|
1436 | char *p = buf;
|
---|
1437 | int etimin = E_OK;
|
---|
1438 | int etimax = E_OK;
|
---|
1439 |
|
---|
1440 | if (p)
|
---|
1441 | {
|
---|
1442 | p += eti_gen(p, E_OK, "Ok", &etimin, &etimax);
|
---|
1443 | p += eti_gen(p, E_SYSTEM_ERROR, "System_Error", &etimin, &etimax);
|
---|
1444 | p += eti_gen(p, E_BAD_ARGUMENT, "Bad_Argument", &etimin, &etimax);
|
---|
1445 | p += eti_gen(p, E_POSTED, "Posted", &etimin, &etimax);
|
---|
1446 | p += eti_gen(p, E_CONNECTED, "Connected", &etimin, &etimax);
|
---|
1447 | p += eti_gen(p, E_BAD_STATE, "Bad_State", &etimin, &etimax);
|
---|
1448 | p += eti_gen(p, E_NO_ROOM, "No_Room", &etimin, &etimax);
|
---|
1449 | p += eti_gen(p, E_NOT_POSTED, "Not_Posted", &etimin, &etimax);
|
---|
1450 | p += eti_gen(p, E_UNKNOWN_COMMAND,
|
---|
1451 | "Unknown_Command", &etimin, &etimax);
|
---|
1452 | p += eti_gen(p, E_NO_MATCH, "No_Match", &etimin, &etimax);
|
---|
1453 | p += eti_gen(p, E_NOT_SELECTABLE,
|
---|
1454 | "Not_Selectable", &etimin, &etimax);
|
---|
1455 | p += eti_gen(p, E_NOT_CONNECTED,
|
---|
1456 | "Not_Connected", &etimin, &etimax);
|
---|
1457 | p += eti_gen(p, E_REQUEST_DENIED,
|
---|
1458 | "Request_Denied", &etimin, &etimax);
|
---|
1459 | p += eti_gen(p, E_INVALID_FIELD,
|
---|
1460 | "Invalid_Field", &etimin, &etimax);
|
---|
1461 | p += eti_gen(p, E_CURRENT,
|
---|
1462 | "Current", &etimin, &etimax);
|
---|
1463 | }
|
---|
1464 | printf(" subtype Eti_Error is C_Int range %d .. %d;\n\n",
|
---|
1465 | etimin, etimax);
|
---|
1466 | printf(buf);
|
---|
1467 | }
|
---|
1468 | break;
|
---|
1469 | default:
|
---|
1470 | break;
|
---|
1471 | }
|
---|
1472 | break;
|
---|
1473 | /* --------------------------------------------------------------- */
|
---|
1474 | case 'V': /* plain version dump */
|
---|
1475 | {
|
---|
1476 | switch (argv[2][0])
|
---|
1477 | {
|
---|
1478 | case '1': /* major version */
|
---|
1479 | #ifdef NCURSES_VERSION_MAJOR
|
---|
1480 | printf("%d", NCURSES_VERSION_MAJOR);
|
---|
1481 | #endif
|
---|
1482 | break;
|
---|
1483 | case '2': /* minor version */
|
---|
1484 | #ifdef NCURSES_VERSION_MINOR
|
---|
1485 | printf("%d", NCURSES_VERSION_MINOR);
|
---|
1486 | #endif
|
---|
1487 | break;
|
---|
1488 | case '3': /* patch level */
|
---|
1489 | #ifdef NCURSES_VERSION_PATCH
|
---|
1490 | printf("%d", NCURSES_VERSION_PATCH);
|
---|
1491 | #endif
|
---|
1492 | break;
|
---|
1493 | default:
|
---|
1494 | break;
|
---|
1495 | }
|
---|
1496 | }
|
---|
1497 | break;
|
---|
1498 | /* --------------------------------------------------------------- */
|
---|
1499 | default:
|
---|
1500 | break;
|
---|
1501 | }
|
---|
1502 | return 0;
|
---|
1503 | }
|
---|