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