1/* 2 * Copyright (c) 2010 Apple Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. Neither the name of Apple Inc. ("Apple") nor the names of its 16 * contributors may be used to endorse or promote products derived from 17 * this software without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 20 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * 30 * Portions of this software have been released under the following terms: 31 * 32 * (c) Copyright 1989-1993 OPEN SOFTWARE FOUNDATION, INC. 33 * (c) Copyright 1989-1993 HEWLETT-PACKARD COMPANY 34 * (c) Copyright 1989-1993 DIGITAL EQUIPMENT CORPORATION 35 * 36 * To anyone who acknowledges that this file is provided "AS IS" 37 * without any express or implied warranty: 38 * permission to use, copy, modify, and distribute this file for any 39 * purpose is hereby granted without fee, provided that the above 40 * copyright notices and this notice appears in all source code copies, 41 * and that none of the names of Open Software Foundation, Inc., Hewlett- 42 * Packard Company or Digital Equipment Corporation be used 43 * in advertising or publicity pertaining to distribution of the software 44 * without specific, written prior permission. Neither Open Software 45 * Foundation, Inc., Hewlett-Packard Company nor Digital 46 * Equipment Corporation makes any representations about the suitability 47 * of this software for any purpose. 48 * 49 * Copyright (c) 2007, Novell, Inc. All rights reserved. 50 * Redistribution and use in source and binary forms, with or without 51 * modification, are permitted provided that the following conditions 52 * are met: 53 * 54 * 1. Redistributions of source code must retain the above copyright 55 * notice, this list of conditions and the following disclaimer. 56 * 2. Redistributions in binary form must reproduce the above copyright 57 * notice, this list of conditions and the following disclaimer in the 58 * documentation and/or other materials provided with the distribution. 59 * 3. Neither the name of Novell Inc. nor the names of its contributors 60 * may be used to endorse or promote products derived from this 61 * this software without specific prior written permission. 62 * 63 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 64 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 65 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 66 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY 67 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 68 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 69 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 70 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 71 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 72 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 73 * 74 * @APPLE_LICENSE_HEADER_END@ 75 */ 76 77/* 78** NAME 79** 80** ASTP.H 81** 82** FACILITY: 83** 84** Interface Definition Language (IDL) Compiler 85** 86** ABSTRACT: 87** 88** Header file for the ASTP.C 89** 90** VERSION: DCE 1.0 91** 92*/ 93 94#ifndef ASTP_H 95#define ASTP_H 96 97#include <nidl.h> 98#include <ast.h> 99 100/* NDR Data Sizes for the Transmissable Types */ 101#define NDR_C_BOOLEAN_SIZE 1 102#define NDR_C_BYTE_SIZE 1 103#define NDR_C_CHARACTER_SIZE 1 104#define NDR_C_SMALL_INT_SIZE 1 105#define NDR_C_SHORT_INT_SIZE 2 106#define NDR_C_LONG_INT_SIZE 4 107#define NDR_C_HYPER_INT_SIZE 8 108#define NDR_C_SHORT_FLOAT_SIZE 4 109#define NDR_C_LONG_FLOAT_SIZE 8 110#define NDR_C_POINTER_SIZE 4 111 112/* MIN/MAX values for various integer sizes */ 113#define ASTP_C_SMALL_MAX 127 114#define ASTP_C_SMALL_MIN -128 115#define ASTP_C_USMALL_MAX 255 116#define ASTP_C_USMALL_MIN 0 117 118#define ASTP_C_SHORT_MAX 32767 119#define ASTP_C_SHORT_MIN -32768 120#define ASTP_C_USHORT_MAX 65535 121#define ASTP_C_USHORT_MIN 0 122 123#define ASTP_C_LONG_MAX 2147483647 124#define ASTP_C_LONG_MIN (-2147483647 - 1) 125#define ASTP_C_ULONG_MAX 4294967295.0 126#define ASTP_C_ULONG_MIN 0 127 128/* 129 * Boolean Attributes Flags for Operations, Parameters, Types and Fields 130 * 131 * broadcast, - operation 132 * maybe, - operation 133 * idempotent, - operation 134 * reflect_deletions, - operation 135 * local - operation 136 * in, - parameter 137 * out, - parameter 138 * mutable, - parameter 139 * context, - parameter, type 140 * handle, - type 141 * ignore, - field, parameter, type 142 * ref, - field, parameter, type 143 * small, - field, parameter, type 144 * string, - field, parameter, type 145 * string0, - field, parameter, type 146 * 147 * Boolean Attributes Flags for an Interface. 148 * Separated from the above attributes since 149 * their life time is the life of the interface. 150 * 151 * npb (non-parametric handle) 152 * local 153 */ 154 155/* 156 * ASTP (Private) definitions for the boolean attributes for operations, 157 * parameters, fields and types. Theses differ from the common definitions 158 * defined in AST.H, since we don't need to create a separate operation 159 * flags word. 160 */ 161 162/* Operation Attributes */ 163#define ASTP_BROADCAST 0x00000001 164#define ASTP_MAYBE 0x00000002 165#define ASTP_IDEMPOTENT 0x00000004 166#define ASTP_LOCAL 0x08000000 167#define ASTP_REFLECT_DELETIONS 0x04000000 168 169/* Parameter-only Attributes */ 170#define ASTP_IN 0x00000008 171#define ASTP_OUT 0x00000010 172#define ASTP_IN_SHAPE 0x00000020 173#define ASTP_OUT_SHAPE 0x00000040 174#define ASTP_PTR 0x00000080 175 176/* Type, Field, Parameter Attributes */ 177#define ASTP_STRING0 0x00000100 178#define ASTP_STRING 0x00000200 179#define ASTP_IGNORE 0x00000400 180#define ASTP_SMALL 0x00000800 181#define ASTP_CONTEXT 0x00001000 182 183/* Type-only Attribute(s) */ 184#define ASTP_REF 0x00002000 185#define ASTP_UNIQUE 0x00004000 186#define ASTP_HANDLE 0x00008000 187#define ASTP_UNALIGN 0x00010000 188#define ASTP_TRANSMIT_AS 0x00020000 189#define ASTP_ALIGN_SMALL 0x00040000 190#define ASTP_ALIGN_SHORT 0x00080000 191#define ASTP_ALIGN_LONG 0x00100000 192#define ASTP_ALIGN_HYPER 0x00200000 193#define ASTP_V1_ENUM 0x00400000 194#define ASTP_SWITCH_TYPE 0x00800000 195 196/* Arm-only Attribute(s) */ 197#define ASTP_CASE 0x01000000 198#define ASTP_DEFAULT 0x02000000 199 200/* MIDL-only Attribute(s) */ 201#define ASTP_RANGE 0x10000000 202 203/* 204 * NOTE: This bit must correspond to the Highest Attribute bit used 205 * above. It is used to check which attributes are applicable. 206 */ 207#define ASTP_MAX_ATTRIBUTE 0x10000000 208 209/* 210 * Sets of valid flags for each node type. Note, these are the flags that can 211 * potentially be set in a node. These do not always correspond as to what is 212 * allowed in the source code get reflected in the AST node built and expected 213 * by the backend. For those attributes such as [unique] [ref] [ptr] which are 214 * allowed in the source in multiple locations, but are only set on types, they 215 * are not specified below, but handled explicity in the builder routines. 216 */ 217#define ASTP_OPERATION_FLAGS ASTP_BROADCAST | ASTP_MAYBE | ASTP_IDEMPOTENT | \ 218 ASTP_REFLECT_DELETIONS | ASTP_LOCAL 219 220#define ASTP_PARAMETER_FLAGS ASTP_STRING | ASTP_STRING0 | \ 221 ASTP_SMALL | ASTP_CONTEXT | \ 222 ASTP_IN | ASTP_OUT | ASTP_IN_SHAPE | \ 223 ASTP_OUT_SHAPE | ASTP_UNIQUE | \ 224 ASTP_REF | ASTP_PTR | ASTP_RANGE 225 226#define ASTP_FIELD_FLAGS ASTP_STRING | ASTP_STRING0 | \ 227 ASTP_IGNORE | ASTP_SMALL | ASTP_CONTEXT | ASTP_UNIQUE | \ 228 ASTP_REF | ASTP_PTR | ASTP_RANGE 229 230#define ASTP_TYPE_FLAGS ASTP_STRING | ASTP_STRING0 | ASTP_UNIQUE | \ 231 ASTP_SWITCH_TYPE | \ 232 ASTP_REF | ASTP_SMALL | ASTP_CONTEXT | \ 233 ASTP_HANDLE | ASTP_TRANSMIT_AS | ASTP_UNALIGN | \ 234 ASTP_ALIGN_SMALL | ASTP_ALIGN_SHORT | ASTP_ALIGN_LONG | \ 235 ASTP_ALIGN_HYPER | ASTP_UNIQUE | ASTP_PTR | ASTP_V1_ENUM 236 237#define ASTP_ARM_FLAGS ASTP_STRING | ASTP_STRING0 | \ 238 ASTP_CASE | ASTP_DEFAULT | \ 239 ASTP_SMALL | ASTP_CONTEXT | ASTP_UNIQUE | \ 240 ASTP_REF | ASTP_PTR 241 242/* 243 * ASTP (Private) definitions for the boolean attributes for an interface. 244 * These are identical to the common definitions defined in AST.H. 245 * 246 * Note, specifying the implicit_handle attribute in the IDL means that 247 * a specific handle will be defined in the ACF, so we set the NPB flag 248 * (non-parametric binding) in the interface. 249 */ 250 251#define ASTP_IF_PORT 0x00000040 252#define ASTP_IF_UUID 0x00000080 253#define ASTP_IF_VERSION 0x00000100 254#define ASTP_IF_EXCEPTIONS 0x00000200 255 256/* 257 * Macro for manipulating interface boolean attributes. 258 */ 259#define ASTP_CLR_IF_AF(if) \ 260 (if)->fe_info->type_specific.if_flags = 0 261 262#define ASTP_SET_IF_AF(if,attribute) \ 263 (if)->fe_info->type_specific.if_flags |= (attribute) 264 265#define ASTP_IF_AF_SET(if,attribute) \ 266 (((if)->fe_info->type_specific.if_flags & (attribute)) != 0) 267 268/* 269 * Macros for checking and clearing attributes in an ASTP_attr_flag_t structure. 270 */ 271#define ASTP_TEST_ATTR(__attr_ptr,__flags) \ 272 ((((__attr_ptr)->attr_flags) & (__flags)) != 0) 273 274#define ASTP_CLR_ATTR(__attr_ptr,__flags) \ 275 (__attr_ptr)->attr_flags &= (~(__flags)) 276 277/* AST Private structure types */ 278 279/* 280 * Structure for attribute flags 281 */ 282typedef unsigned long ASTP_attr_flag_t; 283 284/* 285 * Structure for handling both array_bounds and attribute flags in the 286 * grammar as a unit. 287 */ 288typedef struct ASTP_attributes_t 289{ 290 struct ASTP_type_attr_n_t *bounds; 291 ASTP_attr_flag_t attr_flags; /* values are the ASTP_xxx */ 292 /* flags above */ 293 NAMETABLE_id_t iid_is_name; /* name for iid_is */ 294 295} ASTP_attributes_t; 296 297/* 298 * Structure for the singly-linked list used to build the AST. 299 * 300 * Note, since next and last are not guarenteed for all nodes, 301 * but fe_info, and be_info are, fe_info and be_info are always 302 * the first two fields, followed by the next and last fields 303 * when present. 304 */ 305 306typedef struct ASTP_node_t 307{ 308 fe_info_t *fe_info; 309 be_info_t *be_info; 310 struct ASTP_node_t *next; 311 struct ASTP_node_t *last; 312} ASTP_node_t, *ASTP_node_t_p; 313 314typedef enum 315{ 316 ASTP_constant_bound, 317 ASTP_default_bound, 318 ASTP_open_bound 319} ASTP_bound_t; 320 321/* 322 * Array Index private node. 323 * 324 * Keeps the lower and upper bounds 325 * to a dimension of an array as well 326 * the type of each bound. 327 */ 328typedef struct ASTP_array_index_n_t 329{ 330 fe_info_t *fe_info; /* Must be here, but unused */ 331 be_info_t *be_info; /* Must be here, but unused */ 332 struct ASTP_array_index_n_t *next; 333 struct ASTP_array_index_n_t *last; 334 ASTP_bound_t lower_bound_type; 335 ASTP_bound_t upper_bound_type; 336 AST_constant_n_t *lower_bound; 337 AST_constant_n_t *upper_bound; 338} ASTP_array_index_n_t; 339 340/* 341 * Type attribute node. 342 * 343 * A Type attribute node is used to hold the 344 * attributes for a type during the parse. 345 */ 346 347typedef enum 348{ 349 last_is_k, 350 first_is_k, 351 max_is_k, 352 min_is_k, 353 length_is_k, 354 size_is_k, 355 switch_is_k, 356 iid_is_k, 357 range_k 358} ASTP_attr_k_t; 359 360typedef struct ASTP_type_attr_n_t 361{ 362 fe_info_t *fe_info; /* Must be here, but unused */ 363 be_info_t *be_info; /* Must be here, but unused */ 364 struct ASTP_type_attr_n_t *next; 365 struct ASTP_type_attr_n_t *last; 366 int source_line; 367 ASTP_attr_k_t kind; 368 boolean is_expr; 369 union { 370 struct { 371 NAMETABLE_id_t name; 372 boolean pointer; 373 } simple; 374 struct AST_exp_n_t * expr; 375 } b; 376} ASTP_type_attr_n_t; 377 378/* 379 * Context block to save the field attribute 380 * reference information. 381 * This is used when processing a parameter 382 * field attribute and the referent parameter 383 * is not yet defined. 384 */ 385 386typedef struct ASTP_field_ref_ctx_t 387{ 388 fe_info_t *fe_info; /* Must be here, but unused */ 389 be_info_t *be_info; /* Must be here, but unused */ 390 struct ASTP_field_ref_ctx_t *next; 391 struct ASTP_field_ref_ctx_t *last; 392 NAMETABLE_id_t name; /* Saved parameter reference */ 393 AST_field_ref_n_t *field_ref_ptr; /* Address to field ref needing patch */ 394} ASTP_field_ref_ctx_t; 395 396/* 397 * A declarator node is used hold the information about a IDL/C declarator 398 * which will eventually be merged with the type node and turned into an 399 * export. A declarator node is private to the AST builder which is why it is 400 * not declared in AST.H. If the next_op field is NULL then this is a simple 401 * declarator otherwise the various operations must be applied to the base type to 402 * yeild the result type described via this declarator. 403 */ 404 405typedef struct ASTP_declarator_n_t 406{ 407 fe_info_t *fe_info; /* Points to fe_info of parent node */ 408 /* which determines the type of */ 409 /* the expected referent */ 410 be_info_t *be_info; /* Must be here, but unused */ 411 struct ASTP_declarator_n_t *next; 412 struct ASTP_declarator_n_t *last; 413 NAMETABLE_id_t name; 414 struct ASTP_declarator_op_n_t *next_op; 415 struct ASTP_declarator_op_n_t *last_op; 416} ASTP_declarator_n_t; 417 418/* 419 * Representation of operations that can be performed on declarators to produce 420 * various types (pointer, array, function_pointer). 421 */ 422typedef struct ASTP_declarator_op_n_t 423{ 424 struct ASTP_declarator_op_n_t *next_op; 425 AST_type_k_t op_kind; /* Valid operators are: AST_array_k, */ 426 /* AST_pointer_k, or AST_function_k */ 427 union 428 { 429 ASTP_node_t *node; 430 ASTP_array_index_n_t *indices; /* Set if op_kind == AST_array_k */ 431 AST_type_n_t *type_node_ptr; 432 AST_parameter_n_t *routine_params;/* Set if op_kind == AST_function_k */ 433 int pointer_count; /* Set if op_kind == AST_pointer_k */ 434 } op_info; 435} ASTP_declarator_op_n_t; 436 437/* 438 * A Tag ref node is created for each forward reference to a 439 * struct/union via it's tag name (e.g. struct foo). It 440 * provides enough information to patch references to the 441 * type after the parse has completed. 442 */ 443typedef struct ASTP_tag_ref_n_t 444{ 445 fe_info_t *fe_info; /* Must be here, but unused */ 446 be_info_t *be_info; /* Must be here, but unused */ 447 struct ASTP_tag_ref_n_t *next; 448 struct ASTP_tag_ref_n_t *last; 449 NAMETABLE_id_t name; /* Tag name referenced */ 450 AST_type_k_t ref_kind; /* AST_struct_k or AST_disc_union_k */ 451 AST_type_n_t *type_node_ptr; /* Type node that referenced tag */ 452} ASTP_tag_ref_n_t; 453 454/* 455 * Structure to hold count of input/output parameters needing marshalling 456 * used to formulate operation synthesized attributes AST_HAS_INS/AST_HAS_OUTS. 457 */ 458typedef struct ASTP_parameter_count_t 459{ 460 int in_params; 461 int out_params; 462} ASTP_parameter_count_t; 463 464boolean ASTP_expr_is_simple( 465 parser_location_p location, 466 AST_exp_n_t * exp 467); 468 469AST_exp_n_t * AST_expression( 470 parser_location_p location, 471 unsigned long exp_type, 472 AST_exp_n_t * oper1, 473 AST_exp_n_t * oper2, 474 AST_exp_n_t * oper3 475); 476 477boolean ASTP_evaluate_expr( 478 parser_location_p location, 479 AST_exp_n_t * exp_node, 480 boolean constant_only 481); 482 483long ASTP_expr_integer_value( 484 parser_location_p location, 485 AST_exp_n_t * exp 486); 487 488AST_exp_n_t * AST_exp_boolean_constant( 489 parser_location_p location, 490 boolean value 491); 492 493AST_exp_n_t * AST_exp_null_constant( 494 parser_location_p location 495); 496 497AST_exp_n_t * AST_exp_string_constant( 498 parser_location_p location, 499 STRTAB_str_t string 500); 501 502AST_exp_n_t * AST_exp_identifier( 503 parser_location_p location, 504 NAMETABLE_id_t name 505); 506 507AST_exp_n_t * AST_exp_char_constant( 508 parser_location_p location, 509 char value 510); 511 512AST_exp_n_t * AST_exp_integer_constant( 513 parser_location_p location, 514 long value, 515 int int_signed 516); 517 518AST_constant_n_t * AST_constant_from_exp( 519 parser_location_p location, 520 AST_exp_n_t * exp 521); 522 523/* 524 * Interface Attributes 525 */ 526extern int interface_pointer_class; 527 528/* 529 * Operation, Parameter, Type Attributes 530 */ 531extern AST_type_n_t *ASTP_transmit_as_type; 532extern AST_type_n_t *ASTP_switch_type; 533extern AST_case_label_n_t *ASTP_case; 534 535/* 536 * Interface just parsed 537 */ 538extern AST_interface_n_t * the_interface; 539 540//centeris wfu 541extern AST_cpp_quote_n_t * global_cppquotes; //store cppquote nodes that appear in front of interfaces 542 543extern AST_cpp_quote_n_t * global_cppquotes_post; //store cppquote nodes that appear behind the last parsed interface 544 545/* list of imports that occurred outside of interfaces */ 546extern AST_import_n_t * global_imports; 547 548/* 549 * List head for saved context for field 550 * attributes forward referenced parameters. 551 */ 552extern ASTP_field_ref_ctx_t *ASTP_field_ref_ctx_list; 553 554/* 555 * List head for referenced struct/union tags. 556 */ 557extern ASTP_tag_ref_n_t *ASTP_tag_ref_list; 558 559/* 560 * Control for parser 561 */ 562extern boolean ASTP_parsing_main_idl; /* True when parsing the main idl */ 563 564/* 565 * Builtin in constants 566 */ 567 568extern AST_constant_n_t *zero_constant_p; 569 570/* 571 * Builtin base types 572 */ 573extern AST_type_n_t *ASTP_char_ptr, 574 *ASTP_boolean_ptr, 575 *ASTP_byte_ptr, 576 *ASTP_void_ptr, 577 *ASTP_handle_ptr, 578 *ASTP_short_float_ptr, 579 *ASTP_long_float_ptr, 580 *ASTP_small_int_ptr, 581 *ASTP_short_int_ptr, 582 *ASTP_long_int_ptr, 583 *ASTP_hyper_int_ptr, 584 *ASTP_small_unsigned_ptr, 585 *ASTP_short_unsigned_ptr, 586 *ASTP_long_unsigned_ptr, 587 *ASTP_hyper_unsigned_ptr; 588 589/* Default tag for union */ 590extern NAMETABLE_id_t ASTP_tagged_union_id; 591 592/* 593 * Function prototypes exported by ASTP_{COM/GBL/DMP/CPX/SIM}.C 594 */ 595ASTP_type_attr_n_t *AST_array_bound_info( 596 parser_location_p location, 597 NAMETABLE_id_t name, 598 ASTP_attr_k_t kind, 599 boolean is_pointer 600); 601 602ASTP_type_attr_n_t * AST_array_bound_from_expr( 603 parser_location_p location, 604 AST_exp_n_t * exp, 605 ASTP_attr_k_t kind 606); 607 608ASTP_type_attr_n_t * AST_range_from_expr( 609 parser_location_p location, 610 AST_exp_n_t * min_exp, 611 AST_exp_n_t * max_exp 612); 613 614void AST_capture_operation_attrs( 615 void 616); 617 618AST_constant_n_t *AST_clone_constant( 619 parser_location_p location, 620 AST_constant_n_t *constant_node_p 621); 622 623ASTP_node_t *AST_concat_element( 624 ASTP_node_t *list_head, 625 ASTP_node_t *element 626); 627 628AST_constant_n_t *AST_constant_node( 629 parser_location_p location, 630 AST_constant_k_t kind 631); 632 633ASTP_declarator_n_t *AST_declarator_node( 634 NAMETABLE_id_t name 635); 636 637void AST_declarator_operation( 638 ASTP_declarator_n_t *declarator, 639 AST_type_k_t op_kind, 640 ASTP_node_t *op_info, 641 int pointer_count 642); 643 644AST_parameter_n_t *AST_declarator_to_param( 645 parser_location_p location, 646 ASTP_attributes_t *attributes, 647 AST_type_n_t *type, 648 ASTP_declarator_n_t *declarator 649); 650 651AST_type_p_n_t *AST_declarators_to_types( 652 parser_location_p ploc, 653 AST_interface_n_t * ifp, 654 AST_type_n_t *type_ptr, 655 ASTP_declarator_n_t *declarators_ptr, 656 ASTP_attributes_t *attributes 657); 658 659AST_export_n_t *AST_export_node( 660 parser_location_p location, 661 ASTP_node_t *export_ptr, 662 AST_export_k_t kind 663); 664 665AST_cpp_quote_n_t *AST_cpp_quote_node( 666 parser_location_p location, 667 STRTAB_str_t text 668); 669 670AST_include_n_t *AST_include_node( 671 parser_location_p location, 672 STRTAB_str_t include_file, 673 STRTAB_str_t include_file_name 674); 675 676AST_import_n_t *AST_import_node( 677 parser_location_p location, 678 STRTAB_str_t imported_file 679); 680 681AST_exception_n_t *AST_exception_node( 682 parser_location_p location, 683 NAMETABLE_id_t excep_name 684); 685 686AST_name_n_t *AST_name_node( 687 NAMETABLE_id_t name 688); 689 690void AST_init( 691 parser_location_p location 692); 693 694AST_constant_n_t *AST_integer_constant( 695 parser_location_p location, 696 long int value 697); 698 699AST_interface_n_t *AST_interface_node( 700 parser_location_p location 701); 702 703void AST_finish_interface_node( 704 parser_location_p location, 705 AST_interface_n_t *interface_node 706); 707 708AST_operation_n_t *AST_operation_node( 709 parser_location_p location, 710 AST_type_n_t *result_type, 711 ASTP_declarator_n_t *declarator, 712 ASTP_attributes_t *attributes 713); 714 715AST_parameter_n_t * AST_parameter_node( 716 parser_location_p location, 717 NAMETABLE_id_t identifier 718); 719 720AST_rep_as_n_t *AST_represent_as_node( 721 parser_location_p location, 722 NAMETABLE_id_t name 723); 724 725AST_cs_char_n_t *AST_cs_char_node( 726 parser_location_p location, 727 NAMETABLE_id_t name 728); 729 730AST_type_n_t *AST_set_type_attrs( 731 parser_location_p location, 732 AST_type_n_t *type_node_ptr, 733 ASTP_attributes_t *attributes 734); 735 736void AST_set_ports( 737 AST_interface_n_t *interface_node_p 738); 739 740AST_type_n_t *AST_type_node( 741 parser_location_p location, 742 AST_type_k_t kind 743); 744 745AST_type_p_n_t *AST_type_ptr_node( 746 parser_location_p location 747); 748 749AST_export_n_t *AST_types_to_exports( 750 parser_location_p location, 751 AST_type_p_n_t *type_p_list 752); 753 754AST_array_n_t *AST_array_node( 755 parser_location_p location, 756 AST_type_n_t *element_type_ptr 757); 758 759AST_array_index_n_t *AST_array_index_node( 760 parser_location_p location, 761 unsigned short array_size 762); 763 764ASTP_array_index_n_t *ASTP_array_index_node( 765 parser_location_p location, 766 AST_constant_n_t *lower_bound, 767 ASTP_bound_t lower_bound_type, 768 AST_constant_n_t *upper_bound, 769 ASTP_bound_t upper_bound_type 770); 771 772AST_constant_n_t *AST_boolean_constant( 773 parser_location_p location, 774 boolean value 775); 776 777AST_case_label_n_t *AST_case_label_node( 778 parser_location_p location, 779 AST_constant_n_t *case_label 780); 781 782AST_constant_n_t *AST_char_constant( 783 parser_location_p location, 784 char value 785); 786 787AST_arm_n_t *AST_declarator_to_arm( 788 parser_location_p location, 789 AST_type_n_t *type_ptr, 790 ASTP_declarator_n_t *declarator, 791 ASTP_attributes_t *attributes 792); 793 794AST_field_n_t *AST_declarators_to_fields( 795 parser_location_p location, 796 ASTP_declarator_n_t *declarators_ptr, 797 AST_type_n_t *type_ptr, 798 ASTP_attributes_t *attributes 799); 800 801AST_case_label_n_t *AST_default_case_label_node( 802 parser_location_p location 803); 804 805AST_type_n_t *AST_disc_union_node( 806 parser_location_p location, 807 NAMETABLE_id_t tag_name, 808 NAMETABLE_id_t union_name, 809 NAMETABLE_id_t disc_name, 810 AST_type_n_t *disc_type, 811 AST_arm_n_t *arms_list 812); 813 814AST_type_n_t *AST_enumerator_node( 815 parser_location_p location, 816 AST_constant_n_t *constant_list, 817 AST_type_k_t size 818); 819 820AST_constant_n_t *AST_enum_constant( 821 parser_location_p location, 822 NAMETABLE_id_t identifier, 823 AST_exp_n_t * exp 824); 825 826AST_constant_n_t *AST_finish_constant_node( 827 parser_location_p location, 828 AST_constant_n_t *constant_ptr, 829 ASTP_declarator_n_t *declarator, 830 AST_type_n_t *type_ptr 831); 832 833AST_field_attr_n_t *AST_field_attr_node( 834 parser_location_p location 835); 836 837AST_field_ref_n_t *AST_field_ref_node( 838 parser_location_p location, 839 unsigned short dimension 840); 841 842AST_operation_n_t *AST_function_node( 843 parser_location_p location, 844 AST_type_n_t *result_type, 845 NAMETABLE_id_t op_name, 846 AST_parameter_n_t *parameters 847); 848 849AST_arm_n_t *AST_label_arm( 850 AST_arm_n_t *member, 851 AST_case_label_n_t *case_labels 852); 853 854AST_type_n_t *AST_lookup_integer_type_node( 855 AST_type_k_t int_size, 856 int int_signed 857); 858 859AST_type_n_t *AST_lookup_type_node( 860 AST_type_k_t kind 861); 862 863AST_type_n_t *AST_lookup_named_type( 864 parser_location_p location, 865 NAMETABLE_id_t type_name 866); 867 868AST_constant_n_t *AST_named_constant( 869 parser_location_p location, 870 NAMETABLE_id_t const_name 871); 872 873AST_constant_n_t *AST_null_constant( 874 parser_location_p location 875); 876 877AST_type_n_t *AST_pipe_node( 878 parser_location_p location, 879 AST_type_n_t *pipe_type 880); 881 882AST_pointer_n_t *AST_pointer_node( 883 parser_location_p location, 884 AST_type_n_t * pointee 885); 886 887AST_type_n_t *AST_set_union_arms( 888 AST_type_n_t *union_type_ptr, 889 AST_arm_n_t *member_list 890); 891 892AST_constant_n_t *AST_string_constant( 893 parser_location_p location, 894 STRTAB_str_t value 895); 896 897AST_type_n_t *AST_structure_node( 898 parser_location_p location, 899 AST_field_n_t *field_list, 900 NAMETABLE_id_t identifier 901); 902 903AST_field_n_t *AST_tag_declarators_to_fields( 904 ASTP_declarator_n_t *declarators, 905 NAMETABLE_id_t identifier, 906 ASTP_attributes_t *attributes, 907 AST_type_k_t kind 908); 909 910AST_type_n_t *AST_type_from_tag( 911 parser_location_p location, 912 AST_type_k_t kind, 913 NAMETABLE_id_t identifier 914); 915 916void AST_set_type_boolean_attrs( 917 AST_type_n_t *type_node 918); 919 920void AST_clear_type_attrs( 921 void 922); 923 924boolean AST_lookup_field_attr( 925 ASTP_attributes_t *attributes, /* [in] Attributes - bounds field is */ 926 /* linked list of field attrs */ 927 ASTP_attr_k_t field_attr /* [in] Field attribute to look up */ 928); 929 930AST_field_attr_n_t *AST_set_field_attrs( 931 parser_location_p location, 932 ASTP_attributes_t *attributes, 933 ASTP_node_t *parent_node, 934 AST_type_n_t *type_node 935); 936 937void ASTP_free_declarators( 938 ASTP_declarator_n_t *declarators_ptr 939); 940 941void ASTP_free_simple_list( 942 ASTP_node_t *list_ptr 943); 944 945AST_type_n_t *AST_propagate_type( 946 parser_location_p location, 947 AST_type_n_t *type_node_ptr, 948 ASTP_declarator_n_t *declarator_ptr, 949 ASTP_attributes_t *attributes, 950 ASTP_node_t *parent_node 951); 952 953void ASTP_add_name_binding( 954 parser_location_p location, 955 NAMETABLE_id_t name, 956 void *AST_node 957); 958 959AST_type_n_t *ASTP_chase_ptr_to_kind( 960 AST_type_n_t *type_node, 961 AST_type_k_t kind 962); 963 964AST_type_n_t *ASTP_chase_ptr_to_type( 965 AST_type_n_t *type_node 966); 967 968ASTP_node_t *ASTP_lookup_binding( 969 parser_location_p location, 970 NAMETABLE_id_t name, 971 fe_node_k_t node_kind, 972 boolean noforward_ref 973); 974 975void ASTP_patch_tag_references( 976 parser_location_p location, 977 AST_interface_n_t *interface_node_ptr 978); 979 980void ASTP_patch_field_reference( 981 parser_location_p location 982); 983 984void ASTP_set_fe_info( 985 parser_location_p location, 986 fe_info_t **fe_info_ptr, 987 fe_node_k_t fe_node_kind 988); 989 990void ASTP_save_tag_ref( 991 NAMETABLE_id_t identifier, 992 AST_type_k_t kind, 993 AST_type_n_t *type_node_ptr 994); 995 996void ASTP_process_pa_type( 997 AST_type_n_t *type_node_ptr 998); 999 1000void AST_set_flags( 1001 parser_location_p location, 1002 AST_flags_t *flags, 1003 ASTP_node_t *node_ptr, 1004 ASTP_attributes_t *attributes 1005); 1006 1007long AST_attribute_to_token( 1008 ASTP_attr_flag_t *attribute 1009); 1010 1011AST_arm_n_t *AST_arm_node( 1012 parser_location_p location, 1013 NAMETABLE_id_t name, 1014 AST_case_label_n_t *label, 1015 AST_type_n_t *type 1016); 1017 1018void ASTP_parse_port( 1019 AST_interface_n_t *interface_p, 1020 STRTAB_str_t port_string 1021); 1022 1023void ASTP_validate_forward_ref( 1024 parser_location_p location, 1025 AST_type_n_t *type 1026); 1027 1028NAMETABLE_id_t AST_generate_name( 1029 AST_interface_n_t *int_p, 1030 const char *suffix 1031); 1032 1033void ASTP_validate_integer( 1034 parser_location_p location, 1035 AST_exp_n_t *expression 1036); 1037 1038void KEYWORDS_init( 1039 void 1040); 1041 1042const char *KEYWORDS_lookup_text( 1043 long token 1044); 1045 1046int KEYWORDS_screen( 1047 const char * identifier, 1048 NAMETABLE_id_t * id 1049); 1050 1051void ASTP_set_array_rep_type 1052( 1053 parser_location_p location, 1054 AST_type_n_t *type_node_ptr, 1055 AST_type_n_t *array_base_type, 1056 boolean is_varying 1057); 1058 1059void ASTP_set_implicit_handle( 1060 AST_interface_n_t *int_p, 1061 NAMETABLE_id_t type_name, 1062 NAMETABLE_id_t handle_name 1063); 1064 1065#endif 1066