12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964 |
- /*
- * CDE - Common Desktop Environment
- *
- * Copyright (c) 1993-2012, The Open Group. All rights reserved.
- *
- * These libraries and programs are free software; you can
- * redistribute them and/or modify them under the terms of the GNU
- * Lesser General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * These libraries and programs are distributed in the hope that
- * they will be useful, but WITHOUT ANY WARRANTY; without even the
- * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with these librararies and programs; if not, write
- * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
- * Floor, Boston, MA 02110-1301 USA
- */
- /*
- * @OSF_COPYRIGHT@
- * COPYRIGHT NOTICE
- * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
- * ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for
- * the full copyright text.
- */
- /*
- * HISTORY
- */
- #ifdef REV_INFO
- #ifndef lint
- static char rcsid[] = "$XConsortium: wmlouth.c /main/8 1995/08/29 11:10:46 drk $"
- #endif
- #endif
- /*
- * (c) Copyright 1989, 1990, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */
- /*
- * This module contains routines responsible for writing the .h files
- * produced by WML. All files are written into the current directory.
- *
- * Input:
- * The resolved objects
- *
- * Output:
- * UilSymGen.h
- * UilSymArTy.h
- * UilSymChCl.h
- * UilSymRArg.h
- * UilUrmClas.h
- * UilConst.h
- * UilSymReas.h
- * UilSymArTa.h
- * UilSymChTa.h
- * UilSymCtl.h
- * UilSymNam.h
- * UilSymEnum.h
- * UilSymCSet.h
- */
- #include "wml.h"
- #if defined(__STDC__)
- #include <string.h>
- #endif
- #include <stdio.h>
- /*
- * Routines used only in this module
- */
- void wmlOutputUilSymGen ();
- void wmlOutputUilSymArTy ();
- void wmlOutputUilSymChCl ();
- void wmlOutputUilSymRArg ();
- void wmlOutputUilUrmClas ();
- void wmlOutputUilConst ();
- void wmlOutputUilSymReas ();
- void wmlOutputUilSymArTa ();
- void wmlOutputUilSymChTa ();
- void wmlOutputUilSymCtl ();
- void wmlOutputUilSymNam ();
- void wmlOutputUilSymEnum ();
- void wmlOutputUilSymCSet ();
- /*
- * globals
- */
- static char *canned_warn =
- "/*\n\
- **\tThis file is automatically generated. Do not edit it by hand.\n\
- **/\n";
- /*
- * Used to create masks for bytes in bit vectors. Accessed by bit numbers
- * from 1 - 8.
- */
- static char *bit_masks[] = {""
- ," | 1" /* bit 1 */
- ," | 2" /* bit 2 */
- ," | 4" /* bit 3 */
- ," | 8" /* bit 4 */
- ," | 16" /* bit 5 */
- ," | 32" /* bit 6 */
- ," | 64" /* bit 7 */
- ," | 128"}; /* bit 8 */
- /*
- * To pick up maximum code values
- */
- static int max_object_code = 0;
- static int max_reason_code = 0;
- static int max_arg_code = 0;
- static int max_enumset_code = 0;
- static int max_enumval_code = 0;
- static int max_charset_code = 0;
- static int max_child_code = 0;
- /*
- * Output control routine, which simply outputs each .h file in turn.
- */
- void wmlOutputHFiles ()
- {
- wmlOutputUilSymGen ();
- wmlOutputUilSymArTy ();
- wmlOutputUilSymChCl ();
- wmlOutputUilSymRArg ();
- wmlOutputUilUrmClas ();
- wmlOutputUilConst ();
- wmlOutputUilSymReas ();
- wmlOutputUilSymArTa ();
- wmlOutputUilSymChTa ();
- wmlOutputUilSymCtl ();
- wmlOutputUilSymNam ();
- wmlOutputUilSymEnum ();
- wmlOutputUilSymCSet ();
- }
- /*
- * Routine to write out UilSymGen.h
- *
- * This file defines the sym_k... literals for UIL. Each set of literals
- * typiclly increases monotonically from 1, with 0 used as en error value.
- *
- * sym_k_<class>_object
- * <class> is widget class name in lexicographic order
- * gadgets are not include.
- *
- * bit masks for table access
- *
- * sym_k_<reason>_reason
- * literals specifying all reasons, lexicographically ordered
- *
- * sym_k_<argument>_arg
- * literals for all arguments, lexicographically ordered.
- * Constraints are included, and ordered with the arguments.
- *
- * sym_k_<child>_child
- * literals for all automatic children, lexicographically ordered.
- *
- * sym_k_<enumset>_enumset
- * literals naming each enumeration set, lexicographically ordered
- *
- * Fixed literals naming character set character sizes
- * sym_k_<charset>_charset
- * literals naming each character set, lexicographically ordered
- */
- void wmlOutputUilSymGen ()
- {
- char *canned1 =
- "\n/* Define literals for objects */\n";
- char *canned3 =
- "\n/* Define literals for reasons */\n\n";
- char *canned4 =
- "\n/* Define literals for arguments */\n\n";
- char *canned5 =
- "\n/* Define literals for enumeration sets */\n\n";
- char *canned6 =
- "\n/* Define literals for enumeration values */\n\n";
- char *canned7 =
- "\n/* Define literals for character sets */\n\n";
- char *canned8 =
- "\n/* Define literals for automatic children */\n\n";
- FILE *outfil; /* output file */
- int ndx; /* loop index */
- WmlClassDefPtr clsobj; /* class object */
- WmlDataTypeDefPtr datobj; /* data type object */
- WmlResourceDefPtr resobj; /* resource object */
- WmlEnumSetDefPtr enumsetobj; /* enumeration set object */
- WmlEnumValueDefPtr enumvalobj; /* enumeration value object */
- WmlCharSetDefPtr charsetobj; /* character set object */
- WmlChildDefPtr childobj; /* child object */
- /*
- * Open the output file. Write the canned header stuff
- */
- outfil = fopen ("UilSymGen.h", "w");
- if ( outfil == (FILE *) NULL )
- {
- printf ("\nCouldn't open UilSymGen.h");
- return;
- }
- fprintf (outfil, canned_warn);
- /*
- * Write the sym_k..._object literals
- */
- fprintf (outfil, canned1);
- for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
- {
- clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
- fprintf (outfil, "#define sym_k_%s_object\t%d\n",
- clsobj->tkname,
- clsobj->sym_code);
- if ( clsobj->sym_code > max_object_code )
- max_object_code = clsobj->sym_code;
- }
- /*
- * Define the sym_k_..._reason literals
- */
- fprintf (outfil, canned3);
- for ( ndx=0 ; ndx<wml_obj_reason_ptr->cnt ; ndx++ )
- {
- resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[ndx].objptr;
- fprintf (outfil, "#define sym_k_%s_reason\t%d\n",
- resobj->tkname,
- resobj->sym_code);
- if ( resobj->sym_code > max_reason_code )
- max_reason_code = resobj->sym_code;
- }
- /*
- * Define the sym_k_..._arg literals
- */
- fprintf (outfil, canned4);
- for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
- {
- resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
- fprintf (outfil, "#define sym_k_%s_arg\t%d\n",
- resobj->tkname,
- resobj->sym_code);
- if ( resobj->sym_code > max_arg_code )
- max_arg_code = resobj->sym_code;
- }
- /*
- * Define the sym_k_..._enumset structs and literals
- */
- fprintf (outfil, canned5);
- for ( ndx=0 ; ndx<wml_obj_enumset_ptr->cnt ; ndx++ )
- {
- enumsetobj = (WmlEnumSetDefPtr) wml_obj_enumset_ptr->hvec[ndx].objptr;
- fprintf (outfil, "#define sym_k_%s_enumset\t%d\n",
- enumsetobj->tkname,
- enumsetobj->sym_code);
- if ( enumsetobj->sym_code > max_enumset_code )
- max_enumset_code = enumsetobj->sym_code;
- }
- /*
- * Define the sym_k_..._enumval literals
- */
- fprintf (outfil, canned6);
- for ( ndx=0 ; ndx<wml_obj_enumval_ptr->cnt ; ndx++ )
- {
- enumvalobj = (WmlEnumValueDefPtr) wml_obj_enumval_ptr->hvec[ndx].objptr;
- fprintf (outfil, "#define sym_k_%s_enumval\t%d\n",
- enumvalobj->syndef->name,
- enumvalobj->sym_code);
- if ( enumvalobj->sym_code > max_enumval_code )
- max_enumval_code = enumvalobj->sym_code;
- }
- /*
- * Define the sym_k_..._charsize literals
- * Define the sym_k_..._charset literals
- */
- fprintf (outfil, canned7);
- for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
- {
- charsetobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
- fprintf (outfil, "#define sym_k_%s_charset\t%d\n",
- charsetobj->syndef->name,
- charsetobj->sym_code);
- if ( charsetobj->sym_code > max_charset_code )
- max_charset_code = charsetobj->sym_code;
- }
- /*
- * Define the sym_k_..._child literals
- */
- fprintf (outfil, canned8);
- for ( ndx=0 ; ndx<wml_obj_child_ptr->cnt ; ndx++ )
- {
- childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[ndx].objptr;
- fprintf (outfil, "#define sym_k_%s_child\t%d\n",
- childobj->syndef->name,
- childobj->sym_code);
- if ( childobj->sym_code > max_child_code )
- max_child_code = childobj->sym_code;
- }
- /*
- * close the output file
- */
- printf ("\nCreated UilSymGen.h");
- fclose (outfil);
- }
- /*
- * Routine to write out UilSymChCl.h
- *
- * A table of classes accessed by child type (sym_k_<child>_child, in
- * the form
- * ...
- * sym_k_<class>_class,
- */
- void wmlOutputUilSymChCl ()
- {
- char *canned1 =
- "/* Table of the class type of children\n\
- The table is indexed by child with each entry the\n\
- permitted class for that child.\n\
- */\n\
- \n\
- static unsigned char child_class_table_vec[] =\n\
- {\n\
- 0,\n";
- char *canned1a =
- " };\n\
- externaldef(uil_sym_glbl) unsigned char *child_class_table =\n\
- \t child_class_table_vec;\n";
- FILE *outfil; /* output file */
- int ndx; /* loop index */
- WmlClassDefPtr classobj; /* data type object */
- WmlChildDefPtr childobj; /* resource object */
- /*
- * Open the output file. Write canned header.
- */
- outfil = fopen ( "UilSymChCl.h", "w");
- if ( outfil == (FILE *) NULL )
- {
- printf ("\nCouldn't open UilSymChCL.h");
- return;
- }
- fprintf (outfil, canned_warn);
- /*
- * Create table entries, similar to writing sym_k...
- */
- fprintf (outfil, canned1);
- for ( ndx=0 ; ndx<wml_obj_child_ptr->cnt ; ndx++ )
- {
- childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[ndx].objptr;
- classobj = childobj->class;
- fprintf (outfil, " sym_k_%s_object,\n",
- classobj->tkname);
- }
- fprintf (outfil, canned1a);
- /*
- * close the output file
- */
- printf ("\nCreated UilSymChCl.h");
- fclose (outfil);
- }
- /*
- * Routine to write out UilSymArTy.h
- *
- * A table of data types accessed by argument type (sym_k_<arg>_arg, in
- * the form
- * ...
- * sym_k_<data_type>_value,
- */
- void wmlOutputUilSymArTy ()
- {
- char *canned1 =
- "/* Table of the types of arguments\n\
- The table is indexed by argument with each entry the\n\
- permitted type for that argument.\n\
- */\n\
- \n\
- static unsigned char argument_type_table_vec[] =\n\
- {\n\
- 0,\n";
- char *canned1a =
- " };\n\
- externaldef(uil_sym_glbl) unsigned char *argument_type_table =\n\
- \t argument_type_table_vec;\n";
- FILE *outfil; /* output file */
- int ndx; /* loop index */
- WmlDataTypeDefPtr datobj; /* data type object */
- WmlResourceDefPtr resobj; /* resource object */
- /*
- * Open the output file. Write canned header.
- */
- outfil = fopen ( "UilSymArTy.h", "w");
- if ( outfil == (FILE *) NULL )
- {
- printf ("\nCouldn't open UilSymArTy.h");
- return;
- }
- fprintf (outfil, canned_warn);
- /*
- * Create table entries, similar to writing sym_k...
- */
- fprintf (outfil, canned1);
- for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
- {
- resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
- datobj = resobj->dtype_def;
- fprintf (outfil, " sym_k_%s_value,\n",
- datobj->tkname);
- }
- fprintf (outfil, canned1a);
- /*
- * close the output file
- */
- printf ("\nCreated UilSymArTy.h");
- fclose (outfil);
- }
- /*
- * Routine to write out UilSymRArg.h
- *
- * Related argument table
- */
- void wmlOutputUilSymRArg ()
- {
- char *canned1 =
- "/* Related argument table. Each non-zero entry is the code\n\
- of the related argument.\n\
- */\n\
- \n\
- static unsigned short int related_argument_table_vec[] =\n\
- {\n\
- 0,\n";
- char *canned1a =
- " };\n\
- externaldef(uil_sym_glbl) unsigned short int *related_argument_table =\n\
- \t\trelated_argument_table_vec;\n";
- FILE *outfil; /* output file */
- int ndx; /* loop index */
- WmlResourceDefPtr resobj; /* resource object */
- /*
- * Open the output file. Write canned header.
- */
- outfil = fopen ( "UilSymRArg.h", "w");
- if ( outfil == (FILE *) NULL )
- {
- printf ("\nCouldn't open UilSymRArg.h");
- return;
- }
- fprintf (outfil, canned_warn);
- /*
- * Create table entries, similar to writing sym_k...
- */
- fprintf (outfil, canned1);
- for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
- {
- resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
- fprintf (outfil, " %d,\n",
- resobj->related_code);
- }
- fprintf (outfil, canned1a);
- /*
- * close the output file
- */
- printf ("\nCreated UilSymRArg.h");
- fclose (outfil);
- }
- /*
- * Routine to write out UilUrmClas.h
- *
- * Table of convenience function names indexed by the sym_k_<class> literal
- * for both widgets and gadgets
- * Table of resource names indexed by the sym_k_<argument>_arg and
- * sym_k_<reason>_reason codes.
- */
- void wmlOutputUilUrmClas ()
- {
- char *canned1 =
- "\n/* Define mapping of UIL widget types to convenience functions. */\n\
- static char *uil_widget_funcs_vec[] = {\n\
- \"\",\t /* NOT USED */\n";
- char *canned2 =
- "};\n\
- externaldef(uil_sym_glbl) char **uil_widget_funcs = uil_widget_funcs_vec;\n\
- \n\
- /* Define mapping of UIL widget classes to matching gadget class. */\n\
- static unsigned short int uil_gadget_variants_vec[] = {\n\
- 0,\t /* NOT USED */\n";
- char *canned3 =
- "};\n\
- externaldef(uil_sym_glbl) unsigned short int *uil_gadget_variants =\n\
- \t\tuil_gadget_variants_vec;\n\
- \n\
- /* Define mapping of dialog types to non-dialog URM widget classes. */\n\
- static unsigned short int uil_urm_nondialog_class_vec[] = {\n\
- 0,\t/* NOT USED */\n";
- char *canned4 =
- "};\n\
- externaldef(uil_sym_glbl) unsigned short int *uil_urm_nondialog_class =\n\
- \t\tuil_urm_nondialog_class_vec;\n\
- \n\
- /* Define mapping of widget controls to a (subtree) resource. */\n\
- static unsigned short int uil_urm_subtree_resource_vec[] = {\n\
- 0,\t/* NOT USED */\n";
- char *canned5 =
- "};\n\
- externaldef(uil_sym_glbl) unsigned short int *uil_urm_subtree_resource =\n\
- \t\tuil_urm_subtree_resource_vec;\n\
- \n\
- /* Define mapping of arguments to toolkit names. */\n\
- static char *uil_argument_toolkit_names_vec[] = {\n\
- \"\",\t /* NOT USED */\n";
- char *canned6 =
- "};\n\
- externaldef(uil_sym_glbl) char **uil_argument_toolkit_names =\n\
- \t\tuil_argument_toolkit_names_vec;\n\
- \n\
- /* Define mapping of reasons to toolkit names. */\n\
- static char *uil_reason_toolkit_names_vec[] = {\n\
- \"\",\t/* NOT USED */\n";
- char *canned7 =
- "};\n\
- externaldef(uil_sym_glbl) char **uil_reason_toolkit_names =\n\
- \t\tuil_reason_toolkit_names_vec;\n";
- FILE *outfil; /* output file */
- int ndx; /* loop index */
- WmlClassDefPtr clsobj; /* class object */
- WmlSynClassDefPtr synobj; /* syntactic object */
- WmlClassDefPtr varobj; /* variant (widget) class object */
- WmlResourceDefPtr resobj; /* argument/reason object */
- WmlSynResourceDefPtr synres; /* arg/reason syntactic object */
- WmlResourceDefPtr mapresobj; /* controls map to resource object */
- /*
- * Open the output file. Write canned header.
- */
- outfil = fopen ( "UilUrmClas.h", "w");
- if ( outfil == (FILE *) NULL )
- {
- printf ("\nCouldn't open UilUrmClas.h");
- return;
- }
- fprintf (outfil, canned_warn);
- /*
- * Write entries for widgets
- */
- fprintf (outfil, canned1);
- for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
- {
- clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
- if ( clsobj->sym_code == 0 ) continue;
- synobj = clsobj->syndef;
- if ( synobj->int_lit != NULL )
- fprintf (outfil, " \"%s\",\n", synobj->convfunc);
- else
- fprintf (outfil, " \"%s\",\t\n", synobj->convfunc);
- }
- fprintf (outfil, canned2);
- /*
- * Write entries for gadget variants of widget classes
- */
- for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
- {
- clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
- if ( clsobj->sym_code == 0 ) continue;
- varobj = clsobj->variant;
- synobj = clsobj->syndef;
- if ( varobj==NULL || synobj->type==WmlClassTypeGadget )
- fprintf (outfil, " 0,\n");
- else
- {
- synobj = varobj->syndef;
- if ( synobj->int_lit != NULL )
- fprintf (outfil, " sym_k_%s_object,\n",
- synobj->int_lit);
- else
- fprintf (outfil, " sym_k_%s_object,\n",
- synobj->name);
- }
- }
- fprintf (outfil, canned3);
- /*
- * Write entries for non-dialog widgets
- */
- for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
- {
- clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
- if ( clsobj->sym_code == 0 ) continue;
- varobj = clsobj->nondialog;
- synobj = clsobj->syndef;
- if ( varobj == NULL )
- fprintf (outfil, " 0,\n");
- else
- {
- synobj = varobj->syndef;
- if ( synobj->int_lit != NULL )
- fprintf (outfil, " sym_k_%s_object,\n",
- synobj->int_lit);
- else
- fprintf (outfil, " sym_k_%s_object,\n",
- synobj->name);
- }
- }
- fprintf (outfil, canned4);
- /*
- * Write entries for the resource a widget's controls map to
- */
- for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
- {
- clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
- if ( clsobj->sym_code == 0 ) continue;
- synobj = clsobj->syndef;
- mapresobj = clsobj->ctrlmapto;
- if ( mapresobj == NULL )
- fprintf (outfil, " 0,\n");
- else
- fprintf (outfil, " sym_k_%s_arg,\n", mapresobj->tkname);
- }
- fprintf (outfil, canned5);
- /*
- * Write entries for arguments
- */
- for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
- {
- resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
- synres = resobj->syndef;
- if ( resobj->sym_code == 0 ) continue;
- fprintf (outfil, " %s,\n",
- synres->resliteral);
- }
- fprintf (outfil, canned6);
- /*
- * Write entries for reasons
- */
- for ( ndx=0 ; ndx<wml_obj_reason_ptr->cnt ; ndx++ )
- {
- resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[ndx].objptr;
- synres = resobj->syndef;
- if ( resobj->sym_code == 0 ) continue;
- fprintf (outfil, " %s,\n",
- synres->resliteral);
- }
- fprintf (outfil, canned7);
- /*
- * close the output file
- */
- printf ("\nCreated UilUrmClas.h");
- fclose (outfil);
- }
- /*
- * Routine to write out UilConst.h
- *
- * A bit vector showing which arguments are constraints.
- */
- void wmlOutputUilConst ()
- {
- char *canned1 =
- "/* Table indexed by argument indicating whether\n\
- argument is a constraint (TRUE) or a regular\n\
- argument (FALSE). Each entry is one bit.\n\
- Index and mask macros are defined to simplify\n\
- access to the table\n\
- */\n\
- \n\
- static unsigned char constraint_tab_vec[] = {\n";
- char *canned1a =
- "};\n\
- externaldef(uil_sym_glbl) unsigned char *constraint_tab =\n\
- \t\tconstraint_tab_vec;\n";
- FILE *outfil; /* output file */
- int ndx; /* loop index */
- WmlResourceDefPtr resobj; /* resource object */
- WmlSynResourceDefPtr synobj; /* syntactic object */
- char maskbuf[100]; /* to constuct each mask */
- int bitno; /* current bit number, from code */
- /*
- * Open the output file. Write canned header.
- */
- outfil = fopen ( "UilConst.h", "w");
- if ( outfil == (FILE *) NULL )
- {
- printf ("\nCouldn't open UilConst.h");
- return;
- }
- fprintf (outfil, canned_warn);
- /*
- * Process the arguments in code order. We start with 1, and write out
- * the mask after processing 8 codes.
- */
- fprintf (outfil, canned1);
- strcpy (maskbuf, "0");
- for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
- {
- resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
- synobj = resobj->syndef;
- bitno = resobj->sym_code % 8;
- if ( bitno == 0 ) bitno = 8;
- if ( synobj->type == WmlResourceTypeConstraint )
- strcat (maskbuf, bit_masks[bitno]);
- if ( bitno == 8 )
- {
- fprintf (outfil, "%s,\n", maskbuf);
- strcpy (maskbuf, "0");
- }
- }
- if ( bitno != 8 )
- fprintf (outfil, "%s", maskbuf);
- fprintf (outfil, canned1a);
- /*
- * close the output file
- */
- printf ("\nCreated UilConst.h");
- fclose (outfil);
- }
- /*
- * Routine to write out UilSymReas.h
- *
- * This file defines the reasons supported by each class. For each
- * reason, there is a bit vector with the bit for each supporting class
- * turned on if the reason is supported. There is then a vector pointing
- * to these bit vectors for all reasons. This vector is accessed by
- * sym_k_..._reason to find the reasons bit vector, then by sym_k_..._object
- * to check the bit.
- */
- void wmlOutputUilSymReas ()
- {
- char *canned1 =
- "\n/*\n\
- * Bit vectors for each reason. The entries in the vector correspond\n\
- * to each class.\n\
- */\n";
- char *bvechdr =
- "\n\
- /* sym_k_%s_reason */\n\
- static unsigned char reason_class_vec%d[] =\n\
- {\n";
- char *canned2 =
- "\n/*\n\
- * Table of bit vectors accessed by sym_k_..._reason\n\
- */\n\
- static unsigned char *allowed_reason_table_vec[] =\n\
- {\n\
- NULL,\t/* UNUSED */\n";
- char *canned3 =
- " };\n\
- externaldef(uil_sym_glbl) unsigned char **allowed_reason_table =\n\
- \t\tallowed_reason_table_vec;\n";
- FILE *outfil; /* output file */
- int resndx; /* outer loop index */
- WmlResourceDefPtr resobj; /* current reason */
- int clsndx; /* inner loop index */
- WmlClassDefPtr clsobj; /* current class object */
- WmlClassResDefPtr resref; /* class' resource reference */
- int itemno; /* item in bye */
- char maskbuf[500]; /* current mask buffer */
- char itembuf[100]; /* for current item */
- int donl; /* TRUE if append \n to mask */
- /*
- * Open the output file. Write canned header.
- */
- outfil = fopen ( "UilSymReas.h", "w");
- if ( outfil == (FILE *) NULL )
- {
- printf ("\nCouldn't open UilSymReas.h");
- return;
- }
- fprintf (outfil, canned_warn);
- fprintf (outfil, canned1);
- /*
- * Generate the bit vectors for each class. Outer loop on the reason code,
- * inner loop on the class code.
- */
- for ( resndx=0 ; resndx<wml_obj_reason_ptr->cnt ; resndx++ )
- {
- resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[resndx].objptr;
- fprintf (outfil, bvechdr, resobj->tkname, resobj->sym_code);
- /*
- * inner loop on widget class.
- */
- strcpy (maskbuf, " ");
- for ( clsndx=0 ; clsndx<wml_obj_class_ptr->cnt ; clsndx++ )
- {
- clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[clsndx].objptr;
- itemno = (clsobj->sym_code+1) % 8;
- donl = FALSE;
- resref = wmlResolveResIsMember (resobj, clsobj->reasons);
- if ( resref != NULL )
- if ( resref->exclude != WmlAttributeTrue )
- {
- sprintf (itembuf, " _BIT_MASK(sym_k_%s_object) |",
- clsobj->tkname);
- strcat (maskbuf, itembuf);
- donl = TRUE;
- }
- if ( donl )
- strcat (maskbuf, "\n ");
- if ( itemno == 0 )
- {
- fprintf (outfil, "%s 0", maskbuf);
- strcpy (maskbuf, ",");
- }
- }
- if ( itemno != 0 )
- fprintf (outfil, "%s 0};\n", maskbuf);
- else
- fprintf (outfil, "};\n");
- }
- /*
- * Write the vector of vectors.
- */
- fprintf (outfil, canned2);
- for ( resndx=0 ; resndx<wml_obj_reason_ptr->cnt ; resndx++ )
- {
- resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[resndx].objptr;
- fprintf (outfil, " reason_class_vec%d,\n", resobj->sym_code);
- }
- fprintf (outfil, canned3);
- /*
- * close the output file
- */
- printf ("\nCreated UilSymReas.h");
- fclose (outfil);
- }
- /*
- * Routine to write out UilSymArTa.h
- *
- * This file defines the arguments supported by each class. For each
- * argument, there is a bit vector with the bit for each supporting class
- * turned on if the argument is supported. There is then a vector pointing
- * to these bit vectors for all arguments. This vector is accessed by
- * sym_k_..._arg to find the arguments bit vector, then by sym_k_..._object
- * to check the bit.
- */
- void wmlOutputUilSymArTa ()
- {
- char *canned1 =
- "\n/*\n\
- * Bit vectors for each argument. The entries in the vector correspond\n\
- * to each class.\n\
- */\n";
- char *bvechdr =
- "\n\
- /* sym_k_%s_arg */\n\
- static unsigned char arg_class_vec%d[] =\n\
- {\n";
- char *canned2 =
- "\n/*\n\
- * Table of bit vectors accessed by sym_k_..._arg\n\
- */\n\
- static unsigned char *allowed_argument_table_vec[] =\n\
- {\n\
- NULL,\t/* UNUSED */\n";
- char *canned3 =
- " };\n\
- externaldef(uil_sym_glbl) unsigned char **allowed_argument_table =\n\
- \t\tallowed_argument_table_vec;\n";
- FILE *outfil; /* output file */
- int resndx; /* outer loop index */
- WmlResourceDefPtr resobj; /* current argument */
- int clsndx; /* inner loop index */
- WmlClassDefPtr clsobj; /* current class object */
- WmlClassResDefPtr resref; /* class' resource reference */
- int itemno; /* item in bye */
- char maskbuf[500]; /* current mask buffer */
- char itembuf[100]; /* for current item */
- int donl; /* TRUE if append \n to mask */
- /*
- * Open the output file. Write canned header.
- */
- outfil = fopen ( "UilSymArTa.h", "w");
- if ( outfil == (FILE *) NULL )
- {
- printf ("\nCouldn't open UilSymArTa.h");
- return;
- }
- fprintf (outfil, canned_warn);
- fprintf (outfil, canned1);
- /*
- * Generate the bit vectors for each class. Outer loop on the argument code,
- * inner loop on the class code.
- */
- for ( resndx=0 ; resndx<wml_obj_arg_ptr->cnt ; resndx++ )
- {
- resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[resndx].objptr;
- fprintf (outfil, bvechdr, resobj->tkname, resobj->sym_code);
- /*
- * inner loop on widget class.
- */
- strcpy (maskbuf, " ");
- for ( clsndx=0 ; clsndx<wml_obj_class_ptr->cnt ; clsndx++ )
- {
- clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[clsndx].objptr;
- itemno = (clsobj->sym_code+1) % 8;
- donl = FALSE;
- resref = wmlResolveResIsMember (resobj, clsobj->arguments);
- if ( resref != NULL )
- if ( resref->exclude != WmlAttributeTrue )
- {
- sprintf (itembuf, " _BIT_MASK(sym_k_%s_object) |",
- clsobj->tkname);
- strcat (maskbuf, itembuf);
- donl = TRUE;
- }
- if ( donl )
- strcat (maskbuf, "\n ");
- if ( itemno == 0 )
- {
- fprintf (outfil, "%s 0", maskbuf);
- strcpy (maskbuf, ",");
- }
- }
- if ( itemno != 0 )
- fprintf (outfil, "%s 0};\n", maskbuf);
- else
- fprintf (outfil, "};\n");
- }
- /*
- * Write the vector of vectors.
- */
- fprintf (outfil, canned2);
- for ( resndx=0 ; resndx<wml_obj_arg_ptr->cnt ; resndx++ )
- {
- resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[resndx].objptr;
- fprintf (outfil, " arg_class_vec%d,\n", resobj->sym_code);
- }
- fprintf (outfil, canned3);
- /*
- * close the output file
- */
- printf ("\nCreated UilSymArTa.h");
- fclose (outfil);
- }
- /*
- * Routine to write out UilSymChTa.h
- *
- * This file defines the automatic children supported by each class. For each
- * child, there is a bit vector with the bit for each supporting class
- * turned on if the child is supported. There is then a vector pointing
- * to these bit vectors for all children. This vector is accessed by
- * sym_k_..._child to find the child's bit vector, then by sym_k_..._object
- * to check the bit.
- */
- void wmlOutputUilSymChTa ()
- {
- char *canned1 =
- "\n/*\n\
- * Bit vectors for each child. The entries in the vector correspond\n\
- * to each class.\n\
- */\n";
- char *bvechdr =
- "\n\
- /* sym_k_%s_child */\n\
- static unsigned char child_class_vec%d[] =\n\
- {\n";
- char *canned2 =
- "\n/*\n\
- * Table of bit vectors accessed by sym_k_..._child\n\
- */\n\
- static unsigned char *allowed_child_table_vec[] =\n\
- {\n\
- NULL,\t/* UNUSED */\n";
- char *canned3 =
- " };\n\
- externaldef(uil_sym_glbl) unsigned char **allowed_child_table =\n\
- \t\tallowed_child_table_vec;\n";
- FILE *outfil; /* output file */
- int childndx; /* outer loop index */
- WmlChildDefPtr childobj; /* current argument */
- int clsndx; /* inner loop index */
- WmlClassDefPtr clsobj; /* current class object */
- WmlClassChildDefPtr childref; /* class' child reference */
- int itemno; /* item in byte */
- char maskbuf[500]; /* current mask buffer */
- char itembuf[100]; /* for current item */
- int donl; /* TRUE if append \n to mask */
- /*
- * Open the output file. Write canned header.
- */
- outfil = fopen ( "UilSymChTa.h", "w");
- if ( outfil == (FILE *) NULL )
- {
- printf ("\nCouldn't open UilSymChTa.h");
- return;
- }
- fprintf (outfil, canned_warn);
- fprintf (outfil, canned1);
- /*
- * Generate the bit vectors for each class. Outer loop on the child code,
- * inner loop on the class code.
- */
- for ( childndx=0 ; childndx<wml_obj_child_ptr->cnt ; childndx++ )
- {
- childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[childndx].objptr;
- fprintf (outfil, bvechdr, childobj->tkname, childobj->sym_code);
- /*
- * inner loop on widget class.
- */
- strcpy (maskbuf, " ");
- for ( clsndx=0 ; clsndx<wml_obj_class_ptr->cnt ; clsndx++ )
- {
- clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[clsndx].objptr;
- itemno = (clsobj->sym_code+1) % 8;
- donl = FALSE;
- childref = wmlResolveChildIsMember (childobj, clsobj->children);
- if ( childref != NULL )
- {
- sprintf (itembuf, " _BIT_MASK(sym_k_%s_object) |", clsobj->tkname);
- strcat (maskbuf, itembuf);
- donl = TRUE;
- }
- if ( donl )
- strcat (maskbuf, "\n ");
- if ( itemno == 0 )
- {
- fprintf (outfil, "%s 0", maskbuf);
- strcpy (maskbuf, ",");
- }
- }
- if ( itemno != 0 )
- fprintf (outfil, "%s 0};\n", maskbuf);
- else
- fprintf (outfil, "};\n");
- }
- /*
- * Write the vector of vectors.
- */
- fprintf (outfil, canned2);
- for ( childndx=0 ; childndx<wml_obj_child_ptr->cnt ; childndx++ )
- {
- childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[childndx].objptr;
- fprintf (outfil, " child_class_vec%d,\n", childobj->sym_code);
- }
- fprintf (outfil, canned3);
- /*
- * close the output file
- */
- printf ("\nCreated UilSymChTa.h");
- fclose (outfil);
- }
- /*
- * Routine to write out UilSymCtl.h
- *
- * This file defines the controls supported by each class. For each
- * object, there is a bit vector with the bit for each supporting class
- * turned on if the object is supported. There is then a vector pointing
- * to these bit vectors for all objects. This vector is accessed by
- * sym_k_..._object to find the objects bit vector, then by sym_k_..._object
- * to check the bit.
- */
- void wmlOutputUilSymCtl ()
- {
- char *canned1 =
- "\n/*\n\
- * Bit vectors for each control. The entries in the vector correspond\n\
- * to each class.\n\
- */\n";
- char *bvechdr =
- "\n\
- /* sym_k_%s_object */\n\
- static unsigned char object_class_vec%d[] =\n\
- {\n";
- char *canned2 =
- "\n/*\n\
- * Table of bit vectors accessed by sym_k_..._object\n\
- */\n\
- static unsigned char *allowed_control_table_vec[] =\n\
- {\n\
- NULL,\t/* UNUSED */\n";
- char *canned3 =
- " };\n\
- externaldef(uil_sym_glbl) unsigned char **allowed_control_table =\n\
- \t\tallowed_control_table_vec;\n";
- FILE *outfil; /* output file */
- int ctlndx; /* outer loop index */
- WmlClassDefPtr ctlobj; /* current class allowing controls */
- int clsndx; /* inner loop index */
- WmlClassDefPtr clsobj; /* current class object */
- int itemno; /* item in bye */
- char maskbuf[500]; /* current mask buffer */
- char itembuf[100]; /* for current item */
- int donl; /* TRUE if append \n to mask */
- /*
- * Open the output file. Write canned header.
- */
- outfil = fopen ( "UilSymCtl.h", "w");
- if ( outfil == (FILE *) NULL )
- {
- printf ("\nCouldn't open UilSymCtl.h");
- return;
- }
- fprintf (outfil, canned_warn);
- fprintf (outfil, canned1);
- /*
- * Generate the bit vectors for each class. Outer loop on the class code,
- * inner loop on the class code.
- */
- for ( ctlndx=0 ; ctlndx<wml_obj_class_ptr->cnt ; ctlndx++ )
- {
- clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ctlndx].objptr;
- fprintf (outfil, bvechdr, clsobj->tkname, clsobj->sym_code);
- /*
- * inner loop on widget class.
- */
- strcpy (maskbuf, " ");
- for ( clsndx=0 ; clsndx<wml_obj_class_ptr->cnt ; clsndx++ )
- {
- ctlobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[clsndx].objptr;
- itemno = (ctlobj->sym_code+1) % 8;
- donl = FALSE;
- if ( wmlResolveCtlIsMember(clsobj,ctlobj->controls) == TRUE)
- {
- sprintf (itembuf, " _BIT_MASK(sym_k_%s_object) |",
- ctlobj->tkname);
- strcat (maskbuf, itembuf);
- donl = TRUE;
- }
- if ( donl )
- strcat (maskbuf, "\n ");
- if ( itemno == 0 )
- {
- fprintf (outfil, "%s 0", maskbuf);
- strcpy (maskbuf, ",");
- }
- }
- if ( itemno != 0 )
- fprintf (outfil, "%s 0};\n", maskbuf);
- else
- fprintf (outfil, "};\n");
- }
- /*
- * Write the vector of vectors.
- */
- fprintf (outfil, canned2);
- for ( ctlndx=0 ; ctlndx<wml_obj_class_ptr->cnt ; ctlndx++ )
- {
- clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ctlndx].objptr;
- fprintf (outfil, " object_class_vec%d,\n", clsobj->sym_code);
- }
- fprintf (outfil, canned3);
- /*
- * close the output file
- */
- printf ("\nCreated UilSymCtl.h");
- fclose (outfil);
- }
- /*
- * Predicate to indicate if a class object is in a controls list.
- */
- int wmlResolveCtlIsMember (ctlobj, ctlref)
- WmlClassDefPtr ctlobj;
- WmlClassCtrlDefPtr ctlref;
- {
- while ( ctlref != NULL )
- {
- if ( ctlref->ctrl == ctlobj ) return TRUE;
- ctlref = ctlref->next;
- }
- return FALSE;
- }
- /*
- * Routine to write out UilSymNam.h
- *
- * Tables of names of object indexed by their various sym_k_ literals.
- */
- void wmlOutputUilSymNam ()
- {
- char *canned1 =
- "/* Define mapping of sym_k_..._object codes to widget names. */\n\
- \n\
- externaldef(uil_sym_glbl) int uil_max_object = %d;\n\
- static char *uil_widget_names_vec[] = {\n\
- \"\",\t/* NOT USED */\n";
- char *canned2 =
- "};\n\
- externaldef(uil_sym_glbl) char **uil_widget_names =\n\
- \t\tuil_widget_names_vec;\n\
- \n\n\
- /* Define mapping of sym_k_..._arg codes to argument names. */\n\
- \n\
- externaldef(uil_sym_glbl) int uil_max_arg = %d;\n\
- static char *uil_argument_names_vec[] = {\n\
- \"\",\t/* NOT USED */\n";
- char *canned3 =
- "};\n\
- externaldef(uil_sym_glbl) char **uil_argument_names =\n\
- \t\tuil_argument_names_vec;\n\
- \n\n\
- /* Define mapping of sym_k_..._reason to reason names. */\n\
- \n\
- externaldef(uil_sym_glbl) int uil_max_reason = %d;\n\
- static char *uil_reason_names_vec[] = {\n\
- \"\",\t/* NOT USED */\n";
- char *canned4 =
- "};\n\
- externaldef(uil_sym_glbl) char **uil_reason_names =\n\
- \t\tuil_reason_names_vec;\n\
- \n\n\
- /* Define mapping of sym_k_..._enumval to enumeration value names. */\n\
- \n\
- externaldef(uil_sym_glbl) int uil_max_enumset = %d;\n\
- externaldef(uil_sym_glbl) int uil_max_enumval = %d;\n\
- static char *uil_enumval_names_vec[] = {\n\
- \"\",\t/* NOT USED */\n";
- char *canned5 =
- "};\n\
- externaldef(uil_sym_glbl) char **uil_enumval_names =\n\
- \t\tuil_enumval_names_vec;\n\
- \n\n\
- /* Define mapping of sym_k_..._charset to enumeration value names. */\n\
- \n\
- externaldef(uil_sym_glbl) int uil_max_charset = %d;\n\
- static char *uil_charset_names_vec[] = {\n\
- \"\",\t/* NOT USED */\n\
- \"<userdefined>\",\n";
- char *canned6 =
- "};\n\
- externaldef(uil_sym_glbl) char **uil_charset_names =\n\
- \t\tuil_charset_names_vec;\n\
- \n\n\
- /* Define mapping of sym_k_..._child codes to child names. */\n\
- \n\
- externaldef(uil_sym_glbl) int uil_max_child = %d;\n\
- static char *uil_child_names_vec[] = {\n\
- \"\",\t/* NOT USED */\n";
- char *canned7 =
- "};\n\
- externaldef(uil_sym_glbl) char **uil_child_names =\n\
- \t\tuil_child_names_vec;\n";
- FILE *outfil; /* output file */
- int ndx; /* loop index */
- WmlClassDefPtr clsobj; /* class object */
- WmlClassDefPtr varobj; /* gadget class object */
- WmlSynClassDefPtr synobj; /* syntactic object */
- WmlResourceDefPtr resobj; /* argument/reason object */
- WmlSynResourceDefPtr synres; /* arg/reason syntactic object */
- WmlEnumValueDefPtr evobj; /* enumeration value object */
- WmlSynEnumValueDefPtr synev; /* enumeration value syntactic obj */
- WmlCharSetDefPtr csobj; /* character set object */
- WmlSynCharSetDefPtr syncs; /* character set syntactic obj */
- WmlChildDefPtr chobj; /* child object */
- WmlSynChildDefPtr synch; /* child syntactic object */
- /*
- * Open the output file. Write canned header.
- */
- outfil = fopen ( "UilSymNam.h", "w");
- if ( outfil == (FILE *) NULL )
- {
- printf ("\nCouldn't open UilSymNam.h");
- return;
- }
- fprintf (outfil, canned_warn);
- /*
- * Write entries for widgets
- */
- fprintf (outfil, canned1, max_object_code);
- for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
- {
- clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
- if ( clsobj->sym_code == 0 ) continue;
- synobj = clsobj->syndef;
- fprintf (outfil, " \"%s\",\n",
- synobj->name);
- }
- /*
- * Write entries for arguments
- */
- fprintf (outfil, canned2, max_arg_code);
- for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
- {
- resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
- synres = resobj->syndef;
- if ( resobj->sym_code == 0 ) continue;
- fprintf (outfil, " \"%s\",\n",
- synres->name);
- }
- /*
- * Write entries for reasons
- */
- fprintf (outfil, canned3, max_reason_code);
- for ( ndx=0 ; ndx<wml_obj_reason_ptr->cnt ; ndx++ )
- {
- resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[ndx].objptr;
- synres = resobj->syndef;
- if ( resobj->sym_code == 0 ) continue;
- fprintf (outfil, " \"%s\",\n",
- synres->name);
- }
- /*
- * Write entries for enumeration values
- */
- fprintf (outfil, canned4, max_enumset_code, max_enumval_code);
- for ( ndx=0 ; ndx<wml_obj_enumval_ptr->cnt ; ndx++ )
- {
- evobj = (WmlEnumValueDefPtr) wml_obj_enumval_ptr->hvec[ndx].objptr;
- synev = evobj->syndef;
- if ( evobj->sym_code == 0 ) continue;
- fprintf (outfil, " \"%s\",\n",
- synev->name);
- }
- /*
- * Write entries for character sets
- */
- fprintf (outfil, canned5, max_charset_code);
- for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
- {
- csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
- syncs = csobj->syndef;
- if ( csobj->sym_code == 0 ) continue;
- fprintf (outfil, " \"%s\",\n",
- syncs->name);
- }
- /*
- * Write entries for children
- */
- fprintf (outfil, canned6, max_child_code);
- for ( ndx=0 ; ndx<wml_obj_child_ptr->cnt ; ndx++ )
- {
- chobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[ndx].objptr;
- synch = chobj->syndef;
- if ( chobj->sym_code == 0 ) continue;
- fprintf (outfil, " \"%s\",\n",
- synch->name);
- }
- fprintf (outfil, canned7);
- /*
- * close the output file
- */
- printf ("\nCreated UilSymNam.h");
- fclose (outfil);
- }
- /*
- * Routine to write out UilSymEnum.h
- *
- * This file defines the enumeration sets recognized by UIL. There is an
- * entry in this file for each enumeration set. The definitions are accessed
- * by the sym_k_..._enumset code. Each consists of a structure containing
- * a vector of enumeration value descriptors, each of which is the name
- * of the value and its value.
- *
- * UilSymEnum.h contains:
- * - Vectors of value descriptors for each table entry
- * - The table itself.
- * - A table given the sym_k_..._enumset code for each argument which
- * has an enumeration set.
- * - A table accessed by sym_k_..._enumval code giving the actual value
- * for each enumeration value.
- *
- * The typedefs for the tables are in UilSymGen.h
- */
- void wmlOutputUilSymEnum ()
- {
- char *canned1 =
- "\n\
- /*\n\
- * Enumeration value vectors for each enumeration set\n\
- */\n\
- \n";
- char *valhdr =
- "\n\
- static unsigned short int enum_value_vec%d[] =\n\
- {\n";
- char *canned3 =
- "\n\
- /*\n\
- * Enumeration set descriptor table\n\
- */\n\
- static UilEnumSetDescDef enum_set_table_vec[] =\n\
- {\n\
- {0,NULL},\n";
- char *canned4 =
- " };\n\
- externaldef(uil_sym_glbl) UilEnumSetDescDef *enum_set_table =\n\
- \t\tenum_set_table_vec;\n\
- /*\n\
- * Enumeration set table, accessed by sym_k_..._arg code. Each non-zero entry\n\
- * is the sym_k_..._enumset code for the argument's enumeration set.\n\
- */\n\
- static unsigned short int argument_enumset_table_vec[] =\n\
- {\n\
- 0,\n";
- char *canned5 =
- " };\n\
- externaldef(uil_sym_glbl) unsigned short int *argument_enumset_table =\n\
- \t\targument_enumset_table_vec;\n\
- /*\n\
- * Enumeration value table, accessed by sym_k_..._enumval code. Each entry is\n\
- * the actual value associated with the code.\n\
- */\n\
- static int enumval_values_table_vec[] =\n\
- {\n\
- 0,\n";
- char *canned5a =
- " };\n\
- externaldef(uil_sym_glbl) int *enumval_values_table =\n\
- \t\tenumval_values_table_vec;\n";
- FILE *outfil; /* output file */
- int ndx; /* loop index */
- WmlEnumSetDefPtr enumsetobj; /* enumeration set object */
- WmlEnumSetValDefPtr esvobj; /* current enum set value list element */
- WmlEnumValueDefPtr evobj; /* current enumeration value object */
- WmlResourceDefPtr resobj; /* resource object */
- /*
- * Open the output file. Write the canned header stuff
- */
- outfil = fopen ("UilSymEnum.h", "w");
- if ( outfil == (FILE *) NULL )
- {
- printf ("\nCouldn't open UilSymEnum.h");
- return;
- }
- fprintf (outfil, canned_warn);
- /*
- * Generate the enumeration value vectors for each enumeration set.
- */
- fprintf (outfil, canned1);
- for ( ndx=0 ; ndx<wml_obj_enumset_ptr->cnt ; ndx++ )
- {
- enumsetobj = (WmlEnumSetDefPtr) wml_obj_enumset_ptr->hvec[ndx].objptr;
- fprintf (outfil, valhdr, enumsetobj->sym_code);
- for ( esvobj=enumsetobj->values ; esvobj!=NULL ; esvobj=esvobj->next )
- {
- evobj = esvobj->value;
- fprintf (outfil, " %d,\n",
- evobj->sym_code);
- }
- fprintf (outfil, " };\n");
- }
- /*
- * Generate the enumeration set tables
- */
- fprintf (outfil, canned3);
- for ( ndx=0 ; ndx<wml_obj_enumset_ptr->cnt ; ndx++ )
- {
- enumsetobj = (WmlEnumSetDefPtr) wml_obj_enumset_ptr->hvec[ndx].objptr;
- fprintf (outfil, " {%d,enum_value_vec%d},\n",
- enumsetobj->values_cnt,
- enumsetobj->sym_code);
- }
- /*
- * Create enumset table entries for arguments, similar to writing sym_k...
- */
- fprintf (outfil, canned4);
- for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
- {
- resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
- if ( resobj->enumset_def == NULL )
- fprintf (outfil, " 0,\n");
- else
- fprintf (outfil, " %d,\n",
- resobj->enumset_def->sym_code);
- }
- /*
- * Create the enumval values table.
- */
- fprintf (outfil, canned5);
- for ( ndx=0 ; ndx<wml_obj_enumval_ptr->cnt ; ndx++ )
- {
- evobj = (WmlEnumValueDefPtr) wml_obj_enumval_ptr->hvec[ndx].objptr;
- fprintf (outfil, " %s,\n", evobj->syndef->enumlit);
- }
- fprintf (outfil, canned5a);
- /*
- * close the output file
- */
- printf ("\nCreated UilSymEnum.h");
- fclose (outfil);
- }
- /*
- * Routine to write out UilSymCSet.h
- *
- * This file specifies the various attributes for the character sets
- * recognized by UIL. There is a table for each of the following
- * attributes:
- * - Standards name associated with the character set
- * - Writing direction, from XmSTRING_DIRECTION_...
- * - Parsing direction, from XmSTRING_DIRECTION_...
- * - Bytes per character, from sym_k_..._charsize (in UilSymGen.h)
- * - A pair of tables for recognizing $LANG settings:
- * o a table of all names under which a character set might
- * be legally recognized (upper case).
- * o the sym_k_..._charset code for each entry
- * o a variable giving the number of entries in the table
- *
- * All tables are accessed by the sym_k_..._charset
- *
- */
- void wmlOutputUilSymCSet ()
- {
- char *canned1 =
- "\n\
- /*\n\
- * Character set XmString name table, accessed by sym_k_..._charset code.\n\
- * Each entry is the name which identifies the character set in a XmString.\n\
- */\n\
- static char *charset_xmstring_names_table_vec[] =\n\
- {\n\
- 0,\n\
- \"<userdefined>\",\n";
- char *canned2 =
- "};\n\
- externaldef(uil_sym_glbl) char **charset_xmstring_names_table =\n\
- \t\tcharset_xmstring_names_table_vec;\n\
- /*\n\
- * Character set writing direction table, accessed by sym_k_..._charset code.\n\
- * Each entry is the XmSTRING_DIRECTION_... code which identifies the\n\
- * writing direction for the character set in a XmString.\n\
- */\n\
- static unsigned char charset_wrdirection_table_vec[] =\n\
- {\n\
- 0,\n\
- 0,\t/* userdefined */\n";
- char *canned3 =
- "};\n\
- externaldef(uil_sym_glbl) unsigned char *charset_writing_direction_table =\n\
- \t\tcharset_wrdirection_table_vec;\n\
- /*\n\
- * Character set parsing direction table, accessed by sym_k_..._charset code.\n\
- * Each entry is the XmSTRING_DIRECTION_... code which identifies the\n\
- * parsing direction for the character set in a XmString.\n\
- */\n\
- static unsigned char charset_parsdirection_table_vec[] =\n\
- {\n\
- 0,\n\
- 0,\t/* userdefined */\n";
- char *canned4 =
- "};\n\
- externaldef(uil_sym_glbl) unsigned char *charset_parsing_direction_table =\n\
- \t\tcharset_parsdirection_table_vec;\n\
- /*\n\
- * Character set character size table, accessed by sym_k_..._charset code.\n\
- * Each entry is the sym_k_..._charsize literal which names the character\n\
- * size for the character set in a XmString.\n\
- */\n\
- static unsigned char charset_charsize_table_vec[] =\n\
- {\n\
- 0,\n\
- 0,\t/* userdefined */\n";
- char *canned5 =
- "};\n\
- externaldef(uil_sym_glbl) unsigned char *charset_character_size_table =\n\
- \t\tcharset_charsize_table_vec;\n\
- /*\n\
- * All the names under which a character set may be legally named in a \n\
- * $LANG variable (upper case).\n\
- */\n\
- static char *charset_lang_names_table_vec[] =\n\
- {\n";
- char *canned6 =
- "};\n\
- externaldef(uil_sym_glbl) char **charset_lang_names_table =\n\
- \t\tcharset_lang_names_table_vec;\n\
- /*\n\
- * The sym_k_..._charset codes for charset_lang_names\n\
- */\n\
- static unsigned short int charset_lang_codes_table_vec[] =\n\
- {\n";
- char *canned7 =
- "};\n\
- externaldef(uil_sym_glbl) unsigned short int *charset_lang_codes_table =\n\
- \t\tcharset_lang_codes_table_vec;\n\
- /*\n\
- * The number of entries in charset_lang_..._table tables\n\
- */\n\
- externaldef(uil_sym_glbl) unsigned short int charset_lang_table_max = %d;\n";
- FILE *outfil; /* output file */
- int ndx; /* loop index */
- WmlCharSetDefPtr csobj; /* character set object */
- WmlSynCharSetDefPtr syncs; /* character set syntactic obj */
- int lang_max; /* max value for $LANG tables */
- int alias_ndx; /* alias loop index */
- char uname[200]; /* name converted to upper case */
- /*
- * Open the output file. Write the canned header stuff
- */
- outfil = fopen ("UilSymCSet.h", "w");
- if ( outfil == (FILE *) NULL )
- {
- printf ("\nCouldn't open UilSymCSet.h");
- return;
- }
- fprintf (outfil, canned_warn);
- /*
- * Generate the standards name table
- */
- fprintf (outfil, canned1);
- for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
- {
- csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
- syncs = csobj->syndef;
- if ( csobj->sym_code == 0 ) continue;
- if ((strcmp(syncs->xms_name, "XmFONTLIST_DEFAULT_TAG") == 0) ||
- (strcmp(syncs->xms_name, "_MOTIF_DEFAULT_LOCALE") == 0))
- fprintf (outfil, " %s,\t/* %s */\n",
- syncs->xms_name, syncs->name);
- else
- fprintf (outfil, " \"%s\",\t/* %s */\n",
- syncs->xms_name, syncs->name);
- }
- /*
- * Generate the writing direction table
- */
- fprintf (outfil, canned2);
- for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
- {
- csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
- syncs = csobj->syndef;
- if ( csobj->sym_code == 0 ) continue;
- switch ( syncs->direction )
- {
- case WmlCharSetDirectionLtoR:
- fprintf (outfil, " XmSTRING_DIRECTION_L_TO_R,\t/* %s */\n",
- syncs->name);
- break;
- case WmlCharSetDirectionRtoL:
- fprintf (outfil, " XmSTRING_DIRECTION_R_TO_L,\t/* %s */\n",
- syncs->name);
- break;
- }
- }
- /*
- * Generate the parsing direction table
- */
- fprintf (outfil, canned3);
- for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
- {
- csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
- syncs = csobj->syndef;
- if ( csobj->sym_code == 0 ) continue;
- switch ( syncs->parsedirection )
- {
- case WmlCharSetDirectionLtoR:
- fprintf (outfil, " XmSTRING_DIRECTION_L_TO_R,\t/* %s */\n",
- syncs->name);
- break;
- case WmlCharSetDirectionRtoL:
- fprintf (outfil, " XmSTRING_DIRECTION_R_TO_L,\t/* %s */\n",
- syncs->name);
- break;
- }
- }
- /*
- * Generate the character size table
- */
- fprintf (outfil, canned4);
- for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
- {
- csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
- syncs = csobj->syndef;
- if ( csobj->sym_code == 0 ) continue;
- switch ( syncs->charsize )
- {
- case WmlCharSizeOneByte:
- fprintf (outfil, " sym_k_onebyte_charsize,\t/* %s */\n",
- syncs->name);
- break;
- case WmlCharSizeTwoByte:
- fprintf (outfil, " sym_k_twobyte_charsize,\t/* %s */\n",
- syncs->name);
- break;
- case WmlCharSizeMixed1_2Byte:
- fprintf (outfil, " sym_k_mixed1_2byte_charsize,\t/* %s */\n",
- syncs->name);
- break;
- }
- }
- /*
- * Generate the $LANG name recognition table
- */
- fprintf (outfil, canned5);
- lang_max = 0;
- for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
- {
- csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
- syncs = csobj->syndef;
- if ( csobj->sym_code == 0 ) continue;
- strcpy (uname, syncs->name);
- wmlUpperCaseString (uname);
- fprintf (outfil, " \"%s\",\t/* %s */\n",
- uname, syncs->name);
- lang_max += 1;
- strcpy (uname, syncs->xms_name);
- wmlUpperCaseString (uname);
- fprintf (outfil, " \"%s\",\t/* %s */\n",
- uname, syncs->name);
- lang_max += 1;
- for ( alias_ndx=0 ; alias_ndx<syncs->alias_cnt ; alias_ndx++ )
- {
- strcpy (uname, syncs->alias_list[alias_ndx]);
- wmlUpperCaseString (uname);
- fprintf (outfil, " \"%s\",\t/* %s */\n",
- uname, syncs->name);
- lang_max += 1;
- }
- }
- /*
- * Generate the $LANG code lookup table, in upper case
- */
- fprintf (outfil, canned6);
- for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
- {
- csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
- syncs = csobj->syndef;
- if ( csobj->sym_code == 0 ) continue;
- fprintf (outfil, " sym_k_%s_charset,\n", syncs->name);
- fprintf (outfil, " sym_k_%s_charset,\n", syncs->name);
- for ( alias_ndx=0 ; alias_ndx<syncs->alias_cnt ; alias_ndx++ )
- fprintf (outfil, " sym_k_%s_charset,\n", syncs->name);
- }
- /*
- * Generate the number of entries in the previous two tables
- */
- fprintf (outfil, canned7, lang_max);
- /*
- * close the output file
- */
- printf ("\nCreated UilSymCSet.h");
- fclose (outfil);
- }
|