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