wmlouth.c 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these librararies and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /*
  24. * @OSF_COPYRIGHT@
  25. * COPYRIGHT NOTICE
  26. * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
  27. * ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for
  28. * the full copyright text.
  29. */
  30. /*
  31. * HISTORY
  32. */
  33. #ifdef REV_INFO
  34. #ifndef lint
  35. static char rcsid[] = "$XConsortium: wmlouth.c /main/8 1995/08/29 11:10:46 drk $"
  36. #endif
  37. #endif
  38. /*
  39. * (c) Copyright 1989, 1990, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */
  40. /*
  41. * This module contains routines responsible for writing the .h files
  42. * produced by WML. All files are written into the current directory.
  43. *
  44. * Input:
  45. * The resolved objects
  46. *
  47. * Output:
  48. * UilSymGen.h
  49. * UilSymArTy.h
  50. * UilSymChCl.h
  51. * UilSymRArg.h
  52. * UilUrmClas.h
  53. * UilConst.h
  54. * UilSymReas.h
  55. * UilSymArTa.h
  56. * UilSymChTa.h
  57. * UilSymCtl.h
  58. * UilSymNam.h
  59. * UilSymEnum.h
  60. * UilSymCSet.h
  61. */
  62. #include "wml.h"
  63. #if defined(__STDC__)
  64. #include <string.h>
  65. #endif
  66. #include <stdio.h>
  67. /*
  68. * Routines used only in this module
  69. */
  70. void wmlOutputUilSymGen ();
  71. void wmlOutputUilSymArTy ();
  72. void wmlOutputUilSymChCl ();
  73. void wmlOutputUilSymRArg ();
  74. void wmlOutputUilUrmClas ();
  75. void wmlOutputUilConst ();
  76. void wmlOutputUilSymReas ();
  77. void wmlOutputUilSymArTa ();
  78. void wmlOutputUilSymChTa ();
  79. void wmlOutputUilSymCtl ();
  80. void wmlOutputUilSymNam ();
  81. void wmlOutputUilSymEnum ();
  82. void wmlOutputUilSymCSet ();
  83. /*
  84. * globals
  85. */
  86. static char *canned_warn =
  87. "/*\n\
  88. **\tThis file is automatically generated. Do not edit it by hand.\n\
  89. **/\n";
  90. /*
  91. * Used to create masks for bytes in bit vectors. Accessed by bit numbers
  92. * from 1 - 8.
  93. */
  94. static char *bit_masks[] = {""
  95. ," | 1" /* bit 1 */
  96. ," | 2" /* bit 2 */
  97. ," | 4" /* bit 3 */
  98. ," | 8" /* bit 4 */
  99. ," | 16" /* bit 5 */
  100. ," | 32" /* bit 6 */
  101. ," | 64" /* bit 7 */
  102. ," | 128"}; /* bit 8 */
  103. /*
  104. * To pick up maximum code values
  105. */
  106. static int max_object_code = 0;
  107. static int max_reason_code = 0;
  108. static int max_arg_code = 0;
  109. static int max_enumset_code = 0;
  110. static int max_enumval_code = 0;
  111. static int max_charset_code = 0;
  112. static int max_child_code = 0;
  113. /*
  114. * Output control routine, which simply outputs each .h file in turn.
  115. */
  116. void wmlOutputHFiles ()
  117. {
  118. wmlOutputUilSymGen ();
  119. wmlOutputUilSymArTy ();
  120. wmlOutputUilSymChCl ();
  121. wmlOutputUilSymRArg ();
  122. wmlOutputUilUrmClas ();
  123. wmlOutputUilConst ();
  124. wmlOutputUilSymReas ();
  125. wmlOutputUilSymArTa ();
  126. wmlOutputUilSymChTa ();
  127. wmlOutputUilSymCtl ();
  128. wmlOutputUilSymNam ();
  129. wmlOutputUilSymEnum ();
  130. wmlOutputUilSymCSet ();
  131. }
  132. /*
  133. * Routine to write out UilSymGen.h
  134. *
  135. * This file defines the sym_k... literals for UIL. Each set of literals
  136. * typiclly increases monotonically from 1, with 0 used as en error value.
  137. *
  138. * sym_k_<class>_object
  139. * <class> is widget class name in lexicographic order
  140. * gadgets are not include.
  141. *
  142. * bit masks for table access
  143. *
  144. * sym_k_<reason>_reason
  145. * literals specifying all reasons, lexicographically ordered
  146. *
  147. * sym_k_<argument>_arg
  148. * literals for all arguments, lexicographically ordered.
  149. * Constraints are included, and ordered with the arguments.
  150. *
  151. * sym_k_<child>_child
  152. * literals for all automatic children, lexicographically ordered.
  153. *
  154. * sym_k_<enumset>_enumset
  155. * literals naming each enumeration set, lexicographically ordered
  156. *
  157. * Fixed literals naming character set character sizes
  158. * sym_k_<charset>_charset
  159. * literals naming each character set, lexicographically ordered
  160. */
  161. void wmlOutputUilSymGen ()
  162. {
  163. char *canned1 =
  164. "\n/* Define literals for objects */\n";
  165. char *canned3 =
  166. "\n/* Define literals for reasons */\n\n";
  167. char *canned4 =
  168. "\n/* Define literals for arguments */\n\n";
  169. char *canned5 =
  170. "\n/* Define literals for enumeration sets */\n\n";
  171. char *canned6 =
  172. "\n/* Define literals for enumeration values */\n\n";
  173. char *canned7 =
  174. "\n/* Define literals for character sets */\n\n";
  175. char *canned8 =
  176. "\n/* Define literals for automatic children */\n\n";
  177. FILE *outfil; /* output file */
  178. int ndx; /* loop index */
  179. WmlClassDefPtr clsobj; /* class object */
  180. WmlDataTypeDefPtr datobj; /* data type object */
  181. WmlResourceDefPtr resobj; /* resource object */
  182. WmlEnumSetDefPtr enumsetobj; /* enumeration set object */
  183. WmlEnumValueDefPtr enumvalobj; /* enumeration value object */
  184. WmlCharSetDefPtr charsetobj; /* character set object */
  185. WmlChildDefPtr childobj; /* child object */
  186. /*
  187. * Open the output file. Write the canned header stuff
  188. */
  189. outfil = fopen ("UilSymGen.h", "w");
  190. if ( outfil == (FILE *) NULL )
  191. {
  192. printf ("\nCouldn't open UilSymGen.h");
  193. return;
  194. }
  195. fprintf (outfil, canned_warn);
  196. /*
  197. * Write the sym_k..._object literals
  198. */
  199. fprintf (outfil, canned1);
  200. for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
  201. {
  202. clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
  203. fprintf (outfil, "#define sym_k_%s_object\t%d\n",
  204. clsobj->tkname,
  205. clsobj->sym_code);
  206. if ( clsobj->sym_code > max_object_code )
  207. max_object_code = clsobj->sym_code;
  208. }
  209. /*
  210. * Define the sym_k_..._reason literals
  211. */
  212. fprintf (outfil, canned3);
  213. for ( ndx=0 ; ndx<wml_obj_reason_ptr->cnt ; ndx++ )
  214. {
  215. resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[ndx].objptr;
  216. fprintf (outfil, "#define sym_k_%s_reason\t%d\n",
  217. resobj->tkname,
  218. resobj->sym_code);
  219. if ( resobj->sym_code > max_reason_code )
  220. max_reason_code = resobj->sym_code;
  221. }
  222. /*
  223. * Define the sym_k_..._arg literals
  224. */
  225. fprintf (outfil, canned4);
  226. for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
  227. {
  228. resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
  229. fprintf (outfil, "#define sym_k_%s_arg\t%d\n",
  230. resobj->tkname,
  231. resobj->sym_code);
  232. if ( resobj->sym_code > max_arg_code )
  233. max_arg_code = resobj->sym_code;
  234. }
  235. /*
  236. * Define the sym_k_..._enumset structs and literals
  237. */
  238. fprintf (outfil, canned5);
  239. for ( ndx=0 ; ndx<wml_obj_enumset_ptr->cnt ; ndx++ )
  240. {
  241. enumsetobj = (WmlEnumSetDefPtr) wml_obj_enumset_ptr->hvec[ndx].objptr;
  242. fprintf (outfil, "#define sym_k_%s_enumset\t%d\n",
  243. enumsetobj->tkname,
  244. enumsetobj->sym_code);
  245. if ( enumsetobj->sym_code > max_enumset_code )
  246. max_enumset_code = enumsetobj->sym_code;
  247. }
  248. /*
  249. * Define the sym_k_..._enumval literals
  250. */
  251. fprintf (outfil, canned6);
  252. for ( ndx=0 ; ndx<wml_obj_enumval_ptr->cnt ; ndx++ )
  253. {
  254. enumvalobj = (WmlEnumValueDefPtr) wml_obj_enumval_ptr->hvec[ndx].objptr;
  255. fprintf (outfil, "#define sym_k_%s_enumval\t%d\n",
  256. enumvalobj->syndef->name,
  257. enumvalobj->sym_code);
  258. if ( enumvalobj->sym_code > max_enumval_code )
  259. max_enumval_code = enumvalobj->sym_code;
  260. }
  261. /*
  262. * Define the sym_k_..._charsize literals
  263. * Define the sym_k_..._charset literals
  264. */
  265. fprintf (outfil, canned7);
  266. for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
  267. {
  268. charsetobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
  269. fprintf (outfil, "#define sym_k_%s_charset\t%d\n",
  270. charsetobj->syndef->name,
  271. charsetobj->sym_code);
  272. if ( charsetobj->sym_code > max_charset_code )
  273. max_charset_code = charsetobj->sym_code;
  274. }
  275. /*
  276. * Define the sym_k_..._child literals
  277. */
  278. fprintf (outfil, canned8);
  279. for ( ndx=0 ; ndx<wml_obj_child_ptr->cnt ; ndx++ )
  280. {
  281. childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[ndx].objptr;
  282. fprintf (outfil, "#define sym_k_%s_child\t%d\n",
  283. childobj->syndef->name,
  284. childobj->sym_code);
  285. if ( childobj->sym_code > max_child_code )
  286. max_child_code = childobj->sym_code;
  287. }
  288. /*
  289. * close the output file
  290. */
  291. printf ("\nCreated UilSymGen.h");
  292. fclose (outfil);
  293. }
  294. /*
  295. * Routine to write out UilSymChCl.h
  296. *
  297. * A table of classes accessed by child type (sym_k_<child>_child, in
  298. * the form
  299. * ...
  300. * sym_k_<class>_class,
  301. */
  302. void wmlOutputUilSymChCl ()
  303. {
  304. char *canned1 =
  305. "/* Table of the class type of children\n\
  306. The table is indexed by child with each entry the\n\
  307. permitted class for that child.\n\
  308. */\n\
  309. \n\
  310. static unsigned char child_class_table_vec[] =\n\
  311. {\n\
  312. 0,\n";
  313. char *canned1a =
  314. " };\n\
  315. externaldef(uil_sym_glbl) unsigned char *child_class_table =\n\
  316. \t child_class_table_vec;\n";
  317. FILE *outfil; /* output file */
  318. int ndx; /* loop index */
  319. WmlClassDefPtr classobj; /* data type object */
  320. WmlChildDefPtr childobj; /* resource object */
  321. /*
  322. * Open the output file. Write canned header.
  323. */
  324. outfil = fopen ( "UilSymChCl.h", "w");
  325. if ( outfil == (FILE *) NULL )
  326. {
  327. printf ("\nCouldn't open UilSymChCL.h");
  328. return;
  329. }
  330. fprintf (outfil, canned_warn);
  331. /*
  332. * Create table entries, similar to writing sym_k...
  333. */
  334. fprintf (outfil, canned1);
  335. for ( ndx=0 ; ndx<wml_obj_child_ptr->cnt ; ndx++ )
  336. {
  337. childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[ndx].objptr;
  338. classobj = childobj->class;
  339. fprintf (outfil, " sym_k_%s_object,\n",
  340. classobj->tkname);
  341. }
  342. fprintf (outfil, canned1a);
  343. /*
  344. * close the output file
  345. */
  346. printf ("\nCreated UilSymChCl.h");
  347. fclose (outfil);
  348. }
  349. /*
  350. * Routine to write out UilSymArTy.h
  351. *
  352. * A table of data types accessed by argument type (sym_k_<arg>_arg, in
  353. * the form
  354. * ...
  355. * sym_k_<data_type>_value,
  356. */
  357. void wmlOutputUilSymArTy ()
  358. {
  359. char *canned1 =
  360. "/* Table of the types of arguments\n\
  361. The table is indexed by argument with each entry the\n\
  362. permitted type for that argument.\n\
  363. */\n\
  364. \n\
  365. static unsigned char argument_type_table_vec[] =\n\
  366. {\n\
  367. 0,\n";
  368. char *canned1a =
  369. " };\n\
  370. externaldef(uil_sym_glbl) unsigned char *argument_type_table =\n\
  371. \t argument_type_table_vec;\n";
  372. FILE *outfil; /* output file */
  373. int ndx; /* loop index */
  374. WmlDataTypeDefPtr datobj; /* data type object */
  375. WmlResourceDefPtr resobj; /* resource object */
  376. /*
  377. * Open the output file. Write canned header.
  378. */
  379. outfil = fopen ( "UilSymArTy.h", "w");
  380. if ( outfil == (FILE *) NULL )
  381. {
  382. printf ("\nCouldn't open UilSymArTy.h");
  383. return;
  384. }
  385. fprintf (outfil, canned_warn);
  386. /*
  387. * Create table entries, similar to writing sym_k...
  388. */
  389. fprintf (outfil, canned1);
  390. for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
  391. {
  392. resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
  393. datobj = resobj->dtype_def;
  394. fprintf (outfil, " sym_k_%s_value,\n",
  395. datobj->tkname);
  396. }
  397. fprintf (outfil, canned1a);
  398. /*
  399. * close the output file
  400. */
  401. printf ("\nCreated UilSymArTy.h");
  402. fclose (outfil);
  403. }
  404. /*
  405. * Routine to write out UilSymRArg.h
  406. *
  407. * Related argument table
  408. */
  409. void wmlOutputUilSymRArg ()
  410. {
  411. char *canned1 =
  412. "/* Related argument table. Each non-zero entry is the code\n\
  413. of the related argument.\n\
  414. */\n\
  415. \n\
  416. static unsigned short int related_argument_table_vec[] =\n\
  417. {\n\
  418. 0,\n";
  419. char *canned1a =
  420. " };\n\
  421. externaldef(uil_sym_glbl) unsigned short int *related_argument_table =\n\
  422. \t\trelated_argument_table_vec;\n";
  423. FILE *outfil; /* output file */
  424. int ndx; /* loop index */
  425. WmlResourceDefPtr resobj; /* resource object */
  426. /*
  427. * Open the output file. Write canned header.
  428. */
  429. outfil = fopen ( "UilSymRArg.h", "w");
  430. if ( outfil == (FILE *) NULL )
  431. {
  432. printf ("\nCouldn't open UilSymRArg.h");
  433. return;
  434. }
  435. fprintf (outfil, canned_warn);
  436. /*
  437. * Create table entries, similar to writing sym_k...
  438. */
  439. fprintf (outfil, canned1);
  440. for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
  441. {
  442. resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
  443. fprintf (outfil, " %d,\n",
  444. resobj->related_code);
  445. }
  446. fprintf (outfil, canned1a);
  447. /*
  448. * close the output file
  449. */
  450. printf ("\nCreated UilSymRArg.h");
  451. fclose (outfil);
  452. }
  453. /*
  454. * Routine to write out UilUrmClas.h
  455. *
  456. * Table of convenience function names indexed by the sym_k_<class> literal
  457. * for both widgets and gadgets
  458. * Table of resource names indexed by the sym_k_<argument>_arg and
  459. * sym_k_<reason>_reason codes.
  460. */
  461. void wmlOutputUilUrmClas ()
  462. {
  463. char *canned1 =
  464. "\n/* Define mapping of UIL widget types to convenience functions. */\n\
  465. static char *uil_widget_funcs_vec[] = {\n\
  466. \"\",\t /* NOT USED */\n";
  467. char *canned2 =
  468. "};\n\
  469. externaldef(uil_sym_glbl) char **uil_widget_funcs = uil_widget_funcs_vec;\n\
  470. \n\
  471. /* Define mapping of UIL widget classes to matching gadget class. */\n\
  472. static unsigned short int uil_gadget_variants_vec[] = {\n\
  473. 0,\t /* NOT USED */\n";
  474. char *canned3 =
  475. "};\n\
  476. externaldef(uil_sym_glbl) unsigned short int *uil_gadget_variants =\n\
  477. \t\tuil_gadget_variants_vec;\n\
  478. \n\
  479. /* Define mapping of dialog types to non-dialog URM widget classes. */\n\
  480. static unsigned short int uil_urm_nondialog_class_vec[] = {\n\
  481. 0,\t/* NOT USED */\n";
  482. char *canned4 =
  483. "};\n\
  484. externaldef(uil_sym_glbl) unsigned short int *uil_urm_nondialog_class =\n\
  485. \t\tuil_urm_nondialog_class_vec;\n\
  486. \n\
  487. /* Define mapping of widget controls to a (subtree) resource. */\n\
  488. static unsigned short int uil_urm_subtree_resource_vec[] = {\n\
  489. 0,\t/* NOT USED */\n";
  490. char *canned5 =
  491. "};\n\
  492. externaldef(uil_sym_glbl) unsigned short int *uil_urm_subtree_resource =\n\
  493. \t\tuil_urm_subtree_resource_vec;\n\
  494. \n\
  495. /* Define mapping of arguments to toolkit names. */\n\
  496. static char *uil_argument_toolkit_names_vec[] = {\n\
  497. \"\",\t /* NOT USED */\n";
  498. char *canned6 =
  499. "};\n\
  500. externaldef(uil_sym_glbl) char **uil_argument_toolkit_names =\n\
  501. \t\tuil_argument_toolkit_names_vec;\n\
  502. \n\
  503. /* Define mapping of reasons to toolkit names. */\n\
  504. static char *uil_reason_toolkit_names_vec[] = {\n\
  505. \"\",\t/* NOT USED */\n";
  506. char *canned7 =
  507. "};\n\
  508. externaldef(uil_sym_glbl) char **uil_reason_toolkit_names =\n\
  509. \t\tuil_reason_toolkit_names_vec;\n";
  510. FILE *outfil; /* output file */
  511. int ndx; /* loop index */
  512. WmlClassDefPtr clsobj; /* class object */
  513. WmlSynClassDefPtr synobj; /* syntactic object */
  514. WmlClassDefPtr varobj; /* variant (widget) class object */
  515. WmlResourceDefPtr resobj; /* argument/reason object */
  516. WmlSynResourceDefPtr synres; /* arg/reason syntactic object */
  517. WmlResourceDefPtr mapresobj; /* controls map to resource object */
  518. /*
  519. * Open the output file. Write canned header.
  520. */
  521. outfil = fopen ( "UilUrmClas.h", "w");
  522. if ( outfil == (FILE *) NULL )
  523. {
  524. printf ("\nCouldn't open UilUrmClas.h");
  525. return;
  526. }
  527. fprintf (outfil, canned_warn);
  528. /*
  529. * Write entries for widgets
  530. */
  531. fprintf (outfil, canned1);
  532. for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
  533. {
  534. clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
  535. if ( clsobj->sym_code == 0 ) continue;
  536. synobj = clsobj->syndef;
  537. if ( synobj->int_lit != NULL )
  538. fprintf (outfil, " \"%s\",\n", synobj->convfunc);
  539. else
  540. fprintf (outfil, " \"%s\",\t\n", synobj->convfunc);
  541. }
  542. fprintf (outfil, canned2);
  543. /*
  544. * Write entries for gadget variants of widget classes
  545. */
  546. for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
  547. {
  548. clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
  549. if ( clsobj->sym_code == 0 ) continue;
  550. varobj = clsobj->variant;
  551. synobj = clsobj->syndef;
  552. if ( varobj==NULL || synobj->type==WmlClassTypeGadget )
  553. fprintf (outfil, " 0,\n");
  554. else
  555. {
  556. synobj = varobj->syndef;
  557. if ( synobj->int_lit != NULL )
  558. fprintf (outfil, " sym_k_%s_object,\n",
  559. synobj->int_lit);
  560. else
  561. fprintf (outfil, " sym_k_%s_object,\n",
  562. synobj->name);
  563. }
  564. }
  565. fprintf (outfil, canned3);
  566. /*
  567. * Write entries for non-dialog widgets
  568. */
  569. for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
  570. {
  571. clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
  572. if ( clsobj->sym_code == 0 ) continue;
  573. varobj = clsobj->nondialog;
  574. synobj = clsobj->syndef;
  575. if ( varobj == NULL )
  576. fprintf (outfil, " 0,\n");
  577. else
  578. {
  579. synobj = varobj->syndef;
  580. if ( synobj->int_lit != NULL )
  581. fprintf (outfil, " sym_k_%s_object,\n",
  582. synobj->int_lit);
  583. else
  584. fprintf (outfil, " sym_k_%s_object,\n",
  585. synobj->name);
  586. }
  587. }
  588. fprintf (outfil, canned4);
  589. /*
  590. * Write entries for the resource a widget's controls map to
  591. */
  592. for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
  593. {
  594. clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
  595. if ( clsobj->sym_code == 0 ) continue;
  596. synobj = clsobj->syndef;
  597. mapresobj = clsobj->ctrlmapto;
  598. if ( mapresobj == NULL )
  599. fprintf (outfil, " 0,\n");
  600. else
  601. fprintf (outfil, " sym_k_%s_arg,\n", mapresobj->tkname);
  602. }
  603. fprintf (outfil, canned5);
  604. /*
  605. * Write entries for arguments
  606. */
  607. for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
  608. {
  609. resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
  610. synres = resobj->syndef;
  611. if ( resobj->sym_code == 0 ) continue;
  612. fprintf (outfil, " %s,\n",
  613. synres->resliteral);
  614. }
  615. fprintf (outfil, canned6);
  616. /*
  617. * Write entries for reasons
  618. */
  619. for ( ndx=0 ; ndx<wml_obj_reason_ptr->cnt ; ndx++ )
  620. {
  621. resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[ndx].objptr;
  622. synres = resobj->syndef;
  623. if ( resobj->sym_code == 0 ) continue;
  624. fprintf (outfil, " %s,\n",
  625. synres->resliteral);
  626. }
  627. fprintf (outfil, canned7);
  628. /*
  629. * close the output file
  630. */
  631. printf ("\nCreated UilUrmClas.h");
  632. fclose (outfil);
  633. }
  634. /*
  635. * Routine to write out UilConst.h
  636. *
  637. * A bit vector showing which arguments are constraints.
  638. */
  639. void wmlOutputUilConst ()
  640. {
  641. char *canned1 =
  642. "/* Table indexed by argument indicating whether\n\
  643. argument is a constraint (TRUE) or a regular\n\
  644. argument (FALSE). Each entry is one bit.\n\
  645. Index and mask macros are defined to simplify\n\
  646. access to the table\n\
  647. */\n\
  648. \n\
  649. static unsigned char constraint_tab_vec[] = {\n";
  650. char *canned1a =
  651. "};\n\
  652. externaldef(uil_sym_glbl) unsigned char *constraint_tab =\n\
  653. \t\tconstraint_tab_vec;\n";
  654. FILE *outfil; /* output file */
  655. int ndx; /* loop index */
  656. WmlResourceDefPtr resobj; /* resource object */
  657. WmlSynResourceDefPtr synobj; /* syntactic object */
  658. char maskbuf[100]; /* to constuct each mask */
  659. int bitno; /* current bit number, from code */
  660. /*
  661. * Open the output file. Write canned header.
  662. */
  663. outfil = fopen ( "UilConst.h", "w");
  664. if ( outfil == (FILE *) NULL )
  665. {
  666. printf ("\nCouldn't open UilConst.h");
  667. return;
  668. }
  669. fprintf (outfil, canned_warn);
  670. /*
  671. * Process the arguments in code order. We start with 1, and write out
  672. * the mask after processing 8 codes.
  673. */
  674. fprintf (outfil, canned1);
  675. strcpy (maskbuf, "0");
  676. for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
  677. {
  678. resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
  679. synobj = resobj->syndef;
  680. bitno = resobj->sym_code % 8;
  681. if ( bitno == 0 ) bitno = 8;
  682. if ( synobj->type == WmlResourceTypeConstraint )
  683. strcat (maskbuf, bit_masks[bitno]);
  684. if ( bitno == 8 )
  685. {
  686. fprintf (outfil, "%s,\n", maskbuf);
  687. strcpy (maskbuf, "0");
  688. }
  689. }
  690. if ( bitno != 8 )
  691. fprintf (outfil, "%s", maskbuf);
  692. fprintf (outfil, canned1a);
  693. /*
  694. * close the output file
  695. */
  696. printf ("\nCreated UilConst.h");
  697. fclose (outfil);
  698. }
  699. /*
  700. * Routine to write out UilSymReas.h
  701. *
  702. * This file defines the reasons supported by each class. For each
  703. * reason, there is a bit vector with the bit for each supporting class
  704. * turned on if the reason is supported. There is then a vector pointing
  705. * to these bit vectors for all reasons. This vector is accessed by
  706. * sym_k_..._reason to find the reasons bit vector, then by sym_k_..._object
  707. * to check the bit.
  708. */
  709. void wmlOutputUilSymReas ()
  710. {
  711. char *canned1 =
  712. "\n/*\n\
  713. * Bit vectors for each reason. The entries in the vector correspond\n\
  714. * to each class.\n\
  715. */\n";
  716. char *bvechdr =
  717. "\n\
  718. /* sym_k_%s_reason */\n\
  719. static unsigned char reason_class_vec%d[] =\n\
  720. {\n";
  721. char *canned2 =
  722. "\n/*\n\
  723. * Table of bit vectors accessed by sym_k_..._reason\n\
  724. */\n\
  725. static unsigned char *allowed_reason_table_vec[] =\n\
  726. {\n\
  727. NULL,\t/* UNUSED */\n";
  728. char *canned3 =
  729. " };\n\
  730. externaldef(uil_sym_glbl) unsigned char **allowed_reason_table =\n\
  731. \t\tallowed_reason_table_vec;\n";
  732. FILE *outfil; /* output file */
  733. int resndx; /* outer loop index */
  734. WmlResourceDefPtr resobj; /* current reason */
  735. int clsndx; /* inner loop index */
  736. WmlClassDefPtr clsobj; /* current class object */
  737. WmlClassResDefPtr resref; /* class' resource reference */
  738. int itemno; /* item in bye */
  739. char maskbuf[500]; /* current mask buffer */
  740. char itembuf[100]; /* for current item */
  741. int donl; /* TRUE if append \n to mask */
  742. /*
  743. * Open the output file. Write canned header.
  744. */
  745. outfil = fopen ( "UilSymReas.h", "w");
  746. if ( outfil == (FILE *) NULL )
  747. {
  748. printf ("\nCouldn't open UilSymReas.h");
  749. return;
  750. }
  751. fprintf (outfil, canned_warn);
  752. fprintf (outfil, canned1);
  753. /*
  754. * Generate the bit vectors for each class. Outer loop on the reason code,
  755. * inner loop on the class code.
  756. */
  757. for ( resndx=0 ; resndx<wml_obj_reason_ptr->cnt ; resndx++ )
  758. {
  759. resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[resndx].objptr;
  760. fprintf (outfil, bvechdr, resobj->tkname, resobj->sym_code);
  761. /*
  762. * inner loop on widget class.
  763. */
  764. strcpy (maskbuf, " ");
  765. for ( clsndx=0 ; clsndx<wml_obj_class_ptr->cnt ; clsndx++ )
  766. {
  767. clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[clsndx].objptr;
  768. itemno = (clsobj->sym_code+1) % 8;
  769. donl = FALSE;
  770. resref = wmlResolveResIsMember (resobj, clsobj->reasons);
  771. if ( resref != NULL )
  772. if ( resref->exclude != WmlAttributeTrue )
  773. {
  774. sprintf (itembuf, " _BIT_MASK(sym_k_%s_object) |",
  775. clsobj->tkname);
  776. strcat (maskbuf, itembuf);
  777. donl = TRUE;
  778. }
  779. if ( donl )
  780. strcat (maskbuf, "\n ");
  781. if ( itemno == 0 )
  782. {
  783. fprintf (outfil, "%s 0", maskbuf);
  784. strcpy (maskbuf, ",");
  785. }
  786. }
  787. if ( itemno != 0 )
  788. fprintf (outfil, "%s 0};\n", maskbuf);
  789. else
  790. fprintf (outfil, "};\n");
  791. }
  792. /*
  793. * Write the vector of vectors.
  794. */
  795. fprintf (outfil, canned2);
  796. for ( resndx=0 ; resndx<wml_obj_reason_ptr->cnt ; resndx++ )
  797. {
  798. resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[resndx].objptr;
  799. fprintf (outfil, " reason_class_vec%d,\n", resobj->sym_code);
  800. }
  801. fprintf (outfil, canned3);
  802. /*
  803. * close the output file
  804. */
  805. printf ("\nCreated UilSymReas.h");
  806. fclose (outfil);
  807. }
  808. /*
  809. * Routine to write out UilSymArTa.h
  810. *
  811. * This file defines the arguments supported by each class. For each
  812. * argument, there is a bit vector with the bit for each supporting class
  813. * turned on if the argument is supported. There is then a vector pointing
  814. * to these bit vectors for all arguments. This vector is accessed by
  815. * sym_k_..._arg to find the arguments bit vector, then by sym_k_..._object
  816. * to check the bit.
  817. */
  818. void wmlOutputUilSymArTa ()
  819. {
  820. char *canned1 =
  821. "\n/*\n\
  822. * Bit vectors for each argument. The entries in the vector correspond\n\
  823. * to each class.\n\
  824. */\n";
  825. char *bvechdr =
  826. "\n\
  827. /* sym_k_%s_arg */\n\
  828. static unsigned char arg_class_vec%d[] =\n\
  829. {\n";
  830. char *canned2 =
  831. "\n/*\n\
  832. * Table of bit vectors accessed by sym_k_..._arg\n\
  833. */\n\
  834. static unsigned char *allowed_argument_table_vec[] =\n\
  835. {\n\
  836. NULL,\t/* UNUSED */\n";
  837. char *canned3 =
  838. " };\n\
  839. externaldef(uil_sym_glbl) unsigned char **allowed_argument_table =\n\
  840. \t\tallowed_argument_table_vec;\n";
  841. FILE *outfil; /* output file */
  842. int resndx; /* outer loop index */
  843. WmlResourceDefPtr resobj; /* current argument */
  844. int clsndx; /* inner loop index */
  845. WmlClassDefPtr clsobj; /* current class object */
  846. WmlClassResDefPtr resref; /* class' resource reference */
  847. int itemno; /* item in bye */
  848. char maskbuf[500]; /* current mask buffer */
  849. char itembuf[100]; /* for current item */
  850. int donl; /* TRUE if append \n to mask */
  851. /*
  852. * Open the output file. Write canned header.
  853. */
  854. outfil = fopen ( "UilSymArTa.h", "w");
  855. if ( outfil == (FILE *) NULL )
  856. {
  857. printf ("\nCouldn't open UilSymArTa.h");
  858. return;
  859. }
  860. fprintf (outfil, canned_warn);
  861. fprintf (outfil, canned1);
  862. /*
  863. * Generate the bit vectors for each class. Outer loop on the argument code,
  864. * inner loop on the class code.
  865. */
  866. for ( resndx=0 ; resndx<wml_obj_arg_ptr->cnt ; resndx++ )
  867. {
  868. resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[resndx].objptr;
  869. fprintf (outfil, bvechdr, resobj->tkname, resobj->sym_code);
  870. /*
  871. * inner loop on widget class.
  872. */
  873. strcpy (maskbuf, " ");
  874. for ( clsndx=0 ; clsndx<wml_obj_class_ptr->cnt ; clsndx++ )
  875. {
  876. clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[clsndx].objptr;
  877. itemno = (clsobj->sym_code+1) % 8;
  878. donl = FALSE;
  879. resref = wmlResolveResIsMember (resobj, clsobj->arguments);
  880. if ( resref != NULL )
  881. if ( resref->exclude != WmlAttributeTrue )
  882. {
  883. sprintf (itembuf, " _BIT_MASK(sym_k_%s_object) |",
  884. clsobj->tkname);
  885. strcat (maskbuf, itembuf);
  886. donl = TRUE;
  887. }
  888. if ( donl )
  889. strcat (maskbuf, "\n ");
  890. if ( itemno == 0 )
  891. {
  892. fprintf (outfil, "%s 0", maskbuf);
  893. strcpy (maskbuf, ",");
  894. }
  895. }
  896. if ( itemno != 0 )
  897. fprintf (outfil, "%s 0};\n", maskbuf);
  898. else
  899. fprintf (outfil, "};\n");
  900. }
  901. /*
  902. * Write the vector of vectors.
  903. */
  904. fprintf (outfil, canned2);
  905. for ( resndx=0 ; resndx<wml_obj_arg_ptr->cnt ; resndx++ )
  906. {
  907. resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[resndx].objptr;
  908. fprintf (outfil, " arg_class_vec%d,\n", resobj->sym_code);
  909. }
  910. fprintf (outfil, canned3);
  911. /*
  912. * close the output file
  913. */
  914. printf ("\nCreated UilSymArTa.h");
  915. fclose (outfil);
  916. }
  917. /*
  918. * Routine to write out UilSymChTa.h
  919. *
  920. * This file defines the automatic children supported by each class. For each
  921. * child, there is a bit vector with the bit for each supporting class
  922. * turned on if the child is supported. There is then a vector pointing
  923. * to these bit vectors for all children. This vector is accessed by
  924. * sym_k_..._child to find the child's bit vector, then by sym_k_..._object
  925. * to check the bit.
  926. */
  927. void wmlOutputUilSymChTa ()
  928. {
  929. char *canned1 =
  930. "\n/*\n\
  931. * Bit vectors for each child. The entries in the vector correspond\n\
  932. * to each class.\n\
  933. */\n";
  934. char *bvechdr =
  935. "\n\
  936. /* sym_k_%s_child */\n\
  937. static unsigned char child_class_vec%d[] =\n\
  938. {\n";
  939. char *canned2 =
  940. "\n/*\n\
  941. * Table of bit vectors accessed by sym_k_..._child\n\
  942. */\n\
  943. static unsigned char *allowed_child_table_vec[] =\n\
  944. {\n\
  945. NULL,\t/* UNUSED */\n";
  946. char *canned3 =
  947. " };\n\
  948. externaldef(uil_sym_glbl) unsigned char **allowed_child_table =\n\
  949. \t\tallowed_child_table_vec;\n";
  950. FILE *outfil; /* output file */
  951. int childndx; /* outer loop index */
  952. WmlChildDefPtr childobj; /* current argument */
  953. int clsndx; /* inner loop index */
  954. WmlClassDefPtr clsobj; /* current class object */
  955. WmlClassChildDefPtr childref; /* class' child reference */
  956. int itemno; /* item in byte */
  957. char maskbuf[500]; /* current mask buffer */
  958. char itembuf[100]; /* for current item */
  959. int donl; /* TRUE if append \n to mask */
  960. /*
  961. * Open the output file. Write canned header.
  962. */
  963. outfil = fopen ( "UilSymChTa.h", "w");
  964. if ( outfil == (FILE *) NULL )
  965. {
  966. printf ("\nCouldn't open UilSymChTa.h");
  967. return;
  968. }
  969. fprintf (outfil, canned_warn);
  970. fprintf (outfil, canned1);
  971. /*
  972. * Generate the bit vectors for each class. Outer loop on the child code,
  973. * inner loop on the class code.
  974. */
  975. for ( childndx=0 ; childndx<wml_obj_child_ptr->cnt ; childndx++ )
  976. {
  977. childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[childndx].objptr;
  978. fprintf (outfil, bvechdr, childobj->tkname, childobj->sym_code);
  979. /*
  980. * inner loop on widget class.
  981. */
  982. strcpy (maskbuf, " ");
  983. for ( clsndx=0 ; clsndx<wml_obj_class_ptr->cnt ; clsndx++ )
  984. {
  985. clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[clsndx].objptr;
  986. itemno = (clsobj->sym_code+1) % 8;
  987. donl = FALSE;
  988. childref = wmlResolveChildIsMember (childobj, clsobj->children);
  989. if ( childref != NULL )
  990. {
  991. sprintf (itembuf, " _BIT_MASK(sym_k_%s_object) |", clsobj->tkname);
  992. strcat (maskbuf, itembuf);
  993. donl = TRUE;
  994. }
  995. if ( donl )
  996. strcat (maskbuf, "\n ");
  997. if ( itemno == 0 )
  998. {
  999. fprintf (outfil, "%s 0", maskbuf);
  1000. strcpy (maskbuf, ",");
  1001. }
  1002. }
  1003. if ( itemno != 0 )
  1004. fprintf (outfil, "%s 0};\n", maskbuf);
  1005. else
  1006. fprintf (outfil, "};\n");
  1007. }
  1008. /*
  1009. * Write the vector of vectors.
  1010. */
  1011. fprintf (outfil, canned2);
  1012. for ( childndx=0 ; childndx<wml_obj_child_ptr->cnt ; childndx++ )
  1013. {
  1014. childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[childndx].objptr;
  1015. fprintf (outfil, " child_class_vec%d,\n", childobj->sym_code);
  1016. }
  1017. fprintf (outfil, canned3);
  1018. /*
  1019. * close the output file
  1020. */
  1021. printf ("\nCreated UilSymChTa.h");
  1022. fclose (outfil);
  1023. }
  1024. /*
  1025. * Routine to write out UilSymCtl.h
  1026. *
  1027. * This file defines the controls supported by each class. For each
  1028. * object, there is a bit vector with the bit for each supporting class
  1029. * turned on if the object is supported. There is then a vector pointing
  1030. * to these bit vectors for all objects. This vector is accessed by
  1031. * sym_k_..._object to find the objects bit vector, then by sym_k_..._object
  1032. * to check the bit.
  1033. */
  1034. void wmlOutputUilSymCtl ()
  1035. {
  1036. char *canned1 =
  1037. "\n/*\n\
  1038. * Bit vectors for each control. The entries in the vector correspond\n\
  1039. * to each class.\n\
  1040. */\n";
  1041. char *bvechdr =
  1042. "\n\
  1043. /* sym_k_%s_object */\n\
  1044. static unsigned char object_class_vec%d[] =\n\
  1045. {\n";
  1046. char *canned2 =
  1047. "\n/*\n\
  1048. * Table of bit vectors accessed by sym_k_..._object\n\
  1049. */\n\
  1050. static unsigned char *allowed_control_table_vec[] =\n\
  1051. {\n\
  1052. NULL,\t/* UNUSED */\n";
  1053. char *canned3 =
  1054. " };\n\
  1055. externaldef(uil_sym_glbl) unsigned char **allowed_control_table =\n\
  1056. \t\tallowed_control_table_vec;\n";
  1057. FILE *outfil; /* output file */
  1058. int ctlndx; /* outer loop index */
  1059. WmlClassDefPtr ctlobj; /* current class allowing controls */
  1060. int clsndx; /* inner loop index */
  1061. WmlClassDefPtr clsobj; /* current class object */
  1062. int itemno; /* item in bye */
  1063. char maskbuf[500]; /* current mask buffer */
  1064. char itembuf[100]; /* for current item */
  1065. int donl; /* TRUE if append \n to mask */
  1066. /*
  1067. * Open the output file. Write canned header.
  1068. */
  1069. outfil = fopen ( "UilSymCtl.h", "w");
  1070. if ( outfil == (FILE *) NULL )
  1071. {
  1072. printf ("\nCouldn't open UilSymCtl.h");
  1073. return;
  1074. }
  1075. fprintf (outfil, canned_warn);
  1076. fprintf (outfil, canned1);
  1077. /*
  1078. * Generate the bit vectors for each class. Outer loop on the class code,
  1079. * inner loop on the class code.
  1080. */
  1081. for ( ctlndx=0 ; ctlndx<wml_obj_class_ptr->cnt ; ctlndx++ )
  1082. {
  1083. clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ctlndx].objptr;
  1084. fprintf (outfil, bvechdr, clsobj->tkname, clsobj->sym_code);
  1085. /*
  1086. * inner loop on widget class.
  1087. */
  1088. strcpy (maskbuf, " ");
  1089. for ( clsndx=0 ; clsndx<wml_obj_class_ptr->cnt ; clsndx++ )
  1090. {
  1091. ctlobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[clsndx].objptr;
  1092. itemno = (ctlobj->sym_code+1) % 8;
  1093. donl = FALSE;
  1094. if ( wmlResolveCtlIsMember(clsobj,ctlobj->controls) == TRUE)
  1095. {
  1096. sprintf (itembuf, " _BIT_MASK(sym_k_%s_object) |",
  1097. ctlobj->tkname);
  1098. strcat (maskbuf, itembuf);
  1099. donl = TRUE;
  1100. }
  1101. if ( donl )
  1102. strcat (maskbuf, "\n ");
  1103. if ( itemno == 0 )
  1104. {
  1105. fprintf (outfil, "%s 0", maskbuf);
  1106. strcpy (maskbuf, ",");
  1107. }
  1108. }
  1109. if ( itemno != 0 )
  1110. fprintf (outfil, "%s 0};\n", maskbuf);
  1111. else
  1112. fprintf (outfil, "};\n");
  1113. }
  1114. /*
  1115. * Write the vector of vectors.
  1116. */
  1117. fprintf (outfil, canned2);
  1118. for ( ctlndx=0 ; ctlndx<wml_obj_class_ptr->cnt ; ctlndx++ )
  1119. {
  1120. clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ctlndx].objptr;
  1121. fprintf (outfil, " object_class_vec%d,\n", clsobj->sym_code);
  1122. }
  1123. fprintf (outfil, canned3);
  1124. /*
  1125. * close the output file
  1126. */
  1127. printf ("\nCreated UilSymCtl.h");
  1128. fclose (outfil);
  1129. }
  1130. /*
  1131. * Predicate to indicate if a class object is in a controls list.
  1132. */
  1133. int wmlResolveCtlIsMember (ctlobj, ctlref)
  1134. WmlClassDefPtr ctlobj;
  1135. WmlClassCtrlDefPtr ctlref;
  1136. {
  1137. while ( ctlref != NULL )
  1138. {
  1139. if ( ctlref->ctrl == ctlobj ) return TRUE;
  1140. ctlref = ctlref->next;
  1141. }
  1142. return FALSE;
  1143. }
  1144. /*
  1145. * Routine to write out UilSymNam.h
  1146. *
  1147. * Tables of names of object indexed by their various sym_k_ literals.
  1148. */
  1149. void wmlOutputUilSymNam ()
  1150. {
  1151. char *canned1 =
  1152. "/* Define mapping of sym_k_..._object codes to widget names. */\n\
  1153. \n\
  1154. externaldef(uil_sym_glbl) int uil_max_object = %d;\n\
  1155. static char *uil_widget_names_vec[] = {\n\
  1156. \"\",\t/* NOT USED */\n";
  1157. char *canned2 =
  1158. "};\n\
  1159. externaldef(uil_sym_glbl) char **uil_widget_names =\n\
  1160. \t\tuil_widget_names_vec;\n\
  1161. \n\n\
  1162. /* Define mapping of sym_k_..._arg codes to argument names. */\n\
  1163. \n\
  1164. externaldef(uil_sym_glbl) int uil_max_arg = %d;\n\
  1165. static char *uil_argument_names_vec[] = {\n\
  1166. \"\",\t/* NOT USED */\n";
  1167. char *canned3 =
  1168. "};\n\
  1169. externaldef(uil_sym_glbl) char **uil_argument_names =\n\
  1170. \t\tuil_argument_names_vec;\n\
  1171. \n\n\
  1172. /* Define mapping of sym_k_..._reason to reason names. */\n\
  1173. \n\
  1174. externaldef(uil_sym_glbl) int uil_max_reason = %d;\n\
  1175. static char *uil_reason_names_vec[] = {\n\
  1176. \"\",\t/* NOT USED */\n";
  1177. char *canned4 =
  1178. "};\n\
  1179. externaldef(uil_sym_glbl) char **uil_reason_names =\n\
  1180. \t\tuil_reason_names_vec;\n\
  1181. \n\n\
  1182. /* Define mapping of sym_k_..._enumval to enumeration value names. */\n\
  1183. \n\
  1184. externaldef(uil_sym_glbl) int uil_max_enumset = %d;\n\
  1185. externaldef(uil_sym_glbl) int uil_max_enumval = %d;\n\
  1186. static char *uil_enumval_names_vec[] = {\n\
  1187. \"\",\t/* NOT USED */\n";
  1188. char *canned5 =
  1189. "};\n\
  1190. externaldef(uil_sym_glbl) char **uil_enumval_names =\n\
  1191. \t\tuil_enumval_names_vec;\n\
  1192. \n\n\
  1193. /* Define mapping of sym_k_..._charset to enumeration value names. */\n\
  1194. \n\
  1195. externaldef(uil_sym_glbl) int uil_max_charset = %d;\n\
  1196. static char *uil_charset_names_vec[] = {\n\
  1197. \"\",\t/* NOT USED */\n\
  1198. \"<userdefined>\",\n";
  1199. char *canned6 =
  1200. "};\n\
  1201. externaldef(uil_sym_glbl) char **uil_charset_names =\n\
  1202. \t\tuil_charset_names_vec;\n\
  1203. \n\n\
  1204. /* Define mapping of sym_k_..._child codes to child names. */\n\
  1205. \n\
  1206. externaldef(uil_sym_glbl) int uil_max_child = %d;\n\
  1207. static char *uil_child_names_vec[] = {\n\
  1208. \"\",\t/* NOT USED */\n";
  1209. char *canned7 =
  1210. "};\n\
  1211. externaldef(uil_sym_glbl) char **uil_child_names =\n\
  1212. \t\tuil_child_names_vec;\n";
  1213. FILE *outfil; /* output file */
  1214. int ndx; /* loop index */
  1215. WmlClassDefPtr clsobj; /* class object */
  1216. WmlClassDefPtr varobj; /* gadget class object */
  1217. WmlSynClassDefPtr synobj; /* syntactic object */
  1218. WmlResourceDefPtr resobj; /* argument/reason object */
  1219. WmlSynResourceDefPtr synres; /* arg/reason syntactic object */
  1220. WmlEnumValueDefPtr evobj; /* enumeration value object */
  1221. WmlSynEnumValueDefPtr synev; /* enumeration value syntactic obj */
  1222. WmlCharSetDefPtr csobj; /* character set object */
  1223. WmlSynCharSetDefPtr syncs; /* character set syntactic obj */
  1224. WmlChildDefPtr chobj; /* child object */
  1225. WmlSynChildDefPtr synch; /* child syntactic object */
  1226. /*
  1227. * Open the output file. Write canned header.
  1228. */
  1229. outfil = fopen ( "UilSymNam.h", "w");
  1230. if ( outfil == (FILE *) NULL )
  1231. {
  1232. printf ("\nCouldn't open UilSymNam.h");
  1233. return;
  1234. }
  1235. fprintf (outfil, canned_warn);
  1236. /*
  1237. * Write entries for widgets
  1238. */
  1239. fprintf (outfil, canned1, max_object_code);
  1240. for ( ndx=0 ; ndx<wml_obj_class_ptr->cnt ; ndx++ )
  1241. {
  1242. clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr;
  1243. if ( clsobj->sym_code == 0 ) continue;
  1244. synobj = clsobj->syndef;
  1245. fprintf (outfil, " \"%s\",\n",
  1246. synobj->name);
  1247. }
  1248. /*
  1249. * Write entries for arguments
  1250. */
  1251. fprintf (outfil, canned2, max_arg_code);
  1252. for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
  1253. {
  1254. resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
  1255. synres = resobj->syndef;
  1256. if ( resobj->sym_code == 0 ) continue;
  1257. fprintf (outfil, " \"%s\",\n",
  1258. synres->name);
  1259. }
  1260. /*
  1261. * Write entries for reasons
  1262. */
  1263. fprintf (outfil, canned3, max_reason_code);
  1264. for ( ndx=0 ; ndx<wml_obj_reason_ptr->cnt ; ndx++ )
  1265. {
  1266. resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[ndx].objptr;
  1267. synres = resobj->syndef;
  1268. if ( resobj->sym_code == 0 ) continue;
  1269. fprintf (outfil, " \"%s\",\n",
  1270. synres->name);
  1271. }
  1272. /*
  1273. * Write entries for enumeration values
  1274. */
  1275. fprintf (outfil, canned4, max_enumset_code, max_enumval_code);
  1276. for ( ndx=0 ; ndx<wml_obj_enumval_ptr->cnt ; ndx++ )
  1277. {
  1278. evobj = (WmlEnumValueDefPtr) wml_obj_enumval_ptr->hvec[ndx].objptr;
  1279. synev = evobj->syndef;
  1280. if ( evobj->sym_code == 0 ) continue;
  1281. fprintf (outfil, " \"%s\",\n",
  1282. synev->name);
  1283. }
  1284. /*
  1285. * Write entries for character sets
  1286. */
  1287. fprintf (outfil, canned5, max_charset_code);
  1288. for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
  1289. {
  1290. csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
  1291. syncs = csobj->syndef;
  1292. if ( csobj->sym_code == 0 ) continue;
  1293. fprintf (outfil, " \"%s\",\n",
  1294. syncs->name);
  1295. }
  1296. /*
  1297. * Write entries for children
  1298. */
  1299. fprintf (outfil, canned6, max_child_code);
  1300. for ( ndx=0 ; ndx<wml_obj_child_ptr->cnt ; ndx++ )
  1301. {
  1302. chobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[ndx].objptr;
  1303. synch = chobj->syndef;
  1304. if ( chobj->sym_code == 0 ) continue;
  1305. fprintf (outfil, " \"%s\",\n",
  1306. synch->name);
  1307. }
  1308. fprintf (outfil, canned7);
  1309. /*
  1310. * close the output file
  1311. */
  1312. printf ("\nCreated UilSymNam.h");
  1313. fclose (outfil);
  1314. }
  1315. /*
  1316. * Routine to write out UilSymEnum.h
  1317. *
  1318. * This file defines the enumeration sets recognized by UIL. There is an
  1319. * entry in this file for each enumeration set. The definitions are accessed
  1320. * by the sym_k_..._enumset code. Each consists of a structure containing
  1321. * a vector of enumeration value descriptors, each of which is the name
  1322. * of the value and its value.
  1323. *
  1324. * UilSymEnum.h contains:
  1325. * - Vectors of value descriptors for each table entry
  1326. * - The table itself.
  1327. * - A table given the sym_k_..._enumset code for each argument which
  1328. * has an enumeration set.
  1329. * - A table accessed by sym_k_..._enumval code giving the actual value
  1330. * for each enumeration value.
  1331. *
  1332. * The typedefs for the tables are in UilSymGen.h
  1333. */
  1334. void wmlOutputUilSymEnum ()
  1335. {
  1336. char *canned1 =
  1337. "\n\
  1338. /*\n\
  1339. * Enumeration value vectors for each enumeration set\n\
  1340. */\n\
  1341. \n";
  1342. char *valhdr =
  1343. "\n\
  1344. static unsigned short int enum_value_vec%d[] =\n\
  1345. {\n";
  1346. char *canned3 =
  1347. "\n\
  1348. /*\n\
  1349. * Enumeration set descriptor table\n\
  1350. */\n\
  1351. static UilEnumSetDescDef enum_set_table_vec[] =\n\
  1352. {\n\
  1353. {0,NULL},\n";
  1354. char *canned4 =
  1355. " };\n\
  1356. externaldef(uil_sym_glbl) UilEnumSetDescDef *enum_set_table =\n\
  1357. \t\tenum_set_table_vec;\n\
  1358. /*\n\
  1359. * Enumeration set table, accessed by sym_k_..._arg code. Each non-zero entry\n\
  1360. * is the sym_k_..._enumset code for the argument's enumeration set.\n\
  1361. */\n\
  1362. static unsigned short int argument_enumset_table_vec[] =\n\
  1363. {\n\
  1364. 0,\n";
  1365. char *canned5 =
  1366. " };\n\
  1367. externaldef(uil_sym_glbl) unsigned short int *argument_enumset_table =\n\
  1368. \t\targument_enumset_table_vec;\n\
  1369. /*\n\
  1370. * Enumeration value table, accessed by sym_k_..._enumval code. Each entry is\n\
  1371. * the actual value associated with the code.\n\
  1372. */\n\
  1373. static int enumval_values_table_vec[] =\n\
  1374. {\n\
  1375. 0,\n";
  1376. char *canned5a =
  1377. " };\n\
  1378. externaldef(uil_sym_glbl) int *enumval_values_table =\n\
  1379. \t\tenumval_values_table_vec;\n";
  1380. FILE *outfil; /* output file */
  1381. int ndx; /* loop index */
  1382. WmlEnumSetDefPtr enumsetobj; /* enumeration set object */
  1383. WmlEnumSetValDefPtr esvobj; /* current enum set value list element */
  1384. WmlEnumValueDefPtr evobj; /* current enumeration value object */
  1385. WmlResourceDefPtr resobj; /* resource object */
  1386. /*
  1387. * Open the output file. Write the canned header stuff
  1388. */
  1389. outfil = fopen ("UilSymEnum.h", "w");
  1390. if ( outfil == (FILE *) NULL )
  1391. {
  1392. printf ("\nCouldn't open UilSymEnum.h");
  1393. return;
  1394. }
  1395. fprintf (outfil, canned_warn);
  1396. /*
  1397. * Generate the enumeration value vectors for each enumeration set.
  1398. */
  1399. fprintf (outfil, canned1);
  1400. for ( ndx=0 ; ndx<wml_obj_enumset_ptr->cnt ; ndx++ )
  1401. {
  1402. enumsetobj = (WmlEnumSetDefPtr) wml_obj_enumset_ptr->hvec[ndx].objptr;
  1403. fprintf (outfil, valhdr, enumsetobj->sym_code);
  1404. for ( esvobj=enumsetobj->values ; esvobj!=NULL ; esvobj=esvobj->next )
  1405. {
  1406. evobj = esvobj->value;
  1407. fprintf (outfil, " %d,\n",
  1408. evobj->sym_code);
  1409. }
  1410. fprintf (outfil, " };\n");
  1411. }
  1412. /*
  1413. * Generate the enumeration set tables
  1414. */
  1415. fprintf (outfil, canned3);
  1416. for ( ndx=0 ; ndx<wml_obj_enumset_ptr->cnt ; ndx++ )
  1417. {
  1418. enumsetobj = (WmlEnumSetDefPtr) wml_obj_enumset_ptr->hvec[ndx].objptr;
  1419. fprintf (outfil, " {%d,enum_value_vec%d},\n",
  1420. enumsetobj->values_cnt,
  1421. enumsetobj->sym_code);
  1422. }
  1423. /*
  1424. * Create enumset table entries for arguments, similar to writing sym_k...
  1425. */
  1426. fprintf (outfil, canned4);
  1427. for ( ndx=0 ; ndx<wml_obj_arg_ptr->cnt ; ndx++ )
  1428. {
  1429. resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr;
  1430. if ( resobj->enumset_def == NULL )
  1431. fprintf (outfil, " 0,\n");
  1432. else
  1433. fprintf (outfil, " %d,\n",
  1434. resobj->enumset_def->sym_code);
  1435. }
  1436. /*
  1437. * Create the enumval values table.
  1438. */
  1439. fprintf (outfil, canned5);
  1440. for ( ndx=0 ; ndx<wml_obj_enumval_ptr->cnt ; ndx++ )
  1441. {
  1442. evobj = (WmlEnumValueDefPtr) wml_obj_enumval_ptr->hvec[ndx].objptr;
  1443. fprintf (outfil, " %s,\n", evobj->syndef->enumlit);
  1444. }
  1445. fprintf (outfil, canned5a);
  1446. /*
  1447. * close the output file
  1448. */
  1449. printf ("\nCreated UilSymEnum.h");
  1450. fclose (outfil);
  1451. }
  1452. /*
  1453. * Routine to write out UilSymCSet.h
  1454. *
  1455. * This file specifies the various attributes for the character sets
  1456. * recognized by UIL. There is a table for each of the following
  1457. * attributes:
  1458. * - Standards name associated with the character set
  1459. * - Writing direction, from XmSTRING_DIRECTION_...
  1460. * - Parsing direction, from XmSTRING_DIRECTION_...
  1461. * - Bytes per character, from sym_k_..._charsize (in UilSymGen.h)
  1462. * - A pair of tables for recognizing $LANG settings:
  1463. * o a table of all names under which a character set might
  1464. * be legally recognized (upper case).
  1465. * o the sym_k_..._charset code for each entry
  1466. * o a variable giving the number of entries in the table
  1467. *
  1468. * All tables are accessed by the sym_k_..._charset
  1469. *
  1470. */
  1471. void wmlOutputUilSymCSet ()
  1472. {
  1473. char *canned1 =
  1474. "\n\
  1475. /*\n\
  1476. * Character set XmString name table, accessed by sym_k_..._charset code.\n\
  1477. * Each entry is the name which identifies the character set in a XmString.\n\
  1478. */\n\
  1479. static char *charset_xmstring_names_table_vec[] =\n\
  1480. {\n\
  1481. 0,\n\
  1482. \"<userdefined>\",\n";
  1483. char *canned2 =
  1484. "};\n\
  1485. externaldef(uil_sym_glbl) char **charset_xmstring_names_table =\n\
  1486. \t\tcharset_xmstring_names_table_vec;\n\
  1487. /*\n\
  1488. * Character set writing direction table, accessed by sym_k_..._charset code.\n\
  1489. * Each entry is the XmSTRING_DIRECTION_... code which identifies the\n\
  1490. * writing direction for the character set in a XmString.\n\
  1491. */\n\
  1492. static unsigned char charset_wrdirection_table_vec[] =\n\
  1493. {\n\
  1494. 0,\n\
  1495. 0,\t/* userdefined */\n";
  1496. char *canned3 =
  1497. "};\n\
  1498. externaldef(uil_sym_glbl) unsigned char *charset_writing_direction_table =\n\
  1499. \t\tcharset_wrdirection_table_vec;\n\
  1500. /*\n\
  1501. * Character set parsing direction table, accessed by sym_k_..._charset code.\n\
  1502. * Each entry is the XmSTRING_DIRECTION_... code which identifies the\n\
  1503. * parsing direction for the character set in a XmString.\n\
  1504. */\n\
  1505. static unsigned char charset_parsdirection_table_vec[] =\n\
  1506. {\n\
  1507. 0,\n\
  1508. 0,\t/* userdefined */\n";
  1509. char *canned4 =
  1510. "};\n\
  1511. externaldef(uil_sym_glbl) unsigned char *charset_parsing_direction_table =\n\
  1512. \t\tcharset_parsdirection_table_vec;\n\
  1513. /*\n\
  1514. * Character set character size table, accessed by sym_k_..._charset code.\n\
  1515. * Each entry is the sym_k_..._charsize literal which names the character\n\
  1516. * size for the character set in a XmString.\n\
  1517. */\n\
  1518. static unsigned char charset_charsize_table_vec[] =\n\
  1519. {\n\
  1520. 0,\n\
  1521. 0,\t/* userdefined */\n";
  1522. char *canned5 =
  1523. "};\n\
  1524. externaldef(uil_sym_glbl) unsigned char *charset_character_size_table =\n\
  1525. \t\tcharset_charsize_table_vec;\n\
  1526. /*\n\
  1527. * All the names under which a character set may be legally named in a \n\
  1528. * $LANG variable (upper case).\n\
  1529. */\n\
  1530. static char *charset_lang_names_table_vec[] =\n\
  1531. {\n";
  1532. char *canned6 =
  1533. "};\n\
  1534. externaldef(uil_sym_glbl) char **charset_lang_names_table =\n\
  1535. \t\tcharset_lang_names_table_vec;\n\
  1536. /*\n\
  1537. * The sym_k_..._charset codes for charset_lang_names\n\
  1538. */\n\
  1539. static unsigned short int charset_lang_codes_table_vec[] =\n\
  1540. {\n";
  1541. char *canned7 =
  1542. "};\n\
  1543. externaldef(uil_sym_glbl) unsigned short int *charset_lang_codes_table =\n\
  1544. \t\tcharset_lang_codes_table_vec;\n\
  1545. /*\n\
  1546. * The number of entries in charset_lang_..._table tables\n\
  1547. */\n\
  1548. externaldef(uil_sym_glbl) unsigned short int charset_lang_table_max = %d;\n";
  1549. FILE *outfil; /* output file */
  1550. int ndx; /* loop index */
  1551. WmlCharSetDefPtr csobj; /* character set object */
  1552. WmlSynCharSetDefPtr syncs; /* character set syntactic obj */
  1553. int lang_max; /* max value for $LANG tables */
  1554. int alias_ndx; /* alias loop index */
  1555. char uname[200]; /* name converted to upper case */
  1556. /*
  1557. * Open the output file. Write the canned header stuff
  1558. */
  1559. outfil = fopen ("UilSymCSet.h", "w");
  1560. if ( outfil == (FILE *) NULL )
  1561. {
  1562. printf ("\nCouldn't open UilSymCSet.h");
  1563. return;
  1564. }
  1565. fprintf (outfil, canned_warn);
  1566. /*
  1567. * Generate the standards name table
  1568. */
  1569. fprintf (outfil, canned1);
  1570. for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
  1571. {
  1572. csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
  1573. syncs = csobj->syndef;
  1574. if ( csobj->sym_code == 0 ) continue;
  1575. if ((strcmp(syncs->xms_name, "XmFONTLIST_DEFAULT_TAG") == 0) ||
  1576. (strcmp(syncs->xms_name, "_MOTIF_DEFAULT_LOCALE") == 0))
  1577. fprintf (outfil, " %s,\t/* %s */\n",
  1578. syncs->xms_name, syncs->name);
  1579. else
  1580. fprintf (outfil, " \"%s\",\t/* %s */\n",
  1581. syncs->xms_name, syncs->name);
  1582. }
  1583. /*
  1584. * Generate the writing direction table
  1585. */
  1586. fprintf (outfil, canned2);
  1587. for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
  1588. {
  1589. csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
  1590. syncs = csobj->syndef;
  1591. if ( csobj->sym_code == 0 ) continue;
  1592. switch ( syncs->direction )
  1593. {
  1594. case WmlCharSetDirectionLtoR:
  1595. fprintf (outfil, " XmSTRING_DIRECTION_L_TO_R,\t/* %s */\n",
  1596. syncs->name);
  1597. break;
  1598. case WmlCharSetDirectionRtoL:
  1599. fprintf (outfil, " XmSTRING_DIRECTION_R_TO_L,\t/* %s */\n",
  1600. syncs->name);
  1601. break;
  1602. }
  1603. }
  1604. /*
  1605. * Generate the parsing direction table
  1606. */
  1607. fprintf (outfil, canned3);
  1608. for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
  1609. {
  1610. csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
  1611. syncs = csobj->syndef;
  1612. if ( csobj->sym_code == 0 ) continue;
  1613. switch ( syncs->parsedirection )
  1614. {
  1615. case WmlCharSetDirectionLtoR:
  1616. fprintf (outfil, " XmSTRING_DIRECTION_L_TO_R,\t/* %s */\n",
  1617. syncs->name);
  1618. break;
  1619. case WmlCharSetDirectionRtoL:
  1620. fprintf (outfil, " XmSTRING_DIRECTION_R_TO_L,\t/* %s */\n",
  1621. syncs->name);
  1622. break;
  1623. }
  1624. }
  1625. /*
  1626. * Generate the character size table
  1627. */
  1628. fprintf (outfil, canned4);
  1629. for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
  1630. {
  1631. csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
  1632. syncs = csobj->syndef;
  1633. if ( csobj->sym_code == 0 ) continue;
  1634. switch ( syncs->charsize )
  1635. {
  1636. case WmlCharSizeOneByte:
  1637. fprintf (outfil, " sym_k_onebyte_charsize,\t/* %s */\n",
  1638. syncs->name);
  1639. break;
  1640. case WmlCharSizeTwoByte:
  1641. fprintf (outfil, " sym_k_twobyte_charsize,\t/* %s */\n",
  1642. syncs->name);
  1643. break;
  1644. case WmlCharSizeMixed1_2Byte:
  1645. fprintf (outfil, " sym_k_mixed1_2byte_charsize,\t/* %s */\n",
  1646. syncs->name);
  1647. break;
  1648. }
  1649. }
  1650. /*
  1651. * Generate the $LANG name recognition table
  1652. */
  1653. fprintf (outfil, canned5);
  1654. lang_max = 0;
  1655. for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
  1656. {
  1657. csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
  1658. syncs = csobj->syndef;
  1659. if ( csobj->sym_code == 0 ) continue;
  1660. strcpy (uname, syncs->name);
  1661. wmlUpperCaseString (uname);
  1662. fprintf (outfil, " \"%s\",\t/* %s */\n",
  1663. uname, syncs->name);
  1664. lang_max += 1;
  1665. strcpy (uname, syncs->xms_name);
  1666. wmlUpperCaseString (uname);
  1667. fprintf (outfil, " \"%s\",\t/* %s */\n",
  1668. uname, syncs->name);
  1669. lang_max += 1;
  1670. for ( alias_ndx=0 ; alias_ndx<syncs->alias_cnt ; alias_ndx++ )
  1671. {
  1672. strcpy (uname, syncs->alias_list[alias_ndx]);
  1673. wmlUpperCaseString (uname);
  1674. fprintf (outfil, " \"%s\",\t/* %s */\n",
  1675. uname, syncs->name);
  1676. lang_max += 1;
  1677. }
  1678. }
  1679. /*
  1680. * Generate the $LANG code lookup table, in upper case
  1681. */
  1682. fprintf (outfil, canned6);
  1683. for ( ndx=0 ; ndx<wml_obj_charset_ptr->cnt ; ndx++ )
  1684. {
  1685. csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr;
  1686. syncs = csobj->syndef;
  1687. if ( csobj->sym_code == 0 ) continue;
  1688. fprintf (outfil, " sym_k_%s_charset,\n", syncs->name);
  1689. fprintf (outfil, " sym_k_%s_charset,\n", syncs->name);
  1690. for ( alias_ndx=0 ; alias_ndx<syncs->alias_cnt ; alias_ndx++ )
  1691. fprintf (outfil, " sym_k_%s_charset,\n", syncs->name);
  1692. }
  1693. /*
  1694. * Generate the number of entries in the previous two tables
  1695. */
  1696. fprintf (outfil, canned7, lang_max);
  1697. /*
  1698. * close the output file
  1699. */
  1700. printf ("\nCreated UilSymCSet.h");
  1701. fclose (outfil);
  1702. }