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 #include "idl_defines.h"
66 #include "idl_global.h"
67 #include "global_extern.h"
68 #include "utl_identifier.h"
69 #include "utl_indenter.h"
71 #include "utl_string.h"
72 #include "fe_extern.h"
73 #include "fe_private.h"
74 #include "nr_extern.h"
75 #include "ast_extern.h"
78 #include "ast_generator.h"
79 #include "ast_valuetype.h"
80 #include "ast_annotation_decl.h"
82 #include "ace/OS_NS_stdio.h"
83 #include "ace/OS_NS_unistd.h"
84 #include "ace/Process.h"
85 #include "ace/Env_Value_T.h"
86 // FUZZ: disable check_for_streams_include
87 #include "ace/streams.h"
89 // Define an increment for the size of the array used to store names of
94 static long *pSeenOnce
= nullptr;
96 IDL_GlobalData::IDL_GlobalData ()
97 : syntax_only_ (false),
98 parse_args_exit_ (false),
99 parse_args_exit_status_ (0),
101 print_version_ (false),
103 dump_builtins_ (false),
104 just_dump_builtins_ (false),
105 ignore_files_ (false),
106 ignore_lookup_errors_ (false),
107 unknown_annotations_ (UNKNOWN_ANNOTATIONS_WARN_ONCE
),
110 pd_primary_key_base (nullptr),
114 pd_filename (nullptr),
115 pd_main_filename (nullptr),
116 pd_real_filename (nullptr),
117 pd_stripped_filename (nullptr),
119 pd_in_main_file (false),
120 pd_prog_name (nullptr),
121 pd_cpp_location (nullptr),
122 pd_compile_flags (0),
123 pd_local_escapes (nullptr),
125 pd_include_file_names (nullptr),
126 pd_n_include_file_names (0),
127 pd_n_alloced_file_names (0),
128 included_idl_files_ (nullptr),
129 n_included_idl_files_ (0),
130 n_allocated_idl_files_ (0),
131 pd_parse_state (PS_NoState
),
132 pd_idl_src_file (nullptr),
134 gperf_path_ (nullptr),
136 ident_string_ (nullptr),
137 case_diff_error_ (true),
140 preserve_cpp_keywords_ (true),
141 pass_orb_idl_ (false),
142 using_ifr_backend_ (false),
143 ignore_idl3_ (false),
144 dcps_support_zero_copy_read_ (false),
145 dcps_gen_zero_copy_read_ (false),
146 recursion_start_ (nullptr),
147 multi_file_input_ (false),
148 big_file_name_ ("PICML_IDL_file_bag"),
149 current_params_ (nullptr),
150 alias_params_ (nullptr),
151 for_new_holder_ (nullptr),
152 included_ami_receps_done_ (false),
153 corba_module_ (nullptr),
154 anon_type_diagnostic_ (ANON_TYPE_ERROR
),
155 explicit_anon_type_diagnostic_ (false),
157 in_tmpl_mod_no_alias_ (false),
158 in_tmpl_mod_alias_ (false)
160 // Path for the perfect hash generator(gperf) program.
161 // Default is $ACE_ROOT/bin/gperf unless ACE_GPERF is defined.
162 // Use ACE_GPERF if $ACE_ROOT hasn't been set or won't be set
163 // in the environment.
164 // Form the absolute pathname.
165 char* ace_root
= ACE_OS::getenv ("ACE_ROOT");
167 if (ace_root
== nullptr)
168 // This may not cause any problem if -g option is used to specify
169 // the correct path for the gperf program. Let us ignore this
170 // error here. It will be caught when we check the existence of
171 // the perfect hasher and at that time, we can switch over to some
174 #if defined (ACE_GPERF)
175 // The actual gperf program must be included in the definition of
176 // ACE_GPERF, not just the directory in which it is located.
177 const char ace_gperf
[] = ACE_GPERF
;
178 ACE_NEW (this->gperf_path_
,
179 char [ACE_OS::strlen (ace_gperf
) + 1]);
180 ACE_OS::sprintf (this->gperf_path_
,
184 this->gperf_path_
= nullptr;
189 #if defined (ACE_GPERF)
190 const char ace_gperf
[] = ACE_GPERF
;
191 ACE_NEW (this->gperf_path_
,
192 char [ACE_OS::strlen (ace_root
)
193 + ACE_OS::strlen ("/bin/")
194 + ACE_OS::strlen (ace_gperf
)
196 ACE_OS::sprintf (this->gperf_path_
,
197 "%s" ACE_DIRECTORY_SEPARATOR_STR_A
"bin" ACE_DIRECTORY_SEPARATOR_STR_A
"%s",
200 #else /* Not ACE_GPERF */
201 // Set it to the default value.
202 ACE_NEW (this->gperf_path_
,
203 char [ACE_OS::strlen (ace_root
)
204 + ACE_OS::strlen ("/bin/ace_gperf")
206 ACE_OS::sprintf (this->gperf_path_
,
207 "%s" ACE_DIRECTORY_SEPARATOR_STR_A
"bin" ACE_DIRECTORY_SEPARATOR_STR_A
"ace_gperf",
209 #endif /* ACE_GPERF */
212 #if defined (IDL_ANON_ERROR)
213 anon_type_diagnostic (ANON_TYPE_ERROR
);
214 #elif defined (IDL_ANON_WARNING)
215 anon_type_diagnostic (ANON_TYPE_WARNING
);
216 #elif defined (IDL_ANON_SILENT)
217 anon_type_diagnostic (ANON_TYPE_SILENT
);
220 // ambiguous_type_seen_ and basic_type_seen_ are not reset between
221 // command line idl files, so do those here and then reset the rest.
222 this->ambiguous_type_seen_
= false;
223 this->basic_type_seen_
= false;
224 this->reset_flag_seen ();
227 IDL_GlobalData::~IDL_GlobalData ()
231 // When starting to process the next command line input idl file, reset.
233 IDL_GlobalData::reset_flag_seen ()
235 abstract_iface_seen_
= false;
236 abstractbase_seen_
= false;
237 aggregate_seen_
= false;
238 any_arg_seen_
= false;
240 any_seq_seen_
= false;
242 array_seq_seen_
= false;
243 base_object_seen_
= false;
245 bd_string_seen_
= false;
246 boolean_seq_seen_
= false;
247 char_seq_seen_
= false;
248 component_seen_
= false;
249 connector_seen_
= false;
250 double_seq_seen_
= false;
252 exception_seen_
= false;
253 fixed_array_decl_seen_
= false;
254 fixed_size_decl_seen_
= false;
255 float_seq_seen_
= false;
256 fwd_iface_seen_
= false;
257 fwd_valuetype_seen_
= false;
258 iface_seq_seen_
= false;
259 interface_seen_
= false;
260 local_iface_seen_
= false;
261 long_seq_seen_
= false;
262 longdouble_seq_seen_
= false;
263 longlong_seq_seen_
= false;
264 non_local_fwd_iface_seen_
= false;
265 non_local_iface_seen_
= false;
266 non_local_op_seen_
= false;
267 object_arg_seen_
= false;
268 octet_seq_seen_
= false;
269 operation_seen_
= false;
270 pseudo_seq_seen_
= false;
271 recursive_type_seen_
= false;
273 short_seq_seen_
= false;
274 special_basic_decl_seen_
= false;
276 string_seen_
= false;
277 string_member_seen_
= false;
278 string_seq_seen_
= false;
279 typecode_seen_
= false;
280 ub_string_seen_
= false;
281 ulong_seq_seen_
= false;
282 ulonglong_seq_seen_
= false;
284 ushort_seq_seen_
= false;
285 valuebase_seen_
= false;
286 valuefactory_seen_
= false;
287 valuetype_seen_
= false;
288 var_array_decl_seen_
= false;
289 var_size_decl_seen_
= false;
290 vt_seq_seen_
= false;
291 wchar_seq_seen_
= false;
292 wstring_seq_seen_
= false;
293 dds_connector_seen_
= false;
294 ami_connector_seen_
= false;
296 need_skeleton_includes_
= false;
299 // Get or set scopes stack
301 IDL_GlobalData::scopes ()
303 return this->pd_scopes
;
306 // Get or set root of AST
308 IDL_GlobalData::root ()
310 return this->pd_root
;
314 IDL_GlobalData::set_root (AST_Root
*r
)
319 // Get or set generator object
321 IDL_GlobalData::gen ()
327 IDL_GlobalData::set_gen (AST_Generator
*g
)
332 // Get or set PrimaryKeyBase object
334 IDL_GlobalData::primary_key_base ()
336 return this->pd_primary_key_base
;
340 IDL_GlobalData::primary_key_base (AST_ValueType
*v
)
342 this->pd_primary_key_base
= v
;
345 // Get or set error object
347 IDL_GlobalData::err ()
353 IDL_GlobalData::set_err (UTL_Error
*e
)
358 // Get or set error count
360 IDL_GlobalData::err_count ()
362 return this->pd_err_count
;
366 IDL_GlobalData::set_err_count (int c
)
368 this->pd_err_count
= c
;
371 // Get or set line number
373 IDL_GlobalData::lineno ()
375 return this->pd_lineno
;
379 IDL_GlobalData::set_lineno (long n
)
384 // Get or set file name being read now
386 IDL_GlobalData::filename ()
388 return this->pd_filename
;
392 IDL_GlobalData::set_filename (UTL_String
*s
)
394 if (this->pd_filename
!= nullptr)
396 this->pd_filename
->destroy ();
397 delete this->pd_filename
;
398 this->pd_filename
= nullptr;
401 this->pd_filename
= s
;
404 // Get or set main file name
406 IDL_GlobalData::main_filename ()
408 return this->pd_main_filename
;
412 IDL_GlobalData::set_main_filename (UTL_String
*n
)
414 if (this->pd_main_filename
!= nullptr)
416 this->pd_main_filename
->destroy ();
417 delete this->pd_main_filename
;
418 this->pd_main_filename
= nullptr;
420 this->pd_main_filename
= n
;
423 // Get or set real file name
425 IDL_GlobalData::real_filename ()
427 return this->pd_real_filename
;
431 IDL_GlobalData::set_real_filename (UTL_String
*n
)
433 if (this->pd_real_filename
!= nullptr)
435 this->pd_real_filename
->destroy ();
436 delete this->pd_real_filename
;
437 this->pd_real_filename
= nullptr;
440 this->pd_real_filename
= n
;
443 // Get or set indicator whether import is on
445 IDL_GlobalData::imported ()
447 return this->pd_in_main_file
? false : pd_import
;
451 IDL_GlobalData::import ()
453 return this->pd_import
;
457 IDL_GlobalData::set_import (bool is_in
)
459 this->pd_import
= is_in
;
462 // Get or set indicator whether we're reading the main file now
464 IDL_GlobalData::in_main_file ()
466 return this->pd_in_main_file
;
470 IDL_GlobalData::set_in_main_file (bool is_in
)
472 this->pd_in_main_file
= is_in
;
475 // Get or set stripped file name
477 IDL_GlobalData::stripped_filename ()
479 return this->pd_stripped_filename
;
483 IDL_GlobalData::set_stripped_filename (UTL_String
*nm
)
485 if (this->pd_stripped_filename
!= nullptr)
487 delete this->pd_stripped_filename
;
490 this->pd_stripped_filename
= nm
;
493 // Get or set cache value for argv[0]
495 IDL_GlobalData::prog_name ()
497 return this->pd_prog_name
;
501 IDL_GlobalData::set_prog_name (const char *pn
)
503 this->pd_prog_name
= pn
;
506 // Get or set location to find C preprocessor
508 IDL_GlobalData::cpp_location ()
510 return this->pd_cpp_location
;
514 IDL_GlobalData::set_cpp_location (const char *l
)
516 this->pd_cpp_location
= l
;
519 // Get or set IDL compiler flags
521 IDL_GlobalData::compile_flags ()
523 return this->pd_compile_flags
;
527 IDL_GlobalData::set_compile_flags (long cf
)
529 if (cf
& IDL_CF_ONLY_USAGE
)
533 if (cf
& IDL_CF_DUMP_AST
)
537 this->pd_compile_flags
= cf
;
540 // Get or set local escapes string. This provides an additional
541 // mechanism to pass information to a BE.
543 IDL_GlobalData::local_escapes ()
545 return this->pd_local_escapes
;
549 IDL_GlobalData::set_local_escapes (const char *e
)
551 if (this->pd_local_escapes
!= nullptr)
553 delete [] this->pd_local_escapes
;
556 this->pd_local_escapes
= ACE::strnew (e
);
559 // Get or set indent object
561 IDL_GlobalData::indent ()
563 return this->pd_indent
;
567 IDL_GlobalData::set_indent (UTL_Indenter
*i
)
572 // Have we seen this #include file name before?
574 IDL_GlobalData::seen_include_file_before (char *n
)
577 char *incl
= nullptr;
580 for (i
= 0; i
< this->pd_n_include_file_names
; ++i
)
582 incl
= this->pd_include_file_names
[i
]->get_string ();
584 if (ACE_OS::strcmp (tmp
, incl
) == 0)
586 return ++pSeenOnce
[i
];
593 // Store the name of an #include file.
595 IDL_GlobalData::store_include_file_name (UTL_String
*n
)
597 // Check if we need to store it at all or whether we've seen it already.
598 if (this->seen_include_file_before (n
->get_string ()))
601 delete n
; // Don't keep filenames we don't store!
605 // OK, need to store. Make sure there's space for one more string
606 if (this->pd_n_include_file_names
== this->pd_n_alloced_file_names
)
608 // Allocating more space.
609 if (this->pd_n_alloced_file_names
== 0)
611 this->pd_n_alloced_file_names
= INCREMENT
;
612 ACE_NEW (this->pd_include_file_names
,
613 UTL_String
*[this->pd_n_alloced_file_names
]);
615 long [this->pd_n_alloced_file_names
]);
619 UTL_String
**o_include_file_names
= this->pd_include_file_names
;
620 unsigned long o_n_alloced_file_names
= this->pd_n_alloced_file_names
;
621 long *o_pSeenOnce
= pSeenOnce
;
623 this->pd_n_alloced_file_names
+= INCREMENT
;
624 ACE_NEW (this->pd_include_file_names
,
625 UTL_String
*[this->pd_n_alloced_file_names
]);
627 long [this->pd_n_alloced_file_names
]);
629 for (unsigned long i
= 0; i
< o_n_alloced_file_names
; ++i
)
631 this->pd_include_file_names
[i
] = o_include_file_names
[i
];
632 pSeenOnce
[i
]= o_pSeenOnce
[i
];
635 delete [] o_include_file_names
;
636 delete [] o_pSeenOnce
;
641 pSeenOnce
[this->pd_n_include_file_names
] = 1;
642 this->pd_include_file_names
[this->pd_n_include_file_names
++] = n
;
646 IDL_GlobalData::set_include_file_names (UTL_String
**ns
)
648 this->pd_include_file_names
= ns
;
652 IDL_GlobalData::include_file_names ()
654 return this->pd_include_file_names
;
658 IDL_GlobalData::set_n_include_file_names (unsigned long n
)
660 pd_n_include_file_names
= n
;
664 IDL_GlobalData::n_include_file_names ()
666 return pd_n_include_file_names
;
669 // Access methods to deal with other IDL files included in the main
673 IDL_GlobalData::add_to_included_idl_files (const char *file_name
)
675 // Let's avoid duplicates.
676 for (size_t index
= 0; index
< this->n_included_idl_files_
; ++index
)
678 if (!ACE_OS::strcmp (file_name
, this->included_idl_files_
[index
]))
684 // Is there enough space there to store one more file.
685 if (this->n_included_idl_files_
== this->n_allocated_idl_files_
)
687 // Allocating more space.
688 if (this->n_allocated_idl_files_
== 0)
690 // First time creation.
691 this->n_allocated_idl_files_
= INCREMENT
;
692 ACE_NEW (this->included_idl_files_
,
693 char *[this->n_allocated_idl_files_
]);
697 // Adding more storage.
698 char** old_included_idl_files
=
699 this->included_idl_files_
;
700 size_t n_old_allocated_idl_files
=
701 this->n_allocated_idl_files_
;
702 this->n_allocated_idl_files_
+= INCREMENT
;
703 ACE_NEW (this->included_idl_files_
,
704 char *[this->n_allocated_idl_files_
]);
706 for (size_t i
= 0; i
< n_old_allocated_idl_files
; ++i
)
708 this->included_idl_files_
[i
] =
709 old_included_idl_files
[i
];
712 delete [] old_included_idl_files
;
717 this->included_idl_files_
[this->n_included_idl_files_
++] =
718 ACE::strnew (file_name
);
722 IDL_GlobalData::included_idl_files ()
724 return this->included_idl_files_
;
728 IDL_GlobalData::n_included_idl_files ()
730 return this->n_included_idl_files_
;
733 // Set the number of included_idl_files. Use this carefully. This
734 // method is used when we validate all the #included idl files,
735 // against the ones that we get after preprocessing.
737 IDL_GlobalData::n_included_idl_files (size_t n
)
739 this->n_included_idl_files_
= n
;
743 IDL_GlobalData::set_parse_state(ParseState ps
)
748 IDL_GlobalData::ParseState
749 IDL_GlobalData::parse_state ()
751 return pd_parse_state
;
754 // returns the IDL source file being copiled
755 UTL_String
* IDL_GlobalData::idl_src_file ()
757 return this->pd_idl_src_file
;
760 // set the source IDL file that is being parsed
761 void IDL_GlobalData::idl_src_file (UTL_String
*s
)
763 this->pd_idl_src_file
= s
;
767 IDL_GlobalData::temp_dir (const char *s
)
769 // Delete the old pointer.
770 delete [] this->temp_dir_
;
771 this->temp_dir_
= nullptr; // In case the ACE_NEW fails below.
773 const size_t lengthSep
= sizeof (ACE_DIRECTORY_SEPARATOR_STR_A
) - 1u;
774 const size_t lengthPath
= ACE_OS::strlen (s
);
776 // Allocate memory, 1 for the end of string.
777 ACE_NEW (this->temp_dir_
, char [lengthPath
+ lengthSep
+ 1u]);
780 if (lengthSep
< lengthPath
&&
781 0 == ACE_OS::strcmp (s
+ lengthPath
- lengthSep
, ACE_DIRECTORY_SEPARATOR_STR_A
))
783 // Already has a directory seporator on end of temp root, don't add another.
784 ACE_OS::strcpy (this->temp_dir_
, s
);
788 // Need to add a directory seporator to temp root.
789 ACE_OS::sprintf (this->temp_dir_
,
792 ACE_DIRECTORY_SEPARATOR_STR_A
);
797 IDL_GlobalData::temp_dir () const
799 return this->temp_dir_
;
803 IDL_GlobalData::tao_root (const char *s
)
805 delete [] this->tao_root_
;
806 this->tao_root_
= ACE::strnew (s
);
810 IDL_GlobalData::tao_root () const
812 return this->tao_root_
;
816 IDL_GlobalData::gperf_path (const char *s
)
818 delete [] this->gperf_path_
;
819 this->gperf_path_
= ACE::strnew (s
);
823 IDL_GlobalData::gperf_path () const
825 return this->gperf_path_
;
829 IDL_GlobalData::ident_string (const char *s
)
831 delete [] this->ident_string_
;
832 this->ident_string_
= ACE::strnew (s
);
836 IDL_GlobalData::ident_string () const
838 return this->ident_string_
;
842 IDL_GlobalData::case_diff_error (bool val
)
844 this->case_diff_error_
= val
;
848 IDL_GlobalData::case_diff_error ()
850 return this->case_diff_error_
;
854 IDL_GlobalData::nest_orb (bool val
)
856 this->nest_orb_
= val
;
860 IDL_GlobalData::nest_orb ()
862 return this->nest_orb_
;
866 IDL_GlobalData::destroy ()
868 if (this->pd_filename
!= nullptr)
870 this->pd_filename
->destroy ();
871 delete this->pd_filename
;
872 this->pd_filename
= nullptr;
875 if (this->pd_main_filename
!= nullptr)
877 this->pd_main_filename
->destroy ();
878 delete this->pd_main_filename
;
879 this->pd_main_filename
= nullptr;
882 if (this->pd_real_filename
!= nullptr)
884 this->pd_real_filename
->destroy ();
885 delete this->pd_real_filename
;
886 this->pd_real_filename
= nullptr;
889 if (this->pd_stripped_filename
!= nullptr)
891 this->pd_stripped_filename
->destroy ();
892 delete this->pd_stripped_filename
;
893 this->pd_stripped_filename
= nullptr;
896 if (this->pd_idl_src_file
!= nullptr)
898 this->pd_idl_src_file
->destroy ();
899 delete this->pd_idl_src_file
;
900 this->pd_idl_src_file
= nullptr;
903 size_t size
= this->pragma_prefixes ().size ();
904 char *trash
= nullptr;
906 for (size_t i
= 0; i
< size
; ++i
)
908 this->pragma_prefixes ().pop (trash
);
913 // Clean up each included file name - the array allocation itself
914 // gets cleaned up in fini().
915 for (unsigned long j
= 0; j
< this->pd_n_include_file_names
; ++j
)
917 this->pd_include_file_names
[j
]->destroy ();
918 delete this->pd_include_file_names
[j
];
919 this->pd_include_file_names
[j
] = nullptr;
922 this->pd_n_include_file_names
= 0;
924 for (size_t k
= 0; k
< n_included_idl_files_
; ++k
)
926 ACE::strdelete (this->included_idl_files_
[k
]);
927 this->included_idl_files_
[k
] = nullptr;
930 this->n_included_idl_files_
= 0;
931 this->n_allocated_idl_files_
= 0;
932 delete [] this->included_idl_files_
;
933 this->included_idl_files_
= nullptr;
935 ACE::strdelete (this->recursion_start_
);
936 this->recursion_start_
= nullptr;
938 // Reset the member of the CORBA module containing the basic types
939 // to point to itself, since all the other CORBA modules (if any)
940 // will be destroyed.
941 if (this->corba_module_
!= nullptr)
943 this->corba_module_
->reset_last_in_same_parent_scope ();
946 if (nullptr != this->pd_root
)
948 this->pd_root
->destroy ();
953 IDL_GlobalData::append_idl_flag (const char *s
)
955 this->idl_flags_
+= " " + ACE_CString (s
);
959 IDL_GlobalData::idl_flags () const
961 return this->idl_flags_
.c_str ();
964 ACE_Hash_Map_Manager
<ACE_CString
, int, ACE_Null_Mutex
> &
965 IDL_GlobalData::idl_keywords ()
967 return this->idl_keywords_
;
970 ACE_Unbounded_Stack
<char *> &
971 IDL_GlobalData::pragma_prefixes ()
973 return this->pragma_prefixes_
;
977 IDL_GlobalData::update_prefix (char *filename
)
979 // If we are just starting up and processing the temporary filename,
980 // there are no prefix issues to deal with yet.
981 if (this->pd_main_filename
== nullptr || this->pd_filename
== nullptr)
986 char *fstring
= this->pd_filename
->get_string ();
987 char *tail
= fstring
+ ACE_OS::strlen (fstring
) - 3;
989 // We have to do this check because some preprocessors (gcc 3.2
990 // on RedHat Linux 7.1, for one) output the same filename
991 // multiple times for no apparent reason, and we don't want it
992 // to clear the prefix.
993 if (ACE_OS::strcmp (fstring
, filename
) == 0
994 || ACE_OS::strcmp (tail
, ".cc") == 0)
999 ACE_CString
tmp ("", nullptr, false);
1000 char *main_filename
= this->pd_main_filename
->get_string ();
1002 char *prefix
= nullptr;
1003 int status
= this->file_prefixes_
.find (filename
, prefix
);
1007 this->pd_root
->prefix (prefix
);
1011 prefix
= ACE::strnew ("");
1012 (void) this->file_prefixes_
.bind (ACE::strnew (filename
), prefix
);
1013 this->pd_root
->prefix ("");
1016 // The first branch is executed if we are finishing an
1017 // included IDL file (but the current filename has not yet
1018 // been changed). So we check for (1) the current filename is
1019 // not the same as the main filename (2) the prefix stack size
1020 // is greater than 1 (to skip the case where we are passed the
1021 // temporary filename) and (3) we have either seen the filename
1022 // passed in before as an included file or we are passed the
1023 // main filename. Otherwise we know we are beginning an included
1024 // file, so we push a blank prefix on the stack, which may
1025 // possibly be changed later.
1026 if (this->seen_include_file_before (filename
) != 0
1027 || ACE_OS::strcmp (filename
, main_filename
) == 0
1028 || ACE_OS::strcmp (filename
, this->pd_filename
->get_string ()) != 0)
1030 if (!this->pd_in_main_file
)
1033 this->file_prefixes_
.find (this->pd_filename
->get_string (),
1036 // This function is called just before we transition to a
1037 // new file at global scope. If there is a non-null prefix
1038 // stored in the table under our not-yet-changed filename,
1040 if (status
== 0 && ACE_OS::strcmp (prefix
, "") != 0)
1042 char *trash
= nullptr;
1043 this->pragma_prefixes_
.pop (trash
);
1050 this->pragma_prefixes_
.push (tmp
.rep ());
1055 Whether we should not mung idl element names that are
1056 C++ keywords e.g. delete, operator etc. with _cxx_ prefix.
1057 Should be true when being used by the IFR Service
1060 IDL_GlobalData::preserve_cpp_keywords ()
1062 return preserve_cpp_keywords_
;
1066 Set whether we should not mung idl element names that are C++
1067 keywords e.g. delete, operator etc. with _cxx_ prefix.
1068 Is unset by the tao_idl compiler.
1071 IDL_GlobalData::preserve_cpp_keywords (bool val
)
1073 preserve_cpp_keywords_
= val
;
1077 IDL_GlobalData::add_include_path (const char *s
, bool is_system
)
1079 Include_Path_Info info
= { ACE::strnew (s
), is_system
};
1080 this->include_paths_
.enqueue_tail (info
);
1084 IDL_GlobalData::add_rel_include_path (const char *s
)
1086 this->rel_include_paths_
.enqueue_tail (ACE::strnew (s
));
1089 ACE_Unbounded_Queue
<char *> const &
1090 IDL_GlobalData::rel_include_paths () const
1092 return this->rel_include_paths_
;
1096 IDL_GlobalData::add_ciao_lem_file_names (const char *s
)
1098 this->ciao_lem_file_names_
.enqueue_tail (ACE::strnew (s
));
1101 ACE_Unbounded_Queue
<char *> &
1102 IDL_GlobalData::ciao_lem_file_names ()
1104 return this->ciao_lem_file_names_
;
1108 IDL_GlobalData::add_ciao_rti_ts_file_names (const char *s
)
1110 this->ciao_rti_ts_file_names_
.enqueue_tail (ACE::strnew (s
));
1113 ACE_Unbounded_Queue
<char *> &
1114 IDL_GlobalData::ciao_rti_ts_file_names ()
1116 return this->ciao_rti_ts_file_names_
;
1120 IDL_GlobalData::add_ciao_spl_ts_file_names (const char *s
)
1122 this->ciao_spl_ts_file_names_
.enqueue_tail (ACE::strnew (s
));
1125 ACE_Unbounded_Queue
<char *> &
1126 IDL_GlobalData::ciao_spl_ts_file_names ()
1128 return this->ciao_spl_ts_file_names_
;
1132 IDL_GlobalData::add_ciao_oci_ts_file_names (const char *s
)
1134 this->ciao_oci_ts_file_names_
.enqueue_tail (ACE::strnew (s
));
1137 ACE_Unbounded_Queue
<char *> &
1138 IDL_GlobalData::ciao_oci_ts_file_names ()
1140 return this->ciao_oci_ts_file_names_
;
1144 IDL_GlobalData::add_ciao_coredx_ts_file_names (const char *s
)
1146 this->ciao_coredx_ts_file_names_
.enqueue_tail (ACE::strnew (s
));
1149 ACE_Unbounded_Queue
<char *> &
1150 IDL_GlobalData::ciao_coredx_ts_file_names ()
1152 return this->ciao_coredx_ts_file_names_
;
1156 IDL_GlobalData::add_ciao_ami_iface_names (const char *s
)
1158 this->ciao_ami_iface_names_
.enqueue_tail (ACE::strnew (s
));
1161 ACE_Unbounded_Queue
<char *> &
1162 IDL_GlobalData::ciao_ami_iface_names ()
1164 return this->ciao_ami_iface_names_
;
1168 IDL_GlobalData::add_ciao_ami_recep_names (const char *s
)
1170 this->ciao_ami_recep_names_
.enqueue_tail (ACE::strnew (s
));
1173 ACE_Unbounded_Queue
<char *> &
1174 IDL_GlobalData::ciao_ami_recep_names ()
1176 return this->ciao_ami_recep_names_
;
1180 IDL_GlobalData::add_included_ami_recep_names (const char *s
)
1182 this->included_ami_recep_names_
.enqueue_tail (ACE::strnew (s
));
1185 ACE_Unbounded_Queue
<char *> &
1186 IDL_GlobalData::included_ami_recep_names ()
1188 return this->included_ami_recep_names_
;
1192 IDL_GlobalData::included_ami_receps_done () const
1194 return this->included_ami_receps_done_
;
1198 IDL_GlobalData::included_ami_receps_done (bool val
)
1200 this->included_ami_receps_done_
= val
;
1204 IDL_GlobalData::add_ciao_ami_idl_fnames (const char *s
)
1206 this->ciao_ami_idl_fnames_
.enqueue_tail (ACE::strnew (s
));
1209 ACE_Unbounded_Queue
<char *> &
1210 IDL_GlobalData::ciao_ami_idl_fnames ()
1212 return this->ciao_ami_idl_fnames_
;
1216 IDL_GlobalData::add_dds4ccm_impl_fnames (const char *s
)
1218 this->dds4ccm_impl_fnames_
.enqueue_tail (ACE::strnew (s
));
1221 ACE_Unbounded_Queue
<char *> &
1222 IDL_GlobalData::dds4ccm_impl_fnames ()
1224 return this->dds4ccm_impl_fnames_
;
1227 ACE_Unbounded_Queue
<AST_Interface
*> &
1228 IDL_GlobalData::mixed_parentage_interfaces ()
1230 return this->mixed_parentage_interfaces_
;
1233 ACE_Hash_Map_Manager
<char *, char *, ACE_Null_Mutex
> &
1234 IDL_GlobalData::file_prefixes ()
1236 return this->file_prefixes_
;
1240 IDL_GlobalData::pass_orb_idl () const
1242 return this->pass_orb_idl_
;
1246 IDL_GlobalData::pass_orb_idl (bool val
)
1248 this->pass_orb_idl_
= val
;
1252 IDL_GlobalData::using_ifr_backend () const
1254 return this->using_ifr_backend_
;
1258 IDL_GlobalData::using_ifr_backend (bool val
)
1260 this->using_ifr_backend_
= val
;
1264 IDL_GlobalData::ignore_idl3 () const
1266 return this->ignore_idl3_
;
1270 IDL_GlobalData::ignore_idl3 (bool val
)
1272 this->ignore_idl3_
= val
;
1276 IDL_GlobalData::dcps_support_zero_copy_read () const
1278 return this->dcps_support_zero_copy_read_
;
1282 IDL_GlobalData::dcps_support_zero_copy_read (bool val
)
1284 this->dcps_support_zero_copy_read_
= val
;
1288 IDL_GlobalData::dcps_gen_zero_copy_read () const
1290 return this->dcps_gen_zero_copy_read_
;
1294 IDL_GlobalData::dcps_gen_zero_copy_read (bool val
)
1296 this->dcps_gen_zero_copy_read_
= val
;
1299 // Return 0 on success, -1 failure. The <errno> corresponding to the
1300 // error that caused the GPERF execution is also set.
1302 IDL_GlobalData::check_gperf ()
1304 // If absolute path is not specified yet, let us call just
1305 // "gperf". Hopefully PATH is set up correctly to locate the gperf.
1306 if (this->gperf_path_
== nullptr)
1308 // If ACE_GPERF is defined then use that gperf program instead of "gperf."
1309 #if defined (ACE_GPERF)
1310 this->gperf_path (ACE_GPERF
);
1312 this->gperf_path ("ace_gperf");
1313 #endif /* ACE_GPERF */
1316 // If we have absolute path for the <gperf> rather than just the
1317 // executable name <gperf>, make sure the file exists
1318 // firsts. Otherwise just call <gperf>. Probably PATH is set
1319 // correctly to take care of this.
1321 // If ACE_GPERF is defined then use that gperf program instead of "gperf."
1322 #if defined (ACE_GPERF)
1323 if (ACE_OS::strcmp (this->gperf_path_
, ACE_GPERF
) != 0)
1325 if (ACE_OS::strcmp (this->gperf_path_
, "ace_gperf") != 0)
1326 #endif /* ACE_GPERF */
1328 // It is absolute path. Check the existence, permissions and
1330 if (ACE_OS::access (this->gperf_path_
,
1333 // Problem with the file. No point in having the absolute
1334 // path. Swith to "gperf".
1335 // If ACE_GPERF is defined then use that gperf program
1336 //instead of "gperf."
1337 #if defined (ACE_GPERF)
1338 this->gperf_path (ACE_GPERF
);
1340 this->gperf_path ("ace_gperf");
1341 #endif /* ACE_GPERF */
1345 // Just call gperf in silent mode. It will come and immly exit.
1347 // Using ACE_Process.
1348 ACE_Process process
;
1349 ACE_Process_Options process_options
;
1351 // Set the command line for the gperf program.
1352 process_options
.command_line (ACE_TEXT ("\"%s\" -V"),
1355 // Spawn a process for gperf.
1356 if (process
.spawn (process_options
) == -1)
1361 #if defined (ACE_WIN32)
1362 // No wait or anything in Win32.
1365 // Wait for gperf to complete.
1366 ACE_exitcode wait_status
= 0;
1367 if (process
.wait (&wait_status
) == -1)
1373 // Wait is successful, we will check the exit code from the
1375 if (WIFEXITED (wait_status
))
1379 // Check the exit value of the spawned process. ACE_Process
1380 // exits with <errno> as exit code, if it is not able to
1381 // exec gperf program, so get the exit code now and set that
1382 // to <errno> again, so that it can be used to print error
1384 errno
= WEXITSTATUS (wait_status
);
1388 // <exec> has failed.
1393 // Everything was alright.
1399 // Not a normal exit. No <errno> might be set.
1403 #endif /* ACE_WIN32 */
1407 IDL_GlobalData::fini ()
1409 if (nullptr != this->pd_root
)
1411 this->pd_root
->fini ();
1412 delete this->pd_root
;
1413 this->pd_root
= nullptr;
1416 delete this->pd_err
;
1417 this->pd_err
= nullptr;
1418 delete this->pd_gen
;
1419 this->pd_gen
= nullptr;
1420 delete this->pd_indent
;
1421 this->pd_indent
= nullptr;
1422 delete [] this->pd_local_escapes
;
1423 this->pd_local_escapes
= nullptr;
1424 delete [] this->tao_root_
;
1425 this->tao_root_
= nullptr;
1426 delete [] this->gperf_path_
;
1427 this->gperf_path_
= nullptr;
1428 delete [] this->temp_dir_
;
1429 this->temp_dir_
= nullptr;
1430 delete [] this->ident_string_
;
1431 this->ident_string_
= nullptr;
1432 delete [] this->pd_include_file_names
;
1433 this->pd_include_file_names
= nullptr;
1435 Include_Path_Info
*path_info
= nullptr;
1437 for (Unbounded_Paths_Queue_Iterator
qiter (this->include_paths_
);
1441 qiter
.next (path_info
);
1442 ACE::strdelete (path_info
->path_
);
1445 char **path_tmp
= nullptr;
1447 for (ACE_Unbounded_Queue_Iterator
<char *>riter (
1448 this->rel_include_paths_
1453 riter
.next (path_tmp
);
1454 ACE::strdelete (*path_tmp
);
1457 for (ACE_Unbounded_Queue_Iterator
<char *>iter1 (
1458 this->ciao_lem_file_names_
);
1462 iter1
.next (path_tmp
);
1463 ACE::strdelete (*path_tmp
);
1466 for (ACE_Unbounded_Queue_Iterator
<char *>iter2 (
1467 this->ciao_rti_ts_file_names_
);
1471 iter2
.next (path_tmp
);
1472 ACE::strdelete (*path_tmp
);
1475 for (ACE_Unbounded_Queue_Iterator
<char *>iter3 (
1476 this->ciao_spl_ts_file_names_
);
1480 iter3
.next (path_tmp
);
1481 ACE::strdelete (*path_tmp
);
1484 for (ACE_Unbounded_Queue_Iterator
<char *>iter4 (
1485 this->ciao_oci_ts_file_names_
);
1489 iter4
.next (path_tmp
);
1490 ACE::strdelete (*path_tmp
);
1493 for (ACE_Unbounded_Queue_Iterator
<char *>iter5 (
1494 this->ciao_ami_iface_names_
);
1498 iter5
.next (path_tmp
);
1499 ACE::strdelete (*path_tmp
);
1502 for (ACE_Unbounded_Queue_Iterator
<char *>iter6 (
1503 this->ciao_ami_recep_names_
);
1507 iter6
.next (path_tmp
);
1508 ACE::strdelete (*path_tmp
);
1511 for (ACE_Unbounded_Queue_Iterator
<char *>iter7 (
1512 this->included_ami_recep_names_
);
1516 iter7
.next (path_tmp
);
1517 ACE::strdelete (*path_tmp
);
1520 for (ACE_Unbounded_Queue_Iterator
<char *>iter8 (
1521 this->ciao_ami_idl_fnames_
);
1525 iter8
.next (path_tmp
);
1526 ACE::strdelete (*path_tmp
);
1529 for (ACE_Unbounded_Queue_Iterator
<char *>iter9 (
1530 this->dds4ccm_impl_fnames_
);
1534 iter9
.next (path_tmp
);
1535 ACE::strdelete (*path_tmp
);
1538 for (ACE_Unbounded_Queue_Iterator
<char *>iter10 (
1539 this->dcps_sequence_types_list_
);
1540 iter10
.done () == 0;
1543 iter10
.next (path_tmp
);
1544 ACE::strdelete (*path_tmp
);
1548 ACE_Hash_Map_Entry
<char *, char *> *entry
= nullptr;
1550 for (ACE_Hash_Map_Iterator
<char *, char *, ACE_Null_Mutex
> hiter (
1551 this->file_prefixes_
1557 ACE::strdelete (entry
->ext_id_
);
1558 ACE::strdelete (entry
->int_id_
);
1561 DCPS_Type_Info_Map::ENTRY
*dcps_entry
= nullptr;
1563 for (DCPS_Type_Info_Map::ITERATOR
dcps_iter (
1564 this->dcps_type_info_map_
);
1566 dcps_iter
.advance ())
1568 dcps_iter
.next (dcps_entry
);
1570 dcps_entry
->int_id_
->name_
->destroy ();
1571 delete dcps_entry
->int_id_
->name_
;
1572 dcps_entry
->int_id_
->name_
= nullptr;
1574 delete dcps_entry
->int_id_
;
1575 dcps_entry
->int_id_
= 0;
1577 delete [] dcps_entry
->ext_id_
;
1578 dcps_entry
->ext_id_
= 0;
1582 ACE_Unbounded_Queue
<AST_ValueType
*> &
1583 IDL_GlobalData::primary_keys ()
1585 return this->primary_keys_
;
1589 IDL_GlobalData::check_primary_keys ()
1591 AST_ValueType
*holder
= nullptr;
1593 while (!this->primary_keys_
.is_empty ())
1595 // Dequeue the element at the head of the queue.
1596 if (this->primary_keys_
.dequeue_head (holder
) != 0)
1598 ACE_ERROR ((LM_ERROR
,
1599 "(%N:%l) idl_global::check_primary_keys - "
1600 "dequeue_head failed\n"));
1604 if (!holder
->legal_for_primary_key ())
1606 this->pd_err
->illegal_primary_key (holder
);
1612 IDL_GlobalData::recursion_start () const
1614 return this->recursion_start_
;
1618 IDL_GlobalData::recursion_start (const char *val
)
1620 ACE::strdelete (this->recursion_start_
);
1622 /// Strip off any trailing slashes (not needed
1623 /// for further processing).
1624 ACE_CString
tmp (val
);
1625 ACE_CString::size_type len
= tmp
.length ();
1626 ACE_TCHAR c
= tmp
[len
- 1];
1628 while (c
== '\\' || c
== '/')
1630 tmp
= tmp
.substr (0, --len
);
1634 this->recursion_start_
= ACE::strnew (tmp
.c_str ());
1638 IDL_GlobalData::multi_file_input () const
1640 return this->multi_file_input_
;
1644 IDL_GlobalData::multi_file_input (bool val
)
1646 this->multi_file_input_
= val
;
1650 IDL_GlobalData::big_file_name () const
1652 return this->big_file_name_
;
1655 FE_Utils::T_PARAMLIST_INFO
const *
1656 IDL_GlobalData::current_params () const
1658 return this->current_params_
;
1662 IDL_GlobalData::current_params (
1663 FE_Utils::T_PARAMLIST_INFO
*params
)
1665 this->current_params_
= params
;
1669 IDL_GlobalData::alias_params () const
1671 return this->alias_params_
;
1675 IDL_GlobalData::alias_params (
1676 UTL_StrList
*params
)
1678 this->alias_params_
= params
;
1682 IDL_GlobalData::for_new_holder () const
1684 return this->for_new_holder_
;
1688 IDL_GlobalData::for_new_holder (
1689 UTL_StrList
*params
)
1691 this->for_new_holder_
= params
;
1695 IDL_GlobalData::set_dcps_sequence_type (const char* seq_type
)
1697 this->dcps_sequence_types_list_
.enqueue_tail (ACE::strnew (seq_type
));
1701 IDL_GlobalData::dcps_sequence_type_defined (const char* seq_type
)
1703 char **tmp
= nullptr;
1705 for (ACE_Unbounded_Queue_Iterator
<char *>riter (
1706 this->dcps_sequence_types_list_
);
1711 if (ACE_OS::strcmp (*tmp
, seq_type
) == 0)
1718 IDL_GlobalData::add_dcps_data_type (const char* id
)
1720 // Check if the type already exists.
1721 DCPS_Data_Type_Info
* newinfo
;
1723 if (this->dcps_type_info_map_
.find (id
, newinfo
) != 0)
1725 // No existing entry, add one.
1728 ACE_NEW (foo_type
, char [ACE_OS::strlen (id
) + 1]);
1729 ACE_OS::strcpy (foo_type
, id
);
1731 UTL_ScopedName
* t1
=
1732 FE_Utils::string_to_scoped_name (foo_type
);
1734 // Chained with null Identifier required!!
1735 UTL_ScopedName
* target
=
1736 new UTL_ScopedName (new Identifier (""), t1
);
1738 newinfo
= new DCPS_Data_Type_Info ();
1739 newinfo
->name_
= target
;
1741 // Add the newly formed entry to the map.
1742 if (this->dcps_type_info_map_
.bind (foo_type
, newinfo
) != 0)
1744 ACE_ERROR ((LM_ERROR
,
1745 ACE_TEXT ("Unable to insert type into ")
1746 ACE_TEXT ("DCPS type container: %s.\n"),
1753 ACE_ERROR ((LM_WARNING
,
1754 ACE_TEXT ("Duplicate DCPS type defined: %s.\n"),
1760 IDL_GlobalData::add_dcps_data_key (const char* id
, const char* key
)
1762 // Search the map for the type.
1763 DCPS_Data_Type_Info
* newinfo
= nullptr;
1765 if (this->dcps_type_info_map_
.find (id
, newinfo
) == 0)
1767 // Add the new key field to the type.
1768 newinfo
->key_list_
.enqueue_tail (ACE_TEXT_CHAR_TO_TCHAR (key
));
1773 ACE_ERROR ((LM_ERROR
,
1774 ACE_TEXT ("missing previous #pragma ")
1775 ACE_TEXT ("DCPS_DATA_TYPE\n")));
1781 IDL_GlobalData::DCPS_Data_Type_Info
*
1782 IDL_GlobalData::is_dcps_type (UTL_ScopedName
* target
)
1784 // Traverse the entire map.
1785 DCPS_Type_Info_Map::ENTRY
* entry
;
1787 for (DCPS_Type_Info_Map::ITERATOR
current (
1788 this->dcps_type_info_map_
);
1789 current
.next (entry
);
1792 // Look for our Identifier.
1793 if (0 == entry
->int_id_
->name_
->compare (target
))
1796 return entry
->int_id_
;
1805 IDL_GlobalData::corba_module () const
1807 return this->corba_module_
;
1811 IDL_GlobalData::corba_module (AST_Module
*m
)
1813 this->corba_module_
= m
;
1816 IDL_GlobalData::Unbounded_Paths_Queue
&
1817 IDL_GlobalData::include_paths ()
1819 return this->include_paths_
;
1823 IDL_GlobalData::anon_type_diagnostic (
1824 IDL_GlobalData::ANON_TYPE_DIAGNOSTIC val
)
1826 anon_type_diagnostic_
= val
;
1827 explicit_anon_type_diagnostic_
= true;
1831 IDL_GlobalData::explicit_anon_type_diagnostic () const
1833 return explicit_anon_type_diagnostic_
;
1837 IDL_GlobalData::anon_error () const
1839 if (idl_version_
>= IDL_VERSION_4
&& !explicit_anon_type_diagnostic_
) {
1842 return anon_type_diagnostic_
== ANON_TYPE_ERROR
;
1846 IDL_GlobalData::anon_warning () const
1848 if (idl_version_
>= IDL_VERSION_4
&& !explicit_anon_type_diagnostic_
) {
1851 return anon_type_diagnostic_
== ANON_TYPE_WARNING
;
1855 IDL_GlobalData::anon_silent () const
1857 if (idl_version_
>= IDL_VERSION_4
&& !explicit_anon_type_diagnostic_
) {
1860 return anon_type_diagnostic_
== ANON_TYPE_SILENT
;
1864 IDL_GlobalData::in_typedef () const
1866 return this->in_typedef_
;
1870 IDL_GlobalData::in_typedef (bool val
)
1872 this->in_typedef_
= val
;
1876 IDL_GlobalData::in_tmpl_mod_no_alias () const
1878 return this->in_tmpl_mod_no_alias_
;
1882 IDL_GlobalData::in_tmpl_mod_no_alias (bool val
)
1884 this->in_tmpl_mod_no_alias_
= val
;
1888 IDL_GlobalData::in_tmpl_mod_alias () const
1890 return this->in_tmpl_mod_alias_
;
1894 IDL_GlobalData::in_tmpl_mod_alias (bool val
)
1896 this->in_tmpl_mod_alias_
= val
;
1900 IDL_GlobalData::parse_args_exit (int status
)
1902 parse_args_exit_
= true;
1903 parse_args_exit_status_
= status
;
1907 IDL_GlobalData::print_help ()
1910 parse_args_exit (0);
1914 IDL_GlobalData::print_version ()
1916 print_version_
= true;
1917 parse_args_exit (0);
1921 IDL_GlobalData::print_warnings ()
1923 return ! (idl_global
->compile_flags () & IDL_CF_NOWARNINGS
);
1927 * These are generated in idl.yy.cpp but they are not put in the header file,
1928 * so to use them we must declare them here.
1930 struct yy_buffer_state
;
1931 extern yy_buffer_state
*tao_yy_scan_string (const char *);
1932 extern int tao_yylex_destroy ();
1939 explicit OldState (bool disable_output
= false)
1940 : old_filename_ (idl_global
->filename () ? new UTL_String (idl_global
->filename (), true) : nullptr),
1941 // need a copy because IDL_GlobalData::set_filename() destroys previous value
1942 old_lineno_ (idl_global
->lineno ()),
1943 old_idl_src_file_ (idl_global
->idl_src_file ()),
1944 disable_output_ (disable_output
),
1945 default_streambuf_ (ACE_DEFAULT_LOG_STREAM
->rdbuf ()),
1946 flags_ (ACE_LOG_MSG
->flags ())
1948 idl_global
->in_eval_
= true;
1950 idl_global
->set_lineno (1);
1951 idl_global
->set_filename (nullptr);
1953 // Name this pseudo-file "builtin-N"
1954 static char buffer
[64];
1955 static unsigned n
= 1;
1956 ACE_OS::snprintf (&buffer
[0], sizeof buffer
, "builtin-%u", n
++);
1957 UTL_String
pseudo_filename (&buffer
[0], true);
1959 idl_global
->idl_src_file (new UTL_String (&pseudo_filename
, true));
1960 idl_global
->set_filename (new UTL_String (&pseudo_filename
, true));
1962 if (disable_output_
)
1964 ACE_DEFAULT_LOG_STREAM
->rdbuf (nullptr);
1965 ACE_LOG_MSG
->clr_flags (ACE_Log_Msg::STDERR
);
1966 ACE_LOG_MSG
->clr_flags (ACE_LOG_MSG
->flags ());
1972 idl_global
->set_lineno (old_lineno_
);
1974 idl_global
->set_filename (old_filename_
);
1975 idl_global
->idl_src_file ()->destroy ();
1976 delete idl_global
->idl_src_file ();
1977 idl_global
->idl_src_file (old_idl_src_file_
);
1978 idl_global
->reset_flag_seen ();
1980 if (disable_output_
)
1982 ACE_DEFAULT_LOG_STREAM
->rdbuf (default_streambuf_
);
1983 ACE_LOG_MSG
->set_flags (flags_
);
1986 tao_yylex_destroy ();
1987 idl_global
->in_eval_
= false;
1991 UTL_String
*const old_filename_
;
1992 const long old_lineno_
;
1993 UTL_String
*const old_idl_src_file_
;
1994 const bool disable_output_
;
1995 std::streambuf
*const default_streambuf_
;
1996 const unsigned long flags_
;
2001 IDL_GlobalData::eval (const char *string
, bool disable_output
)
2003 OldState
old (disable_output
);
2005 // Set up Flex to read from string
2006 tao_yy_scan_string (string
);
2008 // emulate DRV_drive()
2010 idl_global
->check_primary_keys ();
2011 AST_check_fwd_decls ();
2015 IDL_GlobalData::dump_ast ()
2017 idl_global
->set_compile_flags (idl_global
->compile_flags ()