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