4 * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
5 * ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for
6 * the full copyright text.
11 /* $XConsortium: UilSymDef.h /main/12 1995/07/14 09:38:52 drk $ */
14 * (c) Copyright 1989, 1990, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */
20 ** User Interface Language Compiler (UIL)
24 ** This include file defines the interface to the UIL symbol table.
38 #include <Mrm/MrmPublic.h>
42 ** constraint check access macro
44 #define _constraint_check(arg) \
45 (constraint_tab[((arg)-1)/8] & (1 << ((arg)-1)%8))
51 /* MOVED TO DBDef.h */
54 ** Symbol tags. These values are used in the tag field of every object header
55 ** to identify the type of the entry.
58 /* MOVED TO DBDef.h */
62 ** Common attribute masks -- These values are used in the b_flags field of
66 /* MOVED TO DBDef.h */
70 ** Output states - order is important
73 /* MOVED TO DBDef.h */
78 ** Constants to define compiler-recognized data types. It is
79 ** important that the names used in .wml language descriptions
80 ** match these names. These values were once automatically generated
81 ** by WML. They are now maintained by hand to reduce compiler
82 ** dependence on WML artifacts.
84 /* MOVED TO DBDef.h */
89 ** Header for each symbol entry
95 /* type of entry The values of this field ia a sym_k_XXX_entry as */
98 /* generic subtype field usage depends on value of b_tag field */
99 /* above (sym_k_value_entry -> b_type is a sym_k_XXX_value as */
100 /* defined in UilSymGen.h, sym_k_list_entry -> b_type is a */
101 /* sym_k_XXX_list as defined below, sym_k_widget_entry -> b_type */
102 /* is a sym_k_XXX_object as defined in UilSymGen.h, */
103 /* sym_k_child_entry -> b_type is a sym_k_XXX_child as defined in */
104 /* UilSymGen.h, sym_k_section_entry -> b_type is a */
105 /* sym_k_XXX_section as defined below). */
107 unsigned short w_node_size;
108 /* size of the node in longwords */
110 /* not used directly by the compiler. It is for use by */
111 /* applications making use of callable UIL only. */
114 ** Fields to save source information about the symbol: We currently save
115 ** five things. The source record where the symbol "begins" (begins is in
116 ** quotes because this may point to just white space before the actual
117 ** symbol), the position (character) within that record where the symbol
118 ** begins, the source record where the symbol ends, the position within
119 ** that record that symbol really begins (i.e. no white space or anything),
120 ** and the position where the symbol definition ends.
123 struct _src_source_record_type *az_src_rec;
124 /* Source record where symbol defined */
125 unsigned char b_src_pos;
126 /* Starting position within the source record */
127 unsigned char b_end_pos;
128 /* Ending position within the source record */
130 } sym_entry_header_type;
135 ** Common view of a symbol entry
140 sym_entry_header_type header;
141 /* common part of all symbol entries. */
143 /* information specific to each different entry type. */
152 /* Flags for name entries */
154 #define sym_m_referenced (1 << 0)
155 /* Used in the b_flags field of a name entry. Set if this name is */
156 /* reference elsewhere in this UIL source module. */
157 #define sym_m_cycle_checked (1 << 1)
158 /* set if the widget entry for this name has been checked for */
159 /* cyclic references. */
160 #define sym_m_has_cycle (2 << 1)
161 /* set if a cycle was detected for a widget entry */
162 #define sym_m_charset (1 << 3)
163 /* set if symbol being used as charset name. */
165 typedef struct _sym_name_entry_type
167 sym_entry_header_type header;
169 sym_entry_type *az_object;
170 /* pointer to the object entry with this name */
171 struct _sym_name_entry_type *az_next_name_entry;
172 /* next name on hash chain */
173 struct _sym_name_entry_type *az_prev_name_entry;
174 /* prev name on hash chain */
176 /* unique id for each cycle check */
177 unsigned char b_flags;
178 /* flags (possible value is sym_m_referenced as declared above) */
180 /* text of the name */
181 } sym_name_entry_type;
184 ** Size of the fixed part of a name entry
187 #define sym_k_name_entry_size (sizeof( sym_name_entry_type)- \
196 ** Types of values are included in UilSymDef.h
200 ** Charsets supported by UIL are defined via WML in UilSymGen.h
206 ** Common header for each "object" entry. This header is shared by all
207 ** widget, gadget, list, argument, callback, and control node types. It
208 ** always appears immediately following the standard entry header field. Also
209 ** defined here is a prototype node for these types of "object" entries.
214 sym_name_entry_type * az_name;
215 /* pointer to the name entry that holds the object name. */
216 sym_entry_type * az_reference;
217 /* pointer to the entry that references this object. */
218 sym_entry_type * az_next;
219 /* pointer to next entry in a list, if this entry is linked under */
222 /* pointer to comment entry associated with this object. */
223 unsigned int b_flags;
225 } sym_obj_header_type;
229 sym_entry_header_type header;
230 /* common entry header */
231 sym_obj_header_type obj_header;
232 /* common object header */
233 } sym_obj_entry_type;
238 ** This structure defines an element in a color table. A color table contains
239 ** an array of such elements.
244 unsigned char b_letter;
245 /* letter for this color */
246 unsigned char b_index;
247 /* index for this color */
248 unsigned short w_desc_offset;
249 /* descriptor offset at in context */
250 struct _sym_value_entry_type *az_color;
251 /* pointer to the value entry for this color */
257 ** This structure defines the data for an icon.
262 unsigned short w_height;
263 /* height in pixels of the icon */
264 unsigned short w_width;
265 /* width in pixels of the icon */
266 struct _sym_value_entry_type *az_color_table;
267 /* pointer to the value entry for the color table */
268 struct _sym_value_entry_type *az_rows;
269 /* pointer to the list of icon rows */
274 ** This structure define an enumeration set entry
277 /* MOVED TO DBDef.h */
281 ** Auxiliary sym_k_flags for values stored in b_aux_flags field
284 #define sym_m_table_entry (1 << 0)
285 /* This item is a component of table */
286 #define sym_m_separate (1 << 2)
287 /* add CDA separator to end of string */
288 #define sym_m_sixteen_bit sym_m_separate
289 /* character set is 16-bit */
290 #define sym_m_exp_eval (1 << 3)
291 /* if set, indicates that expression has already been evaluated */
294 ** Types of colors - stored in b_arg_type
297 #define sym_k_unspecified_color 0
298 #define sym_k_background_color 1
299 /* This color should displayed in the background on a monochrome */
301 #define sym_k_foreground_color 2
302 /* This color should displayed in the foreground on a monochrome */
306 ** value sets defining expression operators
309 /* MOVED TO DBDef.h */
311 typedef struct _sym_value_entry_type
313 sym_entry_header_type header;
315 sym_obj_header_type obj_header;
316 /* common header for objects */
317 unsigned char b_type;
318 /* b_type distinguishes usage. Possible values are sym_k_XXX_value */
319 /* as defined in UilSymGen.h */
320 unsigned short w_length;
321 /* length for variable length types */
323 /* output_state (only byte is needed) */
324 unsigned char b_table_count;
325 /* number of strings in table, colors in a color table, or fonts in */
327 unsigned char b_aux_flags;
328 /* auxiliary flags */
329 unsigned char b_arg_type;
330 /* type of argument value or monochrome treatment of a color */
331 unsigned char b_data_offset;
332 /* offset of bits in context for an icon */
333 unsigned char b_pixel_type;
334 /* pixel size encoding of an icon */
335 unsigned char b_charset;
336 /* character set of a string */
337 unsigned char b_direction;
338 /* writing direction of a string, from XmSTRING_DIRECTION_... */
339 unsigned char b_max_index;
340 /* max index in a color table */
341 unsigned char b_expr_opr;
342 /* operator for an expression value node */
343 unsigned int l_circular_ref_chk;
344 /* field to mark when checking for circular references */
345 unsigned short int b_enumeration_value_code;
346 /* if non-0, the node takes its value from the value of the */
347 /* sym_k_..._enumval code in this field (currently integer) */
348 MrmResource_id resource_id;
350 resource id for private values. */
352 /* Structure for different kinds of nodes pointing to other value nodes */
353 struct _sym_value_entry_type * az_charset_value;
354 /* pointer to value entry describing a userdefined charset. */
355 /* Valid only when b_charset == sym_k_userdefined_charset */
356 struct _sym_value_entry_type * az_next_table_value;
357 /* next element for tables. */
358 struct _sym_value_entry_type *az_first_table_value;
359 /* pointer to first table entry (font, string, etc.) if */
360 /* value is a table. */
361 struct _sym_value_entry_type * az_exp_op1;
362 struct _sym_value_entry_type * az_exp_op2;
363 /* pointer to the one or two value operands of an */
364 /* expression value node. Special operands have an */
365 /* explicitly state semantic. */
367 /* Union for the actual value of a value node */
368 union _sym_value_entry_value_union
370 /* must be capable of holding a pointer, chs */
372 /* value if an integer. */
374 /* value if a double float. */
376 /* value of ASCIZ string */
378 /* value of XmString */
380 /* value if a single float */
381 sym_color_element *z_color;
382 /* value if color table. */
383 sym_icon_element *z_icon;
386 /* pointer to any other kind of allocated data */
388 } sym_value_entry_type;
392 ** Define the fixed size of the value entry structure
395 #define sym_k_value_entry_size (sizeof(sym_value_entry_type))
403 ** The types of lists, values for the header.b_type field of a list entry.
406 #define sym_k_error_list sym_k_error_entry
407 #define sym_k_callback_list sym_k_callback_entry
408 #define sym_k_argument_list sym_k_argument_entry
409 #define sym_k_control_list sym_k_control_entry
410 #define sym_k_proc_ref_list sym_k_proc_ref_entry
412 typedef struct _sym_list_entry_type
414 sym_entry_header_type header;
416 sym_obj_header_type obj_header;
417 /* common header for objects */
418 unsigned short w_count;
419 /* number of elements in the list. */
420 unsigned short w_gadget_count;
421 /* number of gadgets in the list. */
422 } sym_list_entry_type;
425 ** Define the size of the list structure
428 #define sym_k_list_entry_size (sizeof(sym_list_entry_type))
437 ** A nested list entry appears in a list as the entry specifying a reference
438 ** to another list (a nested list reference). It has its b_type field set
439 ** to the list type (necessarily the same type as the list it is contained
440 ** in, and the list it points to). The az_next field locates the next list
441 ** element, as usual. The az_list field points to the list entry for the
442 ** list which is referenced.
445 typedef struct _sym_nested_list_entry_type
447 sym_entry_header_type header;
449 sym_obj_header_type obj_header;
450 /* common header for objects */
451 sym_list_entry_type *az_list;
452 /* pointer to the referenced list */
453 } sym_nested_list_entry_type;
456 ** Define the size of the nested_list structure
459 #define sym_k_nested_list_entry_size (sizeof(sym_nested_list_entry_type))
467 typedef struct _sym_argument_entry_type
469 sym_entry_header_type header;
470 /* common entry header */
471 sym_obj_header_type obj_header;
472 /* common object header */
473 sym_value_entry_type * az_arg_name;
474 /* pointer to the value entry containing the argument name. */
475 sym_value_entry_type * az_arg_value;
476 /* pointer to the value entry containing the argument value. */
477 } sym_argument_entry_type;
479 #define sym_k_argument_entry_size (sizeof(sym_argument_entry_type))
483 ** Procedure Definition Entry
488 sym_entry_header_type header;
490 sym_obj_header_type obj_header;
491 /* common header for objects */
492 unsigned char v_arg_checking;
493 /* should argument type be checked. */
494 unsigned char b_arg_count;
495 /* number of arguments. */
496 unsigned char b_arg_type;
497 /* The type of single argument (tag) for this procedure. It should */
498 /* be a sym_k_XXX_value as defined in UilDBDef.h. */
499 unsigned char b_widget_type;
500 /* If b_arg_type is sym_k_widget_ref_value, then this field should */
501 /* be a sym_k_XXX_object as defined in UilSymGen.h or */
502 /* (uil_max_object + 1) if the type is unspecified. */
503 } sym_proc_def_entry_type;
505 #define sym_k_proc_def_entry_size (sizeof( sym_proc_def_entry_type))
509 ** Procedure Reference Entry
514 sym_entry_header_type header;
516 sym_obj_header_type obj_header;
517 /* common object header. */
518 sym_proc_def_entry_type *az_proc_def;
519 /* pointer to the procedure definition entry for the procedure to */
521 sym_value_entry_type *az_arg_value;
522 /* pointer to the value entry for the argument to be passed as the */
523 /* callback tag to the procedure. */
524 } sym_proc_ref_entry_type;
526 #define sym_k_proc_ref_entry_size (sizeof( sym_proc_ref_entry_type))
530 ** These values are passed from the grammar to the semantic action routines
531 ** (SAR) to identify how the procedure is used.
533 #define sym_k_callback_proc 1
534 /* The procedure was used as a callback routine. */
535 #define sym_k_object_proc 2
536 /* The procedure was used as a creation routine for a user defined */
544 typedef struct _sym_callback_entry_type
546 sym_entry_header_type header;
547 /* common entry header. */
548 sym_obj_header_type obj_header;
549 /* common object header. */
550 sym_value_entry_type * az_call_reason_name;
551 /* pointer to the value entry containing the reason (callback) name */
552 sym_proc_ref_entry_type * az_call_proc_ref;
553 /* pointer to the procedure reference to be invoked for this */
554 /* callback reason. */
555 sym_list_entry_type * az_call_proc_ref_list;
556 /* list entry of procedure references when multiple callbacks are */
557 /* used for the callback. */
558 } sym_callback_entry_type;
560 #define sym_k_callback_entry_size (sizeof(sym_callback_entry_type))
564 ** Parent list for widgets and gadgets
566 ** This list contains pointers to each of the widgets and gadgets that
567 ** reference the current widget in their control list. This information is
568 ** required in order to check constraint arguments.
571 typedef struct _sym_parent_list_type
573 sym_entry_header_type header;
574 /* common entry header */
575 struct _sym_widget_entry_type * parent;
576 /* pointer to a widget entry that references the originating widget */
577 /* in its controls list. */
578 struct _sym_parent_list_type * next;
579 /* pointer to next parent list entry. */
580 } sym_parent_list_type;
582 #define sym_k_parent_list_size (sizeof(sym_parent_list_type))
587 ** Widget entry and Gadget entry
589 ** Gadgets have the same form as a widget. They are distinguished
590 ** simply by the setting of sym_m_obj_is_gadget in obj_header.b_flags .
595 /* widget and gadget node structure. */
597 typedef struct _sym_widget_entry_type
599 sym_entry_header_type header;
600 /* common entry header */
601 sym_obj_header_type obj_header;
602 /* common object header */
603 sym_list_entry_type * az_callbacks;
604 /* pointer to a list entry of type sym_k_callback_list which */
605 /* contains the callbacks for this widget. */
606 sym_list_entry_type * az_arguments;
607 /* pointer to a list entry of type sym_k_argument_list which */
608 /* contains the arguments for this widget. */
609 sym_list_entry_type * az_controls;
610 /* pointer to a list entry of type sym_k_controls_list which */
611 /* contains the widgets that are children (are controlled by) this */
613 sym_proc_ref_entry_type * az_create_proc;
614 /* for user_defined widgets this points to the procedure reference */
615 /* entry that specifies the creation routine for the widget. */
616 sym_parent_list_type * parent_list;
617 /* pointer to a parent list entry that links all objects which */
618 /* reference this object in there controls lists. It is used to */
619 /* traverse through the parents to verify that all contraint */
620 /* arguments specified on this widget are really inherited from one */
621 /* of its parents. */
623 /* Used when generating the UID file. Possible values: */
624 /* sym_k_queued, sym_k_emitted, sym_k_not_processed. (only a byte */
626 MrmResource_id resource_id;
627 /* The resource id if the object is private. This is used when */
628 /* generating the UID file. */
629 } sym_widget_entry_type;
631 #define sym_k_widget_entry_size (sizeof(sym_widget_entry_type))
640 ** Control flags -- These are additional values that may occur in the b_flags
641 ** field for control entries. NOTE: Must not overlap common flags defined
645 #define sym_m_def_in_progress (1 << 6)
646 /* used in all lists. */
647 #define sym_m_managed (1 << 7)
648 /* This bit is set when the controlled object is to be managed. */
649 #define sym_m_obj_is_reference (1 << 8)
650 #define sym_m_forward_ref (1 << 9)
651 /* This bit is set if the item is a forward reference not yet resolved*/
652 #define sym_m_validated (1 << 10)
653 /* Used for widgets to indicate if it has been validated */
656 /* Control node structure. */
658 typedef struct _sym_control_entry_type
660 sym_entry_header_type header;
661 /* common entry header */
662 sym_obj_header_type obj_header;
663 /* common object header */
664 sym_widget_entry_type * az_con_obj;
665 /* pointer to the widget entry that is controlled by this widget. */
666 } sym_control_entry_type;
668 #define sym_k_control_entry_size (sizeof(sym_control_entry_type))
673 ** External Definition Entry
676 typedef struct _sym_external_def_entry_type
678 sym_entry_header_type header;
680 struct _sym_external_def_entry_type *az_next_object;
681 /* pointer next external definition entry. */
682 sym_name_entry_type *az_name;
683 /* pointer to the name entry for the external object. */
684 } sym_external_def_entry_type;
686 #define sym_k_external_def_entry_size (sizeof( sym_external_def_entry_type))
690 ** Forward Reference Entry
693 typedef struct _sym_forward_ref_entry_type
695 sym_entry_header_type header;
696 /* common header. The b_type field holds the object type. */
697 struct _sym_forward_ref_entry_type *az_next_ref;
698 /* pointer to the next forward reference entry. */
699 char *a_update_location;
700 /* address of the longword field in the referencing entry that */
701 /* needs to be updated with the address of the widget entry that */
702 /* this forward reference entry was created for. When this forward */
703 /* reference entry is processed in UilP2Reslv.c, then the widget */
704 /* named in the az_name field will be defined and it can be */
705 /* assigned directly into the a_update_location. */
706 sym_name_entry_type *az_name;
707 /* pointer to the name entry for the widget being referenced before */
708 /* it has been defined. */
709 sym_widget_entry_type *parent;
710 /* pointer to the widget entry of the parent of the forward */
711 /* referenced object. */
712 } sym_forward_ref_entry_type;
714 #define sym_k_forward_ref_entry_size (sizeof( sym_forward_ref_entry_type))
718 ** Forward Reference Entry
721 #define sym_k_patch_add 1
722 #define sym_k_bind_value_name 2
723 #define sym_k_patch_list_add 3
725 typedef struct _sym_val_forward_ref_entry_type
727 sym_entry_header_type header;
728 /* common header. The b_type field holds the expected value type. */
729 struct _sym_val_forward_ref_entry_type *az_next_ref;
730 /* pointer to the next forward reference entry. */
731 char *a_update_location;
732 /* address of the longword field in the referencing entry that */
733 /* needs to be updated with the address of the value entry that */
734 /* this forward reference entry was created for. When this forward */
735 /* reference entry is processed in UilP2Reslv.c, then the value */
736 /* named in the az_name field will be defined and it can be */
737 /* assigned directly into the a_update_location. */
738 sym_name_entry_type *az_name;
739 /* pointer to the name entry for the value being referenced before */
740 /* it has been defined. */
741 unsigned char fwd_ref_flags;
742 /* flags used to indicate how to process entry on forward reference */
744 } sym_val_forward_ref_entry_type;
746 #define sym_k_val_forward_ref_entry_size (sizeof( sym_val_forward_ref_entry_type))
750 ** Default object entry. Pointed to from the module entry. The first one in
751 ** the list contains source information for the "OBJECTS = " text. The 'next'
752 ** field is a pointer to a list which contains the data on the actual clauses.
755 typedef struct _sym_def_obj_entry_type
757 sym_entry_header_type header;
759 struct _sym_def_obj_entry_type *next;
760 /* pointer to next default object entry in the list. */
763 } sym_def_obj_entry_type;
765 #define sym_k_def_obj_entry_size (sizeof( sym_def_obj_entry_type))
770 ** Module entry (only 1 per compilation)
773 typedef struct _sym_module_entry_type
775 sym_entry_header_type header;
777 sym_obj_header_type obj_header;
778 /* common header for objects */
779 sym_value_entry_type *az_version;
780 /* pointer to the value entry containing version string for the */
781 /* module (version clause). */
782 sym_value_entry_type *az_character_set;
783 /* pointer to the value entry containing the default character set */
784 /* information for the module (character set clause). */
785 sym_value_entry_type *az_case_sense;
786 /* pointer to the value entry containing the value of the module */
787 /* case sensitivity clause. */
788 sym_def_obj_entry_type *az_def_obj;
789 /* pointer to the default object type specified in the module */
790 /* default object variant clause. */
791 } sym_module_entry_type;
793 #define sym_k_module_entry_size (sizeof( sym_module_entry_type))
801 ** Posiblilities for header.b_type when header.b_tag is sym_k_section_entry.
804 #define sym_k_list_section 1
806 #define sym_k_procedure_section 2
807 /* procedure section */
808 #define sym_k_value_section 3
810 #define sym_k_identifier_section 4
811 /* identifier section */
812 #define sym_k_object_section 5
813 /* widget/gadget section */
814 #define sym_k_include_section 6
815 /* include directive */
816 #define sym_k_section_tail 7
817 /* This section has no corresponding UIL construct and exists only */
818 /* to aid in saving source information */
822 typedef struct _sym_section_entry_type
824 sym_entry_header_type header;
826 struct _sym_section_entry_type *prev_section;
827 /* previous section "LIST". */
828 sym_entry_type *next;
829 /* pointer to the entry for the next section _OR_ next child. */
830 sym_entry_type *entries;
831 /* points to entries in the section _OR_ the entry in the symbol */
832 /* table for this child. */
833 } sym_section_entry_type;
835 #define sym_k_section_entry_size (sizeof (sym_section_entry_type))
839 ** Include file entry
842 typedef struct _sym_include_file_entry_type
844 sym_entry_header_type header;
846 sym_section_entry_type *sections;
847 /* pointer to a section list; this list is all of the sections that */
848 /* exist in this include file. */
850 /* the file name as specified in the include statement in the UIL */
852 char full_file_name[255];
853 /* the expanded name for the include file actually opened. */
854 } sym_include_file_entry_type;
856 #define sym_k_include_file_entry_size (sizeof( sym_include_file_entry_type))
860 ** Symbol table root entry (root of symbol table tree)
863 typedef struct _sym_root_entry_type
865 sym_entry_header_type header;
867 struct _src_source_record_type *src_record_list;
868 /* pointer to a list of source records. */
870 /* the main UIL file name as specified on the command line. */
871 char full_file_name[255];
872 /* the expanded name for the main UIL file that was actually */
874 sym_section_entry_type *sections;
875 /* pointer to section list entry. */
876 sym_module_entry_type *module_hdr;
877 /* pointer to module header entry. */
879 } sym_root_entry_type;
881 #define sym_k_root_entry_size (sizeof( sym_root_entry_type))
888 typedef struct _sym_color_item_entry_type
890 sym_entry_header_type header;
892 struct _sym_color_item_entry_type *az_next;
894 unsigned char b_letter;
895 /* letter used for color */
896 unsigned char b_index;
897 /* color table index */
898 unsigned char b_spare1;
899 sym_value_entry_type *az_color;
900 /* name or value entry for the color. */
902 } sym_color_item_entry_type;
904 #define sym_k_color_item_entry_size (sizeof( sym_color_item_entry_type))
909 ** This macro copies the contents of one entry to another without disturbing
910 ** the the linked list of entries used to connect all symbol table entries.
912 #define _sym_copy_entry(__dest, __src, __size) _move (__dest, __src, __size)
915 #endif /* UilSymDef_h */
916 /* DON'T ADD STUFF AFTER THIS #endif */