2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
26 * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
27 * ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for
28 * the full copyright text.
35 static char rcsid[] = "$XConsortium: wmlouth.c /main/8 1995/08/29 11:10:46 drk $"
39 * (c) Copyright 1989, 1990, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */
42 * This module contains routines responsible for writing the .h files
43 * produced by WML. All files are written into the current directory.
46 * The resolved objects
74 * Routines used only in this module
76 void wmlOutputUilSymGen ();
77 void wmlOutputUilSymArTy ();
78 void wmlOutputUilSymChCl ();
79 void wmlOutputUilSymRArg ();
80 void wmlOutputUilUrmClas ();
81 void wmlOutputUilConst ();
82 void wmlOutputUilSymReas ();
83 void wmlOutputUilSymArTa ();
84 void wmlOutputUilSymChTa ();
85 void wmlOutputUilSymCtl ();
86 void wmlOutputUilSymNam ();
87 void wmlOutputUilSymEnum ();
88 void wmlOutputUilSymCSet ();
94 static char *canned_warn =
96 **\tThis file is automatically generated. Do not edit it by hand.\n\
100 * Used to create masks for bytes in bit vectors. Accessed by bit numbers
103 static char *bit_masks[] = {""
111 ," | 128"}; /* bit 8 */
114 * To pick up maximum code values
116 static int max_object_code = 0;
117 static int max_reason_code = 0;
118 static int max_arg_code = 0;
119 static int max_enumset_code = 0;
120 static int max_enumval_code = 0;
121 static int max_charset_code = 0;
122 static int max_child_code = 0;
127 * Output control routine, which simply outputs each .h file in turn.
130 void wmlOutputHFiles ()
134 wmlOutputUilSymGen ();
135 wmlOutputUilSymArTy ();
136 wmlOutputUilSymChCl ();
137 wmlOutputUilSymRArg ();
138 wmlOutputUilUrmClas ();
139 wmlOutputUilConst ();
140 wmlOutputUilSymReas ();
141 wmlOutputUilSymArTa ();
142 wmlOutputUilSymChTa ();
143 wmlOutputUilSymCtl ();
144 wmlOutputUilSymNam ();
145 wmlOutputUilSymEnum ();
146 wmlOutputUilSymCSet ();
153 * Routine to write out UilSymGen.h
155 * This file defines the sym_k... literals for UIL. Each set of literals
156 * typiclly increases monotonically from 1, with 0 used as en error value.
158 * sym_k_<class>_object
159 * <class> is widget class name in lexicographic order
160 * gadgets are not include.
162 * bit masks for table access
164 * sym_k_<reason>_reason
165 * literals specifying all reasons, lexicographically ordered
167 * sym_k_<argument>_arg
168 * literals for all arguments, lexicographically ordered.
169 * Constraints are included, and ordered with the arguments.
171 * sym_k_<child>_child
172 * literals for all automatic children, lexicographically ordered.
174 * sym_k_<enumset>_enumset
175 * literals naming each enumeration set, lexicographically ordered
177 * Fixed literals naming character set character sizes
178 * sym_k_<charset>_charset
179 * literals naming each character set, lexicographically ordered
182 void wmlOutputUilSymGen ()
187 "\n/* Define literals for objects */\n";
191 "\n/* Define literals for reasons */\n\n";
195 "\n/* Define literals for arguments */\n\n";
198 "\n/* Define literals for enumeration sets */\n\n";
201 "\n/* Define literals for enumeration values */\n\n";
204 "\n/* Define literals for character sets */\n\n";
207 "\n/* Define literals for automatic children */\n\n";
209 FILE *outfil; /* output file */
210 int ndx; /* loop index */
211 WmlClassDefPtr clsobj; /* class object */
212 WmlDataTypeDefPtr datobj; /* data type object */
213 WmlResourceDefPtr resobj; /* resource object */
214 WmlEnumSetDefPtr enumsetobj; /* enumeration set object */
215 WmlEnumValueDefPtr enumvalobj; /* enumeration value object */
216 WmlCharSetDefPtr charsetobj; /* character set object */
217 WmlChildDefPtr childobj; /* child object */
220 * Open the output file. Write the canned header stuff
222 outfil = fopen ("UilSymGen.h", "w");
223 if ( outfil == (FILE *) NULL )
225 printf ("\nCouldn't open UilSymGen.h");
228 fprintf (outfil, canned_warn);
231 * Write the sym_k..._object literals
233 fprintf (outfil, canned1);
234 for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
236 clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
237 fprintf (outfil, "#define sym_k_%s_object\t%d\n",
240 if ( clsobj->sym_code > max_object_code )
241 max_object_code = clsobj->sym_code;
245 * Define the sym_k_..._reason literals
247 fprintf (outfil, canned3);
248 for ( ndx=0 ; ndx<wml_obj_reason_ptr->cnt ; ndx++ )
250 resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[ndx].objptr;
251 fprintf (outfil, "#define sym_k_%s_reason\t%d\n",
254 if ( resobj->sym_code > max_reason_code )
255 max_reason_code = resobj->sym_code;
259 * Define the sym_k_..._arg literals
261 fprintf (outfil, canned4);
262 for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
264 resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
265 fprintf (outfil, "#define sym_k_%s_arg\t%d\n",
268 if ( resobj->sym_code > max_arg_code )
269 max_arg_code = resobj->sym_code;
273 * Define the sym_k_..._enumset structs and literals
275 fprintf (outfil, canned5);
276 for ( ndx=0 ; ndx<wml_obj_enumset_ptr->cnt ; ndx++ )
278 enumsetobj = (WmlEnumSetDefPtr) wml_obj_enumset_ptr->hvec[ndx].objptr;
279 fprintf (outfil, "#define sym_k_%s_enumset\t%d\n",
281 enumsetobj->sym_code);
282 if ( enumsetobj->sym_code > max_enumset_code )
283 max_enumset_code = enumsetobj->sym_code;
287 * Define the sym_k_..._enumval literals
289 fprintf (outfil, canned6);
290 for ( ndx=0 ; ndx<wml_obj_enumval_ptr->cnt ; ndx++ )
292 enumvalobj = (WmlEnumValueDefPtr) wml_obj_enumval_ptr->hvec[ndx].objptr;
293 fprintf (outfil, "#define sym_k_%s_enumval\t%d\n",
294 enumvalobj->syndef->name,
295 enumvalobj->sym_code);
296 if ( enumvalobj->sym_code > max_enumval_code )
297 max_enumval_code = enumvalobj->sym_code;
301 * Define the sym_k_..._charsize literals
302 * Define the sym_k_..._charset literals
304 fprintf (outfil, canned7);
305 for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
307 charsetobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
308 fprintf (outfil, "#define sym_k_%s_charset\t%d\n",
309 charsetobj->syndef->name,
310 charsetobj->sym_code);
311 if ( charsetobj->sym_code > max_charset_code )
312 max_charset_code = charsetobj->sym_code;
316 * Define the sym_k_..._child literals
318 fprintf (outfil, canned8);
319 for ( ndx=0 ; ndx<wml_obj_child_ptr->cnt ; ndx++ )
321 childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[ndx].objptr;
322 fprintf (outfil, "#define sym_k_%s_child\t%d\n",
323 childobj->syndef->name,
325 if ( childobj->sym_code > max_child_code )
326 max_child_code = childobj->sym_code;
330 * close the output file
332 printf ("\nCreated UilSymGen.h");
340 * Routine to write out UilSymChCl.h
342 * A table of classes accessed by child type (sym_k_<child>_child, in
345 * sym_k_<class>_class,
348 void wmlOutputUilSymChCl ()
353 "/* Table of the class type of children\n\
354 The table is indexed by child with each entry the\n\
355 permitted class for that child.\n\
358 static unsigned char child_class_table_vec[] =\n\
364 externaldef(uil_sym_glbl) unsigned char *child_class_table =\n\
365 \t child_class_table_vec;\n";
367 FILE *outfil; /* output file */
368 int ndx; /* loop index */
369 WmlClassDefPtr classobj; /* data type object */
370 WmlChildDefPtr childobj; /* resource object */
374 * Open the output file. Write canned header.
376 outfil = fopen ( "UilSymChCl.h", "w");
377 if ( outfil == (FILE *) NULL )
379 printf ("\nCouldn't open UilSymChCL.h");
382 fprintf (outfil, canned_warn);
385 * Create table entries, similar to writing sym_k...
387 fprintf (outfil, canned1);
388 for ( ndx=0 ; ndx<wml_obj_child_ptr->cnt ; ndx++ )
390 childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[ndx].objptr;
391 classobj = childobj->class;
392 fprintf (outfil, " sym_k_%s_object,\n",
395 fprintf (outfil, canned1a);
398 * close the output file
400 printf ("\nCreated UilSymChCl.h");
407 * Routine to write out UilSymArTy.h
409 * A table of data types accessed by argument type (sym_k_<arg>_arg, in
412 * sym_k_<data_type>_value,
415 void wmlOutputUilSymArTy ()
420 "/* Table of the types of arguments\n\
421 The table is indexed by argument with each entry the\n\
422 permitted type for that argument.\n\
425 static unsigned char argument_type_table_vec[] =\n\
431 externaldef(uil_sym_glbl) unsigned char *argument_type_table =\n\
432 \t argument_type_table_vec;\n";
434 FILE *outfil; /* output file */
435 int ndx; /* loop index */
436 WmlDataTypeDefPtr datobj; /* data type object */
437 WmlResourceDefPtr resobj; /* resource object */
441 * Open the output file. Write canned header.
443 outfil = fopen ( "UilSymArTy.h", "w");
444 if ( outfil == (FILE *) NULL )
446 printf ("\nCouldn't open UilSymArTy.h");
449 fprintf (outfil, canned_warn);
452 * Create table entries, similar to writing sym_k...
454 fprintf (outfil, canned1);
455 for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
457 resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
458 datobj = resobj->dtype_def;
459 fprintf (outfil, " sym_k_%s_value,\n",
462 fprintf (outfil, canned1a);
465 * close the output file
467 printf ("\nCreated UilSymArTy.h");
475 * Routine to write out UilSymRArg.h
477 * Related argument table
480 void wmlOutputUilSymRArg ()
485 "/* Related argument table. Each non-zero entry is the code\n\
486 of the related argument.\n\
489 static unsigned short int related_argument_table_vec[] =\n\
495 externaldef(uil_sym_glbl) unsigned short int *related_argument_table =\n\
496 \t\trelated_argument_table_vec;\n";
498 FILE *outfil; /* output file */
499 int ndx; /* loop index */
500 WmlResourceDefPtr resobj; /* resource object */
504 * Open the output file. Write canned header.
506 outfil = fopen ( "UilSymRArg.h", "w");
507 if ( outfil == (FILE *) NULL )
509 printf ("\nCouldn't open UilSymRArg.h");
512 fprintf (outfil, canned_warn);
515 * Create table entries, similar to writing sym_k...
517 fprintf (outfil, canned1);
518 for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
520 resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
521 fprintf (outfil, " %d,\n",
522 resobj->related_code);
524 fprintf (outfil, canned1a);
527 * close the output file
529 printf ("\nCreated UilSymRArg.h");
537 * Routine to write out UilUrmClas.h
539 * Table of convenience function names indexed by the sym_k_<class> literal
540 * for both widgets and gadgets
541 * Table of resource names indexed by the sym_k_<argument>_arg and
542 * sym_k_<reason>_reason codes.
545 void wmlOutputUilUrmClas ()
550 "\n/* Define mapping of UIL widget types to convenience functions. */\n\
551 static char *uil_widget_funcs_vec[] = {\n\
552 \"\",\t /* NOT USED */\n";
556 externaldef(uil_sym_glbl) char **uil_widget_funcs = uil_widget_funcs_vec;\n\
558 /* Define mapping of UIL widget classes to matching gadget class. */\n\
559 static unsigned short int uil_gadget_variants_vec[] = {\n\
560 0,\t /* NOT USED */\n";
564 externaldef(uil_sym_glbl) unsigned short int *uil_gadget_variants =\n\
565 \t\tuil_gadget_variants_vec;\n\
567 /* Define mapping of dialog types to non-dialog URM widget classes. */\n\
568 static unsigned short int uil_urm_nondialog_class_vec[] = {\n\
569 0,\t/* NOT USED */\n";
573 externaldef(uil_sym_glbl) unsigned short int *uil_urm_nondialog_class =\n\
574 \t\tuil_urm_nondialog_class_vec;\n\
576 /* Define mapping of widget controls to a (subtree) resource. */\n\
577 static unsigned short int uil_urm_subtree_resource_vec[] = {\n\
578 0,\t/* NOT USED */\n";
582 externaldef(uil_sym_glbl) unsigned short int *uil_urm_subtree_resource =\n\
583 \t\tuil_urm_subtree_resource_vec;\n\
585 /* Define mapping of arguments to toolkit names. */\n\
586 static char *uil_argument_toolkit_names_vec[] = {\n\
587 \"\",\t /* NOT USED */\n";
591 externaldef(uil_sym_glbl) char **uil_argument_toolkit_names =\n\
592 \t\tuil_argument_toolkit_names_vec;\n\
594 /* Define mapping of reasons to toolkit names. */\n\
595 static char *uil_reason_toolkit_names_vec[] = {\n\
596 \"\",\t/* NOT USED */\n";
600 externaldef(uil_sym_glbl) char **uil_reason_toolkit_names =\n\
601 \t\tuil_reason_toolkit_names_vec;\n";
605 FILE *outfil; /* output file */
606 int ndx; /* loop index */
607 WmlClassDefPtr clsobj; /* class object */
608 WmlSynClassDefPtr synobj; /* syntactic object */
609 WmlClassDefPtr varobj; /* variant (widget) class object */
610 WmlResourceDefPtr resobj; /* argument/reason object */
611 WmlSynResourceDefPtr synres; /* arg/reason syntactic object */
612 WmlResourceDefPtr mapresobj; /* controls map to resource object */
616 * Open the output file. Write canned header.
618 outfil = fopen ( "UilUrmClas.h", "w");
619 if ( outfil == (FILE *) NULL )
621 printf ("\nCouldn't open UilUrmClas.h");
624 fprintf (outfil, canned_warn);
627 * Write entries for widgets
629 fprintf (outfil, canned1);
630 for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
632 clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
633 if ( clsobj->sym_code == 0 ) continue;
634 synobj = clsobj->syndef;
635 if ( synobj->int_lit != NULL )
636 fprintf (outfil, " \"%s\",\n", synobj->convfunc);
638 fprintf (outfil, " \"%s\",\t\n", synobj->convfunc);
640 fprintf (outfil, canned2);
643 * Write entries for gadget variants of widget classes
645 for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
647 clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
648 if ( clsobj->sym_code == 0 ) continue;
649 varobj = clsobj->variant;
650 synobj = clsobj->syndef;
651 if ( varobj==NULL || synobj->type==WmlClassTypeGadget )
652 fprintf (outfil, " 0,\n");
655 synobj = varobj->syndef;
656 if ( synobj->int_lit != NULL )
657 fprintf (outfil, " sym_k_%s_object,\n",
660 fprintf (outfil, " sym_k_%s_object,\n",
664 fprintf (outfil, canned3);
667 * Write entries for non-dialog widgets
669 for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
671 clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
672 if ( clsobj->sym_code == 0 ) continue;
673 varobj = clsobj->nondialog;
674 synobj = clsobj->syndef;
675 if ( varobj == NULL )
676 fprintf (outfil, " 0,\n");
679 synobj = varobj->syndef;
680 if ( synobj->int_lit != NULL )
681 fprintf (outfil, " sym_k_%s_object,\n",
684 fprintf (outfil, " sym_k_%s_object,\n",
688 fprintf (outfil, canned4);
691 * Write entries for the resource a widget's controls map to
693 for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
695 clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
696 if ( clsobj->sym_code == 0 ) continue;
697 synobj = clsobj->syndef;
698 mapresobj = clsobj->ctrlmapto;
699 if ( mapresobj == NULL )
700 fprintf (outfil, " 0,\n");
702 fprintf (outfil, " sym_k_%s_arg,\n", mapresobj->tkname);
704 fprintf (outfil, canned5);
707 * Write entries for arguments
709 for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
711 resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
712 synres = resobj->syndef;
713 if ( resobj->sym_code == 0 ) continue;
714 fprintf (outfil, " %s,\n",
717 fprintf (outfil, canned6);
720 * Write entries for reasons
722 for ( ndx=0 ; ndx<wml_obj_reason_ptr->cnt ; ndx++ )
724 resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[ndx].objptr;
725 synres = resobj->syndef;
726 if ( resobj->sym_code == 0 ) continue;
727 fprintf (outfil, " %s,\n",
730 fprintf (outfil, canned7);
733 * close the output file
735 printf ("\nCreated UilUrmClas.h");
743 * Routine to write out UilConst.h
745 * A bit vector showing which arguments are constraints.
748 void wmlOutputUilConst ()
753 "/* Table indexed by argument indicating whether\n\
754 argument is a constraint (TRUE) or a regular\n\
755 argument (FALSE). Each entry is one bit.\n\
756 Index and mask macros are defined to simplify\n\
757 access to the table\n\
760 static unsigned char constraint_tab_vec[] = {\n";
764 externaldef(uil_sym_glbl) unsigned char *constraint_tab =\n\
765 \t\tconstraint_tab_vec;\n";
768 FILE *outfil; /* output file */
769 int ndx; /* loop index */
770 WmlResourceDefPtr resobj; /* resource object */
771 WmlSynResourceDefPtr synobj; /* syntactic object */
772 char maskbuf[100]; /* to constuct each mask */
773 int bitno; /* current bit number, from code */
776 * Open the output file. Write canned header.
778 outfil = fopen ( "UilConst.h", "w");
779 if ( outfil == (FILE *) NULL )
781 printf ("\nCouldn't open UilConst.h");
784 fprintf (outfil, canned_warn);
787 * Process the arguments in code order. We start with 1, and write out
788 * the mask after processing 8 codes.
790 fprintf (outfil, canned1);
791 strcpy (maskbuf, "0");
792 for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
794 resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
795 synobj = resobj->syndef;
796 bitno = resobj->sym_code % 8;
797 if ( bitno == 0 ) bitno = 8;
798 if ( synobj->type == WmlResourceTypeConstraint )
799 strcat (maskbuf, bit_masks[bitno]);
802 fprintf (outfil, "%s,\n", maskbuf);
803 strcpy (maskbuf, "0");
807 fprintf (outfil, "%s", maskbuf);
808 fprintf (outfil, canned1a);
811 * close the output file
813 printf ("\nCreated UilConst.h");
821 * Routine to write out UilSymReas.h
823 * This file defines the reasons supported by each class. For each
824 * reason, there is a bit vector with the bit for each supporting class
825 * turned on if the reason is supported. There is then a vector pointing
826 * to these bit vectors for all reasons. This vector is accessed by
827 * sym_k_..._reason to find the reasons bit vector, then by sym_k_..._object
831 void wmlOutputUilSymReas ()
837 * Bit vectors for each reason. The entries in the vector correspond\n\
843 /* sym_k_%s_reason */\n\
844 static unsigned char reason_class_vec%d[] =\n\
849 * Table of bit vectors accessed by sym_k_..._reason\n\
851 static unsigned char *allowed_reason_table_vec[] =\n\
853 NULL,\t/* UNUSED */\n";
857 externaldef(uil_sym_glbl) unsigned char **allowed_reason_table =\n\
858 \t\tallowed_reason_table_vec;\n";
860 FILE *outfil; /* output file */
861 int resndx; /* outer loop index */
862 WmlResourceDefPtr resobj; /* current reason */
863 int clsndx; /* inner loop index */
864 WmlClassDefPtr clsobj; /* current class object */
865 WmlClassResDefPtr resref; /* class' resource reference */
866 int itemno; /* item in bye */
867 char maskbuf[500]; /* current mask buffer */
868 char itembuf[100]; /* for current item */
869 int donl; /* TRUE if append \n to mask */
873 * Open the output file. Write canned header.
875 outfil = fopen ( "UilSymReas.h", "w");
876 if ( outfil == (FILE *) NULL )
878 printf ("\nCouldn't open UilSymReas.h");
881 fprintf (outfil, canned_warn);
882 fprintf (outfil, canned1);
885 * Generate the bit vectors for each class. Outer loop on the reason code,
886 * inner loop on the class code.
888 for ( resndx=0 ; resndx<wml_obj_reason_ptr->cnt ; resndx++ )
890 resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[resndx].objptr;
891 fprintf (outfil, bvechdr, resobj->tkname, resobj->sym_code);
894 * inner loop on widget class.
896 strcpy (maskbuf, " ");
897 for ( clsndx=0 ; clsndx<wml_obj_class_ptr->cnt ; clsndx++ )
899 clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[clsndx].objptr;
900 itemno = (clsobj->sym_code+1) % 8;
902 resref = wmlResolveResIsMember (resobj, clsobj->reasons);
903 if ( resref != NULL )
904 if ( resref->exclude != WmlAttributeTrue )
906 sprintf (itembuf, " _BIT_MASK(sym_k_%s_object) |",
908 strcat (maskbuf, itembuf);
912 strcat (maskbuf, "\n ");
915 fprintf (outfil, "%s 0", maskbuf);
916 strcpy (maskbuf, ",");
920 fprintf (outfil, "%s 0};\n", maskbuf);
922 fprintf (outfil, "};\n");
926 * Write the vector of vectors.
928 fprintf (outfil, canned2);
929 for ( resndx=0 ; resndx<wml_obj_reason_ptr->cnt ; resndx++ )
931 resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[resndx].objptr;
932 fprintf (outfil, " reason_class_vec%d,\n", resobj->sym_code);
934 fprintf (outfil, canned3);
937 * close the output file
939 printf ("\nCreated UilSymReas.h");
947 * Routine to write out UilSymArTa.h
949 * This file defines the arguments supported by each class. For each
950 * argument, there is a bit vector with the bit for each supporting class
951 * turned on if the argument is supported. There is then a vector pointing
952 * to these bit vectors for all arguments. This vector is accessed by
953 * sym_k_..._arg to find the arguments bit vector, then by sym_k_..._object
957 void wmlOutputUilSymArTa ()
963 * Bit vectors for each argument. The entries in the vector correspond\n\
969 /* sym_k_%s_arg */\n\
970 static unsigned char arg_class_vec%d[] =\n\
975 * Table of bit vectors accessed by sym_k_..._arg\n\
977 static unsigned char *allowed_argument_table_vec[] =\n\
979 NULL,\t/* UNUSED */\n";
983 externaldef(uil_sym_glbl) unsigned char **allowed_argument_table =\n\
984 \t\tallowed_argument_table_vec;\n";
986 FILE *outfil; /* output file */
987 int resndx; /* outer loop index */
988 WmlResourceDefPtr resobj; /* current argument */
989 int clsndx; /* inner loop index */
990 WmlClassDefPtr clsobj; /* current class object */
991 WmlClassResDefPtr resref; /* class' resource reference */
992 int itemno; /* item in bye */
993 char maskbuf[500]; /* current mask buffer */
994 char itembuf[100]; /* for current item */
995 int donl; /* TRUE if append \n to mask */
999 * Open the output file. Write canned header.
1001 outfil = fopen ( "UilSymArTa.h", "w");
1002 if ( outfil == (FILE *) NULL )
1004 printf ("\nCouldn't open UilSymArTa.h");
1007 fprintf (outfil, canned_warn);
1008 fprintf (outfil, canned1);
1011 * Generate the bit vectors for each class. Outer loop on the argument code,
1012 * inner loop on the class code.
1014 for ( resndx=0 ; resndx<wml_obj_arg_ptr->cnt ; resndx++ )
1016 resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[resndx].objptr;
1017 fprintf (outfil, bvechdr, resobj->tkname, resobj->sym_code);
1020 * inner loop on widget class.
1022 strcpy (maskbuf, " ");
1023 for ( clsndx=0 ; clsndx<wml_obj_class_ptr->cnt ; clsndx++ )
1025 clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[clsndx].objptr;
1026 itemno = (clsobj->sym_code+1) % 8;
1028 resref = wmlResolveResIsMember (resobj, clsobj->arguments);
1029 if ( resref != NULL )
1030 if ( resref->exclude != WmlAttributeTrue )
1032 sprintf (itembuf, " _BIT_MASK(sym_k_%s_object) |",
1034 strcat (maskbuf, itembuf);
1038 strcat (maskbuf, "\n ");
1041 fprintf (outfil, "%s 0", maskbuf);
1042 strcpy (maskbuf, ",");
1046 fprintf (outfil, "%s 0};\n", maskbuf);
1048 fprintf (outfil, "};\n");
1052 * Write the vector of vectors.
1054 fprintf (outfil, canned2);
1055 for ( resndx=0 ; resndx<wml_obj_arg_ptr->cnt ; resndx++ )
1057 resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[resndx].objptr;
1058 fprintf (outfil, " arg_class_vec%d,\n", resobj->sym_code);
1060 fprintf (outfil, canned3);
1063 * close the output file
1065 printf ("\nCreated UilSymArTa.h");
1072 * Routine to write out UilSymChTa.h
1074 * This file defines the automatic children supported by each class. For each
1075 * child, there is a bit vector with the bit for each supporting class
1076 * turned on if the child is supported. There is then a vector pointing
1077 * to these bit vectors for all children. This vector is accessed by
1078 * sym_k_..._child to find the child's bit vector, then by sym_k_..._object
1082 void wmlOutputUilSymChTa ()
1088 * Bit vectors for each child. The entries in the vector correspond\n\
1094 /* sym_k_%s_child */\n\
1095 static unsigned char child_class_vec%d[] =\n\
1100 * Table of bit vectors accessed by sym_k_..._child\n\
1102 static unsigned char *allowed_child_table_vec[] =\n\
1104 NULL,\t/* UNUSED */\n";
1108 externaldef(uil_sym_glbl) unsigned char **allowed_child_table =\n\
1109 \t\tallowed_child_table_vec;\n";
1111 FILE *outfil; /* output file */
1112 int childndx; /* outer loop index */
1113 WmlChildDefPtr childobj; /* current argument */
1114 int clsndx; /* inner loop index */
1115 WmlClassDefPtr clsobj; /* current class object */
1116 WmlClassChildDefPtr childref; /* class' child reference */
1117 int itemno; /* item in byte */
1118 char maskbuf[500]; /* current mask buffer */
1119 char itembuf[100]; /* for current item */
1120 int donl; /* TRUE if append \n to mask */
1124 * Open the output file. Write canned header.
1126 outfil = fopen ( "UilSymChTa.h", "w");
1127 if ( outfil == (FILE *) NULL )
1129 printf ("\nCouldn't open UilSymChTa.h");
1132 fprintf (outfil, canned_warn);
1133 fprintf (outfil, canned1);
1136 * Generate the bit vectors for each class. Outer loop on the child code,
1137 * inner loop on the class code.
1139 for ( childndx=0 ; childndx<wml_obj_child_ptr->cnt ; childndx++ )
1141 childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[childndx].objptr;
1142 fprintf (outfil, bvechdr, childobj->tkname, childobj->sym_code);
1145 * inner loop on widget class.
1147 strcpy (maskbuf, " ");
1148 for ( clsndx=0 ; clsndx<wml_obj_class_ptr->cnt ; clsndx++ )
1150 clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[clsndx].objptr;
1151 itemno = (clsobj->sym_code+1) % 8;
1153 childref = wmlResolveChildIsMember (childobj, clsobj->children);
1154 if ( childref != NULL )
1156 sprintf (itembuf, " _BIT_MASK(sym_k_%s_object) |", clsobj->tkname);
1157 strcat (maskbuf, itembuf);
1161 strcat (maskbuf, "\n ");
1164 fprintf (outfil, "%s 0", maskbuf);
1165 strcpy (maskbuf, ",");
1169 fprintf (outfil, "%s 0};\n", maskbuf);
1171 fprintf (outfil, "};\n");
1175 * Write the vector of vectors.
1177 fprintf (outfil, canned2);
1178 for ( childndx=0 ; childndx<wml_obj_child_ptr->cnt ; childndx++ )
1180 childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[childndx].objptr;
1181 fprintf (outfil, " child_class_vec%d,\n", childobj->sym_code);
1183 fprintf (outfil, canned3);
1186 * close the output file
1188 printf ("\nCreated UilSymChTa.h");
1195 * Routine to write out UilSymCtl.h
1197 * This file defines the controls supported by each class. For each
1198 * object, there is a bit vector with the bit for each supporting class
1199 * turned on if the object is supported. There is then a vector pointing
1200 * to these bit vectors for all objects. This vector is accessed by
1201 * sym_k_..._object to find the objects bit vector, then by sym_k_..._object
1205 void wmlOutputUilSymCtl ()
1211 * Bit vectors for each control. The entries in the vector correspond\n\
1217 /* sym_k_%s_object */\n\
1218 static unsigned char object_class_vec%d[] =\n\
1223 * Table of bit vectors accessed by sym_k_..._object\n\
1225 static unsigned char *allowed_control_table_vec[] =\n\
1227 NULL,\t/* UNUSED */\n";
1231 externaldef(uil_sym_glbl) unsigned char **allowed_control_table =\n\
1232 \t\tallowed_control_table_vec;\n";
1234 FILE *outfil; /* output file */
1235 int ctlndx; /* outer loop index */
1236 WmlClassDefPtr ctlobj; /* current class allowing controls */
1237 int clsndx; /* inner loop index */
1238 WmlClassDefPtr clsobj; /* current class object */
1239 int itemno; /* item in bye */
1240 char maskbuf[500]; /* current mask buffer */
1241 char itembuf[100]; /* for current item */
1242 int donl; /* TRUE if append \n to mask */
1246 * Open the output file. Write canned header.
1248 outfil = fopen ( "UilSymCtl.h", "w");
1249 if ( outfil == (FILE *) NULL )
1251 printf ("\nCouldn't open UilSymCtl.h");
1254 fprintf (outfil, canned_warn);
1255 fprintf (outfil, canned1);
1258 * Generate the bit vectors for each class. Outer loop on the class code,
1259 * inner loop on the class code.
1261 for ( ctlndx=0 ; ctlndx<wml_obj_class_ptr->cnt ; ctlndx++ )
1263 clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ctlndx].objptr;
1264 fprintf (outfil, bvechdr, clsobj->tkname, clsobj->sym_code);
1267 * inner loop on widget class.
1269 strcpy (maskbuf, " ");
1270 for ( clsndx=0 ; clsndx<wml_obj_class_ptr->cnt ; clsndx++ )
1272 ctlobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[clsndx].objptr;
1273 itemno = (ctlobj->sym_code+1) % 8;
1275 if ( wmlResolveCtlIsMember(clsobj,ctlobj->controls) == TRUE)
1277 sprintf (itembuf, " _BIT_MASK(sym_k_%s_object) |",
1279 strcat (maskbuf, itembuf);
1283 strcat (maskbuf, "\n ");
1286 fprintf (outfil, "%s 0", maskbuf);
1287 strcpy (maskbuf, ",");
1291 fprintf (outfil, "%s 0};\n", maskbuf);
1293 fprintf (outfil, "};\n");
1297 * Write the vector of vectors.
1299 fprintf (outfil, canned2);
1300 for ( ctlndx=0 ; ctlndx<wml_obj_class_ptr->cnt ; ctlndx++ )
1302 clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ctlndx].objptr;
1303 fprintf (outfil, " object_class_vec%d,\n", clsobj->sym_code);
1305 fprintf (outfil, canned3);
1308 * close the output file
1310 printf ("\nCreated UilSymCtl.h");
1318 * Predicate to indicate if a class object is in a controls list.
1321 int wmlResolveCtlIsMember (ctlobj, ctlref)
1322 WmlClassDefPtr ctlobj;
1323 WmlClassCtrlDefPtr ctlref;
1327 while ( ctlref != NULL )
1329 if ( ctlref->ctrl == ctlobj ) return TRUE;
1330 ctlref = ctlref->next;
1339 * Routine to write out UilSymNam.h
1341 * Tables of names of object indexed by their various sym_k_ literals.
1344 void wmlOutputUilSymNam ()
1349 "/* Define mapping of sym_k_..._object codes to widget names. */\n\
1351 externaldef(uil_sym_glbl) int uil_max_object = %d;\n\
1352 static char *uil_widget_names_vec[] = {\n\
1353 \"\",\t/* NOT USED */\n";
1357 externaldef(uil_sym_glbl) char **uil_widget_names =\n\
1358 \t\tuil_widget_names_vec;\n\
1360 /* Define mapping of sym_k_..._arg codes to argument names. */\n\
1362 externaldef(uil_sym_glbl) int uil_max_arg = %d;\n\
1363 static char *uil_argument_names_vec[] = {\n\
1364 \"\",\t/* NOT USED */\n";
1368 externaldef(uil_sym_glbl) char **uil_argument_names =\n\
1369 \t\tuil_argument_names_vec;\n\
1371 /* Define mapping of sym_k_..._reason to reason names. */\n\
1373 externaldef(uil_sym_glbl) int uil_max_reason = %d;\n\
1374 static char *uil_reason_names_vec[] = {\n\
1375 \"\",\t/* NOT USED */\n";
1379 externaldef(uil_sym_glbl) char **uil_reason_names =\n\
1380 \t\tuil_reason_names_vec;\n\
1382 /* Define mapping of sym_k_..._enumval to enumeration value names. */\n\
1384 externaldef(uil_sym_glbl) int uil_max_enumset = %d;\n\
1385 externaldef(uil_sym_glbl) int uil_max_enumval = %d;\n\
1386 static char *uil_enumval_names_vec[] = {\n\
1387 \"\",\t/* NOT USED */\n";
1391 externaldef(uil_sym_glbl) char **uil_enumval_names =\n\
1392 \t\tuil_enumval_names_vec;\n\
1394 /* Define mapping of sym_k_..._charset to enumeration value names. */\n\
1396 externaldef(uil_sym_glbl) int uil_max_charset = %d;\n\
1397 static char *uil_charset_names_vec[] = {\n\
1398 \"\",\t/* NOT USED */\n\
1399 \"<userdefined>\",\n";
1403 externaldef(uil_sym_glbl) char **uil_charset_names =\n\
1404 \t\tuil_charset_names_vec;\n\
1406 /* Define mapping of sym_k_..._child codes to child names. */\n\
1408 externaldef(uil_sym_glbl) int uil_max_child = %d;\n\
1409 static char *uil_child_names_vec[] = {\n\
1410 \"\",\t/* NOT USED */\n";
1414 externaldef(uil_sym_glbl) char **uil_child_names =\n\
1415 \t\tuil_child_names_vec;\n";
1418 FILE *outfil; /* output file */
1419 int ndx; /* loop index */
1420 WmlClassDefPtr clsobj; /* class object */
1421 WmlClassDefPtr varobj; /* gadget class object */
1422 WmlSynClassDefPtr synobj; /* syntactic object */
1423 WmlResourceDefPtr resobj; /* argument/reason object */
1424 WmlSynResourceDefPtr synres; /* arg/reason syntactic object */
1425 WmlEnumValueDefPtr evobj; /* enumeration value object */
1426 WmlSynEnumValueDefPtr synev; /* enumeration value syntactic obj */
1427 WmlCharSetDefPtr csobj; /* character set object */
1428 WmlSynCharSetDefPtr syncs; /* character set syntactic obj */
1429 WmlChildDefPtr chobj; /* child object */
1430 WmlSynChildDefPtr synch; /* child syntactic object */
1433 * Open the output file. Write canned header.
1435 outfil = fopen ( "UilSymNam.h", "w");
1436 if ( outfil == (FILE *) NULL )
1438 printf ("\nCouldn't open UilSymNam.h");
1441 fprintf (outfil, canned_warn);
1444 * Write entries for widgets
1446 fprintf (outfil, canned1, max_object_code);
1447 for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
1449 clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
1450 if ( clsobj->sym_code == 0 ) continue;
1451 synobj = clsobj->syndef;
1452 fprintf (outfil, " \"%s\",\n",
1457 * Write entries for arguments
1459 fprintf (outfil, canned2, max_arg_code);
1460 for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
1462 resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
1463 synres = resobj->syndef;
1464 if ( resobj->sym_code == 0 ) continue;
1465 fprintf (outfil, " \"%s\",\n",
1470 * Write entries for reasons
1472 fprintf (outfil, canned3, max_reason_code);
1473 for ( ndx=0 ; ndx<wml_obj_reason_ptr->cnt ; ndx++ )
1475 resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[ndx].objptr;
1476 synres = resobj->syndef;
1477 if ( resobj->sym_code == 0 ) continue;
1478 fprintf (outfil, " \"%s\",\n",
1483 * Write entries for enumeration values
1485 fprintf (outfil, canned4, max_enumset_code, max_enumval_code);
1486 for ( ndx=0 ; ndx<wml_obj_enumval_ptr->cnt ; ndx++ )
1488 evobj = (WmlEnumValueDefPtr) wml_obj_enumval_ptr->hvec[ndx].objptr;
1489 synev = evobj->syndef;
1490 if ( evobj->sym_code == 0 ) continue;
1491 fprintf (outfil, " \"%s\",\n",
1496 * Write entries for character sets
1498 fprintf (outfil, canned5, max_charset_code);
1499 for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
1501 csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
1502 syncs = csobj->syndef;
1503 if ( csobj->sym_code == 0 ) continue;
1504 fprintf (outfil, " \"%s\",\n",
1509 * Write entries for children
1511 fprintf (outfil, canned6, max_child_code);
1512 for ( ndx=0 ; ndx<wml_obj_child_ptr->cnt ; ndx++ )
1514 chobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[ndx].objptr;
1515 synch = chobj->syndef;
1516 if ( chobj->sym_code == 0 ) continue;
1517 fprintf (outfil, " \"%s\",\n",
1520 fprintf (outfil, canned7);
1523 * close the output file
1525 printf ("\nCreated UilSymNam.h");
1533 * Routine to write out UilSymEnum.h
1535 * This file defines the enumeration sets recognized by UIL. There is an
1536 * entry in this file for each enumeration set. The definitions are accessed
1537 * by the sym_k_..._enumset code. Each consists of a structure containing
1538 * a vector of enumeration value descriptors, each of which is the name
1539 * of the value and its value.
1541 * UilSymEnum.h contains:
1542 * - Vectors of value descriptors for each table entry
1543 * - The table itself.
1544 * - A table given the sym_k_..._enumset code for each argument which
1545 * has an enumeration set.
1546 * - A table accessed by sym_k_..._enumval code giving the actual value
1547 * for each enumeration value.
1549 * The typedefs for the tables are in UilSymGen.h
1552 void wmlOutputUilSymEnum ()
1559 * Enumeration value vectors for each enumeration set\n\
1565 static unsigned short int enum_value_vec%d[] =\n\
1571 * Enumeration set descriptor table\n\
1573 static UilEnumSetDescDef enum_set_table_vec[] =\n\
1579 externaldef(uil_sym_glbl) UilEnumSetDescDef *enum_set_table =\n\
1580 \t\tenum_set_table_vec;\n\
1582 * Enumeration set table, accessed by sym_k_..._arg code. Each non-zero entry\n\
1583 * is the sym_k_..._enumset code for the argument's enumeration set.\n\
1585 static unsigned short int argument_enumset_table_vec[] =\n\
1591 externaldef(uil_sym_glbl) unsigned short int *argument_enumset_table =\n\
1592 \t\targument_enumset_table_vec;\n\
1594 * Enumeration value table, accessed by sym_k_..._enumval code. Each entry is\n\
1595 * the actual value associated with the code.\n\
1597 static int enumval_values_table_vec[] =\n\
1603 externaldef(uil_sym_glbl) int *enumval_values_table =\n\
1604 \t\tenumval_values_table_vec;\n";
1607 FILE *outfil; /* output file */
1608 int ndx; /* loop index */
1609 WmlEnumSetDefPtr enumsetobj; /* enumeration set object */
1610 WmlEnumSetValDefPtr esvobj; /* current enum set value list element */
1611 WmlEnumValueDefPtr evobj; /* current enumeration value object */
1612 WmlResourceDefPtr resobj; /* resource object */
1616 * Open the output file. Write the canned header stuff
1618 outfil = fopen ("UilSymEnum.h", "w");
1619 if ( outfil == (FILE *) NULL )
1621 printf ("\nCouldn't open UilSymEnum.h");
1624 fprintf (outfil, canned_warn);
1627 * Generate the enumeration value vectors for each enumeration set.
1629 fprintf (outfil, canned1);
1630 for ( ndx=0 ; ndx<wml_obj_enumset_ptr->cnt ; ndx++ )
1632 enumsetobj = (WmlEnumSetDefPtr) wml_obj_enumset_ptr->hvec[ndx].objptr;
1633 fprintf (outfil, valhdr, enumsetobj->sym_code);
1634 for ( esvobj=enumsetobj->values ; esvobj!=NULL ; esvobj=esvobj->next )
1636 evobj = esvobj->value;
1637 fprintf (outfil, " %d,\n",
1640 fprintf (outfil, " };\n");
1644 * Generate the enumeration set tables
1646 fprintf (outfil, canned3);
1647 for ( ndx=0 ; ndx<wml_obj_enumset_ptr->cnt ; ndx++ )
1649 enumsetobj = (WmlEnumSetDefPtr) wml_obj_enumset_ptr->hvec[ndx].objptr;
1650 fprintf (outfil, " {%d,enum_value_vec%d},\n",
1651 enumsetobj->values_cnt,
1652 enumsetobj->sym_code);
1656 * Create enumset table entries for arguments, similar to writing sym_k...
1658 fprintf (outfil, canned4);
1659 for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
1661 resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
1662 if ( resobj->enumset_def == NULL )
1663 fprintf (outfil, " 0,\n");
1665 fprintf (outfil, " %d,\n",
1666 resobj->enumset_def->sym_code);
1670 * Create the enumval values table.
1672 fprintf (outfil, canned5);
1673 for ( ndx=0 ; ndx<wml_obj_enumval_ptr->cnt ; ndx++ )
1675 evobj = (WmlEnumValueDefPtr) wml_obj_enumval_ptr->hvec[ndx].objptr;
1676 fprintf (outfil, " %s,\n", evobj->syndef->enumlit);
1678 fprintf (outfil, canned5a);
1681 * close the output file
1683 printf ("\nCreated UilSymEnum.h");
1691 * Routine to write out UilSymCSet.h
1693 * This file specifies the various attributes for the character sets
1694 * recognized by UIL. There is a table for each of the following
1696 * - Standards name associated with the character set
1697 * - Writing direction, from XmSTRING_DIRECTION_...
1698 * - Parsing direction, from XmSTRING_DIRECTION_...
1699 * - Bytes per character, from sym_k_..._charsize (in UilSymGen.h)
1700 * - A pair of tables for recognizing $LANG settings:
1701 * o a table of all names under which a character set might
1702 * be legally recognized (upper case).
1703 * o the sym_k_..._charset code for each entry
1704 * o a variable giving the number of entries in the table
1706 * All tables are accessed by the sym_k_..._charset
1710 void wmlOutputUilSymCSet ()
1717 * Character set XmString name table, accessed by sym_k_..._charset code.\n\
1718 * Each entry is the name which identifies the character set in a XmString.\n\
1720 static char *charset_xmstring_names_table_vec[] =\n\
1723 \"<userdefined>\",\n";
1727 externaldef(uil_sym_glbl) char **charset_xmstring_names_table =\n\
1728 \t\tcharset_xmstring_names_table_vec;\n\
1730 * Character set writing direction table, accessed by sym_k_..._charset code.\n\
1731 * Each entry is the XmSTRING_DIRECTION_... code which identifies the\n\
1732 * writing direction for the character set in a XmString.\n\
1734 static unsigned char charset_wrdirection_table_vec[] =\n\
1737 0,\t/* userdefined */\n";
1741 externaldef(uil_sym_glbl) unsigned char *charset_writing_direction_table =\n\
1742 \t\tcharset_wrdirection_table_vec;\n\
1744 * Character set parsing direction table, accessed by sym_k_..._charset code.\n\
1745 * Each entry is the XmSTRING_DIRECTION_... code which identifies the\n\
1746 * parsing direction for the character set in a XmString.\n\
1748 static unsigned char charset_parsdirection_table_vec[] =\n\
1751 0,\t/* userdefined */\n";
1755 externaldef(uil_sym_glbl) unsigned char *charset_parsing_direction_table =\n\
1756 \t\tcharset_parsdirection_table_vec;\n\
1758 * Character set character size table, accessed by sym_k_..._charset code.\n\
1759 * Each entry is the sym_k_..._charsize literal which names the character\n\
1760 * size for the character set in a XmString.\n\
1762 static unsigned char charset_charsize_table_vec[] =\n\
1765 0,\t/* userdefined */\n";
1769 externaldef(uil_sym_glbl) unsigned char *charset_character_size_table =\n\
1770 \t\tcharset_charsize_table_vec;\n\
1772 * All the names under which a character set may be legally named in a \n\
1773 * $LANG variable (upper case).\n\
1775 static char *charset_lang_names_table_vec[] =\n\
1780 externaldef(uil_sym_glbl) char **charset_lang_names_table =\n\
1781 \t\tcharset_lang_names_table_vec;\n\
1783 * The sym_k_..._charset codes for charset_lang_names\n\
1785 static unsigned short int charset_lang_codes_table_vec[] =\n\
1790 externaldef(uil_sym_glbl) unsigned short int *charset_lang_codes_table =\n\
1791 \t\tcharset_lang_codes_table_vec;\n\
1793 * The number of entries in charset_lang_..._table tables\n\
1795 externaldef(uil_sym_glbl) unsigned short int charset_lang_table_max = %d;\n";
1798 FILE *outfil; /* output file */
1799 int ndx; /* loop index */
1800 WmlCharSetDefPtr csobj; /* character set object */
1801 WmlSynCharSetDefPtr syncs; /* character set syntactic obj */
1802 int lang_max; /* max value for $LANG tables */
1803 int alias_ndx; /* alias loop index */
1804 char uname[200]; /* name converted to upper case */
1808 * Open the output file. Write the canned header stuff
1810 outfil = fopen ("UilSymCSet.h", "w");
1811 if ( outfil == (FILE *) NULL )
1813 printf ("\nCouldn't open UilSymCSet.h");
1816 fprintf (outfil, canned_warn);
1819 * Generate the standards name table
1821 fprintf (outfil, canned1);
1822 for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
1824 csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
1825 syncs = csobj->syndef;
1826 if ( csobj->sym_code == 0 ) continue;
1827 if ((strcmp(syncs->xms_name, "XmFONTLIST_DEFAULT_TAG") == 0) ||
1828 (strcmp(syncs->xms_name, "_MOTIF_DEFAULT_LOCALE") == 0))
1829 fprintf (outfil, " %s,\t/* %s */\n",
1830 syncs->xms_name, syncs->name);
1832 fprintf (outfil, " \"%s\",\t/* %s */\n",
1833 syncs->xms_name, syncs->name);
1837 * Generate the writing direction table
1839 fprintf (outfil, canned2);
1840 for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
1842 csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
1843 syncs = csobj->syndef;
1844 if ( csobj->sym_code == 0 ) continue;
1845 switch ( syncs->direction )
1847 case WmlCharSetDirectionLtoR:
1848 fprintf (outfil, " XmSTRING_DIRECTION_L_TO_R,\t/* %s */\n",
1851 case WmlCharSetDirectionRtoL:
1852 fprintf (outfil, " XmSTRING_DIRECTION_R_TO_L,\t/* %s */\n",
1859 * Generate the parsing direction table
1861 fprintf (outfil, canned3);
1862 for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
1864 csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
1865 syncs = csobj->syndef;
1866 if ( csobj->sym_code == 0 ) continue;
1867 switch ( syncs->parsedirection )
1869 case WmlCharSetDirectionLtoR:
1870 fprintf (outfil, " XmSTRING_DIRECTION_L_TO_R,\t/* %s */\n",
1873 case WmlCharSetDirectionRtoL:
1874 fprintf (outfil, " XmSTRING_DIRECTION_R_TO_L,\t/* %s */\n",
1881 * Generate the character size table
1883 fprintf (outfil, canned4);
1884 for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
1886 csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
1887 syncs = csobj->syndef;
1888 if ( csobj->sym_code == 0 ) continue;
1889 switch ( syncs->charsize )
1891 case WmlCharSizeOneByte:
1892 fprintf (outfil, " sym_k_onebyte_charsize,\t/* %s */\n",
1895 case WmlCharSizeTwoByte:
1896 fprintf (outfil, " sym_k_twobyte_charsize,\t/* %s */\n",
1899 case WmlCharSizeMixed1_2Byte:
1900 fprintf (outfil, " sym_k_mixed1_2byte_charsize,\t/* %s */\n",
1907 * Generate the $LANG name recognition table
1909 fprintf (outfil, canned5);
1911 for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
1913 csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
1914 syncs = csobj->syndef;
1915 if ( csobj->sym_code == 0 ) continue;
1916 strcpy (uname, syncs->name);
1917 wmlUpperCaseString (uname);
1918 fprintf (outfil, " \"%s\",\t/* %s */\n",
1919 uname, syncs->name);
1921 strcpy (uname, syncs->xms_name);
1922 wmlUpperCaseString (uname);
1923 fprintf (outfil, " \"%s\",\t/* %s */\n",
1924 uname, syncs->name);
1926 for ( alias_ndx=0 ; alias_ndx<syncs->alias_cnt ; alias_ndx++ )
1928 strcpy (uname, syncs->alias_list[alias_ndx]);
1929 wmlUpperCaseString (uname);
1930 fprintf (outfil, " \"%s\",\t/* %s */\n",
1931 uname, syncs->name);
1937 * Generate the $LANG code lookup table, in upper case
1939 fprintf (outfil, canned6);
1940 for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
1942 csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
1943 syncs = csobj->syndef;
1944 if ( csobj->sym_code == 0 ) continue;
1945 fprintf (outfil, " sym_k_%s_charset,\n", syncs->name);
1946 fprintf (outfil, " sym_k_%s_charset,\n", syncs->name);
1947 for ( alias_ndx=0 ; alias_ndx<syncs->alias_cnt ; alias_ndx++ )
1948 fprintf (outfil, " sym_k_%s_charset,\n", syncs->name);
1952 * Generate the number of entries in the previous two tables
1954 fprintf (outfil, canned7, lang_max);
1957 * close the output file
1959 printf ("\nCreated UilSymCSet.h");