UilSymStor.c 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912
  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[] = "$TOG: UilSymStor.c /main/15 1997/03/12 15:21:44 dbl $"
  36. #endif
  37. #endif
  38. /*
  39. * (c) Copyright 1989, 1990, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */
  40. /*
  41. **++
  42. ** FACILITY:
  43. **
  44. ** User Interface Language Compiler (UIL)
  45. **
  46. ** ABSTRACT:
  47. **
  48. ** This module contains the procedures for managing memory for
  49. ** the compiler.
  50. **
  51. **--
  52. **/
  53. /*
  54. **
  55. ** INCLUDE FILES
  56. **
  57. **/
  58. #include <Xm/Xm.h>
  59. #include <ctype.h>
  60. #include "UilDefI.h"
  61. /*
  62. **
  63. ** DEFINE and MACRO DEFINITIONS
  64. **
  65. **/
  66. /*
  67. **
  68. ** EXTERNAL VARIABLE DECLARATIONS
  69. **
  70. **/
  71. /*
  72. **
  73. ** GLOBAL VARIABLE DECLARATIONS
  74. **
  75. **/
  76. externaldef(uil_comp_glbl) sym_name_entry_type
  77. *sym_az_hash_table[ sym_k_hash_table_limit];
  78. externaldef(uil_comp_glbl) sym_value_entry_type
  79. *sym_az_error_value_entry = NULL;
  80. externaldef(uil_comp_glbl) sym_external_def_entry_type
  81. *sym_az_external_def_chain;
  82. externaldef(uil_comp_glbl) sym_forward_ref_entry_type
  83. *sym_az_forward_ref_chain;
  84. externaldef(uil_comp_glbl) sym_val_forward_ref_entry_type
  85. *sym_az_val_forward_ref_chain;
  86. externaldef(uil_comp_glbl) sym_module_entry_type
  87. *sym_az_module_entry;
  88. externaldef(uil_comp_glbl) sym_root_entry_type
  89. *sym_az_root_entry;
  90. externaldef(uil_comp_glbl) sym_section_entry_type
  91. *sym_az_current_section_entry;
  92. externaldef(uil_comp_glbl) sym_entry_type
  93. *sym_az_entry_list_header;
  94. /*
  95. * These lists save the allocated and freed symbol table nodes.
  96. */
  97. externaldef(uil_comp_glbl) URMPointerListPtr sym_az_allocated_nodes;
  98. externaldef(uil_comp_glbl) URMPointerListPtr sym_az_freed_nodes;
  99. /*
  100. **
  101. ** OWN VARIABLE DECLARATIONS
  102. **
  103. **/
  104. /*
  105. **++
  106. ** FUNCTIONAL DESCRIPTION:
  107. **
  108. ** This routine intializes the compiler's memory allocation system.
  109. **
  110. ** FORMAL PARAMETERS:
  111. **
  112. ** none
  113. **
  114. ** IMPLICIT INPUTS:
  115. **
  116. ** none
  117. **
  118. ** IMPLICIT OUTPUTS:
  119. **
  120. ** sym_az_last_location ptr to last byte avail for allocation
  121. **
  122. ** FUNCTION VALUE:
  123. **
  124. ** void
  125. **
  126. ** SIDE EFFECTS:
  127. **
  128. ** first symbol table buffer is allocated
  129. **
  130. **--
  131. **/
  132. void
  133. sym_initialize_storage(void)
  134. {
  135. int i;
  136. /*
  137. * Initialize the name hash table
  138. */
  139. for (i=0; i<sym_k_hash_table_limit; i++)
  140. sym_az_hash_table[ i ] = NULL;
  141. /*
  142. * Set forward reference, external definition, and symbol table header
  143. * chains to null.
  144. */
  145. sym_az_forward_ref_chain = NULL;
  146. sym_az_val_forward_ref_chain = NULL;
  147. sym_az_external_def_chain = NULL;
  148. sym_az_entry_list_header = NULL;
  149. sym_az_module_entry = NULL;
  150. /*
  151. * Acquire pointer lists to access allocated and freed nodes
  152. */
  153. UrmPlistInit (1000, &sym_az_allocated_nodes);
  154. UrmPlistInit (100, &sym_az_freed_nodes);
  155. /*
  156. * Allocate a value entry for an error value and give it a name. Giving it
  157. * name assures that it is not freed. The name used is one that will not
  158. * conflict with a user name.
  159. */
  160. if ( sym_az_error_value_entry == NULL )
  161. sym_az_error_value_entry = (sym_value_entry_type *)
  162. sem_allocate_node (sym_k_value_entry, sym_k_value_entry_size);
  163. sym_az_error_value_entry->b_type = sym_k_error_value;
  164. sym_az_error_value_entry->obj_header.b_flags =
  165. (sym_m_private | sym_m_builtin);
  166. sym_az_error_value_entry->obj_header.az_name =
  167. sym_insert_name( 9, "#error...");
  168. }
  169. /*
  170. **++
  171. ** FUNCTIONAL DESCRIPTION:
  172. **
  173. ** This routine cleans up the compiler's memory allocation system, and
  174. ** frees all memory used by the symbol table.
  175. **
  176. ** FORMAL PARAMETERS:
  177. **
  178. ** freealloc TRUE if allocated nodes are to be freed.
  179. ** Otherwise, free only freed nodes.
  180. **
  181. ** IMPLICIT INPUTS:
  182. **
  183. ** sym_az_entry_list_header ptr to list of symbol entries
  184. **
  185. ** IMPLICIT OUTPUTS:
  186. **
  187. ** sym_az_entry_list_header ptr to list of symbol entries
  188. **
  189. ** FUNCTION VALUE:
  190. **
  191. ** void
  192. **
  193. ** SIDE EFFECTS:
  194. **
  195. ** all symbol table memory is freed.
  196. **
  197. **--
  198. **/
  199. void
  200. Uil_sym_cleanup_storage (boolean freealloc)
  201. {
  202. if ( freealloc )
  203. if ( sym_az_allocated_nodes != NULL )
  204. UrmPlistFreeContents (sym_az_allocated_nodes);
  205. else
  206. if ( sym_az_freed_nodes != NULL )
  207. UrmPlistFreeContents (sym_az_freed_nodes);
  208. if ( sym_az_allocated_nodes != NULL )
  209. UrmPlistFree (sym_az_allocated_nodes);
  210. if ( sym_az_freed_nodes != NULL )
  211. UrmPlistFree (sym_az_freed_nodes);
  212. }
  213. /*
  214. **++
  215. ** FUNCTIONAL DESCRIPTION:
  216. **
  217. ** This routine adds an object to the external definition chain.
  218. **
  219. ** FORMAL PARAMETERS:
  220. **
  221. ** az_name name of object to be placed on the chain
  222. **
  223. ** IMPLICIT INPUTS:
  224. **
  225. ** sym_az_external_def_chain head of the external definition chain
  226. **
  227. ** IMPLICIT OUTPUTS:
  228. **
  229. ** sym_az_external_def_chain head of the external definition chain
  230. **
  231. ** FUNCTION VALUE:
  232. **
  233. ** void
  234. **
  235. ** SIDE EFFECTS:
  236. **
  237. ** none
  238. **
  239. **--
  240. **/
  241. void
  242. sym_make_external_def( XmConst sym_name_entry_type *az_name )
  243. {
  244. sym_external_def_entry_type *external_entry;
  245. /* allocate an external definition entry */
  246. external_entry = (sym_external_def_entry_type *)
  247. sem_allocate_node (sym_k_external_def_entry,
  248. sym_k_external_def_entry_size);
  249. /* fill in the entry */
  250. external_entry->az_name = (sym_name_entry_type *)az_name;
  251. /* place on the front of the chain */
  252. external_entry->az_next_object = sym_az_external_def_chain;
  253. sym_az_external_def_chain = external_entry;
  254. }
  255. /*
  256. **++
  257. ** FUNCTIONAL DESCRIPTION:
  258. **
  259. ** This routine adds a reference to the forward reference chain.
  260. ** This routine is used for widget and gadget forward references only.
  261. **
  262. **
  263. ** FORMAL PARAMETERS:
  264. **
  265. ** az_id_frame parse stack frame for id being referenced
  266. ** l_widget_type type of object being referenced
  267. ** az_object ptr to the location that needs to be updated
  268. ** when the object is resolved
  269. **
  270. ** IMPLICIT INPUTS:
  271. **
  272. ** sym_az_forward_ref_chain head of the forward reference chain
  273. **
  274. ** IMPLICIT OUTPUTS:
  275. **
  276. ** sym_az_forward_ref_chain head of the forward reference chain
  277. **
  278. ** FUNCTION VALUE:
  279. **
  280. ** void
  281. **
  282. ** SIDE EFFECTS:
  283. **
  284. ** none
  285. **
  286. **--
  287. **/
  288. void
  289. sym_make_forward_ref(XmConst yystype *az_id_frame,
  290. XmConst int l_widget_type,
  291. XmConst char *a_location)
  292. {
  293. sym_forward_ref_entry_type *fwd_ref_entry;
  294. _assert( (az_id_frame->b_tag == sar_k_token_frame) &&
  295. (az_id_frame->value.az_symbol_entry->header.b_tag ==
  296. sym_k_name_entry), "arg1 not an id frame" );
  297. /* allocate an external definition entry */
  298. fwd_ref_entry = (sym_forward_ref_entry_type *)
  299. sem_allocate_node (sym_k_forward_ref_entry,
  300. sym_k_forward_ref_entry_size);
  301. /* fill in the entry */
  302. _sar_save_source_pos (&fwd_ref_entry->header, az_id_frame);
  303. fwd_ref_entry->header.b_type = l_widget_type;
  304. fwd_ref_entry->az_name =
  305. (sym_name_entry_type *) az_id_frame->value.az_symbol_entry;
  306. fwd_ref_entry->a_update_location = (char *)a_location;
  307. /* place on the front of the chain */
  308. fwd_ref_entry->az_next_ref = sym_az_forward_ref_chain;
  309. sym_az_forward_ref_chain = fwd_ref_entry;
  310. }
  311. /*
  312. **++
  313. ** FUNCTIONAL DESCRIPTION:
  314. **
  315. ** This routine adds a reference to the values forward reference chain.
  316. ** This routine is used for value forward references only.
  317. **
  318. **
  319. ** FORMAL PARAMETERS:
  320. **
  321. ** az_id_frame parse stack frame for id being referenced
  322. ** az_object ptr to the location that needs to be updated
  323. ** when the object is resolved
  324. **
  325. ** IMPLICIT INPUTS:
  326. **
  327. ** sym_az_val_forward_ref_chain head of the forward reference chain
  328. **
  329. ** IMPLICIT OUTPUTS:
  330. **
  331. ** sym_az_val_forward_ref_chain head of the forward reference chain
  332. **
  333. ** FUNCTION VALUE:
  334. **
  335. ** void
  336. **
  337. ** SIDE EFFECTS:
  338. **
  339. ** none
  340. **
  341. **--
  342. **/
  343. void
  344. sym_make_value_forward_ref (XmConst yystype *az_value_frame,
  345. XmConst char *a_location,
  346. XmConst unsigned char fwd_ref_flags )
  347. {
  348. sym_val_forward_ref_entry_type *fwd_ref_entry;
  349. /* allocate an external definition entry */
  350. fwd_ref_entry = (sym_val_forward_ref_entry_type *)
  351. sem_allocate_node (sym_k_val_forward_ref_entry,
  352. sym_k_val_forward_ref_entry_size);
  353. /* fill in the entry */
  354. _sar_save_source_pos (&fwd_ref_entry->header, az_value_frame);
  355. switch (fwd_ref_flags)
  356. {
  357. case sym_k_patch_add:
  358. fwd_ref_entry->az_name =
  359. ((sym_value_entry_type *)
  360. az_value_frame->value.az_symbol_entry)->obj_header.az_name;
  361. break;
  362. case sym_k_patch_list_add:
  363. fwd_ref_entry->az_name =
  364. (sym_name_entry_type *)az_value_frame->value.az_symbol_entry;
  365. break;
  366. default:
  367. _assert(FALSE, "Illegal forward reference");
  368. };
  369. fwd_ref_entry->a_update_location = (char *)a_location;
  370. fwd_ref_entry->fwd_ref_flags = fwd_ref_flags;
  371. /* place on the front of the chain */
  372. fwd_ref_entry->az_next_ref = sym_az_val_forward_ref_chain;
  373. sym_az_val_forward_ref_chain = fwd_ref_entry;
  374. }
  375. /*
  376. **++
  377. ** FUNCTIONAL DESCRIPTION:
  378. **
  379. ** This procedure recursively goes through the symbol table, dumping
  380. ** each node accessible from the root node.
  381. **
  382. ** FORMAL PARAMETERS:
  383. **
  384. ** none
  385. **
  386. ** IMPLICIT INPUTS:
  387. **
  388. **
  389. ** IMPLICIT OUTPUTS:
  390. **
  391. ** none
  392. **
  393. ** FUNCTION VALUE:
  394. **
  395. ** void
  396. **
  397. ** SIDE EFFECTS:
  398. **
  399. ** symbol table is dump with the debug output
  400. **
  401. **--
  402. **/
  403. void
  404. UilDumpSymbolTable ( sym_entry_type *node_entry )
  405. {
  406. sym_value_entry_type *val_node;
  407. sym_widget_entry_type *widget_node;
  408. sym_module_entry_type *module_node;
  409. sym_list_entry_type *list_node;
  410. sym_obj_entry_type *list_entry;
  411. sym_root_entry_type *root_node;
  412. sym_include_file_entry_type *ifile_node;
  413. sym_section_entry_type *section_node;
  414. /*
  415. * No action on null node. Else dump and processing is based on the kind
  416. * of the current node.
  417. */
  418. if ( node_entry == NULL ) return;
  419. sym_dump_symbol (node_entry);
  420. switch ( node_entry->header.b_tag )
  421. {
  422. case sym_k_value_entry:
  423. val_node = (sym_value_entry_type *) node_entry;
  424. UilDumpSymbolTable ((sym_entry_type *)val_node->az_charset_value);
  425. UilDumpSymbolTable ((sym_entry_type *)val_node->az_first_table_value);
  426. UilDumpSymbolTable ((sym_entry_type *)val_node->az_next_table_value);
  427. UilDumpSymbolTable ((sym_entry_type *)val_node->az_exp_op1);
  428. UilDumpSymbolTable ((sym_entry_type *)val_node->az_exp_op2);
  429. break;
  430. case sym_k_widget_entry:
  431. case sym_k_gadget_entry:
  432. case sym_k_child_entry:
  433. widget_node = (sym_widget_entry_type *) node_entry;
  434. UilDumpSymbolTable ((sym_entry_type *)widget_node->az_callbacks);
  435. UilDumpSymbolTable ((sym_entry_type *)widget_node->az_arguments);
  436. UilDumpSymbolTable ((sym_entry_type *)widget_node->az_controls);
  437. UilDumpSymbolTable ((sym_entry_type *)widget_node->az_create_proc);
  438. break;
  439. case sym_k_module_entry:
  440. module_node = (sym_module_entry_type *) node_entry;
  441. UilDumpSymbolTable ((sym_entry_type *)module_node->az_version);
  442. UilDumpSymbolTable ((sym_entry_type *)module_node->az_character_set);
  443. UilDumpSymbolTable ((sym_entry_type *)module_node->az_case_sense);
  444. UilDumpSymbolTable ((sym_entry_type *)module_node->az_def_obj);
  445. break;
  446. case sym_k_list_entry:
  447. /*
  448. * Sublists (nested lists) are not processed recursively to
  449. * pick up definitions, since all named lists are picked up
  450. * in their list sections. We assume no list of interest to
  451. * us can possibly be encountered only in a nested list reference.
  452. */
  453. list_node = (sym_list_entry_type *) node_entry;
  454. for (list_entry=(sym_obj_entry_type *)
  455. list_node->obj_header.az_next;
  456. list_entry!=NULL;
  457. list_entry=(sym_obj_entry_type *)
  458. list_entry->obj_header.az_next)
  459. UilDumpSymbolTable ((sym_entry_type *)list_entry);
  460. break;
  461. case sym_k_root_entry:
  462. root_node = (sym_root_entry_type *) node_entry;
  463. UilDumpSymbolTable ((sym_entry_type *)root_node->module_hdr);
  464. UilDumpSymbolTable ((sym_entry_type *)root_node->sections);
  465. break;
  466. case sym_k_include_file_entry:
  467. ifile_node = (sym_include_file_entry_type *) node_entry;
  468. UilDumpSymbolTable ((sym_entry_type *)ifile_node->sections);
  469. break;
  470. case sym_k_section_entry:
  471. section_node = (sym_section_entry_type *) node_entry;
  472. switch ( section_node->header.b_type )
  473. {
  474. case sym_k_section_tail:
  475. break;
  476. default:
  477. UilDumpSymbolTable ((sym_entry_type *)section_node->next);
  478. UilDumpSymbolTable ((sym_entry_type *)section_node->entries);
  479. break;
  480. }
  481. break;
  482. }
  483. }
  484. /*
  485. **++
  486. ** FUNCTIONAL DESCRIPTION:
  487. **
  488. ** This procedure dumps the symbol table.
  489. **
  490. ** FORMAL PARAMETERS:
  491. **
  492. ** none
  493. **
  494. ** IMPLICIT INPUTS:
  495. **
  496. **
  497. ** IMPLICIT OUTPUTS:
  498. **
  499. ** none
  500. **
  501. ** FUNCTION VALUE:
  502. **
  503. ** void
  504. **
  505. ** SIDE EFFECTS:
  506. **
  507. ** symbol table is dump with the debug output
  508. **
  509. **--
  510. **/
  511. void
  512. sym_dump_symbols( void )
  513. {
  514. int ndx;
  515. sym_entry_type *cur_entry;
  516. /*
  517. * Loop over all entries which have been allocated. They are in
  518. * allocation order (this will include deleted entries).
  519. */
  520. _debug_output( "\nSymbol Table Dump: \n\n" );
  521. for ( ndx=0 ; ndx<UrmPlistNum(sym_az_allocated_nodes) ; ndx++ )
  522. {
  523. cur_entry = (sym_entry_type *) UrmPlistPtrN (sym_az_allocated_nodes, ndx);
  524. sym_dump_symbol (cur_entry);
  525. }
  526. _debug_output ("\n\n");
  527. }
  528. /*
  529. **++
  530. ** FUNCTIONAL DESCRIPTION:
  531. **
  532. ** This procedure dumps a symbol node.
  533. **
  534. ** FORMAL PARAMETERS:
  535. **
  536. ** az_symbol_entry symbol node to be dumped
  537. **
  538. ** IMPLICIT INPUTS:
  539. **
  540. **
  541. ** IMPLICIT OUTPUTS:
  542. **
  543. ** none
  544. **
  545. ** FUNCTION VALUE:
  546. **
  547. ** void
  548. **
  549. ** SIDE EFFECTS:
  550. **
  551. ** symbol is dumped to the debug output
  552. **
  553. **--
  554. **/
  555. void
  556. sym_dump_symbol (sym_entry_type *az_symbol_entry)
  557. {
  558. switch (az_symbol_entry->header.b_tag) {
  559. case sym_k_name_entry:
  560. sym_dump_name((sym_name_entry_type *) az_symbol_entry );
  561. break;
  562. case sym_k_module_entry:
  563. sym_dump_module((sym_module_entry_type *) az_symbol_entry );
  564. break;
  565. case sym_k_value_entry:
  566. sym_dump_value((sym_value_entry_type *) az_symbol_entry );
  567. break;
  568. case sym_k_widget_entry:
  569. case sym_k_gadget_entry:
  570. case sym_k_child_entry:
  571. sym_dump_widget((sym_widget_entry_type *) az_symbol_entry );
  572. break;
  573. case sym_k_forward_ref_entry:
  574. sym_dump_forward_ref((sym_forward_ref_entry_type *) az_symbol_entry );
  575. break;
  576. case sym_k_external_def_entry:
  577. sym_dump_external_def((sym_external_def_entry_type *) az_symbol_entry );
  578. break;
  579. case sym_k_proc_def_entry:
  580. sym_dump_proc_def((sym_proc_def_entry_type *) az_symbol_entry );
  581. break;
  582. case sym_k_proc_ref_entry:
  583. sym_dump_proc_ref((sym_proc_ref_entry_type *) az_symbol_entry );
  584. break;
  585. case sym_k_control_entry:
  586. sym_dump_control((sym_control_entry_type *) az_symbol_entry );
  587. break;
  588. case sym_k_argument_entry:
  589. sym_dump_argument((sym_argument_entry_type *) az_symbol_entry );
  590. break;
  591. case sym_k_callback_entry:
  592. sym_dump_callback((sym_callback_entry_type *) az_symbol_entry );
  593. break;
  594. case sym_k_list_entry:
  595. sym_dump_list((sym_list_entry_type *) az_symbol_entry );
  596. break;
  597. case sym_k_color_item_entry:
  598. sym_dump_color_item((sym_color_item_entry_type *) az_symbol_entry );
  599. break;
  600. case sym_k_parent_list_entry:
  601. sym_dump_parent_list_item((sym_parent_list_type *) az_symbol_entry );
  602. break;
  603. case sym_k_include_file_entry:
  604. sym_dump_include_file ((sym_include_file_entry_type *)az_symbol_entry);
  605. break;
  606. case sym_k_section_entry:
  607. sym_dump_section ((sym_section_entry_type *)az_symbol_entry);
  608. break;
  609. case sym_k_def_obj_entry:
  610. sym_dump_object_variant ((sym_def_obj_entry_type *)az_symbol_entry);
  611. break;
  612. case sym_k_root_entry:
  613. sym_dump_root_entry ((sym_root_entry_type *)az_symbol_entry);
  614. break;
  615. default:
  616. {
  617. int *l_array;
  618. int i;
  619. _debug_output("%x unknown type: %d size: %d byte: %x\n",
  620. az_symbol_entry,
  621. az_symbol_entry->header.b_tag,
  622. az_symbol_entry->header.w_node_size,
  623. az_symbol_entry->header.b_type );
  624. l_array = (int *) az_symbol_entry->b_value;
  625. for (i=0; i<(int)(az_symbol_entry->header.w_node_size-1); i++)
  626. _debug_output( "\t%x", l_array[ i ] );
  627. _debug_output("\n");
  628. break;
  629. }
  630. }
  631. sym_dump_source_info(( sym_entry_header_type *)az_symbol_entry);
  632. _debug_output("\n");
  633. }
  634. /*
  635. **++
  636. ** FUNCTIONAL DESCRIPTION:
  637. **
  638. ** This function dumps an object entry in the symbol table
  639. **
  640. ** FORMAL PARAMETERS:
  641. **
  642. ** az_widget_entry pointer to the object
  643. **
  644. ** IMPLICIT INPUTS:
  645. **
  646. ** none
  647. **
  648. ** IMPLICIT OUTPUTS:
  649. **
  650. ** none
  651. **
  652. ** FUNCTION VALUE:
  653. **
  654. ** void
  655. **
  656. ** SIDE EFFECTS:
  657. **
  658. ** symbolic representation of the object appears as part of the
  659. ** debug output
  660. **
  661. **--
  662. **/
  663. void
  664. sym_dump_widget( XmConst sym_widget_entry_type *az_widget_entry )
  665. {
  666. sym_dump_obj_header ((sym_obj_entry_type *)az_widget_entry);
  667. _debug_output (
  668. " %s %s controls: %x callbacks: %x arguments: %x parent_list: %x\n",
  669. diag_object_text( az_widget_entry->header.b_type),
  670. diag_tag_text( az_widget_entry->header.b_tag ),
  671. az_widget_entry->az_controls,
  672. az_widget_entry->az_callbacks,
  673. az_widget_entry->az_arguments,
  674. az_widget_entry->parent_list);
  675. if (az_widget_entry->az_create_proc != NULL) {
  676. _debug_output (" create proc: %x\n",
  677. az_widget_entry->az_create_proc);
  678. }
  679. /* preserve comments */
  680. _debug_output ("\n Comment: %s\n", az_widget_entry->obj_header.az_comment);
  681. }
  682. /*
  683. **++
  684. ** FUNCTIONAL DESCRIPTION:
  685. **
  686. ** This function dumps an argument entry in the symbol table
  687. **
  688. ** FORMAL PARAMETERS:
  689. **
  690. ** az_argument_entry pointer to the argument
  691. **
  692. ** IMPLICIT INPUTS:
  693. **
  694. ** none
  695. **
  696. ** IMPLICIT OUTPUTS:
  697. **
  698. ** none
  699. **
  700. ** FUNCTION VALUE:
  701. **
  702. ** void
  703. **
  704. ** SIDE EFFECTS:
  705. **
  706. ** symbolic representation of the name appears as part of the
  707. ** debug output
  708. **
  709. **--
  710. **/
  711. void
  712. sym_dump_argument( XmConst sym_argument_entry_type *az_argument_entry )
  713. {
  714. sym_dump_obj_header ((sym_obj_entry_type *)az_argument_entry);
  715. _debug_output ( " arg name: %x arg value: %x\n",
  716. az_argument_entry->az_arg_name,
  717. az_argument_entry->az_arg_value );
  718. }
  719. /*
  720. **++
  721. ** FUNCTIONAL DESCRIPTION:
  722. **
  723. ** This function dumps a control entry in the symbol table
  724. **
  725. ** FORMAL PARAMETERS:
  726. **
  727. ** az_control_entry pointer to the control
  728. **
  729. ** IMPLICIT INPUTS:
  730. **
  731. ** none
  732. **
  733. ** IMPLICIT OUTPUTS:
  734. **
  735. ** none
  736. **
  737. ** FUNCTION VALUE:
  738. **
  739. ** void
  740. **
  741. ** SIDE EFFECTS:
  742. **
  743. ** symbolic representation of the name appears as part of the
  744. ** debug output
  745. **
  746. **--
  747. **/
  748. void
  749. sym_dump_control( XmConst sym_control_entry_type *az_control_entry )
  750. {
  751. sym_dump_obj_header ((sym_obj_entry_type *)az_control_entry);
  752. /* These are for control objects only. */
  753. if (az_control_entry->obj_header.b_flags & sym_m_def_in_progress) {
  754. _debug_output (" def in progress");
  755. }
  756. if (az_control_entry->obj_header.b_flags & sym_m_managed) {
  757. _debug_output (" managed");
  758. } else {
  759. _debug_output (" unmanaged");
  760. }
  761. _debug_output ( " obj: %x\n",
  762. az_control_entry->az_con_obj );
  763. }
  764. /*
  765. **++
  766. ** FUNCTIONAL DESCRIPTION:
  767. **
  768. ** This function dumps a callback entry in the symbol table
  769. **
  770. ** FORMAL PARAMETERS:
  771. **
  772. ** az_callback_entry pointer to the callback
  773. **
  774. ** IMPLICIT INPUTS:
  775. **
  776. ** none
  777. **
  778. ** IMPLICIT OUTPUTS:
  779. **
  780. ** none
  781. **
  782. ** FUNCTION VALUE:
  783. **
  784. ** void
  785. **
  786. ** SIDE EFFECTS:
  787. **
  788. ** symbolic representation of the name appears as part of the
  789. ** debug output
  790. **
  791. **--
  792. **/
  793. void
  794. sym_dump_callback( XmConst sym_callback_entry_type *az_callback_entry )
  795. {
  796. sym_dump_obj_header ((sym_obj_entry_type *)az_callback_entry);
  797. _debug_output ( " reason name: %x proc ref: %x proc ref list: %x\n",
  798. az_callback_entry->az_call_reason_name,
  799. az_callback_entry->az_call_proc_ref,
  800. az_callback_entry->az_call_proc_ref_list );
  801. }
  802. /*
  803. **++
  804. ** FUNCTIONAL DESCRIPTION:
  805. **
  806. ** This function dumps a list entry in the symbol table
  807. **
  808. ** FORMAL PARAMETERS:
  809. **
  810. ** az_list_entry pointer to the list
  811. **
  812. ** IMPLICIT INPUTS:
  813. **
  814. ** none
  815. **
  816. ** IMPLICIT OUTPUTS:
  817. **
  818. ** none
  819. **
  820. ** FUNCTION VALUE:
  821. **
  822. ** void
  823. **
  824. ** SIDE EFFECTS:
  825. **
  826. ** symbolic representation of the name appears as part of the
  827. ** debug output
  828. **
  829. **--
  830. **/
  831. void
  832. sym_dump_list( XmConst sym_list_entry_type *az_list_entry )
  833. {
  834. sym_dump_obj_header ((sym_obj_entry_type *)az_list_entry);
  835. _debug_output ( " type: %s count: %d gadget count: %d\n",
  836. diag_tag_text( az_list_entry->header.b_type),
  837. az_list_entry->w_count,
  838. az_list_entry->w_gadget_count );
  839. /* preserve comments */
  840. _debug_output ("\n Comment: %s\n", az_list_entry->obj_header.az_comment);
  841. }
  842. /*
  843. **++
  844. ** FUNCTIONAL DESCRIPTION:
  845. **
  846. ** This function dumps a name entry in the symbol table
  847. **
  848. ** FORMAL PARAMETERS:
  849. **
  850. ** az_name_entry pointer to the name
  851. **
  852. ** IMPLICIT INPUTS:
  853. **
  854. ** none
  855. **
  856. ** IMPLICIT OUTPUTS:
  857. **
  858. ** none
  859. **
  860. ** FUNCTION VALUE:
  861. **
  862. ** void
  863. **
  864. ** SIDE EFFECTS:
  865. **
  866. ** symbolic representation of the name appears as part of the
  867. ** debug output
  868. **
  869. **--
  870. **/
  871. void
  872. sym_dump_name( XmConst sym_name_entry_type *az_name_entry )
  873. {
  874. _debug_output
  875. ( "%x name size: %d next name: %x object: %x",
  876. az_name_entry,
  877. az_name_entry->header.w_node_size,
  878. az_name_entry->az_next_name_entry,
  879. az_name_entry->az_object );
  880. if (az_name_entry->b_flags & sym_m_referenced) {
  881. _debug_output (" referenced");
  882. }
  883. _debug_output
  884. ( " name: %s \n", az_name_entry->c_text );
  885. }
  886. /*
  887. **++
  888. ** FUNCTIONAL DESCRIPTION:
  889. **
  890. ** This function dumps a module entry in the symbol table
  891. **
  892. ** FORMAL PARAMETERS:
  893. **
  894. ** az_module_entry pointer to the module
  895. **
  896. ** IMPLICIT INPUTS:
  897. **
  898. ** none
  899. **
  900. ** IMPLICIT OUTPUTS:
  901. **
  902. ** none
  903. **
  904. ** FUNCTION VALUE:
  905. **
  906. ** void
  907. **
  908. ** SIDE EFFECTS:
  909. **
  910. ** symbolic representation of the module appears as part of the
  911. ** debug output
  912. **
  913. **--
  914. **/
  915. void
  916. sym_dump_module( XmConst sym_module_entry_type *az_module_entry )
  917. {
  918. _debug_output
  919. ( "%x module size: %d name: %x version: %x \n",
  920. az_module_entry,
  921. az_module_entry->header.w_node_size,
  922. az_module_entry->obj_header.az_name,
  923. az_module_entry->az_version );
  924. /* preserve comments */
  925. _debug_output ("\n Comment: %s\n", az_module_entry->obj_header.az_comment);
  926. }
  927. /*
  928. **++
  929. ** FUNCTIONAL DESCRIPTION:
  930. **
  931. ** This function dumps a color item entry in the symbol table
  932. **
  933. ** FORMAL PARAMETERS:
  934. **
  935. ** az_color_item_entry pointer to the color_item
  936. **
  937. ** IMPLICIT INPUTS:
  938. **
  939. ** none
  940. **
  941. ** IMPLICIT OUTPUTS:
  942. **
  943. ** none
  944. **
  945. ** FUNCTION VALUE:
  946. **
  947. ** void
  948. **
  949. ** SIDE EFFECTS:
  950. **
  951. ** symbolic representation of the color item appears as part of the
  952. ** debug output
  953. **
  954. **--
  955. **/
  956. void
  957. sym_dump_color_item( XmConst sym_color_item_entry_type *az_color_item_entry )
  958. {
  959. _debug_output
  960. ( "%x color_item size: %d letter: %c index: %d color: %x next: %x\n",
  961. az_color_item_entry,
  962. az_color_item_entry->header.w_node_size,
  963. az_color_item_entry->b_letter,
  964. az_color_item_entry->b_index,
  965. az_color_item_entry->az_color,
  966. az_color_item_entry->az_next );
  967. }
  968. /*
  969. **++
  970. ** FUNCTIONAL DESCRIPTION:
  971. **
  972. ** This function dumps a parent_list entry in the symbol table
  973. **
  974. ** FORMAL PARAMETERS:
  975. **
  976. ** az_parent_list_item pointer to the parent list entry
  977. **
  978. ** IMPLICIT INPUTS:
  979. **
  980. ** none
  981. **
  982. ** IMPLICIT OUTPUTS:
  983. **
  984. ** none
  985. **
  986. ** FUNCTION VALUE:
  987. **
  988. ** void
  989. **
  990. ** SIDE EFFECTS:
  991. **
  992. ** none
  993. **
  994. **--
  995. **/
  996. void
  997. sym_dump_parent_list_item ( XmConst sym_parent_list_type *az_parent_list_item )
  998. {
  999. _debug_output
  1000. ( "%x parent_list size: %d parent: %x next: %x \n",
  1001. az_parent_list_item,
  1002. az_parent_list_item->header.w_node_size,
  1003. az_parent_list_item->parent,
  1004. az_parent_list_item->next);
  1005. }
  1006. /*
  1007. **++
  1008. ** FUNCTIONAL DESCRIPTION:
  1009. **
  1010. ** This function dumps an external definition entry in the symbol table
  1011. **
  1012. ** FORMAL PARAMETERS:
  1013. **
  1014. ** az_external_def_entry pointer to the external definition
  1015. **
  1016. ** IMPLICIT INPUTS:
  1017. **
  1018. ** none
  1019. **
  1020. ** IMPLICIT OUTPUTS:
  1021. **
  1022. ** none
  1023. **
  1024. ** FUNCTION VALUE:
  1025. **
  1026. ** void
  1027. **
  1028. ** SIDE EFFECTS:
  1029. **
  1030. ** symbolic representation of the name appears as part of the
  1031. ** debug output
  1032. **
  1033. **--
  1034. **/
  1035. void
  1036. sym_dump_external_def(
  1037. XmConst sym_external_def_entry_type *az_external_def_entry)
  1038. {
  1039. _debug_output
  1040. ( "%x external def size: %d next external: %x object: %x \n",
  1041. az_external_def_entry,
  1042. az_external_def_entry->header.w_node_size,
  1043. az_external_def_entry->az_next_object,
  1044. az_external_def_entry->az_name );
  1045. }
  1046. /*
  1047. **++
  1048. ** FUNCTIONAL DESCRIPTION:
  1049. **
  1050. ** This function dumps a procedure definition entry in the symbol table
  1051. **
  1052. ** FORMAL PARAMETERS:
  1053. **
  1054. ** az_proc_def_entry pointer to the procedure definition
  1055. **
  1056. ** IMPLICIT INPUTS:
  1057. **
  1058. ** none
  1059. **
  1060. ** IMPLICIT OUTPUTS:
  1061. **
  1062. ** none
  1063. **
  1064. ** FUNCTION VALUE:
  1065. **
  1066. ** void
  1067. **
  1068. ** SIDE EFFECTS:
  1069. **
  1070. ** symbolic representation of the procedure definition appears as
  1071. ** part of the debug output
  1072. **
  1073. **--
  1074. **/
  1075. void
  1076. sym_dump_proc_def( XmConst sym_proc_def_entry_type *az_proc_def_entry )
  1077. {
  1078. char *private_flag;
  1079. char *imported_flag;
  1080. char *exported_flag;
  1081. char *checking_flag;
  1082. private_flag = "";
  1083. imported_flag = "";
  1084. exported_flag = "";
  1085. checking_flag = " no-check";
  1086. if (az_proc_def_entry->v_arg_checking)
  1087. checking_flag = " check";
  1088. if (az_proc_def_entry->obj_header.b_flags & sym_m_private)
  1089. private_flag = " private";
  1090. if (az_proc_def_entry->obj_header.b_flags & sym_m_exported)
  1091. exported_flag = " exported";
  1092. if (az_proc_def_entry->obj_header.b_flags & sym_m_imported)
  1093. imported_flag = " imported";
  1094. _debug_output
  1095. ( "%x proc def size: %d name: %x %s%s%s%s count: %d %s\n",
  1096. az_proc_def_entry,
  1097. az_proc_def_entry->header.w_node_size,
  1098. az_proc_def_entry->obj_header.az_name,
  1099. checking_flag,
  1100. private_flag,
  1101. exported_flag,
  1102. imported_flag,
  1103. az_proc_def_entry->b_arg_count,
  1104. diag_value_text( az_proc_def_entry->b_arg_type ) );
  1105. /* preserve comments */
  1106. _debug_output ("\nComment: %s\n",az_proc_def_entry->obj_header.az_comment);
  1107. }
  1108. /*
  1109. **++
  1110. ** FUNCTIONAL DESCRIPTION:
  1111. **
  1112. ** This function dumps a procedure reference entry in the symbol table
  1113. **
  1114. ** FORMAL PARAMETERS:
  1115. **
  1116. ** az_proc_ref_entry pointer to the procedure reference entry
  1117. **
  1118. ** IMPLICIT INPUTS:
  1119. **
  1120. ** none
  1121. **
  1122. ** IMPLICIT OUTPUTS:
  1123. **
  1124. ** none
  1125. **
  1126. ** FUNCTION VALUE:
  1127. **
  1128. ** void
  1129. **
  1130. ** SIDE EFFECTS:
  1131. **
  1132. ** symbolic representation of the procedure reference appears as
  1133. ** part of the debug output
  1134. **
  1135. **--
  1136. **/
  1137. void
  1138. sym_dump_proc_ref( XmConst sym_proc_ref_entry_type *az_proc_ref_entry )
  1139. {
  1140. sym_dump_obj_header ((sym_obj_entry_type *)az_proc_ref_entry);
  1141. _debug_output
  1142. ( "%x proc ref size: %d proc def: %x value: %x\n",
  1143. az_proc_ref_entry,
  1144. az_proc_ref_entry->header.w_node_size,
  1145. az_proc_ref_entry->az_proc_def,
  1146. az_proc_ref_entry->az_arg_value );
  1147. }
  1148. /*
  1149. **++
  1150. ** FUNCTIONAL DESCRIPTION:
  1151. **
  1152. ** This function dumps an forward reference entry in the symbol table
  1153. **
  1154. ** FORMAL PARAMETERS:
  1155. **
  1156. ** az_forward_ref_entry pointer to the forward reference
  1157. **
  1158. ** IMPLICIT INPUTS:
  1159. **
  1160. ** none
  1161. **
  1162. ** IMPLICIT OUTPUTS:
  1163. **
  1164. ** none
  1165. **
  1166. ** FUNCTION VALUE:
  1167. **
  1168. ** void
  1169. **
  1170. ** SIDE EFFECTS:
  1171. **
  1172. ** symbolic representation of the name appears as part of the
  1173. ** debug output
  1174. **
  1175. **--
  1176. **/
  1177. void
  1178. sym_dump_forward_ref(XmConst sym_forward_ref_entry_type *az_forward_ref_entry)
  1179. {
  1180. _debug_output
  1181. ( "%x forward ref size: %d next ref: %x location: %x %s parent: %x\n",
  1182. az_forward_ref_entry,
  1183. az_forward_ref_entry->header.w_node_size,
  1184. az_forward_ref_entry->az_next_ref,
  1185. az_forward_ref_entry->a_update_location,
  1186. diag_object_text( az_forward_ref_entry->header.b_type ),
  1187. az_forward_ref_entry->parent );
  1188. _debug_output
  1189. ( " name: %x %s\n",
  1190. az_forward_ref_entry->az_name,
  1191. az_forward_ref_entry->az_name->c_text );
  1192. }
  1193. /*
  1194. **++
  1195. ** FUNCTIONAL DESCRIPTION:
  1196. **
  1197. ** This function dumps a value entry in the symbol table
  1198. **
  1199. ** FORMAL PARAMETERS:
  1200. **
  1201. ** az_value_entry pointer to the value
  1202. **
  1203. ** IMPLICIT INPUTS:
  1204. **
  1205. ** none
  1206. **
  1207. ** IMPLICIT OUTPUTS:
  1208. **
  1209. ** none
  1210. **
  1211. ** FUNCTION VALUE:
  1212. **
  1213. ** void
  1214. **
  1215. ** SIDE EFFECTS:
  1216. **
  1217. ** symbolic representation of the value appears as part of the
  1218. ** debug output
  1219. **
  1220. **--
  1221. **/
  1222. void
  1223. sym_dump_value( XmConst sym_value_entry_type *az_value_entry )
  1224. {
  1225. char *private_flag;
  1226. char *imported_flag;
  1227. char *exported_flag;
  1228. char *builtin_flag;
  1229. char *special_type, *table_type;
  1230. private_flag = "";
  1231. imported_flag = "";
  1232. exported_flag = "";
  1233. builtin_flag = "";
  1234. if (az_value_entry->obj_header.b_flags & sym_m_builtin)
  1235. builtin_flag = " builtin";
  1236. if (az_value_entry->obj_header.b_flags & sym_m_private)
  1237. private_flag = " private";
  1238. if (az_value_entry->obj_header.b_flags & sym_m_exported)
  1239. exported_flag = " exported";
  1240. if (az_value_entry->obj_header.b_flags & sym_m_imported)
  1241. imported_flag = " imported";
  1242. _debug_output
  1243. ( "%x value size: %d name: %x %s%s%s%s",
  1244. az_value_entry,
  1245. az_value_entry->header.w_node_size,
  1246. az_value_entry->obj_header.az_name,
  1247. builtin_flag, private_flag, exported_flag, imported_flag );
  1248. if (az_value_entry->obj_header.b_flags & sym_m_imported)
  1249. {
  1250. _debug_output( " %s \n", diag_value_text( az_value_entry->b_type ));
  1251. return;
  1252. }
  1253. switch (az_value_entry->b_type)
  1254. {
  1255. case sym_k_integer_value:
  1256. case sym_k_horizontal_integer_value:
  1257. case sym_k_vertical_integer_value:
  1258. _debug_output(" integer: %d \n",
  1259. az_value_entry->value.l_integer );
  1260. break;
  1261. case sym_k_bool_value:
  1262. _debug_output(" boolean: %d \n",
  1263. az_value_entry->value.l_integer );
  1264. break;
  1265. case sym_k_float_value:
  1266. case sym_k_horizontal_float_value:
  1267. case sym_k_vertical_float_value:
  1268. _debug_output(" double: %g \n",
  1269. az_value_entry->value.d_real);
  1270. break;
  1271. case sym_k_color_value:
  1272. {
  1273. char *ptr;
  1274. switch (az_value_entry->b_arg_type)
  1275. {
  1276. case sym_k_background_color:
  1277. ptr = "background";
  1278. break;
  1279. case sym_k_foreground_color:
  1280. ptr = "foreground";
  1281. break;
  1282. case sym_k_unspecified_color:
  1283. ptr = "unspecified";
  1284. break;
  1285. default:
  1286. ptr = "illegal";
  1287. }
  1288. _debug_output(" color type: %s", ptr );
  1289. output_text( az_value_entry->w_length,
  1290. az_value_entry->value.c_value);
  1291. break;
  1292. }
  1293. case sym_k_reason_value:
  1294. special_type = "reason";
  1295. goto common_special_type;
  1296. case sym_k_argument_value:
  1297. special_type = "argument";
  1298. common_special_type:
  1299. _debug_output(" %s", special_type );
  1300. if (az_value_entry->obj_header.b_flags & sym_m_builtin)
  1301. _debug_output(" code: %d \n", az_value_entry->value.l_integer );
  1302. else
  1303. output_text( az_value_entry->w_length,
  1304. az_value_entry->value.c_value);
  1305. break;
  1306. case sym_k_compound_string_value:
  1307. _debug_output(" compound string\n first component: %x\n",
  1308. az_value_entry->az_first_table_value );
  1309. if ( (az_value_entry->b_aux_flags & sym_m_table_entry) != 0 ) {
  1310. _debug_output(" next table entry: %x",
  1311. az_value_entry->az_next_table_value);
  1312. }
  1313. break;
  1314. case sym_k_font_value:
  1315. case sym_k_fontset_value:
  1316. if (az_value_entry->b_charset != sym_k_userdefined_charset)
  1317. _debug_output(" font charset: %s",
  1318. diag_charset_text( az_value_entry->b_charset ) );
  1319. else
  1320. _debug_output(" font charset: userdefined(%x)",
  1321. diag_charset_text( (long)az_value_entry->az_charset_value ) );
  1322. goto check_for_table_value;
  1323. case sym_k_char_8_value:
  1324. case sym_k_localized_string_value:
  1325. if (az_value_entry->b_charset != sym_k_userdefined_charset)
  1326. switch ( az_value_entry->b_direction )
  1327. {
  1328. case XmSTRING_DIRECTION_L_TO_R:
  1329. _debug_output
  1330. (" string length: %d\n charset: %s L_TO_R",
  1331. az_value_entry->w_length,
  1332. diag_charset_text(
  1333. az_value_entry->b_charset ));
  1334. break;
  1335. case XmSTRING_DIRECTION_R_TO_L:
  1336. _debug_output
  1337. (" string length: %d\n charset: %s R_TO_L",
  1338. az_value_entry->w_length,
  1339. diag_charset_text(
  1340. az_value_entry->b_charset ));
  1341. break;
  1342. }
  1343. else
  1344. switch ( az_value_entry->b_direction )
  1345. {
  1346. case XmSTRING_DIRECTION_L_TO_R:
  1347. _debug_output
  1348. (" string length: %d\n charset: userdefined(%x) L_TO_R",
  1349. az_value_entry->w_length,
  1350. az_value_entry->az_charset_value);
  1351. break;
  1352. case XmSTRING_DIRECTION_R_TO_L:
  1353. _debug_output
  1354. (" string length: %d\n charset: userdefined(%x) R_TO_L",
  1355. az_value_entry->w_length,
  1356. az_value_entry->az_charset_value);
  1357. break;
  1358. }
  1359. /* See if this is an entry in a table. */
  1360. check_for_table_value:
  1361. if ( (az_value_entry->b_aux_flags & sym_m_table_entry) != 0 ) {
  1362. _debug_output(" next table entry: %x",
  1363. az_value_entry->az_next_table_value);
  1364. }
  1365. output_text
  1366. ( az_value_entry->w_length, az_value_entry->value.c_value );
  1367. break;
  1368. case sym_k_identifier_value:
  1369. _debug_output(" identifier: %s", az_value_entry->value.c_value );
  1370. break;
  1371. case sym_k_icon_value:
  1372. _debug_output(" icon width: %d height: %d colors: %x rows: %x \n",
  1373. az_value_entry->value.z_icon->w_width,
  1374. az_value_entry->value.z_icon->w_height,
  1375. az_value_entry->value.z_icon->az_color_table,
  1376. az_value_entry->value.z_icon->az_rows );
  1377. break;
  1378. case sym_k_string_table_value:
  1379. table_type = "string table";
  1380. goto common_table;
  1381. case sym_k_font_table_value:
  1382. table_type = "font table";
  1383. goto common_table;
  1384. case sym_k_trans_table_value:
  1385. table_type = "translation table";
  1386. common_table:
  1387. _debug_output(" %s first table entry: %x\n",
  1388. table_type, az_value_entry->az_first_table_value);
  1389. break;
  1390. case sym_k_color_table_value:
  1391. {
  1392. int index;
  1393. _debug_output(" color_table count: %d max_index: %d \n",
  1394. az_value_entry->b_table_count,
  1395. az_value_entry->b_max_index );
  1396. for (index = 0; index < (int)az_value_entry->b_table_count; index++)
  1397. {
  1398. _debug_output( " letter: %c index: %d color: %x\n",
  1399. az_value_entry->value.z_color[index].b_letter,
  1400. az_value_entry->value.z_color[index].b_index,
  1401. az_value_entry->value.z_color[index].az_color );
  1402. }
  1403. break;
  1404. }
  1405. case sym_k_error_value:
  1406. _debug_output(" error \n");
  1407. break;
  1408. default:
  1409. _debug_output(" unknown type: %d \n", az_value_entry->b_type );
  1410. }
  1411. /* preserve comments */
  1412. _debug_output ("\nComment: %s\n",az_value_entry->obj_header.az_comment);
  1413. }
  1414. /*
  1415. **++
  1416. ** FUNCTIONAL DESCRIPTION:
  1417. **
  1418. ** This function will output an arbitrarily long amount of text
  1419. ** with the debug output.
  1420. **
  1421. ** FORMAL PARAMETERS:
  1422. **
  1423. ** length length of the text
  1424. ** text pointer to the text
  1425. **
  1426. ** IMPLICIT INPUTS:
  1427. **
  1428. ** none
  1429. **
  1430. ** IMPLICIT OUTPUTS:
  1431. **
  1432. ** none
  1433. **
  1434. ** FUNCTION VALUE:
  1435. **
  1436. ** void
  1437. **
  1438. ** SIDE EFFECTS:
  1439. **
  1440. ** text is placed in the debug output
  1441. **
  1442. **--
  1443. **/
  1444. void
  1445. output_text(XmConst int length, XmConst char *text)
  1446. {
  1447. char c_buffer[ 71 ];
  1448. XmConst char *c_ptr;
  1449. int l_length;
  1450. l_length = length;
  1451. _debug_output( "\n" );
  1452. for (c_ptr = text;
  1453. l_length > 0;
  1454. l_length -= 70,
  1455. c_ptr += 70)
  1456. {
  1457. int last;
  1458. int i;
  1459. last = ( l_length > 70)? 70: l_length;
  1460. _move( c_buffer, c_ptr, last );
  1461. for (i=0; i<last; i++)
  1462. {
  1463. if (iscntrl( c_buffer[ i ] ))
  1464. c_buffer[ i ] = '.';
  1465. }
  1466. c_buffer[ last ] = 0;
  1467. _debug_output( " \"%s\"\n", c_buffer );
  1468. }
  1469. }
  1470. /*
  1471. **++
  1472. ** FUNCTIONAL DESCRIPTION:
  1473. **
  1474. ** This procedure dumps the source information in the header of symbol
  1475. ** entries.
  1476. **
  1477. ** FORMAL PARAMETERS:
  1478. **
  1479. **
  1480. ** IMPLICIT INPUTS:
  1481. **
  1482. **
  1483. ** IMPLICIT OUTPUTS:
  1484. **
  1485. **
  1486. ** SIDE EFFECTS:
  1487. **
  1488. **
  1489. **--
  1490. **/
  1491. void
  1492. sym_dump_source_info (sym_entry_header_type *hdr)
  1493. {
  1494. src_source_record_type *src_rec;
  1495. src_rec = hdr->az_src_rec;
  1496. if (src_rec != NULL)
  1497. _debug_output (" Source position: file %d, line %d, columns %d through %d\n",
  1498. src_rec->b_file_number,
  1499. src_rec->w_line_number,
  1500. hdr->b_src_pos,
  1501. hdr->b_end_pos);
  1502. else
  1503. _debug_output (" Src source record not present.\n");
  1504. }
  1505. /*
  1506. **++
  1507. ** FUNCTIONAL DESCRIPTION:
  1508. **
  1509. ** This procedure dumps the common header of "object" entries.
  1510. **
  1511. ** FORMAL PARAMETERS:
  1512. **
  1513. **
  1514. ** IMPLICIT INPUTS:
  1515. **
  1516. **
  1517. ** IMPLICIT OUTPUTS:
  1518. **
  1519. **
  1520. ** SIDE EFFECTS:
  1521. **
  1522. **
  1523. **--
  1524. **/
  1525. void
  1526. sym_dump_obj_header (XmConst sym_obj_entry_type *az_obj_entry)
  1527. {
  1528. _debug_output
  1529. ( "%x %s size: %d \n",
  1530. az_obj_entry,
  1531. diag_tag_text (az_obj_entry->header.b_tag),
  1532. az_obj_entry->header.w_node_size);
  1533. if (az_obj_entry->obj_header.az_name != NULL) {
  1534. _debug_output (" name: %x", az_obj_entry->obj_header.az_name);
  1535. }
  1536. if (az_obj_entry->obj_header.az_reference != NULL) {
  1537. _debug_output (" reference: %x",
  1538. az_obj_entry->obj_header.az_reference);
  1539. }
  1540. if (az_obj_entry->obj_header.az_next != NULL) {
  1541. _debug_output (" next: %x", az_obj_entry->obj_header.az_next);
  1542. }
  1543. if (az_obj_entry->obj_header.b_flags & sym_m_private) {
  1544. _debug_output (" private");
  1545. }
  1546. if (az_obj_entry->obj_header.b_flags & sym_m_exported) {
  1547. _debug_output (" exported");
  1548. }
  1549. if (az_obj_entry->obj_header.b_flags & sym_m_imported) {
  1550. _debug_output (" imported");
  1551. }
  1552. _debug_output ("\n");
  1553. }
  1554. void
  1555. sym_dump_include_file ( sym_include_file_entry_type *az_symbol_entry )
  1556. {
  1557. _debug_output ("%x include file file name: %s full file name: %s\n",
  1558. az_symbol_entry,
  1559. az_symbol_entry->file_name, az_symbol_entry->full_file_name);
  1560. }
  1561. void
  1562. sym_dump_section ( sym_section_entry_type *az_symbol_entry )
  1563. {
  1564. _debug_output ("%x %s section prev section : %x next section: %x entries: %x\n",
  1565. az_symbol_entry,
  1566. sym_section_text(az_symbol_entry->header.b_type),
  1567. az_symbol_entry->prev_section, az_symbol_entry->next,
  1568. az_symbol_entry->entries);
  1569. }
  1570. void
  1571. sym_dump_object_variant ( sym_def_obj_entry_type * az_symbol_entry )
  1572. {
  1573. _debug_output ("%x default obj var next: %x object info: %d, variant_info: %d\n",
  1574. az_symbol_entry,
  1575. az_symbol_entry->next, az_symbol_entry->b_object_info,
  1576. az_symbol_entry->b_variant_info);
  1577. }
  1578. void
  1579. sym_dump_root_entry ( sym_root_entry_type *az_symbol_entry )
  1580. {
  1581. _debug_output ( "%x root tag: %d module: %x sections: %x\n module tail: ",
  1582. az_symbol_entry,
  1583. az_symbol_entry->header.b_tag,
  1584. az_symbol_entry->module_hdr,
  1585. az_symbol_entry->sections);
  1586. }
  1587. char *
  1588. sym_section_text (int b_type)
  1589. {
  1590. switch (b_type)
  1591. {
  1592. case 0:
  1593. return "";
  1594. case sym_k_list_section:
  1595. return "list";
  1596. case sym_k_procedure_section:
  1597. return "procedure";
  1598. case sym_k_value_section:
  1599. return "value";
  1600. case sym_k_identifier_section:
  1601. return "identifier";
  1602. case sym_k_object_section:
  1603. return "object";
  1604. case sym_k_include_section:
  1605. return "include";
  1606. case sym_k_section_tail:
  1607. return "tail";
  1608. default:
  1609. return "*unknown*";
  1610. }
  1611. }