5 Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
6 States of America. All Rights Reserved.
8 This product is protected by copyright and distributed under the following
9 license restricting its use.
11 The Interface Definition Language Compiler Front End (CFE) is made
12 available for your use provided that you include this license and copyright
13 notice on all media and documentation and the software program in which
14 this product is incorporated in whole or part. You may copy and extend
15 functionality (but may not remove functionality) of the Interface
16 Definition Language CFE without charge, but you are not authorized to
17 license or distribute it to anyone else except as part of a product or
18 program developed by you or with the express written consent of Sun
19 Microsystems, Inc. ("Sun").
21 The names of Sun Microsystems, Inc. and any of its subsidiaries or
22 affiliates may not be used in advertising or publicity pertaining to
23 distribution of Interface Definition Language CFE as permitted herein.
25 This license is effective until terminated by Sun for failure to comply
26 with this license. Upon termination, you shall destroy or return all code
27 and documentation for the Interface Definition Language CFE.
29 INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
30 ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
31 FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
32 DEALING, USAGE OR TRADE PRACTICE.
34 INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
35 ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
36 TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
38 SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
39 RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
40 INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
42 IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
43 ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
44 DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
46 Use, duplication, or disclosure by the government is subject to
47 restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
48 Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
51 Sun, Sun Microsystems and the Sun logo are trademarks or registered
52 trademarks of Sun Microsystems, Inc.
56 Mountain View, California 94043
60 SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
61 trademarks or registered trademarks of Sun Microsystems, Inc.
65 #ifndef _IDL_IDL_GLOBAL_HH
66 #define _IDL_IDL_GLOBAL_HH
68 // May of them could be forward declared..
69 #include "ace/SString.h"
70 #include "ace/Hash_Map_Manager_T.h"
71 #include "ace/Containers_T.h"
72 #include "ace/Synch_Traits.h"
73 #include "ace/Null_Mutex.h"
75 #include "ast_expression.h"
76 #include "ast_predefined_type.h"
77 #include "utl_identifier.h"
78 #include "utl_stack.h"
80 #include "idl_version.h"
94 * \file Defines a class containing all front end global data.
96 * Corresponding source file is util/utl_global.cpp.
99 class TAO_IDL_FE_Export IDL_GlobalData
104 // The ParseState type encodes the state of the Yacc parser so that
105 // better error messages can be produced, and for use by BEs in situations
106 // where context sensitive behavior is required
108 PS_NoState
// No state
109 , PS_TypeDeclSeen
// Seen complete type declaration
110 , PS_TypeIdDeclSeen
// Seen complete typeId declaration
111 , PS_TypePrefixDeclSeen
// Seen complete type_prefix declaration
112 , PS_ConstDeclSeen
// Seen complete const declaration
113 , PS_ExceptDeclSeen
// Seen complete exception declaration
114 , PS_InterfaceDeclSeen
// Seen complete interface declaration
115 , PS_ModuleDeclSeen
// Seen complete module declaration
116 , PS_ValueTypeDeclSeen
// Seen complete valuetype declaration
117 , PS_ComponentDeclSeen
// Seen complete component declaration
118 , PS_HomeDeclSeen
// Seen complete home declaration
119 , PS_EventDeclSeen
// Seen complete eventtype declartion
120 , PS_PorttypeDeclSeen
// Seen complete porttype declaration
121 , PS_ConnectorDeclSeen
// Seen complete connector declaration
122 , PS_AttrDeclSeen
// Seen complete attribute declaration
123 , PS_OpDeclSeen
// Seen complete operation declaration
124 , PS_ProvidesDeclSeen
// Seen complete privides declaration
125 , PS_ExtProvidesDeclSeen
// Seen complete extended provides declaration
126 , PS_UsesDeclSeen
// Seen complete uses declaration
127 , PS_ExtUsesDeclSeen
// Seen complete extended uses declaration
128 , PS_EmitsDeclSeen
// Seen complete emits declaration
129 , PS_PublishesDeclSeen
// Seen complete publishes declaration
130 , PS_FactoryDeclSeen
// Seen complete factory declaration
131 , PS_FinderDeclSeen
// Seen complete finder declaration
132 , PS_ConsumesDeclSeen
// Seen complete subscribes declaration
133 , PS_ExtendedPortDeclSeen
// Seen extended port
134 , PS_MirrorPortDeclSeen
// Seen mirror port
135 , PS_ModuleSeen
// Seen a MODULE keyword
136 , PS_ModuleIDSeen
// Seen the module ID
137 , PS_ModuleSqSeen
// '{' seen for module
138 , PS_ModuleQsSeen
// '}' seen for module
139 , PS_ModuleBodySeen
// Seen complete module body
140 , PS_InheritColonSeen
// Seen ':' in inheritance list
141 , PS_InheritSpecSeen
// Seen a complete inheritance spec
142 , PS_SupportSpecSeen
// Seen a complete supports spec
143 , PS_ManagesSeen
// Seen a MANAGES keyword
144 , PS_ManagesIDSeen
// Seen the scoped name referred to by MANAGES
145 , PS_PrimaryKeySpecSeen
// Seen a complete primary key spec
146 , PS_InterfaceSeen
// Seen an INTERFACE keyword
147 , PS_InterfaceIDSeen
// Seen the interface ID
148 , PS_InterfaceForwardSeen
// Forward interface decl seen
149 , PS_InterfaceSqSeen
// '{' seen for interface
150 , PS_InterfaceQsSeen
// '}' seen for interface
151 , PS_InterfaceBodySeen
// Seen an interface body
152 , PS_TmplModuleIDSeen
// Seen the template module ID
153 , PS_TmplModuleParamsSeen
// Seen template module params
154 , PS_TmplModuleSqSeen
// '{' seen for template module
155 , PS_TmplModuleQsSeen
// '}' seen for template module
156 , PS_TmplModuleBodySeen
// Seen a template module body
157 , PS_InstModuleSeen
// Seen MODULE keyword + reference
158 , PS_InstModuleArgsSeen
// Seen template args
159 , PS_InstModuleIDSeen
// Seen instantiated module ID
160 , PS_ModuleRefSeen
// Seen ALIAS keyword + reference
161 , PS_ModuleRefParamsSeen
// Seen the subset of params used
162 , PS_ModuleRefIDSeen
// Seen referenced module ID
163 , PS_ValueTypeSeen
// Seen a VALUETYPE keyword
164 , PS_ValueTypeForwardSeen
// Forward valuetype decl seen
165 , PS_ValueTypeIDSeen
// Seen the valuetype ID
166 , PS_ValueTypeSqSeen
// '{' seen for value type
167 , PS_ValueTypeQsSeen
// '}' seen for value type
168 , PS_ValueTypeBodySeen
// Seen a value type body
169 , PS_EventTypeSeen
// Seen a EVENTTYPE keyword
170 , PS_EventTypeForwardSeen
// Forward eventtype decl seen
171 , PS_EventTypeIDSeen
// Seen the eventtype ID
172 , PS_EventTypeSqSeen
// '{' seen for event type
173 , PS_EventTypeQsSeen
// '}' seen for event type
174 , PS_EventTypeBodySeen
// Seen a event type body
175 , PS_ComponentSeen
// Seen a component declaration
176 , PS_ComponentIDSeen
// Seen the component ID
177 , PS_ComponentForwardSeen
// Seen a forward declaration of a component
178 , PS_ComponentSqSeen
// '{' seen for component
179 , PS_ComponentQsSeen
// '}' seen for component
180 , PS_ComponentBodySeen
// Seen a component body
181 , PS_HomeSeen
// Seen a home declaration
182 , PS_HomeIDSeen
// Seen the home ID
183 , PS_HomeSqSeen
// '{' seen for home
184 , PS_HomeQsSeen
// '}' seen for home
185 , PS_HomeBodySeen
// Seen a home body
186 , PS_ConnectorSeen
// Seen an CONNECTOR keyword
187 , PS_ConnectorIDSeen
// Seen the connector ID
188 , PS_ConnectorSqSeen
// '{' seen for connector
189 , PS_ConnectorQsSeen
// '}' seen for connector
190 , PS_ConnectorBodySeen
// Seen a connector body
191 , PS_SNListCommaSeen
// Seen ',' in list of scoped names
192 , PS_ScopedNameSeen
// Seen a complete scoped name
193 , PS_SN_IDSeen
// Seen an identifier as part of a scoped name
194 , PS_ScopeDelimSeen
// Seen a scope delim as party of a scoped name
195 , PS_ConstSeen
// Seen a CONST keyword
196 , PS_ConstTypeSeen
// Parsed the type of a constant
197 , PS_ConstIDSeen
// Seen the constant ID
198 , PS_ConstAssignSeen
// Seen the '='
199 , PS_ConstExprSeen
// Seen the constant value expression
200 , PS_TypedefSeen
// Seen a TYPEDEF keyword
201 , PS_TypeSpecSeen
// Seen a complete type specification
202 , PS_DeclaratorsSeen
// Seen a complete list of declarators
203 , PS_StructSeen
// Seen a STRUCT keyword
204 , PS_StructIDSeen
// Seen the struct ID
205 , PS_StructSqSeen
// '{' seen for struct
206 , PS_StructQsSeen
// '}' seen for struct
207 , PS_StructBodySeen
// Seen complete body of struct decl
208 , PS_StructForwardSeen
// Forward struct decl seen
209 , PS_MemberTypeSeen
// Seen type of struct or except member
210 , PS_MemberDeclsSeen
// Seen decls of struct or except members
211 , PS_MemberDeclsCompleted
// Completed one struct or except member to ';'
212 , PS_UnionSeen
// Seen a UNION keyword
213 , PS_UnionIDSeen
// Seen the union ID
214 , PS_UnionForwardSeen
// Forward union decl seen
215 , PS_SwitchSeen
// Seen the SWITCH keyword
216 , PS_SwitchOpenParSeen
// Seen the switch open par.
217 , PS_SwitchTypeSeen
// Seen the switch type spec
218 , PS_SwitchCloseParSeen
// Seen the switch close par.
219 , PS_UnionSqSeen
// '{' seen for union
220 , PS_UnionQsSeen
// '}' seen for union
221 , PS_DefaultSeen
// Seen DEFAULT keyword
222 , PS_UnionLabelSeen
// Seen label of union element
223 , PS_LabelColonSeen
// Seen ':' of union branch label
224 , PS_LabelExprSeen
// Seen expression of union branch label
225 , PS_UnionElemSeen
// Seen a union element
226 , PS_UnionElemCompleted
// Completed one union member up to ';'
227 , PS_CaseSeen
// Seen a CASE keyword
228 , PS_UnionElemTypeSeen
// Seen type spec for union element
229 , PS_UnionElemDeclSeen
// Seen declarator for union element
230 , PS_UnionBodySeen
// Seen completed union body
231 , PS_EnumSeen
// Seen an ENUM keyword
232 , PS_EnumIDSeen
// Seen the enum ID
233 , PS_EnumSqSeen
// Seen '{' for enum
234 , PS_EnumQsSeen
// Seen '}' for enum
235 , PS_EnumBodySeen
// Seen complete enum body
236 , PS_EnumCommaSeen
// Seen ',' in list of enumerators
237 , PS_MapSeen
// Seen a MAP keyword
238 , PS_MapSqSeen
// Seen a '<' for map
239 , PS_MapQsSeen
// Seen a '>' for map
240 , PS_MapKeyTypeSeen
// Seen a key type decl for map
241 , PS_MapValueTypeSeen
// Seen a value type decl for map
242 , PS_MapCommaSeen
// Seen comma for map
243 , PS_MapExprSeen
// Seen a size expression for map
244 , PS_SequenceSeen
// Seen a SEQUENCE keyword
245 , PS_SequenceSqSeen
// Seen '<' for sequence
246 , PS_SequenceQsSeen
// Seen '>' for sequence
247 , PS_SequenceTypeSeen
// Seen type decl for sequence
248 , PS_SequenceCommaSeen
// Seen comma for sequence
249 , PS_SequenceExprSeen
// Seen size expression for sequence
250 , PS_StringSeen
// Seen a STRING keyword
251 , PS_StringSqSeen
// Seen '<' for string
252 , PS_StringQsSeen
// Seen '>' for string
253 , PS_StringExprSeen
// Seen size expression for string
254 , PS_StringCompleted
// Seen a string decl without size spec
255 , PS_ArrayIDSeen
// Seen array ID
256 , PS_ArrayCompleted
// Seen completed array declaration
257 , PS_DimSqSeen
// Seen '[' for array dimension
258 , PS_DimQsSeen
// Seen ']' for array dimension
259 , PS_DimExprSeen
// Seen size expression for array dimension
260 , PS_AttrROSeen
// Seen READONLY keyword
261 , PS_AttrSeen
// Seen ATTRIBUTE keyword
262 , PS_AttrTypeSeen
// Seen type decl for attribute
263 , PS_AttrDeclsSeen
// Seen declarators for attribute
264 , PS_AttrCompleted
// Seen complete attribute declaration
265 , PS_ExceptSeen
// Seen EXCEPTION keyword
266 , PS_ExceptIDSeen
// Seen exception identifier
267 , PS_ExceptSqSeen
// Seen '{' for exception
268 , PS_ExceptQsSeen
// Seen '}' for exception
269 , PS_ExceptBodySeen
// Seen complete exception body
270 , PS_OpAttrSeen
// Seen operation attribute
271 , PS_OpTypeSeen
// Seen operation return type
272 , PS_OpIDSeen
// Seen operation ID
273 , PS_OpParsCompleted
// Completed operation param list
274 , PS_OpRaiseCompleted
// Completed operation except list
275 , PS_OpGetRaiseCompleted
// Completed attribute get except list
276 , PS_OpSetRaiseCompleted
// Completed attribute set except list
277 , PS_OpContextCompleted
// Completed operation context spec
278 , PS_OpCompleted
// Completed operation statement
279 , PS_OpSqSeen
// Seen '(' for operation
280 , PS_OpQsSeen
// Seen ')' for operation
281 , PS_OpParCommaSeen
// Seen ',' in list of op params
282 , PS_OpParDirSeen
// Seen parameter direction
283 , PS_OpParTypeSeen
// Seen parameter type
284 , PS_OpParDeclSeen
// Seen parameter declaration
285 , PS_OpRaiseSeen
// Seen RAISES keyword
286 , PS_OpRaiseSqSeen
// Seen '(' for RAISES
287 , PS_OpRaiseQsSeen
// Seen ')' for RAISES
288 , PS_OpGetRaiseSeen
// Seen GETRAISES keyword
289 , PS_OpGetRaiseSqSeen
// Seen '(' for GETRAISES
290 , PS_OpGetRaiseQsSeen
// Seen ')' for GETRAISES
291 , PS_OpSetRaiseSeen
// Seen SETRAISES keyword
292 , PS_OpSetRaiseSqSeen
// Seen '(' for SETRAISES
293 , PS_OpSetRaiseQsSeen
// Seen ')' for SETRAISES
294 , PS_OpContextSeen
// Seen CONTEXT keyword
295 , PS_OpContextSqSeen
// Seen '(' for CONTEXT
296 , PS_OpContextQsSeen
// Seen ')' for CONTEXT
297 , PS_OpContextCommaSeen
// Seen ',' for CONTEXT
298 , PS_DeclsCommaSeen
// Seen ',' in declarators list
299 , PS_DeclsDeclSeen
// Seen complete decl in decls list
300 , PS_NativeSeen
// Seen a native declaration
301 , PS_PragmaPrefixSyntax
// Could not parse the #pragma prefix
302 , PS_ValueBoxDeclSeen
// Seen complete valuebox declaration
303 , PS_PorttypeSeen
// Seen PORTTYPE keyword
304 , PS_PorttypeIDSeen
// Seen porttype indentifier
305 , PS_PorttypeSqSeen
// Seen '{' for porttype
306 , PS_PorttypeQsSeen
// Seen '}' for porttype
307 , PS_PorttypeBodySeen
// Seen complete porttype body
308 , PS_AnnotationDeclSeen
312 * Choices for how to react to unkown annotations
314 enum Unknown_Annotations
{
315 UNKNOWN_ANNOTATIONS_WARN_ONCE
,
316 UNKNOWN_ANNOTATIONS_WARN_ALL
,
317 UNKNOWN_ANNOTATIONS_ERROR
,
318 UNKNOWN_ANNOTATIONS_IGNORE
325 UTL_ScopeStack
&scopes (); // Scopes stack
327 AST_Root
*root (); // Root of AST
328 void set_root (AST_Root
*); // Set it
330 AST_Generator
*gen (); // Generator
331 void set_gen (AST_Generator
*); // Set it
333 AST_ValueType
*primary_key_base (); // PrimaryKeyBase
334 void primary_key_base (AST_ValueType
*); // Set it
336 UTL_Error
*err (); // Error reporter
337 void set_err (UTL_Error
*); // Set it
339 int err_count (); // How many errors?
340 void set_err_count (int); // Set it
342 long lineno (); // Where in file?
343 void set_lineno (long); // Set it
345 UTL_String
*filename (); // What file?
346 void set_filename (UTL_String
*); // Set it
348 UTL_String
*main_filename (); // What's the main
350 void set_main_filename (UTL_String
*);
353 UTL_String
*real_filename (); // What's the real
355 void set_real_filename (UTL_String
*);
358 UTL_String
*stripped_filename (); // Stripped filename
359 void set_stripped_filename (UTL_String
*); // Set it
361 bool imported (); // Are we imported?
362 bool import (); // Is import on?
363 void set_import (bool); // Set it
365 bool in_main_file (); // Are we?
366 void set_in_main_file (bool); // Set it
368 const char *prog_name (); // Invoked as..
369 void set_prog_name (const char *); // Set it
371 const char *cpp_location (); // Where's CPP?
372 void set_cpp_location (const char *);// Set it
374 long compile_flags (); // What flags are on?
375 void set_compile_flags (long); // Turn some on or off
377 char *local_escapes (); // Get local escapes
378 void set_local_escapes (const char *);// Set it
380 UTL_Indenter
*indent (); // Get indenter
381 void set_indent (UTL_Indenter
*); // Set it
383 void store_include_file_name (UTL_String
*);
385 UTL_String
**include_file_names (); // Array of file names
386 void set_include_file_names (UTL_String
**); // Set it
388 unsigned long n_include_file_names (); // How many
389 void set_n_include_file_names (unsigned long n
);
391 void reset_flag_seen ();
393 // = Types & methods supporting DDS DCPS sequence definitions (from #pragma)
394 typedef ACE_Unbounded_Queue
<char *> DCPS_Sequence_Types_List
;
397 // = Types & methods supporting DDS DCPS data type/key definition (from #pragma)
398 typedef ACE_Unbounded_Queue
<ACE_TString
> DCPS_Key_List
;
400 struct DCPS_Data_Type_Info
402 UTL_ScopedName
*name_
;
403 DCPS_Key_List key_list_
;
406 typedef ACE_Unbounded_Queue_Iterator
<ACE_TString
> DCPS_Data_Type_Info_Iter
;
408 typedef ACE_Hash_Map_Manager_Ex
< const char*,
409 DCPS_Data_Type_Info
*,
415 // FE calls when #pragma DCPS_DATA_TYPE is processed
416 void add_dcps_data_type (const char* id
);
418 // FE calls when #pragma DCPS_DATA_KEY is processed
419 bool add_dcps_data_key (const char* id
, const char* key
);
421 // returns null if not matching; otherwise pointer to the info
422 DCPS_Data_Type_Info
* is_dcps_type (UTL_ScopedName
* target
);
424 // FE calls when #pragma DCPS_SUPPORT_ZERO_COPY_READ is processed
425 void dcps_support_zero_copy_read (bool value
);
427 // BE calls to check the status of zero-copy read support
428 bool dcps_support_zero_copy_read () const;
430 // FE calls when #pragma DCPS_DATA_SEQUENCE_TYPE is processed
431 void set_dcps_sequence_type (const char* seq_type
);
433 // BE calls to check whether pragma for this sequence has been set
434 bool dcps_sequence_type_defined (const char* seq_type
);
436 // FE calls when #pragma DCPS_GEN_ZERO_COPY_READ is processed
437 void dcps_gen_zero_copy_read (bool value
);
439 // BE calls to check the status of zero-copy read support
440 bool dcps_gen_zero_copy_read () const;
442 // = Access methods to deal with other IDL files included in the main
443 // IDL file. These IDL files are exactly the same strings that are
444 // "#include"d in the main IDL file, not the ones after CC
445 // preprocessor parsed the file.
447 // Just storing the pointer. No memory will be allocated.
448 void add_to_included_idl_files (const char *file_name
);
450 // Get all the files.
451 char** included_idl_files ();
453 // The number of currently availabe include files.
454 size_t n_included_idl_files ();
456 // Set the number of included_idl_files. Use this carefully. This
457 // method is used when we validate all the #included idl files,
458 // against the ones that we get after preprocessing.
459 void n_included_idl_files (size_t n
);
461 ParseState
parse_state (); // What state we're in
462 void set_parse_state (ParseState s
); // Set it
464 UTL_String
*idl_src_file ();
465 // Returns the IDL source file being compiled.
467 void idl_src_file (UTL_String
*);
468 // Set the source IDL file that is being parsed.
470 void temp_dir (const char *s
);
471 // Set the directory where the IDL compiler can keep all its temp
472 // files. By default, IDL compiler looks for TEMP env variable and
473 // if it is not set, "/tmp/" is assigned.
475 const char *temp_dir () const;
476 // Get the directory where the IDL compiler can keep all its temp
477 // files. By default, IDL compiler looks for TEMP env variable and
478 // if it is not set, "/tmp/" is assigned.
480 void tao_root (const char *s
);
481 // Set the path of TAO_ROOT.
483 const char *tao_root () const;
484 // Get the path for TAO_ROOT.
486 void gperf_path (const char *s
);
487 // Set the path for the perfect hashing program (GPERF).
489 const char *gperf_path () const;
490 // Get the path for the perfect hashing program (GPERF).
492 void ident_string (const char *s
);
493 // Set the value of the #ident string.
495 const char *ident_string () const;
496 // Get the value of the #ident string.
498 void case_diff_error (bool);
499 // report an error (1) for indentifiers in the same scope
500 // that differ only by case, or report a warning (0).
502 bool case_diff_error ();
503 // are we strict about case-only differences or not?
505 void nest_orb (bool);
506 // Set on or off whether we are using the NEST ORB.
509 // are we beIng used with the NEST ORB?
514 void append_idl_flag (const char *s
);
515 // Save each flag passed to the IDL compiler.
517 const char *idl_flags () const;
518 // Get a string representation of the flags
519 // passed to the idl compiler.
521 ACE_Hash_Map_Manager
<ACE_CString
, int, ACE_Null_Mutex
> &
523 // Accessor for the IDL keyword container.
525 ACE_Unbounded_Stack
<char *> & pragma_prefixes ();
526 // Accessor for the pragma prefix container.
528 void update_prefix (char *filename
);
529 // Do repo id prefix bookkeeping when the file changes.
531 long seen_include_file_before (char *);
532 // Seen this include before?
534 long last_seen_index () const;
535 void last_seen_index (long val
);
536 // Accessors for last_seen_index_ member.
538 bool preserve_cpp_keywords ();
539 // Whether we should not mung idl element names that are
540 // C++ keywords e.g. delete, operator etc. with _cxx_ prefix.
541 // Should be true when being used by the IFR Service
543 void preserve_cpp_keywords (bool);
544 // Set whether we should not mung idl element names that are C++
545 // keywords e.g. delete, operator etc. with _cxx_ prefix.
546 // Is set by the IFR Service.
548 void add_include_path (const char *s
, bool is_system
);
549 // Add another path to 'include_paths_'. is_system is true for TAO/CIAO
550 // specific paths and false for paths provided by user.
552 void add_rel_include_path (const char *s
);
553 ACE_Unbounded_Queue
<char *> const & rel_include_paths () const;
554 // Accessor/mutator for the rel_include_paths_ member.
556 void add_ciao_lem_file_names (const char *s
);
557 ACE_Unbounded_Queue
<char *> & ciao_lem_file_names ();
558 // Accessor/mutator for the ciao_lem_file_names_ member.
560 void add_ciao_rti_ts_file_names (const char *s
);
561 ACE_Unbounded_Queue
<char *> & ciao_rti_ts_file_names ();
562 // Accessor/mutator for the ciao_rti_ts_file_names_ member.
564 void add_ciao_spl_ts_file_names (const char *s
);
565 ACE_Unbounded_Queue
<char *> & ciao_spl_ts_file_names ();
566 // Accessor/mutator for the ciao_spl_ts_file_names_ member.
568 void add_ciao_oci_ts_file_names (const char *s
);
569 ACE_Unbounded_Queue
<char *> & ciao_oci_ts_file_names ();
570 // Accessor/mutator for the ciao_oci_ts_file_names_ member.
572 void add_ciao_coredx_ts_file_names (const char *s
);
573 ACE_Unbounded_Queue
<char *> & ciao_coredx_ts_file_names ();
574 // Accessor/mutator for the ciao_coredx_ts_file_names_ member.
576 void add_ciao_ami_iface_names (const char *s
);
577 ACE_Unbounded_Queue
<char *> & ciao_ami_iface_names ();
578 // Accessor/mutator for the ciao_ami_iface_names_ member.
580 void add_ciao_ami_recep_names (const char *s
);
581 ACE_Unbounded_Queue
<char *> & ciao_ami_recep_names ();
582 // Accessor/mutator for the ciao_ami_recep_names_ member.
584 void add_included_ami_recep_names (const char *s
);
585 ACE_Unbounded_Queue
<char *> & included_ami_recep_names ();
586 // Accessor/mutator for the included_ami_recep_names_ member.
588 bool included_ami_receps_done () const;
589 void included_ami_receps_done (bool val
);
591 void add_ciao_ami_idl_fnames (const char *s
);
592 ACE_Unbounded_Queue
<char *> & ciao_ami_idl_fnames ();
593 // Accessor/mutator for the included_ami_idl_fnames_ member.
595 void add_dds4ccm_impl_fnames (const char *s
);
596 ACE_Unbounded_Queue
<char *> & dds4ccm_impl_fnames ();
597 // Accessor mutator for the dds4ccm_impl_fnames_ member.
599 ACE_Unbounded_Queue
<AST_Interface
*> & mixed_parentage_interfaces ();
600 // Accessor for the member
602 ACE_Hash_Map_Manager
<char *, char *, ACE_Null_Mutex
> &
604 // Accessor for the IDL file prefix container.
606 bool pass_orb_idl () const;
607 void pass_orb_idl (bool val
);
608 // Accessor for the pass_orb_idl_ member.
610 bool using_ifr_backend () const;
611 void using_ifr_backend (bool val
);
612 // Accessor for the using_ifr_backend_ member.
614 bool ignore_idl3 () const;
615 void ignore_idl3 (bool val
);
616 // Accessor for the ignore_idl3_ member.
619 // Currently called only from IDL backend, but could be useful elsewhere.
622 // Do final cleanup just before process exits.
624 ACE_Unbounded_Queue
<AST_ValueType
*> &primary_keys ();
625 // Accessor for the member.
627 void check_primary_keys ();
628 // Called affer yy_parse() returns - iterates over our list
629 // of primary keys. Must be called this late so that we can
630 // be sure that all forward declared stucts or unions that
631 // might be used in such a valuetype are fully defined.
633 const char *recursion_start () const;
634 void recursion_start (const char *val
);
635 // Accessors for the member.
637 bool multi_file_input () const;
638 void multi_file_input (bool val
);
639 // Accessors for the member.
641 const char *big_file_name () const;
642 // Just get the const string.
644 FE_Utils::T_PARAMLIST_INFO
const *current_params () const;
645 void current_params (FE_Utils::T_PARAMLIST_INFO
*params
);
646 // Accessors for the member. If UTL_Scope::lookup_by_name()
647 // has a 0 result, it will check this param list (if it is not
648 // 0, meaning we are in the scope of a template module) for a
649 // match before returning, in case it is processing a
650 // referenced template parameter of the eclosing template
653 UTL_StrList
const *alias_params () const;
654 void alias_params (UTL_StrList
*params
);
655 // Accessors for the member. If we are parsing a template
656 // module reference, we traverse the scope of the referenced
657 // template module, but create param holders with the
660 UTL_StrList
const *for_new_holder () const;
661 void for_new_holder (UTL_StrList
*params
);
662 // Accessors for the member. If a lookup matches something
663 // from current_params(), the actual created param holder must
664 // match the corresponding element on this list, if it is
667 AST_Module
*corba_module () const;
668 void corba_module (AST_Module
*m
);
669 // Accessors for the member.
671 struct Include_Path_Info
677 typedef ACE_Unbounded_Queue
<Include_Path_Info
>
678 Unbounded_Paths_Queue
;
679 typedef ACE_Unbounded_Queue_Iterator
<Include_Path_Info
>
680 Unbounded_Paths_Queue_Iterator
;
682 Unbounded_Paths_Queue
&include_paths ();
683 // Accessor for the member.
685 enum ANON_TYPE_DIAGNOSTIC
691 // Determines which type of diagnostic to emit, if any, upon
692 // detecting the presence of an anonymous IDL construct.
694 void anon_type_diagnostic (ANON_TYPE_DIAGNOSTIC val
);
695 // Mutator for the member.
697 /// Has anon_type_diagnostic () been called?
698 bool explicit_anon_type_diagnostic () const;
700 bool anon_error () const;
701 bool anon_warning () const;
702 bool anon_silent () const;
703 // Simple checks for the value of anon_type_diagnostic_.
705 bool in_typedef () const;
706 void in_typedef (bool val
);
707 // Accessors for the member.
709 bool in_tmpl_mod_no_alias () const;
710 void in_tmpl_mod_no_alias (bool val
);
711 // Accessors for the member.
713 bool in_tmpl_mod_alias () const;
714 void in_tmpl_mod_alias (bool val
);
715 // Accessors for the member.
718 * Convenience function that causes the program to exit with the given return
719 * status after returning from parsing arguments.
721 void parse_args_exit (int status
);
724 * Convenience function that causes the program to print version and exit
725 * with an success return code after returning from parsing arguments.
727 void print_version ();
730 * Convenience function that causes the program to print help and exit
731 * with an success return code after returning from parsing arguments.
736 * Returns true if warnings are to be shown
738 bool print_warnings ();
741 * Eval string as though it was included in the IDL file. Results are added
742 * to the Abstract Syntax Tree. It was added for use in be_post_init. THIS
743 * SHOULD NOT BE CALLED WHILE IN THE MIDDLE OF PARSING.
745 void eval (const char *string
, bool disable_output
= false);
748 * Dump AST after parsing files and exit
752 /// flags for types of declarations seen while parsing.
754 bool abstract_iface_seen_
;
755 bool abstractbase_seen_
;
756 bool aggregate_seen_
;
757 bool ambiguous_type_seen_
;
762 bool array_seq_seen_
;
763 bool base_object_seen_
;
764 bool basic_type_seen_
;
765 bool bd_string_seen_
;
766 bool boolean_seq_seen_
;
768 bool component_seen_
;
769 bool connector_seen_
;
770 bool double_seq_seen_
;
772 bool exception_seen_
;
773 bool fixed_array_decl_seen_
;
774 bool fixed_size_decl_seen_
;
775 bool float_seq_seen_
;
776 bool fwd_iface_seen_
;
777 bool fwd_valuetype_seen_
;
778 bool iface_seq_seen_
;
779 bool interface_seen_
;
780 bool local_iface_seen_
;
782 bool longdouble_seq_seen_
;
783 bool longlong_seq_seen_
;
784 bool non_local_fwd_iface_seen_
;
785 bool non_local_iface_seen_
;
786 bool non_local_op_seen_
;
787 bool object_arg_seen_
;
788 bool octet_seq_seen_
;
789 bool octet_map_seen_
;
790 bool operation_seen_
;
791 bool pseudo_seq_seen_
;
792 bool recursive_type_seen_
;
795 bool short_seq_seen_
;
796 bool special_basic_decl_seen_
;
798 bool string_member_seen_
;
799 bool string_seq_seen_
;
801 bool ub_string_seen_
;
802 bool ulong_seq_seen_
;
803 bool ulonglong_seq_seen_
;
805 bool ushort_seq_seen_
;
806 bool valuebase_seen_
;
807 bool valuefactory_seen_
;
808 bool valuetype_seen_
;
809 bool var_array_decl_seen_
;
810 bool var_size_decl_seen_
;
812 bool wchar_seq_seen_
;
813 bool wstring_seq_seen_
;
814 bool dds_connector_seen_
;
815 bool ami_connector_seen_
;
818 /// flag to force generation of skeleton includes (see bug #2419).
819 bool need_skeleton_includes_
;
822 * Version of IDL to enforce
824 IdlVersion idl_version_
;
827 * Default version of IDL to enforce. Compilers extending tao_idl coould set
828 * idl_version_ directly, but this allows Can be set to allow
829 * --default-idl-version to print an accuate default IDL version.
831 IdlVersion default_idl_version_
;
834 * Perform the compilation process right up until invoking the backend.
835 * In other words just check the syntax of the input files, do not create
841 * Exit when finished processing cli arguments
844 bool parse_args_exit_
;
847 * If parse_args_exit_ is true, this is the program status to return from
851 int parse_args_exit_status_
;
854 * Print command line argument help message when finished processing
860 * Print compiler version when finished processing cli arguments.
865 * If true, we are inside the eval() function
870 * Dump constructs defined using eval() if true.
875 * If true, Dump only the IDL defined using eval() and exit using
878 bool just_dump_builtins_
;
881 * Exit right before parsing input files.
886 * If true, silently ignore lookup errors.
888 bool ignore_lookup_errors_
;
891 * Reaction to unknown annotations
893 Unknown_Annotations unknown_annotations_
;
896 * Set of the local names of unkown annotations already seen
898 ACE_Unbounded_Set
<Identifier
> unknown_annotations_seen_
;
902 UTL_ScopeStack pd_scopes
; // Store scopes stack
903 AST_Root
*pd_root
; // Store AST root
904 AST_Generator
*pd_gen
; // Store generator
905 AST_ValueType
*pd_primary_key_base
; // Store PrimaryKeyBase
906 UTL_Error
*pd_err
; // Error object
907 int pd_err_count
; // Count of errors
908 long pd_lineno
; // What line #
909 UTL_String
*pd_filename
; // What file
910 UTL_String
*pd_main_filename
; // What main filename
911 UTL_String
*pd_real_filename
; // What real filename
912 UTL_String
*pd_stripped_filename
; // Stripped filename
913 bool pd_import
; // Is import on?
914 bool pd_in_main_file
; // Are we in it?
915 const char *pd_prog_name
; // Argv[0]
916 const char *pd_cpp_location
; // Where to find CPP
917 long pd_compile_flags
; // Compile flags
918 char *pd_local_escapes
; // Trapdoor argument
919 UTL_Indenter
*pd_indent
; // Indent object
920 // as it's being built
921 UTL_String
**pd_include_file_names
;// Array of file names.
922 unsigned long pd_n_include_file_names
;// How many.
923 unsigned long pd_n_alloced_file_names
;// How many alloced.
925 char **included_idl_files_
;
926 // IDL files that are "#include'd.
928 size_t n_included_idl_files_
;
929 // The number of such idl files that are currently stored.
931 size_t n_allocated_idl_files_
;
932 // For char*'s have been allocated for this.
934 ParseState pd_parse_state
; // Parse state we're in.
936 UTL_String
*pd_idl_src_file
; // IDL source file.
939 // Needed if orb.idl is included.
942 // Path for the perfect hash generator(gperf) program. Default
943 // is $ACE_ROOT/bin/gperf.
946 // Temp directory where which we can rewsolve in drv_preproc.cpp by
947 // checking for TEMP env variable otherwise we assign to /tmp/.
950 // Holds a string that begins with #ident, to be passed from the IDL
951 // file to the generated files.
953 bool case_diff_error_
;
954 // Do we report an error for indentifiers in the same scope that differ
955 // only by case? or just a warning?
958 // Is this front end being used for the NEST ORB?
960 ACE_CString idl_flags_
;
961 // Concatenation of all the command line options.
963 ACE_Hash_Map_Manager
<ACE_CString
, int, ACE_Null_Mutex
> idl_keywords_
;
964 // Container for all the IDL keywords so local names can be checked.
966 ACE_Unbounded_Stack
<char *> pragma_prefixes_
;
967 // Container for all the #pragma prefix declarations.
969 bool preserve_cpp_keywords_
;
970 // Do we allow C++ keywords as identifiers in the idl to stay as they are ?
972 Unbounded_Paths_Queue include_paths_
;
973 // List of -I options passed to us.
975 ACE_Unbounded_Queue
<char *> rel_include_paths_
;
976 // Used by backends with the -r option.
978 ACE_Hash_Map_Manager
<char *, char *, ACE_Null_Mutex
> file_prefixes_
;
979 // Associates a prefix with a file.
982 // Treat orb.idl like any other included IDL file.
984 bool using_ifr_backend_
;
985 // Set by the IFR backend itself.
988 // Need this for eventtypes left over after running idl3_to_idl2,
989 // we don't want to try to generate another event consumer.
990 DCPS_Type_Info_Map dcps_type_info_map_
;
991 // Map of #pragma DCPS_DATA_TYPE and DCPS_DATA_KEY infomation.
993 DCPS_Sequence_Types_List dcps_sequence_types_list_
;
995 bool dcps_support_zero_copy_read_
;
996 // Are we enabled to support DCPS zero-copy read.
997 // Need this flag to avoid generating wrong code for pre v0.12 DDS
998 // with new TAO_IDL compiler.
1000 bool dcps_gen_zero_copy_read_
;
1001 // Are we generating code insupport of DCPS zero-copy read data sequences?
1003 ACE_Unbounded_Queue
<AST_ValueType
*>primary_keys_
;
1004 // List of valuetypes used as a primary key.
1006 char *recursion_start_
;
1007 // Path to directory subtree we are iterating/recursing over.
1008 // Not used by all backends.
1010 bool multi_file_input_
;
1011 // Some backends process multiple files to a single output.
1013 const char *big_file_name_
;
1014 // Used if the above flag is set.
1016 FE_Utils::T_PARAMLIST_INFO
*current_params_
;
1017 // Stored if we are parsing the scope of a template module,
1018 // 0 otherwise. Contains the params of the referenced
1019 // template module if we are traversing an alias.
1021 UTL_StrList
*alias_params_
;
1022 // Stored if we are parsing a template module reference. The
1023 // scope traversed will be that of the referenced template
1024 // module, but the param holder(s) created will use the
1027 UTL_StrList
*for_new_holder_
;
1028 // Stored if we are traversing an alias, this is a list of
1029 // the enclosing template module's params. When we create
1030 // a param holder, it will need this name rather than the
1031 // name of the alias's referenced param.
1033 ACE_Unbounded_Queue
<char *> ciao_lem_file_names_
;
1034 // Files parsed with ciao lem pragma
1036 ACE_Unbounded_Queue
<char *> ciao_rti_ts_file_names_
;
1037 // Files parsed with RTI typesupport pragma
1039 ACE_Unbounded_Queue
<char *> ciao_spl_ts_file_names_
;
1040 // Files parsed with OpenSplice typesupport pragma
1042 ACE_Unbounded_Queue
<char *> ciao_oci_ts_file_names_
;
1043 // Files parsed with OpenDDS typesupport pragma
1045 ACE_Unbounded_Queue
<char *> ciao_coredx_ts_file_names_
;
1046 // Files parsed with CoreDX typesupport pragma
1048 ACE_Unbounded_Queue
<char *> ciao_ami_iface_names_
;
1049 // Interfaces that get a reply handler generated for AMI4CCM.
1051 ACE_Unbounded_Queue
<char *> ciao_ami_recep_names_
;
1052 // Receptacles that get a sendc_ version added for AMI4CCM.
1054 ACE_Unbounded_Queue
<char *> included_ami_recep_names_
;
1055 // We need to do something different with these...
1057 bool included_ami_receps_done_
;
1058 // ...but we need to do it only once.
1060 ACE_Unbounded_Queue
<char *> ciao_ami_idl_fnames_
;
1061 // Stores directives from #pragma ciao ami4ccm idl "xxx"
1062 // or #pragma ami4ccm idl "xxx".
1064 ACE_Unbounded_Queue
<char *> dds4ccm_impl_fnames_
;
1065 // Stores directives from #pragma dds4ccm impl "xxx".
1068 * Used in the generation of overrides for CORBA::release and
1069 * CORBA::is_nil, needed when the interface inherits versions from
1070 * both CORBA::Object and CORBA::AbstractBase.
1072 ACE_Unbounded_Queue
<AST_Interface
*> mixed_parentage_interfaces_
;
1074 /// For quick access.
1075 AST_Module
*corba_module_
;
1077 ANON_TYPE_DIAGNOSTIC anon_type_diagnostic_
;
1078 bool explicit_anon_type_diagnostic_
;
1080 /// Flag set in parser so we can decide whether to emit
1081 /// an anonymous type diagnostic.
1084 /// Used during AST creation, corresponding flag in each
1085 /// AST_Decl created is set to this flag's value.
1086 bool in_tmpl_mod_no_alias_
;
1088 /// Disables the error check faciliated by the above flag.
1089 /// No errors are possible because created nodes are all
1091 bool in_tmpl_mod_alias_
;
1094 #endif //_IDL_IDL_GLOBAL_HH