Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / TAO_IDL / include / idl_global.h
blobd00dffdcbd866a2b606b05f8ac0cb1975a9b0279
1 /*
3 COPYRIGHT
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
49 52.227-19.
51 Sun, Sun Microsystems and the Sun logo are trademarks or registered
52 trademarks of Sun Microsystems, Inc.
54 SunSoft, Inc.
55 2550 Garcia Avenue
56 Mountain View, California 94043
58 NOTE:
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"
79 #include "fe_utils.h"
80 #include "idl_version.h"
82 class AST_Root;
83 class AST_Module;
84 class AST_Interface;
85 class AST_ValueType;
86 class AST_Component;
87 class AST_Uses;
88 class AST_Generator;
89 class UTL_Error;
90 class UTL_String;
91 class UTL_Indenter;
93 /**
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
101 public:
102 // Types
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
107 enum ParseState {
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_SequenceSeen // Seen a SEQUENCE keyword
238 , PS_SequenceSqSeen // Seen '<' for sequence
239 , PS_SequenceQsSeen // Seen '>' for sequence
240 , PS_SequenceTypeSeen // Seen type decl for sequence
241 , PS_SequenceCommaSeen // Seen comma for sequence
242 , PS_SequenceExprSeen // Seen size expression for sequence
243 , PS_StringSeen // Seen a STRING keyword
244 , PS_StringSqSeen // Seen '<' for string
245 , PS_StringQsSeen // Seen '>' for string
246 , PS_StringExprSeen // Seen size expression for string
247 , PS_StringCompleted // Seen a string decl without size spec
248 , PS_ArrayIDSeen // Seen array ID
249 , PS_ArrayCompleted // Seen completed array declaration
250 , PS_DimSqSeen // Seen '[' for array dimension
251 , PS_DimQsSeen // Seen ']' for array dimension
252 , PS_DimExprSeen // Seen size expression for array dimension
253 , PS_AttrROSeen // Seen READONLY keyword
254 , PS_AttrSeen // Seen ATTRIBUTE keyword
255 , PS_AttrTypeSeen // Seen type decl for attribute
256 , PS_AttrDeclsSeen // Seen declarators for attribute
257 , PS_AttrCompleted // Seen complete attribute declaration
258 , PS_ExceptSeen // Seen EXCEPTION keyword
259 , PS_ExceptIDSeen // Seen exception identifier
260 , PS_ExceptSqSeen // Seen '{' for exception
261 , PS_ExceptQsSeen // Seen '}' for exception
262 , PS_ExceptBodySeen // Seen complete exception body
263 , PS_OpAttrSeen // Seen operation attribute
264 , PS_OpTypeSeen // Seen operation return type
265 , PS_OpIDSeen // Seen operation ID
266 , PS_OpParsCompleted // Completed operation param list
267 , PS_OpRaiseCompleted // Completed operation except list
268 , PS_OpGetRaiseCompleted // Completed attribute get except list
269 , PS_OpSetRaiseCompleted // Completed attribute set except list
270 , PS_OpContextCompleted // Completed operation context spec
271 , PS_OpCompleted // Completed operation statement
272 , PS_OpSqSeen // Seen '(' for operation
273 , PS_OpQsSeen // Seen ')' for operation
274 , PS_OpParCommaSeen // Seen ',' in list of op params
275 , PS_OpParDirSeen // Seen parameter direction
276 , PS_OpParTypeSeen // Seen parameter type
277 , PS_OpParDeclSeen // Seen parameter declaration
278 , PS_OpRaiseSeen // Seen RAISES keyword
279 , PS_OpRaiseSqSeen // Seen '(' for RAISES
280 , PS_OpRaiseQsSeen // Seen ')' for RAISES
281 , PS_OpGetRaiseSeen // Seen GETRAISES keyword
282 , PS_OpGetRaiseSqSeen // Seen '(' for GETRAISES
283 , PS_OpGetRaiseQsSeen // Seen ')' for GETRAISES
284 , PS_OpSetRaiseSeen // Seen SETRAISES keyword
285 , PS_OpSetRaiseSqSeen // Seen '(' for SETRAISES
286 , PS_OpSetRaiseQsSeen // Seen ')' for SETRAISES
287 , PS_OpContextSeen // Seen CONTEXT keyword
288 , PS_OpContextSqSeen // Seen '(' for CONTEXT
289 , PS_OpContextQsSeen // Seen ')' for CONTEXT
290 , PS_OpContextCommaSeen // Seen ',' for CONTEXT
291 , PS_DeclsCommaSeen // Seen ',' in declarators list
292 , PS_DeclsDeclSeen // Seen complete decl in decls list
293 , PS_NativeSeen // Seen a native declaration
294 , PS_PragmaPrefixSyntax // Could not parse the #pragma prefix
295 , PS_ValueBoxDeclSeen // Seen complete valuebox declaration
296 , PS_PorttypeSeen // Seen PORTTYPE keyword
297 , PS_PorttypeIDSeen // Seen porttype indentifier
298 , PS_PorttypeSqSeen // Seen '{' for porttype
299 , PS_PorttypeQsSeen // Seen '}' for porttype
300 , PS_PorttypeBodySeen // Seen complete porttype body
301 , PS_AnnotationDeclSeen
305 * Choices for how to react to unkown annotations
307 enum Unknown_Annotations {
308 UNKNOWN_ANNOTATIONS_WARN_ONCE,
309 UNKNOWN_ANNOTATIONS_WARN_ALL,
310 UNKNOWN_ANNOTATIONS_ERROR,
311 UNKNOWN_ANNOTATIONS_IGNORE
314 IDL_GlobalData (void);
315 ~IDL_GlobalData (void);
317 // Operations
318 UTL_ScopeStack &scopes (void); // Scopes stack
320 AST_Root *root (void); // Root of AST
321 void set_root (AST_Root *); // Set it
323 AST_Generator *gen (void); // Generator
324 void set_gen (AST_Generator *); // Set it
326 AST_ValueType *primary_key_base (void); // PrimaryKeyBase
327 void primary_key_base (AST_ValueType *); // Set it
329 UTL_Error *err (void); // Error reporter
330 void set_err (UTL_Error *); // Set it
332 int err_count (void); // How many errors?
333 void set_err_count (int); // Set it
335 long lineno (void); // Where in file?
336 void set_lineno (long); // Set it
338 UTL_String *filename (void); // What file?
339 void set_filename (UTL_String *); // Set it
341 UTL_String *main_filename (void); // What's the main
342 // file name?
343 void set_main_filename (UTL_String *);
344 // Set it
346 UTL_String *real_filename (void); // What's the real
347 // file name?
348 void set_real_filename (UTL_String *);
349 // Set it
351 UTL_String *stripped_filename (void); // Stripped filename
352 void set_stripped_filename (UTL_String *); // Set it
354 bool imported (void); // Are we imported?
355 bool import (void); // Is import on?
356 void set_import (bool); // Set it
358 bool in_main_file (void); // Are we?
359 void set_in_main_file (bool); // Set it
361 const char *prog_name (void); // Invoked as..
362 void set_prog_name (const char *); // Set it
364 const char *cpp_location (void); // Where's CPP?
365 void set_cpp_location (const char *);// Set it
367 long compile_flags (void); // What flags are on?
368 void set_compile_flags (long); // Turn some on or off
370 char *local_escapes (void); // Get local escapes
371 void set_local_escapes (const char *);// Set it
373 UTL_Indenter *indent (void); // Get indenter
374 void set_indent (UTL_Indenter *); // Set it
376 void store_include_file_name (UTL_String *);
378 UTL_String **include_file_names (void); // Array of file names
379 void set_include_file_names (UTL_String **); // Set it
381 unsigned long n_include_file_names (void); // How many
382 void set_n_include_file_names (unsigned long n);
384 void reset_flag_seen (void);
386 // = Types & methods supporting DDS DCPS sequence definitions (from #pragma)
387 typedef ACE_Unbounded_Queue<char *> DCPS_Sequence_Types_List;
390 // = Types & methods supporting DDS DCPS data type/key definition (from #pragma)
391 typedef ACE_Unbounded_Queue<ACE_TString> DCPS_Key_List;
393 struct DCPS_Data_Type_Info
395 UTL_ScopedName *name_;
396 DCPS_Key_List key_list_;
399 typedef ACE_Unbounded_Queue_Iterator<ACE_TString> DCPS_Data_Type_Info_Iter;
401 typedef ACE_Hash_Map_Manager_Ex< const char*,
402 DCPS_Data_Type_Info*,
403 ACE_Hash<char*>,
404 ACE_Equal_To<char*>,
405 ACE_Null_Mutex>
406 DCPS_Type_Info_Map;
408 // FE calls when #pragma DCPS_DATA_TYPE is processed
409 void add_dcps_data_type (const char* id);
411 // FE calls when #pragma DCPS_DATA_KEY is processed
412 bool add_dcps_data_key (const char* id, const char* key);
414 // returns null if not matching; otherwise pointer to the info
415 DCPS_Data_Type_Info* is_dcps_type (UTL_ScopedName* target);
417 // FE calls when #pragma DCPS_SUPPORT_ZERO_COPY_READ is processed
418 void dcps_support_zero_copy_read (bool value);
420 // BE calls to check the status of zero-copy read support
421 bool dcps_support_zero_copy_read (void) const;
423 // FE calls when #pragma DCPS_DATA_SEQUENCE_TYPE is processed
424 void set_dcps_sequence_type (const char* seq_type);
426 // BE calls to check whether pragma for this sequence has been set
427 bool dcps_sequence_type_defined (const char* seq_type);
429 // FE calls when #pragma DCPS_GEN_ZERO_COPY_READ is processed
430 void dcps_gen_zero_copy_read (bool value);
432 // BE calls to check the status of zero-copy read support
433 bool dcps_gen_zero_copy_read (void) const;
435 // = Access methods to deal with other IDL files included in the main
436 // IDL file. These IDL files are exactly the same strings that are
437 // "#include"d in the main IDL file, not the ones after CC
438 // preprocessor parsed the file.
440 // Just storing the pointer. No memory will be allocated.
441 void add_to_included_idl_files (const char *file_name);
443 // Get all the files.
444 char** included_idl_files (void);
446 // The number of currently availabe include files.
447 size_t n_included_idl_files (void);
449 // Set the number of included_idl_files. Use this carefully. This
450 // method is used when we validate all the #included idl files,
451 // against the ones that we get after preprocessing.
452 void n_included_idl_files (size_t n);
454 ParseState parse_state (void); // What state we're in
455 void set_parse_state (ParseState s); // Set it
457 UTL_String *idl_src_file (void);
458 // Returns the IDL source file being compiled.
460 void idl_src_file (UTL_String *);
461 // Set the source IDL file that is being parsed.
463 void temp_dir (const char *s);
464 // Set the directory where the IDL compiler can keep all its temp
465 // files. By default, IDL compiler looks for TEMP env variable and
466 // if it is not set, "/tmp/" is assigned.
468 const char *temp_dir (void) const;
469 // Get the directory where the IDL compiler can keep all its temp
470 // files. By default, IDL compiler looks for TEMP env variable and
471 // if it is not set, "/tmp/" is assigned.
473 void tao_root (const char *s);
474 // Set the path of TAO_ROOT.
476 const char *tao_root (void) const;
477 // Get the path for TAO_ROOT.
479 void gperf_path (const char *s);
480 // Set the path for the perfect hashing program (GPERF).
482 const char *gperf_path (void) const;
483 // Get the path for the perfect hashing program (GPERF).
485 void ident_string (const char *s);
486 // Set the value of the #ident string.
488 const char *ident_string (void) const;
489 // Get the value of the #ident string.
491 void case_diff_error (bool);
492 // report an error (1) for indentifiers in the same scope
493 // that differ only by case, or report a warning (0).
495 bool case_diff_error (void);
496 // are we strict about case-only differences or not?
498 void nest_orb (bool);
499 // Set on or off whether we are using the NEST ORB.
501 bool nest_orb (void);
502 // are we beIng used with the NEST ORB?
504 void destroy (void);
505 // Cleanup function.
507 void append_idl_flag (const char *s);
508 // Save each flag passed to the IDL compiler.
510 const char *idl_flags (void) const;
511 // Get a string representation of the flags
512 // passed to the idl compiler.
514 ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex> &
515 idl_keywords (void);
516 // Accessor for the IDL keyword container.
518 ACE_Unbounded_Stack<char *> & pragma_prefixes (void);
519 // Accessor for the pragma prefix container.
521 void update_prefix (char *filename);
522 // Do repo id prefix bookkeeping when the file changes.
524 long seen_include_file_before (char *);
525 // Seen this include before?
527 long last_seen_index (void) const;
528 void last_seen_index (long val);
529 // Accessors for last_seen_index_ member.
531 bool preserve_cpp_keywords (void);
532 // Whether we should not mung idl element names that are
533 // C++ keywords e.g. delete, operator etc. with _cxx_ prefix.
534 // Should be true when being used by the IFR Service
536 void preserve_cpp_keywords (bool);
537 // Set whether we should not mung idl element names that are C++
538 // keywords e.g. delete, operator etc. with _cxx_ prefix.
539 // Is set by the IFR Service.
541 void add_include_path (const char *s, bool is_system);
542 // Add another path to 'include_paths_'. is_system is true for TAO/CIAO
543 // specific paths and false for paths provided by user.
545 void add_rel_include_path (const char *s);
546 ACE_Unbounded_Queue<char *> const & rel_include_paths (void) const;
547 // Accessor/mutator for the rel_include_paths_ member.
549 void add_ciao_lem_file_names (const char *s);
550 ACE_Unbounded_Queue<char *> & ciao_lem_file_names (void);
551 // Accessor/mutator for the ciao_lem_file_names_ member.
553 void add_ciao_rti_ts_file_names (const char *s);
554 ACE_Unbounded_Queue<char *> & ciao_rti_ts_file_names (void);
555 // Accessor/mutator for the ciao_rti_ts_file_names_ member.
557 void add_ciao_spl_ts_file_names (const char *s);
558 ACE_Unbounded_Queue<char *> & ciao_spl_ts_file_names (void);
559 // Accessor/mutator for the ciao_spl_ts_file_names_ member.
561 void add_ciao_oci_ts_file_names (const char *s);
562 ACE_Unbounded_Queue<char *> & ciao_oci_ts_file_names (void);
563 // Accessor/mutator for the ciao_oci_ts_file_names_ member.
565 void add_ciao_coredx_ts_file_names (const char *s);
566 ACE_Unbounded_Queue<char *> & ciao_coredx_ts_file_names (void);
567 // Accessor/mutator for the ciao_coredx_ts_file_names_ member.
569 void add_ciao_ami_iface_names (const char *s);
570 ACE_Unbounded_Queue<char *> & ciao_ami_iface_names (void);
571 // Accessor/mutator for the ciao_ami_iface_names_ member.
573 void add_ciao_ami_recep_names (const char *s);
574 ACE_Unbounded_Queue<char *> & ciao_ami_recep_names (void);
575 // Accessor/mutator for the ciao_ami_recep_names_ member.
577 void add_included_ami_recep_names (const char *s);
578 ACE_Unbounded_Queue<char *> & included_ami_recep_names (void);
579 // Accessor/mutator for the included_ami_recep_names_ member.
581 bool included_ami_receps_done (void) const;
582 void included_ami_receps_done (bool val);
584 void add_ciao_ami_idl_fnames (const char *s);
585 ACE_Unbounded_Queue<char *> & ciao_ami_idl_fnames (void);
586 // Accessor/mutator for the included_ami_idl_fnames_ member.
588 void add_dds4ccm_impl_fnames (const char *s);
589 ACE_Unbounded_Queue<char *> & dds4ccm_impl_fnames (void);
590 // Accessor mutator for the dds4ccm_impl_fnames_ member.
592 ACE_Unbounded_Queue<AST_Interface *> & mixed_parentage_interfaces (void);
593 // Accessor for the member
595 ACE_Hash_Map_Manager<char *, char *, ACE_Null_Mutex> &
596 file_prefixes (void);
597 // Accessor for the IDL file prefix container.
599 bool pass_orb_idl (void) const;
600 void pass_orb_idl (bool val);
601 // Accessor for the pass_orb_idl_ member.
603 bool using_ifr_backend (void) const;
604 void using_ifr_backend (bool val);
605 // Accessor for the using_ifr_backend_ member.
607 bool ignore_idl3 (void) const;
608 void ignore_idl3 (bool val);
609 // Accessor for the ignore_idl3_ member.
611 int check_gperf (void);
612 // Currently called only from IDL backend, but could be useful elsewhere.
614 void fini (void);
615 // Do final cleanup just before process exits.
617 ACE_Unbounded_Queue<AST_ValueType *> &primary_keys (void);
618 // Accessor for the member.
620 void check_primary_keys (void);
621 // Called affer yy_parse() returns - iterates over our list
622 // of primary keys. Must be called this late so that we can
623 // be sure that all forward declared stucts or unions that
624 // might be used in such a valuetype are fully defined.
626 const char *recursion_start (void) const;
627 void recursion_start (const char *val);
628 // Accessors for the member.
630 bool multi_file_input (void) const;
631 void multi_file_input (bool val);
632 // Accessors for the member.
634 const char *big_file_name (void) const;
635 // Just get the const string.
637 FE_Utils::T_PARAMLIST_INFO const *current_params (void) const;
638 void current_params (FE_Utils::T_PARAMLIST_INFO *params);
639 // Accessors for the member. If UTL_Scope::lookup_by_name()
640 // has a 0 result, it will check this param list (if it is not
641 // 0, meaning we are in the scope of a template module) for a
642 // match before returning, in case it is processing a
643 // referenced template parameter of the eclosing template
644 // module.
646 UTL_StrList const *alias_params (void) const;
647 void alias_params (UTL_StrList *params);
648 // Accessors for the member. If we are parsing a template
649 // module reference, we traverse the scope of the referenced
650 // template module, but create param holders with the
651 // alias names.
653 UTL_StrList const *for_new_holder (void) const;
654 void for_new_holder (UTL_StrList *params);
655 // Accessors for the member. If a lookup matches something
656 // from current_params(), the actual created param holder must
657 // match the corresponding element on this list, if it is
658 // non-zero.
660 #if defined (ACE_OPENVMS)
661 static char* translateName (const char* name, char *name_buf);
662 #endif
664 AST_Module *corba_module (void) const;
665 void corba_module (AST_Module *m);
666 // Accessors for the member.
668 struct Include_Path_Info
670 char *path_;
671 bool is_system_;
674 typedef ACE_Unbounded_Queue<Include_Path_Info>
675 Unbounded_Paths_Queue;
676 typedef ACE_Unbounded_Queue_Iterator<Include_Path_Info>
677 Unbounded_Paths_Queue_Iterator;
679 Unbounded_Paths_Queue &include_paths (void);
680 // Accessor for the member.
682 enum ANON_TYPE_DIAGNOSTIC
684 ANON_TYPE_ERROR,
685 ANON_TYPE_WARNING,
686 ANON_TYPE_SILENT
688 // Determines which type of diagnostic to emit, if any, upon
689 // detecting the presence of an anonymous IDL construct.
691 void anon_type_diagnostic (ANON_TYPE_DIAGNOSTIC val);
692 // Mutator for the member.
694 /// Has anon_type_diagnostic () been called?
695 bool explicit_anon_type_diagnostic () const;
697 bool anon_error (void) const;
698 bool anon_warning (void) const;
699 bool anon_silent (void) const;
700 // Simple checks for the value of anon_type_diagnostic_.
702 bool in_typedef (void) const;
703 void in_typedef (bool val);
704 // Accessors for the member.
706 bool in_tmpl_mod_no_alias (void) const;
707 void in_tmpl_mod_no_alias (bool val);
708 // Accessors for the member.
710 bool in_tmpl_mod_alias (void) const;
711 void in_tmpl_mod_alias (bool val);
712 // Accessors for the member.
715 * Convenience function that causes the program to exit with the given return
716 * status after returning from parsing arguments.
718 void parse_args_exit (int status);
721 * Convenience function that causes the program to print version and exit
722 * with an success return code after returning from parsing arguments.
724 void print_version ();
727 * Convenience function that causes the program to print help and exit
728 * with an success return code after returning from parsing arguments.
730 void print_help ();
733 * Returns true if warnings are to be shown
735 bool print_warnings ();
738 * Eval string as though it was included in the IDL file. Results are added
739 * to the Abstract Syntax Tree. It was added for use in be_post_init. THIS
740 * SHOULD NOT BE CALLED WHILE IN THE MIDDLE OF PARSING.
742 void eval (const char *string, bool disable_output = false);
745 * Dump AST after parsing files and exit
747 void dump_ast ();
749 /// flags for types of declarations seen while parsing.
750 ///{
751 bool abstract_iface_seen_;
752 bool abstractbase_seen_;
753 bool aggregate_seen_;
754 bool ambiguous_type_seen_;
755 bool any_arg_seen_;
756 bool any_seen_;
757 bool any_seq_seen_;
758 bool array_seen_;
759 bool array_seq_seen_;
760 bool base_object_seen_;
761 bool basic_type_seen_;
762 bool bd_string_seen_;
763 bool boolean_seq_seen_;
764 bool char_seq_seen_;
765 bool component_seen_;
766 bool connector_seen_;
767 bool double_seq_seen_;
768 bool enum_seen_;
769 bool exception_seen_;
770 bool fixed_array_decl_seen_;
771 bool fixed_size_decl_seen_;
772 bool float_seq_seen_;
773 bool fwd_iface_seen_;
774 bool fwd_valuetype_seen_;
775 bool iface_seq_seen_;
776 bool interface_seen_;
777 bool local_iface_seen_;
778 bool long_seq_seen_;
779 bool longdouble_seq_seen_;
780 bool longlong_seq_seen_;
781 bool non_local_fwd_iface_seen_;
782 bool non_local_iface_seen_;
783 bool non_local_op_seen_;
784 bool object_arg_seen_;
785 bool octet_seq_seen_;
786 bool operation_seen_;
787 bool pseudo_seq_seen_;
788 bool recursive_type_seen_;
789 bool seq_seen_;
790 bool short_seq_seen_;
791 bool special_basic_decl_seen_;
792 bool string_seen_;
793 bool string_member_seen_;
794 bool string_seq_seen_;
795 bool typecode_seen_;
796 bool ub_string_seen_;
797 bool ulong_seq_seen_;
798 bool ulonglong_seq_seen_;
799 bool union_seen_;
800 bool ushort_seq_seen_;
801 bool valuebase_seen_;
802 bool valuefactory_seen_;
803 bool valuetype_seen_;
804 bool var_array_decl_seen_;
805 bool var_size_decl_seen_;
806 bool vt_seq_seen_;
807 bool wchar_seq_seen_;
808 bool wstring_seq_seen_;
809 bool dds_connector_seen_;
810 bool ami_connector_seen_;
811 ///}
813 /// flag to force generation of skeleton includes (see bug #2419).
814 bool need_skeleton_includes_;
817 * Version of IDL to enforce
819 IdlVersion idl_version_;
822 * Default version of IDL to enforce. Compilers extending tao_idl coould set
823 * idl_version_ directly, but this allows Can be set to allow
824 * --default-idl-version to print an accuate default IDL version.
826 IdlVersion default_idl_version_;
829 * Perform the compilation process right up until invoking the backend.
830 * In other words just check the syntax of the input files, do not create
831 * any output.
833 bool syntax_only_;
836 * Exit when finished processing cli arguments
837 * Default is false.
839 bool parse_args_exit_;
842 * If parse_args_exit_ is true, this is the program status to return from
843 * main.
844 * Default is 0.
846 int parse_args_exit_status_;
849 * Print command line argument help message when finished processing
850 * cli arguments.
852 bool print_help_;
855 * Print compiler version when finished processing cli arguments.
857 bool print_version_;
860 * If true, we are inside the eval() function
862 bool in_eval_;
865 * Dump constructs defined using eval() if true.
867 bool dump_builtins_;
870 * If true, Dump only the IDL defined using eval() and exit using
871 * ignore_files_
873 bool just_dump_builtins_;
876 * Exit right before parsing input files.
878 bool ignore_files_;
881 * If true, silently ignore lookup errors.
883 bool ignore_lookup_errors_;
886 * Reaction to unknown annotations
888 Unknown_Annotations unknown_annotations_;
891 * Set of the local names of unkown annotations already seen
893 ACE_Unbounded_Set<Identifier> unknown_annotations_seen_;
895 private:
896 // Data
897 UTL_ScopeStack pd_scopes; // Store scopes stack
898 AST_Root *pd_root; // Store AST root
899 AST_Generator *pd_gen; // Store generator
900 AST_ValueType *pd_primary_key_base; // Store PrimaryKeyBase
901 UTL_Error *pd_err; // Error object
902 int pd_err_count; // Count of errors
903 long pd_lineno; // What line #
904 UTL_String *pd_filename; // What file
905 UTL_String *pd_main_filename; // What main filename
906 UTL_String *pd_real_filename; // What real filename
907 UTL_String *pd_stripped_filename; // Stripped filename
908 bool pd_import; // Is import on?
909 bool pd_in_main_file; // Are we in it?
910 const char *pd_prog_name; // Argv[0]
911 const char *pd_cpp_location; // Where to find CPP
912 long pd_compile_flags; // Compile flags
913 char *pd_local_escapes; // Trapdoor argument
914 UTL_Indenter *pd_indent; // Indent object
915 // as it's being built
916 UTL_String **pd_include_file_names;// Array of file names.
917 unsigned long pd_n_include_file_names;// How many.
918 unsigned long pd_n_alloced_file_names;// How many alloced.
920 char **included_idl_files_;
921 // IDL files that are "#include'd.
923 size_t n_included_idl_files_;
924 // The number of such idl files that are currently stored.
926 size_t n_allocated_idl_files_;
927 // For char*'s have been allocated for this.
929 ParseState pd_parse_state; // Parse state we're in.
931 UTL_String *pd_idl_src_file; // IDL source file.
933 char *tao_root_;
934 // Needed if orb.idl is included.
936 char *gperf_path_;
937 // Path for the perfect hash generator(gperf) program. Default
938 // is $ACE_ROOT/bin/gperf.
940 char *temp_dir_;
941 // Temp directory where which we can rewsolve in drv_preproc.cpp by
942 // checking for TEMP env variable otherwise we assign to /tmp/.
944 char *ident_string_;
945 // Holds a string that begins with #ident, to be passed from the IDL
946 // file to the generated files.
948 bool case_diff_error_;
949 // Do we report an error for indentifiers in the same scope that differ
950 // only by case? or just a warning?
952 bool nest_orb_;
953 // Is this front end being used for the NEST ORB?
955 ACE_CString idl_flags_;
956 // Concatenation of all the command line options.
958 ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex> idl_keywords_;
959 // Container for all the IDL keywords so local names can be checked.
961 ACE_Unbounded_Stack<char *> pragma_prefixes_;
962 // Container for all the #pragma prefix declarations.
964 bool preserve_cpp_keywords_;
965 // Do we allow C++ keywords as identifiers in the idl to stay as they are ?
967 Unbounded_Paths_Queue include_paths_;
968 // List of -I options passed to us.
970 ACE_Unbounded_Queue<char *> rel_include_paths_;
971 // Used by backends with the -r option.
973 ACE_Hash_Map_Manager<char *, char *, ACE_Null_Mutex> file_prefixes_;
974 // Associates a prefix with a file.
976 bool pass_orb_idl_;
977 // Treat orb.idl like any other included IDL file.
979 bool using_ifr_backend_;
980 // Set by the IFR backend itself.
982 bool ignore_idl3_;
983 // Need this for eventtypes left over after running idl3_to_idl2,
984 // we don't want to try to generate another event consumer.
985 DCPS_Type_Info_Map dcps_type_info_map_;
986 // Map of #pragma DCPS_DATA_TYPE and DCPS_DATA_KEY infomation.
988 DCPS_Sequence_Types_List dcps_sequence_types_list_;
990 bool dcps_support_zero_copy_read_;
991 // Are we enabled to support DCPS zero-copy read.
992 // Need this flag to avoid generating wrong code for pre v0.12 DDS
993 // with new TAO_IDL compiler.
995 bool dcps_gen_zero_copy_read_;
996 // Are we generating code insupport of DCPS zero-copy read data sequences?
998 ACE_Unbounded_Queue<AST_ValueType *>primary_keys_;
999 // List of valuetypes used as a primary key.
1001 char *recursion_start_;
1002 // Path to directory subtree we are iterating/recursing over.
1003 // Not used by all backends.
1005 bool multi_file_input_;
1006 // Some backends process multiple files to a single output.
1008 const char *big_file_name_;
1009 // Used if the above flag is set.
1011 FE_Utils::T_PARAMLIST_INFO *current_params_;
1012 // Stored if we are parsing the scope of a template module,
1013 // 0 otherwise. Contains the params of the referenced
1014 // template module if we are traversing an alias.
1016 UTL_StrList *alias_params_;
1017 // Stored if we are parsing a template module reference. The
1018 // scope traversed will be that of the referenced template
1019 // module, but the param holder(s) created will use the
1020 // aliased names.
1022 UTL_StrList *for_new_holder_;
1023 // Stored if we are traversing an alias, this is a list of
1024 // the enclosing template module's params. When we create
1025 // a param holder, it will need this name rather than the
1026 // name of the alias's referenced param.
1028 ACE_Unbounded_Queue<char *> ciao_lem_file_names_;
1029 // Files parsed with ciao lem pragma
1031 ACE_Unbounded_Queue<char *> ciao_rti_ts_file_names_;
1032 // Files parsed with RTI typesupport pragma
1034 ACE_Unbounded_Queue<char *> ciao_spl_ts_file_names_;
1035 // Files parsed with OpenSplice typesupport pragma
1037 ACE_Unbounded_Queue<char *> ciao_oci_ts_file_names_;
1038 // Files parsed with OpenDDS typesupport pragma
1040 ACE_Unbounded_Queue<char *> ciao_coredx_ts_file_names_;
1041 // Files parsed with CoreDX typesupport pragma
1043 ACE_Unbounded_Queue<char *> ciao_ami_iface_names_;
1044 // Interfaces that get a reply handler generated for AMI4CCM.
1046 ACE_Unbounded_Queue<char *> ciao_ami_recep_names_;
1047 // Receptacles that get a sendc_ version added for AMI4CCM.
1049 ACE_Unbounded_Queue<char *> included_ami_recep_names_;
1050 // We need to do something different with these...
1052 bool included_ami_receps_done_;
1053 // ...but we need to do it only once.
1055 ACE_Unbounded_Queue<char *> ciao_ami_idl_fnames_;
1056 // Stores directives from #pragma ciao ami4ccm idl "xxx"
1057 // or #pragma ami4ccm idl "xxx".
1059 ACE_Unbounded_Queue<char *> dds4ccm_impl_fnames_;
1060 // Stores directives from #pragma dds4ccm impl "xxx".
1063 * Used in the generation of overrides for CORBA::release and
1064 * CORBA::is_nil, needed when the interface inherits versions from
1065 * both CORBA::Object and CORBA::AbstractBase.
1067 ACE_Unbounded_Queue<AST_Interface *> mixed_parentage_interfaces_;
1069 /// For quick access.
1070 AST_Module *corba_module_;
1072 ANON_TYPE_DIAGNOSTIC anon_type_diagnostic_;
1073 bool explicit_anon_type_diagnostic_;
1075 /// Flag set in parser so we can decide whether to emit
1076 /// an anonymous type diagnostic.
1077 bool in_typedef_;
1079 /// Used during AST creation, corresponding flag in each
1080 /// AST_Decl created is set to this flag's value.
1081 bool in_tmpl_mod_no_alias_;
1083 /// Disables the error check faciliated by the above flag.
1084 /// No errors are possible because created nodes are all
1085 /// implied IDL.
1086 bool in_tmpl_mod_alias_;
1089 #endif //_IDL_IDL_GLOBAL_HH