Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / osf / wml / UilDBDef.h
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 /*   $XConsortium: UilDBDef.h /main/8 1995/07/13 21:03:16 drk $ */
34
35 /*
36 *  (c) Copyright 1989, 1990, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */
37
38 /*
39 **++
40 **  FACILITY:
41 **
42 **      User Interface Language Compiler (UIL)
43 **
44 **  ABSTRACT:
45 **
46 **      This include file defines the interfaces necessry to the binary 
47 **      data base in the WML & UIL compilers.
48 **
49 **--
50 **/
51
52 #ifndef UilDBDef_h
53 #define UilDBDef_h
54
55 /***********************************************************************
56 ****************** From UilDef.h ***************************************/
57 #define _BIT_INDEX(_type)       \
58             (((unsigned int) (_type)) >> 3)
59
60 #define _BIT_MASK(_type)        \
61   (1 << (((unsigned int) (_type)) & 0x7))
62
63 #define _BIT_SET(table_entry_addr, _type) \
64   ( _BIT_MASK (_type) &  \
65     ( ((unsigned char *) (table_entry_addr)) \
66       [ _BIT_INDEX (_type) ] ) )
67
68 /*******************************************************************
69 **************** From UilSymDef.h *********************************/
70 /*
71 **  Hash table size
72 */
73
74 #define sym_k_hash_table_limit  127
75
76 /* 
77 **  Symbol tags.  These values are used in the tag field of every object header
78 **  to identify the type of the entry.
79 */
80
81 #define sym_k_error_entry               (127)
82     /*  An error entry is used when compilation errors are detected in the  */
83     /*  source program.  Its use reduces cascading errors caused by missing */
84     /*  information and allows the compilation to continue and thus         */
85     /*  additional errors may be detected                                   */
86 #define sym_k_value_entry               1
87     /*  A value entry contains information about a UIL literal value        */
88     /*  (integer, string, compound string, xbitmapfile, argument, color,    */
89     /*  icon, etc.).  The b_type field is used to determine the datatype of */
90     /*  this value.                                                         */
91 #define sym_k_name_entry                2
92     /*  A name entry corresponds to a name (identifier) used in the UIL     */
93     /*  source.                                                             */
94 #define sym_k_widget_entry              3
95     /*  A widget entry represents a widget declaration.  It points off to   */
96     /*  the arguments, callbacks, and controls lists for the widget.        */
97 #define sym_k_control_entry             4
98     /*  A control entry hangs off a list entry and identifes an object      */
99     /*  (widget or gadget) that is controlled.  It also contains the        */
100     /*  managed/unmanaged information.                                      */
101 #define sym_k_forward_ref_entry         5
102     /*  forward reference entries are a linked listed of objects            */
103     /*  (widgets/gadgets) that were not defined at the time of the          */
104     /*  reference.  After all objects have been seen, then this list is     */
105     /*  traversed and all objects in it should now be defined and the       */
106     /*  specified pointers can be filled-in.                                */
107 #define sym_k_external_def_entry        6
108     /*  An external definition entry identifies a name that has been        */
109     /*  imported and thus in not declared within this source module.        */
110 #define sym_k_argument_entry            7
111     /*  An argument entry hangs off a list entry and identifies an object   */
112     /*  argument.  It contains informtation about the argument name and     */
113     /*  argument value.                                                     */
114 #define sym_k_callback_entry            8
115     /*  An calllback entry hangs off a list entry and identifies an object  */
116     /*  callback.  It contains informtation about the callback name,        */
117     /*  callback procedure, and callback tag.                               */
118 #define sym_k_module_entry              9
119     /*  A module entry contains information specified on the module         */
120     /*  statement.                                                          */
121 #define sym_k_proc_def_entry            10
122     /*  A procedure definition entry is created for each procedure listed   */
123     /*  in a procedure section.  I contains informaion on the number and    */
124     /*  types of the arguments.                                             */
125
126 #define sym_k_proc_ref_entry            11
127     /*  A procedure reference entry contains information about a the use of */
128     /*  a procedure (e.g. as a callback).  It also stores the tag to be     */
129     /*  passed to the procedure.                                            */
130 #define sym_k_list_entry                12
131     /*  A list entry is a typed list of other symbol table entries. It      */
132     /*  contains a count and a pointer to the next entry on the list via    */
133     /*  the obj_header.az_next field.                                       */
134 #define sym_k_child_entry               13
135     /*  A child entry represents a declaration for an                       */
136     /*  automatically created child.  It points off to                      */
137     /*  the arguments, callbacks, and controls lists for the child. Since   */
138     /*  the structures for widget and child are the same, the               */
139     /*  datastructure for children is really a sym_k_widget_entry_type.     */
140 #define sym_k_identifier_entry          14
141     /*  identifier entry tag is used for diagnostic messages only           */
142 #define sym_k_color_item_entry          15
143     /*  entry describing a color.                                           */
144 #define sym_k_gadget_entry              16
145     /*  A gadget entry represents a gadget declaration.  It points off to   */
146     /*  the arguments, callbacks, and controls lists for the gadget. Since  */
147     /*  the structures for widget and gadgets are the same, the             */
148     /*  datastructure for gadgets is really a sym_k_widget_entry_type.      */
149 #define sym_k_root_entry                17
150     /*  An entry used to group all the other entries together.  It is       */
151     /*  returned in the parse_tree_root field of the compilation descriptor */
152     /*  when using the callable interface.                                  */
153 #define sym_k_parent_list_entry         18
154     /*  This is a list of parents of a widget.  It is used to check for     */
155     /*  constraints provided by the parent that may be used on this widget. */
156 #define sym_k_nested_list_entry         19
157     /*  This entry occurs as a list entry for a nested list. It occupies    */
158     /*  the correct position in the list for the reference to a list, and   */
159     /*  points to the actual list entry.                                    */
160 #define sym_k_include_file_entry        20
161     /*  An include file entry is used to describe the contents of an        */
162     /*  include file.  It is needed only maintain information about the     */
163     /*  source file from which this parse tree was generated.  It is not    */
164     /*  used by UIL directly.                                               */
165 #define sym_k_section_entry             21
166     /*  A section entry is used to describe the contents of an source file. */
167     /*  It is needed only maintain information about the structure of       */
168     /*  source file from which this parse tree was generated.  It is not    */
169     /*  used by UIL directly.                                               */
170     /*                                                                      */
171 #define sym_k_def_obj_entry             22
172     /*  This entry corresponds to the default object clause on the module   */
173     /*  declaration it is used to store source information about the file   */
174     /*  from which this parse tree was generated.   It is not used by UIL   */
175     /*  directly.                                                           */
176 #define sym_k_UNUSED23_entry            23
177 #define sym_k_val_forward_ref_entry     24
178     /*  val forward reference entries are a linked listed of values         */
179     /*  that were not defined at the time of the                            */
180     /*  reference.  After all values have been seen, then this list is      */
181     /*  traversed and all values in it should now be defined and the        */
182     /*  specified pointers can be filled-in.                                */
183 #define sym_k_max_entry                 24
184     /*  this is the largest possible value for an entry constant.           */
185
186
187 /*
188 **    Common attribute masks -- These values are used in the b_flags field of
189 **    the object_header.
190 */
191
192 #define         sym_m_private           (1 << 0)
193     /*  This item is private to this source module and thus need not be     */
194     /*  output into the UID file.                                           */
195 #define         sym_m_exported          (1 << 1)
196     /*  This is an exported definition and must be put in the UID file.     */
197 #define         sym_m_imported          (1 << 2)
198     /*  This item is a reference external to this source module and thus    */
199     /*  will be resolved at runtime by searching the resourec hierarchy.    */
200 #define         sym_m_reference         (1 << 3)
201 #define         sym_m_builtin           (1 << 4)
202     /*  This item is builtin as oppose to a userdefined item.               */
203 #define         sym_m_obj_is_gadget     (1 << 5)
204     /*  This object is a gadget as oppose to a widget.                      */
205
206
207 /*
208 **      Output states - order is important
209 */
210
211 #define         sym_k_not_processed     0
212 #define         sym_k_queued            1
213 #define         sym_k_emitted           2
214
215
216 \f
217 /*
218 **      Constants to define compiler-recognized data types. It is
219 **      important that the names used in .wml language descriptions
220 **      match these names. These values were once automatically generated
221 **      by WML. They are now maintained by hand to reduce compiler
222 **      dependence on WML artifacts.
223 **
224 **      We have also separated the values loosely into two classes:
225 **      values which can be used to verify operator legality and values
226 **      which cannot (see UilSemVal.c -- the legal_operand_type table).
227 **      There is a comment below denoting where the separation is. Any
228 **      values above the comment may be used for validation of an operator
229 **      while any values below may not.
230 **
231 **      The order of the values below is unimportant except that the
232 **      entries in the uil_datatype_names table in UilData.c must be
233 **      ordered the same way.
234 */
235 #define sym_k_any_value                 1
236 #define sym_k_bool_value                2
237 #define sym_k_char_8_value              3
238 #define sym_k_compound_string_value     4 
239 #define sym_k_float_value               5
240 #define sym_k_integer_value             6 
241 #define sym_k_single_float_value        7
242 #define sym_k_localized_string_value    8
243 #define sym_k_wchar_string_value        9
244 #define sym_k_horizontal_integer_value  10
245 #define sym_k_vertical_integer_value    11
246 #define sym_k_horizontal_float_value    12
247 #define sym_k_vertical_float_value      13
248 /* Values after here may not be used for operator argument validation */
249 #define sym_k_argument_value            14
250 #define sym_k_asciz_table_value         15
251 #define sym_k_class_rec_name_value      16
252 #define sym_k_color_value               17
253 #define sym_k_color_table_value         18
254 #define sym_k_font_value                19
255 #define sym_k_font_table_value          20
256 #define sym_k_icon_value                21
257 #define sym_k_identifier_value          22
258 #define sym_k_integer_table_value       23
259 #define sym_k_keysym_value              24
260 #define sym_k_pixmap_value              25
261 #define sym_k_reason_value              26
262 #define sym_k_rgb_value                 27
263 #define sym_k_string_table_value        28
264 #define sym_k_trans_table_value         29
265 #define sym_k_widget_ref_value          30
266 #define sym_k_xbitmapfile_value         31
267 #define sym_k_fontset_value             32
268 #define sym_k_child_value               33
269 #define sym_k_max_value                 33
270 #define sym_k_no_value                  (sym_k_max_value+1)
271
272 /*
273  * Error values for all kind of sym_k_... literal set
274  */
275 #define sym_k_error_value               0
276 #define sym_k_error_object              0
277 #define sym_k_error_charset             0
278
279
280 /*
281  * Literals associated with character sets
282  *
283  * Character set character sizes
284  */
285 #define sym_k_onebyte_charsize  1
286 #define sym_k_twobyte_charsize  2
287 #define sym_k_mixed1_2byte_charsize     3
288
289 /*
290  * User-defined character set
291  */
292 #define sym_k_userdefined_charset       1
293
294 /*
295  * XmFONTLIST_DEFAULT_TAG 
296  */
297 #define sym_k_fontlist_default_tag      0
298
299 /*
300 **      value sets defining expression operators
301 */
302 #define sym_k_unspecified_op    0
303 #define sym_k_not_op            1 
304 #define sym_k_unary_plus_op     2
305 #define sym_k_unary_minus_op    3
306 #define sym_k_comp_str_op       4
307 #define sym_k_wchar_str_op      5
308 #define sym_k_last_unary_op     5
309
310 #define sym_k_multiply_op       6
311 #define sym_k_divide_op         7
312 #define sym_k_add_op            8
313 #define sym_k_subtract_op       9
314 #define sym_k_left_shift_op     10 
315 #define sym_k_right_shift_op    11
316 #define sym_k_and_op            12
317 #define sym_k_xor_op            13
318 #define sym_k_or_op             14
319 #define sym_k_cat_op            15
320 #define sym_k_last_binary_op    15
321 #define sym_k_valref_op         16      /* az_exp_op1 points to the value node
322                                            whose value is referenced by this
323                                            value node. */
324 #define sym_k_coerce_op         17      /* az_exp_op1 points to the value node
325                                            whose value is to be coerced to the
326                                            data type of this node. */
327 #define sym_k_last_special_op   17
328
329 /*
330  * Structure of an enumeration set entry
331  */
332 typedef struct
333     {
334     short int           values_cnt;
335         /* number of values in the enuemration set descriptor           */
336     unsigned short int  *values;
337         /* vector of values                                             */
338     } UilEnumSetDescDef, *UilEnumSetDescDefPtr;
339
340
341
342 /**********************************************************************
343 **************** From UilKeyDef.h ************************************/
344 /*
345  *    Token class literals
346  */
347 #define tkn_k_class_argument    1
348 #define tkn_k_class_charset     2
349 #define tkn_k_class_color       3
350 #define tkn_k_class_enumval     4
351 #define tkn_k_class_font        5
352 #define tkn_k_class_identifier  6
353 #define tkn_k_class_keyword     7
354 #define tkn_k_class_literal     8
355 #define tkn_k_class_reason      9
356 #define tkn_k_class_reserved    10
357 #define tkn_k_class_special     11
358 #define tkn_k_class_unused      12
359 #define tkn_k_class_class       13
360 #define tkn_k_class_child       14
361
362 /*
363  * Keyword table entry structure
364  */
365 typedef struct 
366     {
367     unsigned char         b_class;
368     unsigned short int    b_subclass;
369     unsigned char         b_length;
370     unsigned char         b_token;
371     char                  *at_name;
372     }  key_keytable_entry_type;
373
374
375
376 /*************************************************************************
377 ************************ New Stuff **************************************/
378
379 /* For COMPOUND_STRING_COMPONENT */
380 #define XmStringComponent "XmStringComponent"
381
382 /*
383  * Names of the tables put in the binary database
384 */
385
386 #define Constraint_Tab 1
387 #define Key_Table 2
388 #define Key_Table_Case_Ins 3
389 #define Allowed_Argument_Table 4
390 #define Argument_Type_Table_Value 5
391 #define Charset_Xmstring_Names_Table 6
392 #define Charset_Wrdirection_Table 7
393 #define Charset_Parsdirection_Table 8
394 #define Charset_Charsize_Table 9
395 #define Charset_Lang_Names_Table 10
396 #define Charset_Lang_Codes_Table 11
397 #define Allowed_Control_Table 12
398 #define Enum_Set_Table 13
399 #define Argument_Enum_Set_Table 14
400 #define Enumval_Values_Table 15
401 #define Uil_Widget_Names 16
402 #define Uil_Argument_Names 17
403 #define Uil_Reason_Names 18
404 #define Uil_Enumval_names 19
405 #define Uil_Charset_Names 20
406 #define Related_Argument_Table 21
407 #define Allowed_Reason_Table 22
408 #define Uil_Widget_Funcs 23
409 #define Uil_Gadget_Funcs 24
410 #define Uil_Urm_Nondialog_Class 25
411 #define Uil_Urm_Subtree_Resource 26
412 #define Uil_Argument_Toolkit_Names 27
413 #define Uil_Reason_Toolkit_Names 28
414 #define Child_Class_Table       29
415 #define Allowed_Child_Table     30
416 #define Uil_Children_Names      31
417
418 /*
419  * Binary Data Base Work
420  */
421 #define DB_Compiled_Version 2
422
423 typedef struct _db_globals_struct
424 {
425     int     version;
426     int     uil_max_arg;
427     int     uil_max_charset;
428     int     charset_lang_table_max;
429     int     uil_max_object;
430     int     uil_max_reason;
431     int     uil_max_enumval;
432     int     uil_max_enumset;
433     int     key_k_keyword_count;
434     int     key_k_keyword_max_length;
435     int     uil_max_child;
436 } _db_globals;
437    
438 typedef struct _db_header_struct
439 {
440     int     table_id;
441     int     num_items;
442     int     table_size;
443 } _db_header, *_db_header_ptr;
444    
445
446 #endif /* UilDBDef_h */
447 /* DON'T ADD STUFF AFTER THIS #endif */