4 * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
5 * ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for
6 * the full copyright text.
13 static char rcsid[] = "$XConsortium: wmlouth.c /main/8 1995/08/29 11:10:46 drk $"
17 * (c) Copyright 1989, 1990, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */
20 * This module contains routines responsible for writing the .h files
21 * produced by WML. All files are written into the current directory.
24 * The resolved objects
52 * Routines used only in this module
54 void wmlOutputUilSymGen ();
55 void wmlOutputUilSymArTy ();
56 void wmlOutputUilSymChCl ();
57 void wmlOutputUilSymRArg ();
58 void wmlOutputUilUrmClas ();
59 void wmlOutputUilConst ();
60 void wmlOutputUilSymReas ();
61 void wmlOutputUilSymArTa ();
62 void wmlOutputUilSymChTa ();
63 void wmlOutputUilSymCtl ();
64 void wmlOutputUilSymNam ();
65 void wmlOutputUilSymEnum ();
66 void wmlOutputUilSymCSet ();
72 static char *canned_warn =
74 **\tThis file is automatically generated. Do not edit it by hand.\n\
78 * Used to create masks for bytes in bit vectors. Accessed by bit numbers
81 static char *bit_masks[] = {""
89 ," | 128"}; /* bit 8 */
92 * To pick up maximum code values
94 static int max_object_code = 0;
95 static int max_reason_code = 0;
96 static int max_arg_code = 0;
97 static int max_enumset_code = 0;
98 static int max_enumval_code = 0;
99 static int max_charset_code = 0;
100 static int max_child_code = 0;
105 * Output control routine, which simply outputs each .h file in turn.
108 void wmlOutputHFiles ()
112 wmlOutputUilSymGen ();
113 wmlOutputUilSymArTy ();
114 wmlOutputUilSymChCl ();
115 wmlOutputUilSymRArg ();
116 wmlOutputUilUrmClas ();
117 wmlOutputUilConst ();
118 wmlOutputUilSymReas ();
119 wmlOutputUilSymArTa ();
120 wmlOutputUilSymChTa ();
121 wmlOutputUilSymCtl ();
122 wmlOutputUilSymNam ();
123 wmlOutputUilSymEnum ();
124 wmlOutputUilSymCSet ();
131 * Routine to write out UilSymGen.h
133 * This file defines the sym_k... literals for UIL. Each set of literals
134 * typiclly increases monotonically from 1, with 0 used as en error value.
136 * sym_k_<class>_object
137 * <class> is widget class name in lexicographic order
138 * gadgets are not include.
140 * bit masks for table access
142 * sym_k_<reason>_reason
143 * literals specifying all reasons, lexicographically ordered
145 * sym_k_<argument>_arg
146 * literals for all arguments, lexicographically ordered.
147 * Constraints are included, and ordered with the arguments.
149 * sym_k_<child>_child
150 * literals for all automatic children, lexicographically ordered.
152 * sym_k_<enumset>_enumset
153 * literals naming each enumeration set, lexicographically ordered
155 * Fixed literals naming character set character sizes
156 * sym_k_<charset>_charset
157 * literals naming each character set, lexicographically ordered
160 void wmlOutputUilSymGen ()
165 "\n/* Define literals for objects */\n";
169 "\n/* Define literals for reasons */\n\n";
173 "\n/* Define literals for arguments */\n\n";
176 "\n/* Define literals for enumeration sets */\n\n";
179 "\n/* Define literals for enumeration values */\n\n";
182 "\n/* Define literals for character sets */\n\n";
185 "\n/* Define literals for automatic children */\n\n";
187 FILE *outfil; /* output file */
188 int ndx; /* loop index */
189 WmlClassDefPtr clsobj; /* class object */
190 WmlDataTypeDefPtr datobj; /* data type object */
191 WmlResourceDefPtr resobj; /* resource object */
192 WmlEnumSetDefPtr enumsetobj; /* enumeration set object */
193 WmlEnumValueDefPtr enumvalobj; /* enumeration value object */
194 WmlCharSetDefPtr charsetobj; /* character set object */
195 WmlChildDefPtr childobj; /* child object */
198 * Open the output file. Write the canned header stuff
200 outfil = fopen ("UilSymGen.h", "w");
201 if ( outfil == (FILE *) NULL )
203 printf ("\nCouldn't open UilSymGen.h");
206 fprintf (outfil, canned_warn);
209 * Write the sym_k..._object literals
211 fprintf (outfil, canned1);
212 for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
214 clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
215 fprintf (outfil, "#define sym_k_%s_object\t%d\n",
218 if ( clsobj->sym_code > max_object_code )
219 max_object_code = clsobj->sym_code;
223 * Define the sym_k_..._reason literals
225 fprintf (outfil, canned3);
226 for ( ndx=0 ; ndx<wml_obj_reason_ptr->cnt ; ndx++ )
228 resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[ndx].objptr;
229 fprintf (outfil, "#define sym_k_%s_reason\t%d\n",
232 if ( resobj->sym_code > max_reason_code )
233 max_reason_code = resobj->sym_code;
237 * Define the sym_k_..._arg literals
239 fprintf (outfil, canned4);
240 for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
242 resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
243 fprintf (outfil, "#define sym_k_%s_arg\t%d\n",
246 if ( resobj->sym_code > max_arg_code )
247 max_arg_code = resobj->sym_code;
251 * Define the sym_k_..._enumset structs and literals
253 fprintf (outfil, canned5);
254 for ( ndx=0 ; ndx<wml_obj_enumset_ptr->cnt ; ndx++ )
256 enumsetobj = (WmlEnumSetDefPtr) wml_obj_enumset_ptr->hvec[ndx].objptr;
257 fprintf (outfil, "#define sym_k_%s_enumset\t%d\n",
259 enumsetobj->sym_code);
260 if ( enumsetobj->sym_code > max_enumset_code )
261 max_enumset_code = enumsetobj->sym_code;
265 * Define the sym_k_..._enumval literals
267 fprintf (outfil, canned6);
268 for ( ndx=0 ; ndx<wml_obj_enumval_ptr->cnt ; ndx++ )
270 enumvalobj = (WmlEnumValueDefPtr) wml_obj_enumval_ptr->hvec[ndx].objptr;
271 fprintf (outfil, "#define sym_k_%s_enumval\t%d\n",
272 enumvalobj->syndef->name,
273 enumvalobj->sym_code);
274 if ( enumvalobj->sym_code > max_enumval_code )
275 max_enumval_code = enumvalobj->sym_code;
279 * Define the sym_k_..._charsize literals
280 * Define the sym_k_..._charset literals
282 fprintf (outfil, canned7);
283 for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
285 charsetobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
286 fprintf (outfil, "#define sym_k_%s_charset\t%d\n",
287 charsetobj->syndef->name,
288 charsetobj->sym_code);
289 if ( charsetobj->sym_code > max_charset_code )
290 max_charset_code = charsetobj->sym_code;
294 * Define the sym_k_..._child literals
296 fprintf (outfil, canned8);
297 for ( ndx=0 ; ndx<wml_obj_child_ptr->cnt ; ndx++ )
299 childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[ndx].objptr;
300 fprintf (outfil, "#define sym_k_%s_child\t%d\n",
301 childobj->syndef->name,
303 if ( childobj->sym_code > max_child_code )
304 max_child_code = childobj->sym_code;
308 * close the output file
310 printf ("\nCreated UilSymGen.h");
318 * Routine to write out UilSymChCl.h
320 * A table of classes accessed by child type (sym_k_<child>_child, in
323 * sym_k_<class>_class,
326 void wmlOutputUilSymChCl ()
331 "/* Table of the class type of children\n\
332 The table is indexed by child with each entry the\n\
333 permitted class for that child.\n\
336 static unsigned char child_class_table_vec[] =\n\
342 externaldef(uil_sym_glbl) unsigned char *child_class_table =\n\
343 \t child_class_table_vec;\n";
345 FILE *outfil; /* output file */
346 int ndx; /* loop index */
347 WmlClassDefPtr classobj; /* data type object */
348 WmlChildDefPtr childobj; /* resource object */
352 * Open the output file. Write canned header.
354 outfil = fopen ( "UilSymChCl.h", "w");
355 if ( outfil == (FILE *) NULL )
357 printf ("\nCouldn't open UilSymChCL.h");
360 fprintf (outfil, canned_warn);
363 * Create table entries, similar to writing sym_k...
365 fprintf (outfil, canned1);
366 for ( ndx=0 ; ndx<wml_obj_child_ptr->cnt ; ndx++ )
368 childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[ndx].objptr;
369 classobj = childobj->class;
370 fprintf (outfil, " sym_k_%s_object,\n",
373 fprintf (outfil, canned1a);
376 * close the output file
378 printf ("\nCreated UilSymChCl.h");
385 * Routine to write out UilSymArTy.h
387 * A table of data types accessed by argument type (sym_k_<arg>_arg, in
390 * sym_k_<data_type>_value,
393 void wmlOutputUilSymArTy ()
398 "/* Table of the types of arguments\n\
399 The table is indexed by argument with each entry the\n\
400 permitted type for that argument.\n\
403 static unsigned char argument_type_table_vec[] =\n\
409 externaldef(uil_sym_glbl) unsigned char *argument_type_table =\n\
410 \t argument_type_table_vec;\n";
412 FILE *outfil; /* output file */
413 int ndx; /* loop index */
414 WmlDataTypeDefPtr datobj; /* data type object */
415 WmlResourceDefPtr resobj; /* resource object */
419 * Open the output file. Write canned header.
421 outfil = fopen ( "UilSymArTy.h", "w");
422 if ( outfil == (FILE *) NULL )
424 printf ("\nCouldn't open UilSymArTy.h");
427 fprintf (outfil, canned_warn);
430 * Create table entries, similar to writing sym_k...
432 fprintf (outfil, canned1);
433 for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
435 resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
436 datobj = resobj->dtype_def;
437 fprintf (outfil, " sym_k_%s_value,\n",
440 fprintf (outfil, canned1a);
443 * close the output file
445 printf ("\nCreated UilSymArTy.h");
453 * Routine to write out UilSymRArg.h
455 * Related argument table
458 void wmlOutputUilSymRArg ()
463 "/* Related argument table. Each non-zero entry is the code\n\
464 of the related argument.\n\
467 static unsigned short int related_argument_table_vec[] =\n\
473 externaldef(uil_sym_glbl) unsigned short int *related_argument_table =\n\
474 \t\trelated_argument_table_vec;\n";
476 FILE *outfil; /* output file */
477 int ndx; /* loop index */
478 WmlResourceDefPtr resobj; /* resource object */
482 * Open the output file. Write canned header.
484 outfil = fopen ( "UilSymRArg.h", "w");
485 if ( outfil == (FILE *) NULL )
487 printf ("\nCouldn't open UilSymRArg.h");
490 fprintf (outfil, canned_warn);
493 * Create table entries, similar to writing sym_k...
495 fprintf (outfil, canned1);
496 for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
498 resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
499 fprintf (outfil, " %d,\n",
500 resobj->related_code);
502 fprintf (outfil, canned1a);
505 * close the output file
507 printf ("\nCreated UilSymRArg.h");
515 * Routine to write out UilUrmClas.h
517 * Table of convenience function names indexed by the sym_k_<class> literal
518 * for both widgets and gadgets
519 * Table of resource names indexed by the sym_k_<argument>_arg and
520 * sym_k_<reason>_reason codes.
523 void wmlOutputUilUrmClas ()
528 "\n/* Define mapping of UIL widget types to convenience functions. */\n\
529 static char *uil_widget_funcs_vec[] = {\n\
530 \"\",\t /* NOT USED */\n";
534 externaldef(uil_sym_glbl) char **uil_widget_funcs = uil_widget_funcs_vec;\n\
536 /* Define mapping of UIL widget classes to matching gadget class. */\n\
537 static unsigned short int uil_gadget_variants_vec[] = {\n\
538 0,\t /* NOT USED */\n";
542 externaldef(uil_sym_glbl) unsigned short int *uil_gadget_variants =\n\
543 \t\tuil_gadget_variants_vec;\n\
545 /* Define mapping of dialog types to non-dialog URM widget classes. */\n\
546 static unsigned short int uil_urm_nondialog_class_vec[] = {\n\
547 0,\t/* NOT USED */\n";
551 externaldef(uil_sym_glbl) unsigned short int *uil_urm_nondialog_class =\n\
552 \t\tuil_urm_nondialog_class_vec;\n\
554 /* Define mapping of widget controls to a (subtree) resource. */\n\
555 static unsigned short int uil_urm_subtree_resource_vec[] = {\n\
556 0,\t/* NOT USED */\n";
560 externaldef(uil_sym_glbl) unsigned short int *uil_urm_subtree_resource =\n\
561 \t\tuil_urm_subtree_resource_vec;\n\
563 /* Define mapping of arguments to toolkit names. */\n\
564 static char *uil_argument_toolkit_names_vec[] = {\n\
565 \"\",\t /* NOT USED */\n";
569 externaldef(uil_sym_glbl) char **uil_argument_toolkit_names =\n\
570 \t\tuil_argument_toolkit_names_vec;\n\
572 /* Define mapping of reasons to toolkit names. */\n\
573 static char *uil_reason_toolkit_names_vec[] = {\n\
574 \"\",\t/* NOT USED */\n";
578 externaldef(uil_sym_glbl) char **uil_reason_toolkit_names =\n\
579 \t\tuil_reason_toolkit_names_vec;\n";
583 FILE *outfil; /* output file */
584 int ndx; /* loop index */
585 WmlClassDefPtr clsobj; /* class object */
586 WmlSynClassDefPtr synobj; /* syntactic object */
587 WmlClassDefPtr varobj; /* variant (widget) class object */
588 WmlResourceDefPtr resobj; /* argument/reason object */
589 WmlSynResourceDefPtr synres; /* arg/reason syntactic object */
590 WmlResourceDefPtr mapresobj; /* controls map to resource object */
594 * Open the output file. Write canned header.
596 outfil = fopen ( "UilUrmClas.h", "w");
597 if ( outfil == (FILE *) NULL )
599 printf ("\nCouldn't open UilUrmClas.h");
602 fprintf (outfil, canned_warn);
605 * Write entries for widgets
607 fprintf (outfil, canned1);
608 for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
610 clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
611 if ( clsobj->sym_code == 0 ) continue;
612 synobj = clsobj->syndef;
613 if ( synobj->int_lit != NULL )
614 fprintf (outfil, " \"%s\",\n", synobj->convfunc);
616 fprintf (outfil, " \"%s\",\t\n", synobj->convfunc);
618 fprintf (outfil, canned2);
621 * Write entries for gadget variants of widget classes
623 for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
625 clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
626 if ( clsobj->sym_code == 0 ) continue;
627 varobj = clsobj->variant;
628 synobj = clsobj->syndef;
629 if ( varobj==NULL || synobj->type==WmlClassTypeGadget )
630 fprintf (outfil, " 0,\n");
633 synobj = varobj->syndef;
634 if ( synobj->int_lit != NULL )
635 fprintf (outfil, " sym_k_%s_object,\n",
638 fprintf (outfil, " sym_k_%s_object,\n",
642 fprintf (outfil, canned3);
645 * Write entries for non-dialog widgets
647 for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
649 clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
650 if ( clsobj->sym_code == 0 ) continue;
651 varobj = clsobj->nondialog;
652 synobj = clsobj->syndef;
653 if ( varobj == NULL )
654 fprintf (outfil, " 0,\n");
657 synobj = varobj->syndef;
658 if ( synobj->int_lit != NULL )
659 fprintf (outfil, " sym_k_%s_object,\n",
662 fprintf (outfil, " sym_k_%s_object,\n",
666 fprintf (outfil, canned4);
669 * Write entries for the resource a widget's controls map to
671 for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
673 clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
674 if ( clsobj->sym_code == 0 ) continue;
675 synobj = clsobj->syndef;
676 mapresobj = clsobj->ctrlmapto;
677 if ( mapresobj == NULL )
678 fprintf (outfil, " 0,\n");
680 fprintf (outfil, " sym_k_%s_arg,\n", mapresobj->tkname);
682 fprintf (outfil, canned5);
685 * Write entries for arguments
687 for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
689 resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
690 synres = resobj->syndef;
691 if ( resobj->sym_code == 0 ) continue;
692 fprintf (outfil, " %s,\n",
695 fprintf (outfil, canned6);
698 * Write entries for reasons
700 for ( ndx=0 ; ndx<wml_obj_reason_ptr->cnt ; ndx++ )
702 resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[ndx].objptr;
703 synres = resobj->syndef;
704 if ( resobj->sym_code == 0 ) continue;
705 fprintf (outfil, " %s,\n",
708 fprintf (outfil, canned7);
711 * close the output file
713 printf ("\nCreated UilUrmClas.h");
721 * Routine to write out UilConst.h
723 * A bit vector showing which arguments are constraints.
726 void wmlOutputUilConst ()
731 "/* Table indexed by argument indicating whether\n\
732 argument is a constraint (TRUE) or a regular\n\
733 argument (FALSE). Each entry is one bit.\n\
734 Index and mask macros are defined to simplify\n\
735 access to the table\n\
738 static unsigned char constraint_tab_vec[] = {\n";
742 externaldef(uil_sym_glbl) unsigned char *constraint_tab =\n\
743 \t\tconstraint_tab_vec;\n";
746 FILE *outfil; /* output file */
747 int ndx; /* loop index */
748 WmlResourceDefPtr resobj; /* resource object */
749 WmlSynResourceDefPtr synobj; /* syntactic object */
750 char maskbuf[100]; /* to constuct each mask */
751 int bitno; /* current bit number, from code */
754 * Open the output file. Write canned header.
756 outfil = fopen ( "UilConst.h", "w");
757 if ( outfil == (FILE *) NULL )
759 printf ("\nCouldn't open UilConst.h");
762 fprintf (outfil, canned_warn);
765 * Process the arguments in code order. We start with 1, and write out
766 * the mask after processing 8 codes.
768 fprintf (outfil, canned1);
769 strcpy (maskbuf, "0");
770 for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
772 resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
773 synobj = resobj->syndef;
774 bitno = resobj->sym_code % 8;
775 if ( bitno == 0 ) bitno = 8;
776 if ( synobj->type == WmlResourceTypeConstraint )
777 strcat (maskbuf, bit_masks[bitno]);
780 fprintf (outfil, "%s,\n", maskbuf);
781 strcpy (maskbuf, "0");
785 fprintf (outfil, "%s", maskbuf);
786 fprintf (outfil, canned1a);
789 * close the output file
791 printf ("\nCreated UilConst.h");
799 * Routine to write out UilSymReas.h
801 * This file defines the reasons supported by each class. For each
802 * reason, there is a bit vector with the bit for each supporting class
803 * turned on if the reason is supported. There is then a vector pointing
804 * to these bit vectors for all reasons. This vector is accessed by
805 * sym_k_..._reason to find the reasons bit vector, then by sym_k_..._object
809 void wmlOutputUilSymReas ()
815 * Bit vectors for each reason. The entries in the vector correspond\n\
821 /* sym_k_%s_reason */\n\
822 static unsigned char reason_class_vec%d[] =\n\
827 * Table of bit vectors accessed by sym_k_..._reason\n\
829 static unsigned char *allowed_reason_table_vec[] =\n\
831 NULL,\t/* UNUSED */\n";
835 externaldef(uil_sym_glbl) unsigned char **allowed_reason_table =\n\
836 \t\tallowed_reason_table_vec;\n";
838 FILE *outfil; /* output file */
839 int resndx; /* outer loop index */
840 WmlResourceDefPtr resobj; /* current reason */
841 int clsndx; /* inner loop index */
842 WmlClassDefPtr clsobj; /* current class object */
843 WmlClassResDefPtr resref; /* class' resource reference */
844 int itemno; /* item in bye */
845 char maskbuf[500]; /* current mask buffer */
846 char itembuf[100]; /* for current item */
847 int donl; /* TRUE if append \n to mask */
851 * Open the output file. Write canned header.
853 outfil = fopen ( "UilSymReas.h", "w");
854 if ( outfil == (FILE *) NULL )
856 printf ("\nCouldn't open UilSymReas.h");
859 fprintf (outfil, canned_warn);
860 fprintf (outfil, canned1);
863 * Generate the bit vectors for each class. Outer loop on the reason code,
864 * inner loop on the class code.
866 for ( resndx=0 ; resndx<wml_obj_reason_ptr->cnt ; resndx++ )
868 resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[resndx].objptr;
869 fprintf (outfil, bvechdr, resobj->tkname, resobj->sym_code);
872 * inner loop on widget class.
874 strcpy (maskbuf, " ");
875 for ( clsndx=0 ; clsndx<wml_obj_class_ptr->cnt ; clsndx++ )
877 clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[clsndx].objptr;
878 itemno = (clsobj->sym_code+1) % 8;
880 resref = wmlResolveResIsMember (resobj, clsobj->reasons);
881 if ( resref != NULL )
882 if ( resref->exclude != WmlAttributeTrue )
884 sprintf (itembuf, " _BIT_MASK(sym_k_%s_object) |",
886 strcat (maskbuf, itembuf);
890 strcat (maskbuf, "\n ");
893 fprintf (outfil, "%s 0", maskbuf);
894 strcpy (maskbuf, ",");
898 fprintf (outfil, "%s 0};\n", maskbuf);
900 fprintf (outfil, "};\n");
904 * Write the vector of vectors.
906 fprintf (outfil, canned2);
907 for ( resndx=0 ; resndx<wml_obj_reason_ptr->cnt ; resndx++ )
909 resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[resndx].objptr;
910 fprintf (outfil, " reason_class_vec%d,\n", resobj->sym_code);
912 fprintf (outfil, canned3);
915 * close the output file
917 printf ("\nCreated UilSymReas.h");
925 * Routine to write out UilSymArTa.h
927 * This file defines the arguments supported by each class. For each
928 * argument, there is a bit vector with the bit for each supporting class
929 * turned on if the argument is supported. There is then a vector pointing
930 * to these bit vectors for all arguments. This vector is accessed by
931 * sym_k_..._arg to find the arguments bit vector, then by sym_k_..._object
935 void wmlOutputUilSymArTa ()
941 * Bit vectors for each argument. The entries in the vector correspond\n\
947 /* sym_k_%s_arg */\n\
948 static unsigned char arg_class_vec%d[] =\n\
953 * Table of bit vectors accessed by sym_k_..._arg\n\
955 static unsigned char *allowed_argument_table_vec[] =\n\
957 NULL,\t/* UNUSED */\n";
961 externaldef(uil_sym_glbl) unsigned char **allowed_argument_table =\n\
962 \t\tallowed_argument_table_vec;\n";
964 FILE *outfil; /* output file */
965 int resndx; /* outer loop index */
966 WmlResourceDefPtr resobj; /* current argument */
967 int clsndx; /* inner loop index */
968 WmlClassDefPtr clsobj; /* current class object */
969 WmlClassResDefPtr resref; /* class' resource reference */
970 int itemno; /* item in bye */
971 char maskbuf[500]; /* current mask buffer */
972 char itembuf[100]; /* for current item */
973 int donl; /* TRUE if append \n to mask */
977 * Open the output file. Write canned header.
979 outfil = fopen ( "UilSymArTa.h", "w");
980 if ( outfil == (FILE *) NULL )
982 printf ("\nCouldn't open UilSymArTa.h");
985 fprintf (outfil, canned_warn);
986 fprintf (outfil, canned1);
989 * Generate the bit vectors for each class. Outer loop on the argument code,
990 * inner loop on the class code.
992 for ( resndx=0 ; resndx<wml_obj_arg_ptr->cnt ; resndx++ )
994 resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[resndx].objptr;
995 fprintf (outfil, bvechdr, resobj->tkname, resobj->sym_code);
998 * inner loop on widget class.
1000 strcpy (maskbuf, " ");
1001 for ( clsndx=0 ; clsndx<wml_obj_class_ptr->cnt ; clsndx++ )
1003 clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[clsndx].objptr;
1004 itemno = (clsobj->sym_code+1) % 8;
1006 resref = wmlResolveResIsMember (resobj, clsobj->arguments);
1007 if ( resref != NULL )
1008 if ( resref->exclude != WmlAttributeTrue )
1010 sprintf (itembuf, " _BIT_MASK(sym_k_%s_object) |",
1012 strcat (maskbuf, itembuf);
1016 strcat (maskbuf, "\n ");
1019 fprintf (outfil, "%s 0", maskbuf);
1020 strcpy (maskbuf, ",");
1024 fprintf (outfil, "%s 0};\n", maskbuf);
1026 fprintf (outfil, "};\n");
1030 * Write the vector of vectors.
1032 fprintf (outfil, canned2);
1033 for ( resndx=0 ; resndx<wml_obj_arg_ptr->cnt ; resndx++ )
1035 resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[resndx].objptr;
1036 fprintf (outfil, " arg_class_vec%d,\n", resobj->sym_code);
1038 fprintf (outfil, canned3);
1041 * close the output file
1043 printf ("\nCreated UilSymArTa.h");
1050 * Routine to write out UilSymChTa.h
1052 * This file defines the automatic children supported by each class. For each
1053 * child, there is a bit vector with the bit for each supporting class
1054 * turned on if the child is supported. There is then a vector pointing
1055 * to these bit vectors for all children. This vector is accessed by
1056 * sym_k_..._child to find the child's bit vector, then by sym_k_..._object
1060 void wmlOutputUilSymChTa ()
1066 * Bit vectors for each child. The entries in the vector correspond\n\
1072 /* sym_k_%s_child */\n\
1073 static unsigned char child_class_vec%d[] =\n\
1078 * Table of bit vectors accessed by sym_k_..._child\n\
1080 static unsigned char *allowed_child_table_vec[] =\n\
1082 NULL,\t/* UNUSED */\n";
1086 externaldef(uil_sym_glbl) unsigned char **allowed_child_table =\n\
1087 \t\tallowed_child_table_vec;\n";
1089 FILE *outfil; /* output file */
1090 int childndx; /* outer loop index */
1091 WmlChildDefPtr childobj; /* current argument */
1092 int clsndx; /* inner loop index */
1093 WmlClassDefPtr clsobj; /* current class object */
1094 WmlClassChildDefPtr childref; /* class' child reference */
1095 int itemno; /* item in byte */
1096 char maskbuf[500]; /* current mask buffer */
1097 char itembuf[100]; /* for current item */
1098 int donl; /* TRUE if append \n to mask */
1102 * Open the output file. Write canned header.
1104 outfil = fopen ( "UilSymChTa.h", "w");
1105 if ( outfil == (FILE *) NULL )
1107 printf ("\nCouldn't open UilSymChTa.h");
1110 fprintf (outfil, canned_warn);
1111 fprintf (outfil, canned1);
1114 * Generate the bit vectors for each class. Outer loop on the child code,
1115 * inner loop on the class code.
1117 for ( childndx=0 ; childndx<wml_obj_child_ptr->cnt ; childndx++ )
1119 childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[childndx].objptr;
1120 fprintf (outfil, bvechdr, childobj->tkname, childobj->sym_code);
1123 * inner loop on widget class.
1125 strcpy (maskbuf, " ");
1126 for ( clsndx=0 ; clsndx<wml_obj_class_ptr->cnt ; clsndx++ )
1128 clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[clsndx].objptr;
1129 itemno = (clsobj->sym_code+1) % 8;
1131 childref = wmlResolveChildIsMember (childobj, clsobj->children);
1132 if ( childref != NULL )
1134 sprintf (itembuf, " _BIT_MASK(sym_k_%s_object) |", clsobj->tkname);
1135 strcat (maskbuf, itembuf);
1139 strcat (maskbuf, "\n ");
1142 fprintf (outfil, "%s 0", maskbuf);
1143 strcpy (maskbuf, ",");
1147 fprintf (outfil, "%s 0};\n", maskbuf);
1149 fprintf (outfil, "};\n");
1153 * Write the vector of vectors.
1155 fprintf (outfil, canned2);
1156 for ( childndx=0 ; childndx<wml_obj_child_ptr->cnt ; childndx++ )
1158 childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[childndx].objptr;
1159 fprintf (outfil, " child_class_vec%d,\n", childobj->sym_code);
1161 fprintf (outfil, canned3);
1164 * close the output file
1166 printf ("\nCreated UilSymChTa.h");
1173 * Routine to write out UilSymCtl.h
1175 * This file defines the controls supported by each class. For each
1176 * object, there is a bit vector with the bit for each supporting class
1177 * turned on if the object is supported. There is then a vector pointing
1178 * to these bit vectors for all objects. This vector is accessed by
1179 * sym_k_..._object to find the objects bit vector, then by sym_k_..._object
1183 void wmlOutputUilSymCtl ()
1189 * Bit vectors for each control. The entries in the vector correspond\n\
1195 /* sym_k_%s_object */\n\
1196 static unsigned char object_class_vec%d[] =\n\
1201 * Table of bit vectors accessed by sym_k_..._object\n\
1203 static unsigned char *allowed_control_table_vec[] =\n\
1205 NULL,\t/* UNUSED */\n";
1209 externaldef(uil_sym_glbl) unsigned char **allowed_control_table =\n\
1210 \t\tallowed_control_table_vec;\n";
1212 FILE *outfil; /* output file */
1213 int ctlndx; /* outer loop index */
1214 WmlClassDefPtr ctlobj; /* current class allowing controls */
1215 int clsndx; /* inner loop index */
1216 WmlClassDefPtr clsobj; /* current class object */
1217 int itemno; /* item in bye */
1218 char maskbuf[500]; /* current mask buffer */
1219 char itembuf[100]; /* for current item */
1220 int donl; /* TRUE if append \n to mask */
1224 * Open the output file. Write canned header.
1226 outfil = fopen ( "UilSymCtl.h", "w");
1227 if ( outfil == (FILE *) NULL )
1229 printf ("\nCouldn't open UilSymCtl.h");
1232 fprintf (outfil, canned_warn);
1233 fprintf (outfil, canned1);
1236 * Generate the bit vectors for each class. Outer loop on the class code,
1237 * inner loop on the class code.
1239 for ( ctlndx=0 ; ctlndx<wml_obj_class_ptr->cnt ; ctlndx++ )
1241 clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ctlndx].objptr;
1242 fprintf (outfil, bvechdr, clsobj->tkname, clsobj->sym_code);
1245 * inner loop on widget class.
1247 strcpy (maskbuf, " ");
1248 for ( clsndx=0 ; clsndx<wml_obj_class_ptr->cnt ; clsndx++ )
1250 ctlobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[clsndx].objptr;
1251 itemno = (ctlobj->sym_code+1) % 8;
1253 if ( wmlResolveCtlIsMember(clsobj,ctlobj->controls) == TRUE)
1255 sprintf (itembuf, " _BIT_MASK(sym_k_%s_object) |",
1257 strcat (maskbuf, itembuf);
1261 strcat (maskbuf, "\n ");
1264 fprintf (outfil, "%s 0", maskbuf);
1265 strcpy (maskbuf, ",");
1269 fprintf (outfil, "%s 0};\n", maskbuf);
1271 fprintf (outfil, "};\n");
1275 * Write the vector of vectors.
1277 fprintf (outfil, canned2);
1278 for ( ctlndx=0 ; ctlndx<wml_obj_class_ptr->cnt ; ctlndx++ )
1280 clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ctlndx].objptr;
1281 fprintf (outfil, " object_class_vec%d,\n", clsobj->sym_code);
1283 fprintf (outfil, canned3);
1286 * close the output file
1288 printf ("\nCreated UilSymCtl.h");
1296 * Predicate to indicate if a class object is in a controls list.
1299 int wmlResolveCtlIsMember (ctlobj, ctlref)
1300 WmlClassDefPtr ctlobj;
1301 WmlClassCtrlDefPtr ctlref;
1305 while ( ctlref != NULL )
1307 if ( ctlref->ctrl == ctlobj ) return TRUE;
1308 ctlref = ctlref->next;
1317 * Routine to write out UilSymNam.h
1319 * Tables of names of object indexed by their various sym_k_ literals.
1322 void wmlOutputUilSymNam ()
1327 "/* Define mapping of sym_k_..._object codes to widget names. */\n\
1329 externaldef(uil_sym_glbl) int uil_max_object = %d;\n\
1330 static char *uil_widget_names_vec[] = {\n\
1331 \"\",\t/* NOT USED */\n";
1335 externaldef(uil_sym_glbl) char **uil_widget_names =\n\
1336 \t\tuil_widget_names_vec;\n\
1338 /* Define mapping of sym_k_..._arg codes to argument names. */\n\
1340 externaldef(uil_sym_glbl) int uil_max_arg = %d;\n\
1341 static char *uil_argument_names_vec[] = {\n\
1342 \"\",\t/* NOT USED */\n";
1346 externaldef(uil_sym_glbl) char **uil_argument_names =\n\
1347 \t\tuil_argument_names_vec;\n\
1349 /* Define mapping of sym_k_..._reason to reason names. */\n\
1351 externaldef(uil_sym_glbl) int uil_max_reason = %d;\n\
1352 static char *uil_reason_names_vec[] = {\n\
1353 \"\",\t/* NOT USED */\n";
1357 externaldef(uil_sym_glbl) char **uil_reason_names =\n\
1358 \t\tuil_reason_names_vec;\n\
1360 /* Define mapping of sym_k_..._enumval to enumeration value names. */\n\
1362 externaldef(uil_sym_glbl) int uil_max_enumset = %d;\n\
1363 externaldef(uil_sym_glbl) int uil_max_enumval = %d;\n\
1364 static char *uil_enumval_names_vec[] = {\n\
1365 \"\",\t/* NOT USED */\n";
1369 externaldef(uil_sym_glbl) char **uil_enumval_names =\n\
1370 \t\tuil_enumval_names_vec;\n\
1372 /* Define mapping of sym_k_..._charset to enumeration value names. */\n\
1374 externaldef(uil_sym_glbl) int uil_max_charset = %d;\n\
1375 static char *uil_charset_names_vec[] = {\n\
1376 \"\",\t/* NOT USED */\n\
1377 \"<userdefined>\",\n";
1381 externaldef(uil_sym_glbl) char **uil_charset_names =\n\
1382 \t\tuil_charset_names_vec;\n\
1384 /* Define mapping of sym_k_..._child codes to child names. */\n\
1386 externaldef(uil_sym_glbl) int uil_max_child = %d;\n\
1387 static char *uil_child_names_vec[] = {\n\
1388 \"\",\t/* NOT USED */\n";
1392 externaldef(uil_sym_glbl) char **uil_child_names =\n\
1393 \t\tuil_child_names_vec;\n";
1396 FILE *outfil; /* output file */
1397 int ndx; /* loop index */
1398 WmlClassDefPtr clsobj; /* class object */
1399 WmlClassDefPtr varobj; /* gadget class object */
1400 WmlSynClassDefPtr synobj; /* syntactic object */
1401 WmlResourceDefPtr resobj; /* argument/reason object */
1402 WmlSynResourceDefPtr synres; /* arg/reason syntactic object */
1403 WmlEnumValueDefPtr evobj; /* enumeration value object */
1404 WmlSynEnumValueDefPtr synev; /* enumeration value syntactic obj */
1405 WmlCharSetDefPtr csobj; /* character set object */
1406 WmlSynCharSetDefPtr syncs; /* character set syntactic obj */
1407 WmlChildDefPtr chobj; /* child object */
1408 WmlSynChildDefPtr synch; /* child syntactic object */
1411 * Open the output file. Write canned header.
1413 outfil = fopen ( "UilSymNam.h", "w");
1414 if ( outfil == (FILE *) NULL )
1416 printf ("\nCouldn't open UilSymNam.h");
1419 fprintf (outfil, canned_warn);
1422 * Write entries for widgets
1424 fprintf (outfil, canned1, max_object_code);
1425 for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
1427 clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
1428 if ( clsobj->sym_code == 0 ) continue;
1429 synobj = clsobj->syndef;
1430 fprintf (outfil, " \"%s\",\n",
1435 * Write entries for arguments
1437 fprintf (outfil, canned2, max_arg_code);
1438 for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
1440 resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
1441 synres = resobj->syndef;
1442 if ( resobj->sym_code == 0 ) continue;
1443 fprintf (outfil, " \"%s\",\n",
1448 * Write entries for reasons
1450 fprintf (outfil, canned3, max_reason_code);
1451 for ( ndx=0 ; ndx<wml_obj_reason_ptr->cnt ; ndx++ )
1453 resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[ndx].objptr;
1454 synres = resobj->syndef;
1455 if ( resobj->sym_code == 0 ) continue;
1456 fprintf (outfil, " \"%s\",\n",
1461 * Write entries for enumeration values
1463 fprintf (outfil, canned4, max_enumset_code, max_enumval_code);
1464 for ( ndx=0 ; ndx<wml_obj_enumval_ptr->cnt ; ndx++ )
1466 evobj = (WmlEnumValueDefPtr) wml_obj_enumval_ptr->hvec[ndx].objptr;
1467 synev = evobj->syndef;
1468 if ( evobj->sym_code == 0 ) continue;
1469 fprintf (outfil, " \"%s\",\n",
1474 * Write entries for character sets
1476 fprintf (outfil, canned5, max_charset_code);
1477 for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
1479 csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
1480 syncs = csobj->syndef;
1481 if ( csobj->sym_code == 0 ) continue;
1482 fprintf (outfil, " \"%s\",\n",
1487 * Write entries for children
1489 fprintf (outfil, canned6, max_child_code);
1490 for ( ndx=0 ; ndx<wml_obj_child_ptr->cnt ; ndx++ )
1492 chobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[ndx].objptr;
1493 synch = chobj->syndef;
1494 if ( chobj->sym_code == 0 ) continue;
1495 fprintf (outfil, " \"%s\",\n",
1498 fprintf (outfil, canned7);
1501 * close the output file
1503 printf ("\nCreated UilSymNam.h");
1511 * Routine to write out UilSymEnum.h
1513 * This file defines the enumeration sets recognized by UIL. There is an
1514 * entry in this file for each enumeration set. The definitions are accessed
1515 * by the sym_k_..._enumset code. Each consists of a structure containing
1516 * a vector of enumeration value descriptors, each of which is the name
1517 * of the value and its value.
1519 * UilSymEnum.h contains:
1520 * - Vectors of value descriptors for each table entry
1521 * - The table itself.
1522 * - A table given the sym_k_..._enumset code for each argument which
1523 * has an enumeration set.
1524 * - A table accessed by sym_k_..._enumval code giving the actual value
1525 * for each enumeration value.
1527 * The typedefs for the tables are in UilSymGen.h
1530 void wmlOutputUilSymEnum ()
1537 * Enumeration value vectors for each enumeration set\n\
1543 static unsigned short int enum_value_vec%d[] =\n\
1549 * Enumeration set descriptor table\n\
1551 static UilEnumSetDescDef enum_set_table_vec[] =\n\
1557 externaldef(uil_sym_glbl) UilEnumSetDescDef *enum_set_table =\n\
1558 \t\tenum_set_table_vec;\n\
1560 * Enumeration set table, accessed by sym_k_..._arg code. Each non-zero entry\n\
1561 * is the sym_k_..._enumset code for the argument's enumeration set.\n\
1563 static unsigned short int argument_enumset_table_vec[] =\n\
1569 externaldef(uil_sym_glbl) unsigned short int *argument_enumset_table =\n\
1570 \t\targument_enumset_table_vec;\n\
1572 * Enumeration value table, accessed by sym_k_..._enumval code. Each entry is\n\
1573 * the actual value associated with the code.\n\
1575 static int enumval_values_table_vec[] =\n\
1581 externaldef(uil_sym_glbl) int *enumval_values_table =\n\
1582 \t\tenumval_values_table_vec;\n";
1585 FILE *outfil; /* output file */
1586 int ndx; /* loop index */
1587 WmlEnumSetDefPtr enumsetobj; /* enumeration set object */
1588 WmlEnumSetValDefPtr esvobj; /* current enum set value list element */
1589 WmlEnumValueDefPtr evobj; /* current enumeration value object */
1590 WmlResourceDefPtr resobj; /* resource object */
1594 * Open the output file. Write the canned header stuff
1596 outfil = fopen ("UilSymEnum.h", "w");
1597 if ( outfil == (FILE *) NULL )
1599 printf ("\nCouldn't open UilSymEnum.h");
1602 fprintf (outfil, canned_warn);
1605 * Generate the enumeration value vectors for each enumeration set.
1607 fprintf (outfil, canned1);
1608 for ( ndx=0 ; ndx<wml_obj_enumset_ptr->cnt ; ndx++ )
1610 enumsetobj = (WmlEnumSetDefPtr) wml_obj_enumset_ptr->hvec[ndx].objptr;
1611 fprintf (outfil, valhdr, enumsetobj->sym_code);
1612 for ( esvobj=enumsetobj->values ; esvobj!=NULL ; esvobj=esvobj->next )
1614 evobj = esvobj->value;
1615 fprintf (outfil, " %d,\n",
1618 fprintf (outfil, " };\n");
1622 * Generate the enumeration set tables
1624 fprintf (outfil, canned3);
1625 for ( ndx=0 ; ndx<wml_obj_enumset_ptr->cnt ; ndx++ )
1627 enumsetobj = (WmlEnumSetDefPtr) wml_obj_enumset_ptr->hvec[ndx].objptr;
1628 fprintf (outfil, " {%d,enum_value_vec%d},\n",
1629 enumsetobj->values_cnt,
1630 enumsetobj->sym_code);
1634 * Create enumset table entries for arguments, similar to writing sym_k...
1636 fprintf (outfil, canned4);
1637 for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
1639 resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
1640 if ( resobj->enumset_def == NULL )
1641 fprintf (outfil, " 0,\n");
1643 fprintf (outfil, " %d,\n",
1644 resobj->enumset_def->sym_code);
1648 * Create the enumval values table.
1650 fprintf (outfil, canned5);
1651 for ( ndx=0 ; ndx<wml_obj_enumval_ptr->cnt ; ndx++ )
1653 evobj = (WmlEnumValueDefPtr) wml_obj_enumval_ptr->hvec[ndx].objptr;
1654 fprintf (outfil, " %s,\n", evobj->syndef->enumlit);
1656 fprintf (outfil, canned5a);
1659 * close the output file
1661 printf ("\nCreated UilSymEnum.h");
1669 * Routine to write out UilSymCSet.h
1671 * This file specifies the various attributes for the character sets
1672 * recognized by UIL. There is a table for each of the following
1674 * - Standards name associated with the character set
1675 * - Writing direction, from XmSTRING_DIRECTION_...
1676 * - Parsing direction, from XmSTRING_DIRECTION_...
1677 * - Bytes per character, from sym_k_..._charsize (in UilSymGen.h)
1678 * - A pair of tables for recognizing $LANG settings:
1679 * o a table of all names under which a character set might
1680 * be legally recognized (upper case).
1681 * o the sym_k_..._charset code for each entry
1682 * o a variable giving the number of entries in the table
1684 * All tables are accessed by the sym_k_..._charset
1688 void wmlOutputUilSymCSet ()
1695 * Character set XmString name table, accessed by sym_k_..._charset code.\n\
1696 * Each entry is the name which identifies the character set in a XmString.\n\
1698 static char *charset_xmstring_names_table_vec[] =\n\
1701 \"<userdefined>\",\n";
1705 externaldef(uil_sym_glbl) char **charset_xmstring_names_table =\n\
1706 \t\tcharset_xmstring_names_table_vec;\n\
1708 * Character set writing direction table, accessed by sym_k_..._charset code.\n\
1709 * Each entry is the XmSTRING_DIRECTION_... code which identifies the\n\
1710 * writing direction for the character set in a XmString.\n\
1712 static unsigned char charset_wrdirection_table_vec[] =\n\
1715 0,\t/* userdefined */\n";
1719 externaldef(uil_sym_glbl) unsigned char *charset_writing_direction_table =\n\
1720 \t\tcharset_wrdirection_table_vec;\n\
1722 * Character set parsing direction table, accessed by sym_k_..._charset code.\n\
1723 * Each entry is the XmSTRING_DIRECTION_... code which identifies the\n\
1724 * parsing direction for the character set in a XmString.\n\
1726 static unsigned char charset_parsdirection_table_vec[] =\n\
1729 0,\t/* userdefined */\n";
1733 externaldef(uil_sym_glbl) unsigned char *charset_parsing_direction_table =\n\
1734 \t\tcharset_parsdirection_table_vec;\n\
1736 * Character set character size table, accessed by sym_k_..._charset code.\n\
1737 * Each entry is the sym_k_..._charsize literal which names the character\n\
1738 * size for the character set in a XmString.\n\
1740 static unsigned char charset_charsize_table_vec[] =\n\
1743 0,\t/* userdefined */\n";
1747 externaldef(uil_sym_glbl) unsigned char *charset_character_size_table =\n\
1748 \t\tcharset_charsize_table_vec;\n\
1750 * All the names under which a character set may be legally named in a \n\
1751 * $LANG variable (upper case).\n\
1753 static char *charset_lang_names_table_vec[] =\n\
1758 externaldef(uil_sym_glbl) char **charset_lang_names_table =\n\
1759 \t\tcharset_lang_names_table_vec;\n\
1761 * The sym_k_..._charset codes for charset_lang_names\n\
1763 static unsigned short int charset_lang_codes_table_vec[] =\n\
1768 externaldef(uil_sym_glbl) unsigned short int *charset_lang_codes_table =\n\
1769 \t\tcharset_lang_codes_table_vec;\n\
1771 * The number of entries in charset_lang_..._table tables\n\
1773 externaldef(uil_sym_glbl) unsigned short int charset_lang_table_max = %d;\n";
1776 FILE *outfil; /* output file */
1777 int ndx; /* loop index */
1778 WmlCharSetDefPtr csobj; /* character set object */
1779 WmlSynCharSetDefPtr syncs; /* character set syntactic obj */
1780 int lang_max; /* max value for $LANG tables */
1781 int alias_ndx; /* alias loop index */
1782 char uname[200]; /* name converted to upper case */
1786 * Open the output file. Write the canned header stuff
1788 outfil = fopen ("UilSymCSet.h", "w");
1789 if ( outfil == (FILE *) NULL )
1791 printf ("\nCouldn't open UilSymCSet.h");
1794 fprintf (outfil, canned_warn);
1797 * Generate the standards name table
1799 fprintf (outfil, canned1);
1800 for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
1802 csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
1803 syncs = csobj->syndef;
1804 if ( csobj->sym_code == 0 ) continue;
1805 if ((strcmp(syncs->xms_name, "XmFONTLIST_DEFAULT_TAG") == 0) ||
1806 (strcmp(syncs->xms_name, "_MOTIF_DEFAULT_LOCALE") == 0))
1807 fprintf (outfil, " %s,\t/* %s */\n",
1808 syncs->xms_name, syncs->name);
1810 fprintf (outfil, " \"%s\",\t/* %s */\n",
1811 syncs->xms_name, syncs->name);
1815 * Generate the writing direction table
1817 fprintf (outfil, canned2);
1818 for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
1820 csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
1821 syncs = csobj->syndef;
1822 if ( csobj->sym_code == 0 ) continue;
1823 switch ( syncs->direction )
1825 case WmlCharSetDirectionLtoR:
1826 fprintf (outfil, " XmSTRING_DIRECTION_L_TO_R,\t/* %s */\n",
1829 case WmlCharSetDirectionRtoL:
1830 fprintf (outfil, " XmSTRING_DIRECTION_R_TO_L,\t/* %s */\n",
1837 * Generate the parsing direction table
1839 fprintf (outfil, canned3);
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->parsedirection )
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 character size table
1861 fprintf (outfil, canned4);
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->charsize )
1869 case WmlCharSizeOneByte:
1870 fprintf (outfil, " sym_k_onebyte_charsize,\t/* %s */\n",
1873 case WmlCharSizeTwoByte:
1874 fprintf (outfil, " sym_k_twobyte_charsize,\t/* %s */\n",
1877 case WmlCharSizeMixed1_2Byte:
1878 fprintf (outfil, " sym_k_mixed1_2byte_charsize,\t/* %s */\n",
1885 * Generate the $LANG name recognition table
1887 fprintf (outfil, canned5);
1889 for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
1891 csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
1892 syncs = csobj->syndef;
1893 if ( csobj->sym_code == 0 ) continue;
1894 strcpy (uname, syncs->name);
1895 wmlUpperCaseString (uname);
1896 fprintf (outfil, " \"%s\",\t/* %s */\n",
1897 uname, syncs->name);
1899 strcpy (uname, syncs->xms_name);
1900 wmlUpperCaseString (uname);
1901 fprintf (outfil, " \"%s\",\t/* %s */\n",
1902 uname, syncs->name);
1904 for ( alias_ndx=0 ; alias_ndx<syncs->alias_cnt ; alias_ndx++ )
1906 strcpy (uname, syncs->alias_list[alias_ndx]);
1907 wmlUpperCaseString (uname);
1908 fprintf (outfil, " \"%s\",\t/* %s */\n",
1909 uname, syncs->name);
1915 * Generate the $LANG code lookup table, in upper case
1917 fprintf (outfil, canned6);
1918 for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
1920 csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
1921 syncs = csobj->syndef;
1922 if ( csobj->sym_code == 0 ) continue;
1923 fprintf (outfil, " sym_k_%s_charset,\n", syncs->name);
1924 fprintf (outfil, " sym_k_%s_charset,\n", syncs->name);
1925 for ( alias_ndx=0 ; alias_ndx<syncs->alias_cnt ; alias_ndx++ )
1926 fprintf (outfil, " sym_k_%s_charset,\n", syncs->name);
1930 * Generate the number of entries in the previous two tables
1932 fprintf (outfil, canned7, lang_max);
1935 * close the output file
1937 printf ("\nCreated UilSymCSet.h");