diff options
79 files changed, 22565 insertions, 1258 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c index 4d7953023c1..934cb6f9287 100644 --- a/TAO/ChangeLog-98c +++ b/TAO/ChangeLog-98c @@ -1,3 +1,134 @@ +Tue Mar 10 16:09:56 1998 Aniruddha Gokhale <gokhale@mambo.cs.wustl.edu> + + * tao/cdr.{h,cpp}: Added a get_string and put_string method for + retrieving and encoding a string. This uses "memcpy" rather than + having to go through a get_char/put_char for every byte of the + string. + + * tao/connect.cpp: In "handle_request", the marshaling of inout, + out, and return value parameters was done inside this method after + the operation skeleton had returned. This required unnecessary + heap allocation of these parameters. Allocating these parameters + on the skeleton call stack was not possible since the marshaling + took place after the skeleton had returned. To eliminate these + unnecessary waste, 2 new methods on the ServerRequest class are + added that perform the demarshaling and marshaling while the + skeleton call stack is active. More explanation on these is given + below. + + * tao/{encode, decode}.cpp: Used the get_string and put_string + methods on the CDR class. + + * tao/giop.*: Added a method called "stream" that returns a + reference to the underlying CDR stream. This is helpful when you + need access to the stream so that data types can be marshaled into + the stream using a compiled form of marshaling. This form of + marshaling will soon be added to TAO IDL compiler. + + * tao/object.{h, cpp}: Added a method called "stubobj" which + returns a pointer to the underlying Stub_Object. This method + eliminates the need to call QueryInterface inside every stub. This + way some code size is reduced. + + Also, removed the "get_most_derived" method as well as the "void + *sub_" data member which was useless. + + * tao/svrrqst.{h, i, cpp}: Added a new file svrrqst.i. Added two + new methods on class IIOP_ServerRequest. These methods enable + demarshaling and marshaling of parameters while the operation + skeleton's call stack is active. The interface to these methods is + exactly like the one used by do_call i.e., a table driven + approach. Two new data structures - TAO_Param_data_Skel and + TAO_Call_Data_Skel are added. These two tables behave in exactly + the same way as the TAO_Param_Data and TAO_Call_Data tables. See + the generated code to see how these are used by the demarshal and + marshal methods. + + Two more methods and data members are added to this class - + "incoming" and "outgoing". These are the CDR streams that indicate + the incoming and the outgoing CDR streams. + + An additional "init_reply" method is added that is useful for the + compiled marshaling. This is still experimental. + + * TAO_IDL: This is the first release of the new TAO_IDL compiler + based on the Visitor pattern. All the old files and code is still + included in this release until the transition is complete. + + Although the Visitor pattern is used, we still maintain all the + code generation states we had in the previous version of the + compiler. The reason is that we maintain a Factory of Visitors + indexed on these enumerated states. The downside is the necessity + to have states and a larger code size. The larger code size is due + to the fact that everytime a Visitor is required, we must first + set the appropriate state and then ask the factory to produce it + for us. The positive side of this design is that almost all the + Visitor files are independent of each other. They only deal with + an abstract base level Visitors. The Factory will produce the + appropriate specialized Visitor which is a subclass of the base + "visitor" class. An additional benefit is that we can switch from + having to generate code that uses Interpretive marshaling to + compiled marshaling. Visitors for compiled marshaling will be + added later. Here are the files that are added: + + be_include/ + be_visitor.h + be_visitor_args.h + be_visitor_attribute.h + be_visitor_constant.h + be_visitor_context.h + be_visitor_decl.h + be_visitor_enum.h + be_visitor_field.h + be_visitor_interface.h + be_visitor_interface_fwd.h + be_visitor_module.h + be_visitor_operation.h + be_visitor_root.h + be_visitor_scope.h + be_visitor_sequence.h + be_visitor_structure.h + be_visitor_typedef.h + be_visitor_union.h + be_visitor_union_branch.h + be/ + be_visitor.cpp + be_visitor_args.cpp + be_visitor_attribute.cpp + be_visitor_constant.cpp + be_visitor_context.cpp + be_visitor_decl.cpp + be_visitor_enum.cpp + be_visitor_exception.cpp + be_visitor_field.cpp + be_visitor_interface.cpp + be_visitor_interface_fwd.cpp + be_visitor_module.cpp + be_visitor_operation.cpp + be_visitor_root.cpp + be_visitor_scope.cpp + be_visitor_sequence.cpp + be_visitor_structure.cpp + be_visitor_typedef.cpp + be_visitor_union.cpp + be_visitor_union_branch.cpp + + NOTE: Code generation for attributes is achieved by using a crude + form of the Adapter pattern. We convert the Attribute node into + one or possibly two operation nodes and add scope elements that + are arguments. The code gene ration is then handed over to the + Operation Visitors. + + * be/be_interpretive.cpp: This file defined the implementation of + the Factory of Visitors for intepretive marshaling. + + * be_include/be_codegen.h: Added a few more states. Some others + are now useless. They will be removed eventually. Also added the + Abstract Factory for Visitors. + + * Makefile: Modofoed to include all the visitor files and ran + "make depend" on it. + Tue Mar 10 13:22:20 1998 David L. Levine <levine@cs.wustl.edu> * orbsvcs/tests/Event_Latency/Makefile, @@ -45,12 +176,12 @@ Mon Mar 09 22:27:53 1998 Irfan Pyarali <irfan@cs.wustl.edu> buffer. The TAO_Temporary_Creation_Time is a special class that tracks the creation time only during the lifetime of the upcall. - + - parse_key_permanent_id() and parse_key_temporary_id() were added so that the parse_key() routine can distinguish when to create a new id and when to create a special id which is only used during the lifetime of the upcall. - + - rfind() was added so that the TAO_POA::String::rfind() does not have to be used. @@ -60,17 +191,17 @@ Mon Mar 09 22:27:53 1998 Irfan Pyarali <irfan@cs.wustl.edu> - Changed create_object_key() and parse_key() so that the old format of: - + Transient/Seconds/MicroSecond/POAName/ObjectId - + to: T/TimeStampPOAName/ObjectId - + - Removed excessive memcpy() and strcpy() calls in parse_key(). - Changed create_object_id() to not include the POA name. - + - Changed is_poa_generated_id() to take the changes to create_object_id() into account. @@ -86,10 +217,10 @@ Mon Mar 9 15:23:19 1998 Sumedh Mungee <sumedh@cs.wustl.edu> Mon Mar 9 14:57:13 1998 Carlos O'Ryan <coryan@cs.wustl.edu> - * tao/sequence.h: - * tao/sequence.cpp: - * tao/sequence_T.h: - * tao/sequence_T.cpp: + * tao/sequence.h: + * tao/sequence.cpp: + * tao/sequence_T.h: + * tao/sequence_T.cpp: Removed the _narrow_fixup() method, it was causing problem with sequences of TypeCodes and it is not really needed: the functionality can be implemented in the stubs (skeletons) and/or diff --git a/TAO/TAO_IDL/Makefile b/TAO/TAO_IDL/Makefile index 30c5ccb9c96..a8665bf3b4b 100644 --- a/TAO/TAO_IDL/Makefile +++ b/TAO/TAO_IDL/Makefile @@ -105,6 +105,11 @@ FILES = tao_idl \ be/be_produce \ be/be_args \ be/be_helper \ + be/be_codegen \ + be/be_factory \ + be/be_sunsoft \ + be/be_decl \ + be/be_scope \ be/be_state \ be/be_state_array \ be/be_state_argument \ @@ -115,16 +120,25 @@ FILES = tao_idl \ be/be_state_structure \ be/be_state_typedef \ be/be_state_union \ - be/be_codegen \ - be/be_factory \ - be/be_sunsoft \ - be/be_decl \ - be/be_scope \ be/be_visitor \ - be/be_visitor_interface \ be/be_visitor_args \ + be/be_visitor_attribute \ + be/be_visitor_constant \ + be/be_visitor_context \ + be/be_visitor_decl \ + be/be_visitor_enum \ + be/be_visitor_field \ + be/be_visitor_interface \ + be/be_visitor_interface_fwd \ + be/be_visitor_module \ + be/be_visitor_operation \ be/be_visitor_root \ + be/be_visitor_scope \ be/be_visitor_sequence \ + be/be_visitor_structure \ + be/be_visitor_typedef \ + be/be_visitor_union \ + be/be_visitor_union_branch \ be/be_interpretive LSRC = $(addsuffix .cpp,$(FILES)) \ @@ -2485,7 +2499,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_argument.o .obj/be_argument.so .shobj/be_argument.o .shobj/be_argument.so: be/be_argument.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -2553,7 +2568,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_attribute.o .obj/be_attribute.so .shobj/be_attribute.o .shobj/be_attribute.so: be/be_attribute.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -2621,7 +2637,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_constant.o .obj/be_constant.so .shobj/be_constant.o .shobj/be_constant.so: be/be_constant.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -2689,7 +2706,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_enum.o .obj/be_enum.so .shobj/be_enum.o .shobj/be_enum.so: be/be_enum.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -2757,7 +2775,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_enum_val.o .obj/be_enum_val.so .shobj/be_enum_val.o .shobj/be_enum_val.so: be/be_enum_val.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -2825,7 +2844,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_exception.o .obj/be_exception.so .shobj/be_exception.o .shobj/be_exception.so: be/be_exception.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -2893,7 +2913,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_expression.o .obj/be_expression.so .shobj/be_expression.o .shobj/be_expression.so: be/be_expression.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -2961,7 +2982,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_field.o .obj/be_field.so .shobj/be_field.o .shobj/be_field.so: be/be_field.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3029,7 +3051,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_interface.o .obj/be_interface.so .shobj/be_interface.o .shobj/be_interface.so: be/be_interface.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3066,8 +3089,8 @@ realclean.old: include/utl_error.h include/utl_indenter.h include/idl_extern.h \ include/fe_extern.h include/be_extern.h include/drv_extern.h \ include/ast_extern.h include/nr_extern.h include/global_extern.h \ - be_include/be_visitor_interface.h be_include/be_visitor.h \ - be_include/be.h \ + be_include/be_visitor_interface.h be_include/be_visitor_scope.h \ + be_include/be_visitor.h be_include/be_visitor_decl.h be_include/be.h \ $(ACE_ROOT)/ace/Singleton.h \ $(ACE_ROOT)/ace/Synch.h \ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ @@ -3098,7 +3121,7 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h + be_include/be_factory.h be_include/be_visitor_context.h .obj/be_interface_fwd.o .obj/be_interface_fwd.so .shobj/be_interface_fwd.o .shobj/be_interface_fwd.so: be/be_interface_fwd.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3166,7 +3189,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_module.o .obj/be_module.so .shobj/be_module.o .shobj/be_module.so: be/be_module.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3234,7 +3258,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_native.o .obj/be_native.so .shobj/be_native.o .shobj/be_native.so: be/be_native.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3302,7 +3327,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_operation.o .obj/be_operation.so .shobj/be_operation.o .shobj/be_operation.so: be/be_operation.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3370,7 +3396,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_predefined_type.o .obj/be_predefined_type.so .shobj/be_predefined_type.o .shobj/be_predefined_type.so: be/be_predefined_type.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3438,7 +3465,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_root.o .obj/be_root.so .shobj/be_root.o .shobj/be_root.so: be/be_root.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3506,7 +3534,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_sequence.o .obj/be_sequence.so .shobj/be_sequence.o .shobj/be_sequence.so: be/be_sequence.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3575,7 +3604,8 @@ realclean.old: be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ be_include/be_factory.h be_include/be_visitor.h \ - be_include/be_visitor_sequence.h + be_include/be_visitor_context.h be_include/be_visitor_sequence.h \ + be_include/be_visitor_decl.h .obj/be_string.o .obj/be_string.so .shobj/be_string.o .shobj/be_string.so: be/be_string.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3643,7 +3673,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_structure.o .obj/be_structure.so .shobj/be_structure.o .shobj/be_structure.so: be/be_structure.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3711,7 +3742,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_type.o .obj/be_type.so .shobj/be_type.o .shobj/be_type.so: be/be_type.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3779,7 +3811,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_typedef.o .obj/be_typedef.so .shobj/be_typedef.o .shobj/be_typedef.so: be/be_typedef.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3847,7 +3880,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_union.o .obj/be_union.so .shobj/be_union.o .shobj/be_union.so: be/be_union.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3915,7 +3949,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_union_branch.o .obj/be_union_branch.so .shobj/be_union_branch.o .shobj/be_union_branch.so: be/be_union_branch.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3983,7 +4018,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_union_label.o .obj/be_union_label.so .shobj/be_union_label.o .shobj/be_union_label.so: be/be_union_label.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -4051,7 +4087,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_generator.o .obj/be_generator.so .shobj/be_generator.o .shobj/be_generator.so: be/be_generator.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -4119,7 +4156,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_init.o .obj/be_init.so .shobj/be_init.o .shobj/be_init.so: be/be_init.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -4187,7 +4225,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_produce.o .obj/be_produce.so .shobj/be_produce.o .shobj/be_produce.so: be/be_produce.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -4256,7 +4295,7 @@ realclean.old: be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ be_include/be_factory.h be_include/be_visitor.h \ - be_include/be_interpretive.h + be_include/be_visitor_context.h be_include/be_interpretive.h .obj/be_args.o .obj/be_args.so .shobj/be_args.o .shobj/be_args.so: be/be_args.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -4324,7 +4363,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_helper.o .obj/be_helper.so .shobj/be_helper.o .shobj/be_helper.so: be/be_helper.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -4392,7 +4432,353 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h +.obj/be_codegen.o .obj/be_codegen.so .shobj/be_codegen.o .shobj/be_codegen.so: be/be_codegen.cpp include/idl.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + include/intlmacros.h include/idl_narrow.h include/idl_defines.h \ + include/idl_fwd.h include/idl_bool.h include/utl_string.h \ + include/utl_identifier.h include/ast.h include/utl_scoped_name.h \ + include/ast_decl.h include/ast_expression.h include/utl_scope.h \ + include/ast_type.h include/ast_concrete_type.h \ + include/ast_predefined_type.h include/ast_module.h include/ast_root.h \ + include/ast_interface.h include/ast_interface_fwd.h \ + include/ast_structure.h include/ast_exception.h include/ast_enum.h \ + include/ast_operation.h include/utl_list.h include/ast_field.h \ + include/ast_argument.h include/ast_attribute.h include/ast_union.h \ + include/ast_union_branch.h include/ast_union_label.h \ + include/ast_constant.h include/ast_enum_val.h include/ast_array.h \ + include/ast_sequence.h include/ast_string.h include/ast_typedef.h \ + include/ast_native.h include/utl_strlist.h include/utl_exprlist.h \ + include/ast_generator.h include/util.h include/utl_stack.h \ + include/utl_idlist.h include/utl_exceptlist.h include/utl_namelist.h \ + include/utl_labellist.h include/utl_decllist.h include/idl_global.h \ + include/utl_error.h include/utl_indenter.h include/idl_extern.h \ + include/fe_extern.h include/be_extern.h include/drv_extern.h \ + include/ast_extern.h include/nr_extern.h include/global_extern.h \ + be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + be_include/be_decl.h be_include/be_scope.h be_include/be_generator.h \ + be_include/be_type.h be_include/be_predefined_type.h \ + be_include/be_module.h be_include/be_interface.h \ + be_include/be_interface_fwd.h be_include/be_structure.h \ + be_include/be_exception.h be_include/be_expression.h \ + be_include/be_enum.h be_include/be_operation.h be_include/be_field.h \ + be_include/be_argument.h be_include/be_attribute.h \ + be_include/be_union.h be_include/be_union_branch.h \ + be_include/be_union_label.h be_include/be_constant.h \ + be_include/be_enum_val.h be_include/be_array.h \ + be_include/be_sequence.h be_include/be_string.h \ + be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ + be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h +.obj/be_factory.o .obj/be_factory.so .shobj/be_factory.o .shobj/be_factory.so: be/be_factory.cpp include/idl.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + include/intlmacros.h include/idl_narrow.h include/idl_defines.h \ + include/idl_fwd.h include/idl_bool.h include/utl_string.h \ + include/utl_identifier.h include/ast.h include/utl_scoped_name.h \ + include/ast_decl.h include/ast_expression.h include/utl_scope.h \ + include/ast_type.h include/ast_concrete_type.h \ + include/ast_predefined_type.h include/ast_module.h include/ast_root.h \ + include/ast_interface.h include/ast_interface_fwd.h \ + include/ast_structure.h include/ast_exception.h include/ast_enum.h \ + include/ast_operation.h include/utl_list.h include/ast_field.h \ + include/ast_argument.h include/ast_attribute.h include/ast_union.h \ + include/ast_union_branch.h include/ast_union_label.h \ + include/ast_constant.h include/ast_enum_val.h include/ast_array.h \ + include/ast_sequence.h include/ast_string.h include/ast_typedef.h \ + include/ast_native.h include/utl_strlist.h include/utl_exprlist.h \ + include/ast_generator.h include/util.h include/utl_stack.h \ + include/utl_idlist.h include/utl_exceptlist.h include/utl_namelist.h \ + include/utl_labellist.h include/utl_decllist.h include/idl_global.h \ + include/utl_error.h include/utl_indenter.h include/idl_extern.h \ + include/fe_extern.h include/be_extern.h include/drv_extern.h \ + include/ast_extern.h include/nr_extern.h include/global_extern.h \ + be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + be_include/be_decl.h be_include/be_scope.h be_include/be_generator.h \ + be_include/be_type.h be_include/be_predefined_type.h \ + be_include/be_module.h be_include/be_interface.h \ + be_include/be_interface_fwd.h be_include/be_structure.h \ + be_include/be_exception.h be_include/be_expression.h \ + be_include/be_enum.h be_include/be_operation.h be_include/be_field.h \ + be_include/be_argument.h be_include/be_attribute.h \ + be_include/be_union.h be_include/be_union_branch.h \ + be_include/be_union_label.h be_include/be_constant.h \ + be_include/be_enum_val.h be_include/be_array.h \ + be_include/be_sequence.h be_include/be_string.h \ + be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ + be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h be_include/be_sunsoft.h +.obj/be_sunsoft.o .obj/be_sunsoft.so .shobj/be_sunsoft.o .shobj/be_sunsoft.so: be/be_sunsoft.cpp include/idl.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + include/intlmacros.h include/idl_narrow.h include/idl_defines.h \ + include/idl_fwd.h include/idl_bool.h include/utl_string.h \ + include/utl_identifier.h include/ast.h include/utl_scoped_name.h \ + include/ast_decl.h include/ast_expression.h include/utl_scope.h \ + include/ast_type.h include/ast_concrete_type.h \ + include/ast_predefined_type.h include/ast_module.h include/ast_root.h \ + include/ast_interface.h include/ast_interface_fwd.h \ + include/ast_structure.h include/ast_exception.h include/ast_enum.h \ + include/ast_operation.h include/utl_list.h include/ast_field.h \ + include/ast_argument.h include/ast_attribute.h include/ast_union.h \ + include/ast_union_branch.h include/ast_union_label.h \ + include/ast_constant.h include/ast_enum_val.h include/ast_array.h \ + include/ast_sequence.h include/ast_string.h include/ast_typedef.h \ + include/ast_native.h include/utl_strlist.h include/utl_exprlist.h \ + include/ast_generator.h include/util.h include/utl_stack.h \ + include/utl_idlist.h include/utl_exceptlist.h include/utl_namelist.h \ + include/utl_labellist.h include/utl_decllist.h include/idl_global.h \ + include/utl_error.h include/utl_indenter.h include/idl_extern.h \ + include/fe_extern.h include/be_extern.h include/drv_extern.h \ + include/ast_extern.h include/nr_extern.h include/global_extern.h \ + be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + be_include/be_decl.h be_include/be_scope.h be_include/be_generator.h \ + be_include/be_type.h be_include/be_predefined_type.h \ + be_include/be_module.h be_include/be_interface.h \ + be_include/be_interface_fwd.h be_include/be_structure.h \ + be_include/be_exception.h be_include/be_expression.h \ + be_include/be_enum.h be_include/be_operation.h be_include/be_field.h \ + be_include/be_argument.h be_include/be_attribute.h \ + be_include/be_union.h be_include/be_union_branch.h \ + be_include/be_union_label.h be_include/be_constant.h \ + be_include/be_enum_val.h be_include/be_array.h \ + be_include/be_sequence.h be_include/be_string.h \ + be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ + be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h be_include/be_sunsoft.h +.obj/be_decl.o .obj/be_decl.so .shobj/be_decl.o .shobj/be_decl.so: be/be_decl.cpp include/idl.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + include/intlmacros.h include/idl_narrow.h include/idl_defines.h \ + include/idl_fwd.h include/idl_bool.h include/utl_string.h \ + include/utl_identifier.h include/ast.h include/utl_scoped_name.h \ + include/ast_decl.h include/ast_expression.h include/utl_scope.h \ + include/ast_type.h include/ast_concrete_type.h \ + include/ast_predefined_type.h include/ast_module.h include/ast_root.h \ + include/ast_interface.h include/ast_interface_fwd.h \ + include/ast_structure.h include/ast_exception.h include/ast_enum.h \ + include/ast_operation.h include/utl_list.h include/ast_field.h \ + include/ast_argument.h include/ast_attribute.h include/ast_union.h \ + include/ast_union_branch.h include/ast_union_label.h \ + include/ast_constant.h include/ast_enum_val.h include/ast_array.h \ + include/ast_sequence.h include/ast_string.h include/ast_typedef.h \ + include/ast_native.h include/utl_strlist.h include/utl_exprlist.h \ + include/ast_generator.h include/util.h include/utl_stack.h \ + include/utl_idlist.h include/utl_exceptlist.h include/utl_namelist.h \ + include/utl_labellist.h include/utl_decllist.h include/idl_global.h \ + include/utl_error.h include/utl_indenter.h include/idl_extern.h \ + include/fe_extern.h include/be_extern.h include/drv_extern.h \ + include/ast_extern.h include/nr_extern.h include/global_extern.h \ + be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + be_include/be_decl.h be_include/be_scope.h be_include/be_generator.h \ + be_include/be_type.h be_include/be_predefined_type.h \ + be_include/be_module.h be_include/be_interface.h \ + be_include/be_interface_fwd.h be_include/be_structure.h \ + be_include/be_exception.h be_include/be_expression.h \ + be_include/be_enum.h be_include/be_operation.h be_include/be_field.h \ + be_include/be_argument.h be_include/be_attribute.h \ + be_include/be_union.h be_include/be_union_branch.h \ + be_include/be_union_label.h be_include/be_constant.h \ + be_include/be_enum_val.h be_include/be_array.h \ + be_include/be_sequence.h be_include/be_string.h \ + be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ + be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h +.obj/be_scope.o .obj/be_scope.so .shobj/be_scope.o .shobj/be_scope.so: be/be_scope.cpp include/idl.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + include/intlmacros.h include/idl_narrow.h include/idl_defines.h \ + include/idl_fwd.h include/idl_bool.h include/utl_string.h \ + include/utl_identifier.h include/ast.h include/utl_scoped_name.h \ + include/ast_decl.h include/ast_expression.h include/utl_scope.h \ + include/ast_type.h include/ast_concrete_type.h \ + include/ast_predefined_type.h include/ast_module.h include/ast_root.h \ + include/ast_interface.h include/ast_interface_fwd.h \ + include/ast_structure.h include/ast_exception.h include/ast_enum.h \ + include/ast_operation.h include/utl_list.h include/ast_field.h \ + include/ast_argument.h include/ast_attribute.h include/ast_union.h \ + include/ast_union_branch.h include/ast_union_label.h \ + include/ast_constant.h include/ast_enum_val.h include/ast_array.h \ + include/ast_sequence.h include/ast_string.h include/ast_typedef.h \ + include/ast_native.h include/utl_strlist.h include/utl_exprlist.h \ + include/ast_generator.h include/util.h include/utl_stack.h \ + include/utl_idlist.h include/utl_exceptlist.h include/utl_namelist.h \ + include/utl_labellist.h include/utl_decllist.h include/idl_global.h \ + include/utl_error.h include/utl_indenter.h include/idl_extern.h \ + include/fe_extern.h include/be_extern.h include/drv_extern.h \ + include/ast_extern.h include/nr_extern.h include/global_extern.h \ + be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + be_include/be_decl.h be_include/be_scope.h be_include/be_generator.h \ + be_include/be_type.h be_include/be_predefined_type.h \ + be_include/be_module.h be_include/be_interface.h \ + be_include/be_interface_fwd.h be_include/be_structure.h \ + be_include/be_exception.h be_include/be_expression.h \ + be_include/be_enum.h be_include/be_operation.h be_include/be_field.h \ + be_include/be_argument.h be_include/be_attribute.h \ + be_include/be_union.h be_include/be_union_branch.h \ + be_include/be_union_label.h be_include/be_constant.h \ + be_include/be_enum_val.h be_include/be_array.h \ + be_include/be_sequence.h be_include/be_string.h \ + be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ + be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_state.o .obj/be_state.so .shobj/be_state.o .shobj/be_state.so: be/be_state.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -4460,7 +4846,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_state_array.o .obj/be_state_array.so .shobj/be_state_array.o .shobj/be_state_array.so: be/be_state_array.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -4528,7 +4915,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_state_argument.o .obj/be_state_argument.so .shobj/be_state_argument.o .shobj/be_state_argument.so: be/be_state_argument.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -4596,7 +4984,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_state_attribute.o .obj/be_state_attribute.so .shobj/be_state_attribute.o .shobj/be_state_attribute.so: be/be_state_attribute.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -4664,7 +5053,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_state_exception.o .obj/be_state_exception.so .shobj/be_state_exception.o .shobj/be_state_exception.so: be/be_state_exception.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -4732,7 +5122,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_state_operation.o .obj/be_state_operation.so .shobj/be_state_operation.o .shobj/be_state_operation.so: be/be_state_operation.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -4800,7 +5191,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_state_sequence.o .obj/be_state_sequence.so .shobj/be_state_sequence.o .shobj/be_state_sequence.so: be/be_state_sequence.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -4868,7 +5260,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_state_structure.o .obj/be_state_structure.so .shobj/be_state_structure.o .shobj/be_state_structure.so: be/be_state_structure.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -4936,7 +5329,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_state_typedef.o .obj/be_state_typedef.so .shobj/be_state_typedef.o .shobj/be_state_typedef.so: be/be_state_typedef.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -5004,7 +5398,8 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h .obj/be_state_union.o .obj/be_state_union.so .shobj/be_state_union.o .shobj/be_state_union.so: be/be_state_union.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -5072,8 +5467,142 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h -.obj/be_codegen.o .obj/be_codegen.so .shobj/be_codegen.o .shobj/be_codegen.so: be/be_codegen.cpp include/idl.h \ + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h +.obj/be_visitor.o .obj/be_visitor.so .shobj/be_visitor.o .shobj/be_visitor.so: be/be_visitor.cpp include/idl.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + include/intlmacros.h include/idl_narrow.h include/idl_defines.h \ + include/idl_fwd.h include/idl_bool.h include/utl_string.h \ + include/utl_identifier.h include/ast.h include/utl_scoped_name.h \ + include/ast_decl.h include/ast_expression.h include/utl_scope.h \ + include/ast_type.h include/ast_concrete_type.h \ + include/ast_predefined_type.h include/ast_module.h include/ast_root.h \ + include/ast_interface.h include/ast_interface_fwd.h \ + include/ast_structure.h include/ast_exception.h include/ast_enum.h \ + include/ast_operation.h include/utl_list.h include/ast_field.h \ + include/ast_argument.h include/ast_attribute.h include/ast_union.h \ + include/ast_union_branch.h include/ast_union_label.h \ + include/ast_constant.h include/ast_enum_val.h include/ast_array.h \ + include/ast_sequence.h include/ast_string.h include/ast_typedef.h \ + include/ast_native.h include/utl_strlist.h include/utl_exprlist.h \ + include/ast_generator.h include/util.h include/utl_stack.h \ + include/utl_idlist.h include/utl_exceptlist.h include/utl_namelist.h \ + include/utl_labellist.h include/utl_decllist.h include/idl_global.h \ + include/utl_error.h include/utl_indenter.h be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + be_include/be_decl.h be_include/be_scope.h be_include/be_generator.h \ + be_include/be_type.h be_include/be_predefined_type.h \ + be_include/be_module.h be_include/be_interface.h \ + be_include/be_interface_fwd.h be_include/be_structure.h \ + be_include/be_exception.h be_include/be_expression.h \ + be_include/be_enum.h be_include/be_operation.h be_include/be_field.h \ + be_include/be_argument.h be_include/be_attribute.h \ + be_include/be_union.h be_include/be_union_branch.h \ + be_include/be_union_label.h be_include/be_constant.h \ + be_include/be_enum_val.h be_include/be_array.h \ + be_include/be_sequence.h be_include/be_string.h \ + be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ + be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h +.obj/be_visitor_args.o .obj/be_visitor_args.so .shobj/be_visitor_args.o .shobj/be_visitor_args.so: be/be_visitor_args.cpp include/idl.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + include/intlmacros.h include/idl_narrow.h include/idl_defines.h \ + include/idl_fwd.h include/idl_bool.h include/utl_string.h \ + include/utl_identifier.h include/ast.h include/utl_scoped_name.h \ + include/ast_decl.h include/ast_expression.h include/utl_scope.h \ + include/ast_type.h include/ast_concrete_type.h \ + include/ast_predefined_type.h include/ast_module.h include/ast_root.h \ + include/ast_interface.h include/ast_interface_fwd.h \ + include/ast_structure.h include/ast_exception.h include/ast_enum.h \ + include/ast_operation.h include/utl_list.h include/ast_field.h \ + include/ast_argument.h include/ast_attribute.h include/ast_union.h \ + include/ast_union_branch.h include/ast_union_label.h \ + include/ast_constant.h include/ast_enum_val.h include/ast_array.h \ + include/ast_sequence.h include/ast_string.h include/ast_typedef.h \ + include/ast_native.h include/utl_strlist.h include/utl_exprlist.h \ + include/ast_generator.h include/util.h include/utl_stack.h \ + include/utl_idlist.h include/utl_exceptlist.h include/utl_namelist.h \ + include/utl_labellist.h include/utl_decllist.h include/idl_global.h \ + include/utl_error.h include/utl_indenter.h be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + be_include/be_decl.h be_include/be_scope.h be_include/be_generator.h \ + be_include/be_type.h be_include/be_predefined_type.h \ + be_include/be_module.h be_include/be_interface.h \ + be_include/be_interface_fwd.h be_include/be_structure.h \ + be_include/be_exception.h be_include/be_expression.h \ + be_include/be_enum.h be_include/be_operation.h be_include/be_field.h \ + be_include/be_argument.h be_include/be_attribute.h \ + be_include/be_union.h be_include/be_union_branch.h \ + be_include/be_union_label.h be_include/be_constant.h \ + be_include/be_enum_val.h be_include/be_array.h \ + be_include/be_sequence.h be_include/be_string.h \ + be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ + be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h be_include/be_visitor_args.h \ + be_include/be_visitor_decl.h +.obj/be_visitor_attribute.o .obj/be_visitor_attribute.so .shobj/be_visitor_attribute.o .shobj/be_visitor_attribute.so: be/be_visitor_attribute.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ @@ -5140,8 +5669,10 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h -.obj/be_factory.o .obj/be_factory.so .shobj/be_factory.o .shobj/be_factory.so: be/be_factory.cpp include/idl.h \ + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h be_include/be_visitor_attribute.h \ + be_include/be_visitor_scope.h be_include/be_visitor_decl.h +.obj/be_visitor_constant.o .obj/be_visitor_constant.so .shobj/be_visitor_constant.o .shobj/be_visitor_constant.so: be/be_visitor_constant.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ @@ -5209,8 +5740,9 @@ realclean.old: be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ be_include/be_factory.h be_include/be_visitor.h \ - be_include/be_sunsoft.h -.obj/be_sunsoft.o .obj/be_sunsoft.so .shobj/be_sunsoft.o .shobj/be_sunsoft.so: be/be_sunsoft.cpp include/idl.h \ + be_include/be_visitor_context.h be_include/be_visitor_constant.h \ + be_include/be_visitor_scope.h be_include/be_visitor_decl.h +.obj/be_visitor_context.o .obj/be_visitor_context.so .shobj/be_visitor_context.o .shobj/be_visitor_context.so: be/be_visitor_context.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ @@ -5278,8 +5810,8 @@ realclean.old: be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ be_include/be_factory.h be_include/be_visitor.h \ - be_include/be_sunsoft.h -.obj/be_decl.o .obj/be_decl.so .shobj/be_decl.o .shobj/be_decl.so: be/be_decl.cpp include/idl.h \ + be_include/be_visitor_context.h +.obj/be_visitor_decl.o .obj/be_visitor_decl.so .shobj/be_visitor_decl.o .shobj/be_visitor_decl.so: be/be_visitor_decl.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ @@ -5346,8 +5878,9 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h -.obj/be_scope.o .obj/be_scope.so .shobj/be_scope.o .shobj/be_scope.so: be/be_scope.cpp include/idl.h \ + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h be_include/be_visitor_decl.h +.obj/be_visitor_enum.o .obj/be_visitor_enum.so .shobj/be_visitor_enum.o .shobj/be_visitor_enum.so: be/be_visitor_enum.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ @@ -5414,8 +5947,10 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h -.obj/be_visitor.o .obj/be_visitor.so .shobj/be_visitor.o .shobj/be_visitor.so: be/be_visitor.cpp include/idl.h \ + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h be_include/be_visitor_enum.h \ + be_include/be_visitor_scope.h be_include/be_visitor_decl.h +.obj/be_visitor_field.o .obj/be_visitor_field.so .shobj/be_visitor_field.o .shobj/be_visitor_field.so: be/be_visitor_field.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ @@ -5448,7 +5983,10 @@ realclean.old: include/ast_generator.h include/util.h include/utl_stack.h \ include/utl_idlist.h include/utl_exceptlist.h include/utl_namelist.h \ include/utl_labellist.h include/utl_decllist.h include/idl_global.h \ - include/utl_error.h include/utl_indenter.h be_include/be.h \ + include/utl_error.h include/utl_indenter.h include/idl_extern.h \ + include/fe_extern.h include/be_extern.h include/drv_extern.h \ + include/ast_extern.h include/nr_extern.h include/global_extern.h \ + be_include/be.h \ $(ACE_ROOT)/ace/Singleton.h \ $(ACE_ROOT)/ace/Synch.h \ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ @@ -5479,7 +6017,9 @@ realclean.old: be_include/be_sequence.h be_include/be_string.h \ be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ - be_include/be_factory.h be_include/be_visitor.h + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h be_include/be_visitor_field.h \ + be_include/be_visitor_decl.h .obj/be_visitor_interface.o .obj/be_visitor_interface.so .shobj/be_visitor_interface.o .shobj/be_visitor_interface.so: be/be_visitor_interface.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -5513,8 +6053,10 @@ realclean.old: include/ast_generator.h include/util.h include/utl_stack.h \ include/utl_idlist.h include/utl_exceptlist.h include/utl_namelist.h \ include/utl_labellist.h include/utl_decllist.h include/idl_global.h \ - include/utl_error.h include/utl_indenter.h include/global_extern.h \ - include/nr_extern.h be_include/be.h \ + include/utl_error.h include/utl_indenter.h include/idl_extern.h \ + include/fe_extern.h include/be_extern.h include/drv_extern.h \ + include/ast_extern.h include/nr_extern.h include/global_extern.h \ + be_include/be.h \ $(ACE_ROOT)/ace/Singleton.h \ $(ACE_ROOT)/ace/Synch.h \ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ @@ -5546,8 +6088,79 @@ realclean.old: be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ be_include/be_factory.h be_include/be_visitor.h \ - be_include/be_visitor_args.h be_include/be_visitor_interface.h -.obj/be_visitor_args.o .obj/be_visitor_args.so .shobj/be_visitor_args.o .shobj/be_visitor_args.so: be/be_visitor_args.cpp include/idl.h \ + be_include/be_visitor_context.h be_include/be_visitor_interface.h \ + be_include/be_visitor_scope.h be_include/be_visitor_decl.h +.obj/be_visitor_interface_fwd.o .obj/be_visitor_interface_fwd.so .shobj/be_visitor_interface_fwd.o .shobj/be_visitor_interface_fwd.so: be/be_visitor_interface_fwd.cpp \ + include/idl.h $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + include/intlmacros.h include/idl_narrow.h include/idl_defines.h \ + include/idl_fwd.h include/idl_bool.h include/utl_string.h \ + include/utl_identifier.h include/ast.h include/utl_scoped_name.h \ + include/ast_decl.h include/ast_expression.h include/utl_scope.h \ + include/ast_type.h include/ast_concrete_type.h \ + include/ast_predefined_type.h include/ast_module.h include/ast_root.h \ + include/ast_interface.h include/ast_interface_fwd.h \ + include/ast_structure.h include/ast_exception.h include/ast_enum.h \ + include/ast_operation.h include/utl_list.h include/ast_field.h \ + include/ast_argument.h include/ast_attribute.h include/ast_union.h \ + include/ast_union_branch.h include/ast_union_label.h \ + include/ast_constant.h include/ast_enum_val.h include/ast_array.h \ + include/ast_sequence.h include/ast_string.h include/ast_typedef.h \ + include/ast_native.h include/utl_strlist.h include/utl_exprlist.h \ + include/ast_generator.h include/util.h include/utl_stack.h \ + include/utl_idlist.h include/utl_exceptlist.h include/utl_namelist.h \ + include/utl_labellist.h include/utl_decllist.h include/idl_global.h \ + include/utl_error.h include/utl_indenter.h include/idl_extern.h \ + include/fe_extern.h include/be_extern.h include/drv_extern.h \ + include/ast_extern.h include/nr_extern.h include/global_extern.h \ + be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + be_include/be_decl.h be_include/be_scope.h be_include/be_generator.h \ + be_include/be_type.h be_include/be_predefined_type.h \ + be_include/be_module.h be_include/be_interface.h \ + be_include/be_interface_fwd.h be_include/be_structure.h \ + be_include/be_exception.h be_include/be_expression.h \ + be_include/be_enum.h be_include/be_operation.h be_include/be_field.h \ + be_include/be_argument.h be_include/be_attribute.h \ + be_include/be_union.h be_include/be_union_branch.h \ + be_include/be_union_label.h be_include/be_constant.h \ + be_include/be_enum_val.h be_include/be_array.h \ + be_include/be_sequence.h be_include/be_string.h \ + be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ + be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h be_include/be_visitor_interface_fwd.h \ + be_include/be_visitor_scope.h be_include/be_visitor_decl.h +.obj/be_visitor_module.o .obj/be_visitor_module.so .shobj/be_visitor_module.o .shobj/be_visitor_module.so: be/be_visitor_module.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ @@ -5580,7 +6193,10 @@ realclean.old: include/ast_generator.h include/util.h include/utl_stack.h \ include/utl_idlist.h include/utl_exceptlist.h include/utl_namelist.h \ include/utl_labellist.h include/utl_decllist.h include/idl_global.h \ - include/utl_error.h include/utl_indenter.h be_include/be.h \ + include/utl_error.h include/utl_indenter.h include/idl_extern.h \ + include/fe_extern.h include/be_extern.h include/drv_extern.h \ + include/ast_extern.h include/nr_extern.h include/global_extern.h \ + be_include/be.h \ $(ACE_ROOT)/ace/Singleton.h \ $(ACE_ROOT)/ace/Synch.h \ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ @@ -5612,7 +6228,78 @@ realclean.old: be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ be_include/be_factory.h be_include/be_visitor.h \ - be_include/be_visitor_args.h + be_include/be_visitor_context.h be_include/be_visitor_module.h \ + be_include/be_visitor_scope.h be_include/be_visitor_decl.h +.obj/be_visitor_operation.o .obj/be_visitor_operation.so .shobj/be_visitor_operation.o .shobj/be_visitor_operation.so: be/be_visitor_operation.cpp include/idl.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + include/intlmacros.h include/idl_narrow.h include/idl_defines.h \ + include/idl_fwd.h include/idl_bool.h include/utl_string.h \ + include/utl_identifier.h include/ast.h include/utl_scoped_name.h \ + include/ast_decl.h include/ast_expression.h include/utl_scope.h \ + include/ast_type.h include/ast_concrete_type.h \ + include/ast_predefined_type.h include/ast_module.h include/ast_root.h \ + include/ast_interface.h include/ast_interface_fwd.h \ + include/ast_structure.h include/ast_exception.h include/ast_enum.h \ + include/ast_operation.h include/utl_list.h include/ast_field.h \ + include/ast_argument.h include/ast_attribute.h include/ast_union.h \ + include/ast_union_branch.h include/ast_union_label.h \ + include/ast_constant.h include/ast_enum_val.h include/ast_array.h \ + include/ast_sequence.h include/ast_string.h include/ast_typedef.h \ + include/ast_native.h include/utl_strlist.h include/utl_exprlist.h \ + include/ast_generator.h include/util.h include/utl_stack.h \ + include/utl_idlist.h include/utl_exceptlist.h include/utl_namelist.h \ + include/utl_labellist.h include/utl_decllist.h include/idl_global.h \ + include/utl_error.h include/utl_indenter.h include/idl_extern.h \ + include/fe_extern.h include/be_extern.h include/drv_extern.h \ + include/ast_extern.h include/nr_extern.h include/global_extern.h \ + be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + be_include/be_decl.h be_include/be_scope.h be_include/be_generator.h \ + be_include/be_type.h be_include/be_predefined_type.h \ + be_include/be_module.h be_include/be_interface.h \ + be_include/be_interface_fwd.h be_include/be_structure.h \ + be_include/be_exception.h be_include/be_expression.h \ + be_include/be_enum.h be_include/be_operation.h be_include/be_field.h \ + be_include/be_argument.h be_include/be_attribute.h \ + be_include/be_union.h be_include/be_union_branch.h \ + be_include/be_union_label.h be_include/be_constant.h \ + be_include/be_enum_val.h be_include/be_array.h \ + be_include/be_sequence.h be_include/be_string.h \ + be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ + be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h be_include/be_visitor_operation.h \ + be_include/be_visitor_scope.h be_include/be_visitor_decl.h .obj/be_visitor_root.o .obj/be_visitor_root.so .shobj/be_visitor_root.o .shobj/be_visitor_root.so: be/be_visitor_root.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -5681,7 +6368,78 @@ realclean.old: be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ be_include/be_factory.h be_include/be_visitor.h \ - be_include/be_visitor_root.h + be_include/be_visitor_context.h be_include/be_visitor_root.h \ + be_include/be_visitor_scope.h be_include/be_visitor_decl.h +.obj/be_visitor_scope.o .obj/be_visitor_scope.so .shobj/be_visitor_scope.o .shobj/be_visitor_scope.so: be/be_visitor_scope.cpp include/idl.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + include/intlmacros.h include/idl_narrow.h include/idl_defines.h \ + include/idl_fwd.h include/idl_bool.h include/utl_string.h \ + include/utl_identifier.h include/ast.h include/utl_scoped_name.h \ + include/ast_decl.h include/ast_expression.h include/utl_scope.h \ + include/ast_type.h include/ast_concrete_type.h \ + include/ast_predefined_type.h include/ast_module.h include/ast_root.h \ + include/ast_interface.h include/ast_interface_fwd.h \ + include/ast_structure.h include/ast_exception.h include/ast_enum.h \ + include/ast_operation.h include/utl_list.h include/ast_field.h \ + include/ast_argument.h include/ast_attribute.h include/ast_union.h \ + include/ast_union_branch.h include/ast_union_label.h \ + include/ast_constant.h include/ast_enum_val.h include/ast_array.h \ + include/ast_sequence.h include/ast_string.h include/ast_typedef.h \ + include/ast_native.h include/utl_strlist.h include/utl_exprlist.h \ + include/ast_generator.h include/util.h include/utl_stack.h \ + include/utl_idlist.h include/utl_exceptlist.h include/utl_namelist.h \ + include/utl_labellist.h include/utl_decllist.h include/idl_global.h \ + include/utl_error.h include/utl_indenter.h include/idl_extern.h \ + include/fe_extern.h include/be_extern.h include/drv_extern.h \ + include/ast_extern.h include/nr_extern.h include/global_extern.h \ + be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + be_include/be_decl.h be_include/be_scope.h be_include/be_generator.h \ + be_include/be_type.h be_include/be_predefined_type.h \ + be_include/be_module.h be_include/be_interface.h \ + be_include/be_interface_fwd.h be_include/be_structure.h \ + be_include/be_exception.h be_include/be_expression.h \ + be_include/be_enum.h be_include/be_operation.h be_include/be_field.h \ + be_include/be_argument.h be_include/be_attribute.h \ + be_include/be_union.h be_include/be_union_branch.h \ + be_include/be_union_label.h be_include/be_constant.h \ + be_include/be_enum_val.h be_include/be_array.h \ + be_include/be_sequence.h be_include/be_string.h \ + be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ + be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h be_include/be_visitor_scope.h \ + be_include/be_visitor_decl.h .obj/be_visitor_sequence.o .obj/be_visitor_sequence.so .shobj/be_visitor_sequence.o .shobj/be_visitor_sequence.so: be/be_visitor_sequence.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -5750,7 +6508,288 @@ realclean.old: be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ be_include/be_factory.h be_include/be_visitor.h \ - be_include/be_visitor_sequence.h + be_include/be_visitor_context.h be_include/be_visitor_sequence.h \ + be_include/be_visitor_decl.h +.obj/be_visitor_structure.o .obj/be_visitor_structure.so .shobj/be_visitor_structure.o .shobj/be_visitor_structure.so: be/be_visitor_structure.cpp include/idl.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + include/intlmacros.h include/idl_narrow.h include/idl_defines.h \ + include/idl_fwd.h include/idl_bool.h include/utl_string.h \ + include/utl_identifier.h include/ast.h include/utl_scoped_name.h \ + include/ast_decl.h include/ast_expression.h include/utl_scope.h \ + include/ast_type.h include/ast_concrete_type.h \ + include/ast_predefined_type.h include/ast_module.h include/ast_root.h \ + include/ast_interface.h include/ast_interface_fwd.h \ + include/ast_structure.h include/ast_exception.h include/ast_enum.h \ + include/ast_operation.h include/utl_list.h include/ast_field.h \ + include/ast_argument.h include/ast_attribute.h include/ast_union.h \ + include/ast_union_branch.h include/ast_union_label.h \ + include/ast_constant.h include/ast_enum_val.h include/ast_array.h \ + include/ast_sequence.h include/ast_string.h include/ast_typedef.h \ + include/ast_native.h include/utl_strlist.h include/utl_exprlist.h \ + include/ast_generator.h include/util.h include/utl_stack.h \ + include/utl_idlist.h include/utl_exceptlist.h include/utl_namelist.h \ + include/utl_labellist.h include/utl_decllist.h include/idl_global.h \ + include/utl_error.h include/utl_indenter.h include/idl_extern.h \ + include/fe_extern.h include/be_extern.h include/drv_extern.h \ + include/ast_extern.h include/nr_extern.h include/global_extern.h \ + be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + be_include/be_decl.h be_include/be_scope.h be_include/be_generator.h \ + be_include/be_type.h be_include/be_predefined_type.h \ + be_include/be_module.h be_include/be_interface.h \ + be_include/be_interface_fwd.h be_include/be_structure.h \ + be_include/be_exception.h be_include/be_expression.h \ + be_include/be_enum.h be_include/be_operation.h be_include/be_field.h \ + be_include/be_argument.h be_include/be_attribute.h \ + be_include/be_union.h be_include/be_union_branch.h \ + be_include/be_union_label.h be_include/be_constant.h \ + be_include/be_enum_val.h be_include/be_array.h \ + be_include/be_sequence.h be_include/be_string.h \ + be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ + be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h be_include/be_visitor_structure.h \ + be_include/be_visitor_scope.h be_include/be_visitor_decl.h +.obj/be_visitor_typedef.o .obj/be_visitor_typedef.so .shobj/be_visitor_typedef.o .shobj/be_visitor_typedef.so: be/be_visitor_typedef.cpp include/idl.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + include/intlmacros.h include/idl_narrow.h include/idl_defines.h \ + include/idl_fwd.h include/idl_bool.h include/utl_string.h \ + include/utl_identifier.h include/ast.h include/utl_scoped_name.h \ + include/ast_decl.h include/ast_expression.h include/utl_scope.h \ + include/ast_type.h include/ast_concrete_type.h \ + include/ast_predefined_type.h include/ast_module.h include/ast_root.h \ + include/ast_interface.h include/ast_interface_fwd.h \ + include/ast_structure.h include/ast_exception.h include/ast_enum.h \ + include/ast_operation.h include/utl_list.h include/ast_field.h \ + include/ast_argument.h include/ast_attribute.h include/ast_union.h \ + include/ast_union_branch.h include/ast_union_label.h \ + include/ast_constant.h include/ast_enum_val.h include/ast_array.h \ + include/ast_sequence.h include/ast_string.h include/ast_typedef.h \ + include/ast_native.h include/utl_strlist.h include/utl_exprlist.h \ + include/ast_generator.h include/util.h include/utl_stack.h \ + include/utl_idlist.h include/utl_exceptlist.h include/utl_namelist.h \ + include/utl_labellist.h include/utl_decllist.h include/idl_global.h \ + include/utl_error.h include/utl_indenter.h include/idl_extern.h \ + include/fe_extern.h include/be_extern.h include/drv_extern.h \ + include/ast_extern.h include/nr_extern.h include/global_extern.h \ + be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + be_include/be_decl.h be_include/be_scope.h be_include/be_generator.h \ + be_include/be_type.h be_include/be_predefined_type.h \ + be_include/be_module.h be_include/be_interface.h \ + be_include/be_interface_fwd.h be_include/be_structure.h \ + be_include/be_exception.h be_include/be_expression.h \ + be_include/be_enum.h be_include/be_operation.h be_include/be_field.h \ + be_include/be_argument.h be_include/be_attribute.h \ + be_include/be_union.h be_include/be_union_branch.h \ + be_include/be_union_label.h be_include/be_constant.h \ + be_include/be_enum_val.h be_include/be_array.h \ + be_include/be_sequence.h be_include/be_string.h \ + be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ + be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h be_include/be_visitor_typedef.h \ + be_include/be_visitor_scope.h be_include/be_visitor_decl.h +.obj/be_visitor_union.o .obj/be_visitor_union.so .shobj/be_visitor_union.o .shobj/be_visitor_union.so: be/be_visitor_union.cpp include/idl.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + include/intlmacros.h include/idl_narrow.h include/idl_defines.h \ + include/idl_fwd.h include/idl_bool.h include/utl_string.h \ + include/utl_identifier.h include/ast.h include/utl_scoped_name.h \ + include/ast_decl.h include/ast_expression.h include/utl_scope.h \ + include/ast_type.h include/ast_concrete_type.h \ + include/ast_predefined_type.h include/ast_module.h include/ast_root.h \ + include/ast_interface.h include/ast_interface_fwd.h \ + include/ast_structure.h include/ast_exception.h include/ast_enum.h \ + include/ast_operation.h include/utl_list.h include/ast_field.h \ + include/ast_argument.h include/ast_attribute.h include/ast_union.h \ + include/ast_union_branch.h include/ast_union_label.h \ + include/ast_constant.h include/ast_enum_val.h include/ast_array.h \ + include/ast_sequence.h include/ast_string.h include/ast_typedef.h \ + include/ast_native.h include/utl_strlist.h include/utl_exprlist.h \ + include/ast_generator.h include/util.h include/utl_stack.h \ + include/utl_idlist.h include/utl_exceptlist.h include/utl_namelist.h \ + include/utl_labellist.h include/utl_decllist.h include/idl_global.h \ + include/utl_error.h include/utl_indenter.h include/idl_extern.h \ + include/fe_extern.h include/be_extern.h include/drv_extern.h \ + include/ast_extern.h include/nr_extern.h include/global_extern.h \ + be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + be_include/be_decl.h be_include/be_scope.h be_include/be_generator.h \ + be_include/be_type.h be_include/be_predefined_type.h \ + be_include/be_module.h be_include/be_interface.h \ + be_include/be_interface_fwd.h be_include/be_structure.h \ + be_include/be_exception.h be_include/be_expression.h \ + be_include/be_enum.h be_include/be_operation.h be_include/be_field.h \ + be_include/be_argument.h be_include/be_attribute.h \ + be_include/be_union.h be_include/be_union_branch.h \ + be_include/be_union_label.h be_include/be_constant.h \ + be_include/be_enum_val.h be_include/be_array.h \ + be_include/be_sequence.h be_include/be_string.h \ + be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ + be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h be_include/be_visitor_union.h \ + be_include/be_visitor_scope.h be_include/be_visitor_decl.h +.obj/be_visitor_union_branch.o .obj/be_visitor_union_branch.so .shobj/be_visitor_union_branch.o .shobj/be_visitor_union_branch.so: be/be_visitor_union_branch.cpp \ + include/idl.h $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + include/intlmacros.h include/idl_narrow.h include/idl_defines.h \ + include/idl_fwd.h include/idl_bool.h include/utl_string.h \ + include/utl_identifier.h include/ast.h include/utl_scoped_name.h \ + include/ast_decl.h include/ast_expression.h include/utl_scope.h \ + include/ast_type.h include/ast_concrete_type.h \ + include/ast_predefined_type.h include/ast_module.h include/ast_root.h \ + include/ast_interface.h include/ast_interface_fwd.h \ + include/ast_structure.h include/ast_exception.h include/ast_enum.h \ + include/ast_operation.h include/utl_list.h include/ast_field.h \ + include/ast_argument.h include/ast_attribute.h include/ast_union.h \ + include/ast_union_branch.h include/ast_union_label.h \ + include/ast_constant.h include/ast_enum_val.h include/ast_array.h \ + include/ast_sequence.h include/ast_string.h include/ast_typedef.h \ + include/ast_native.h include/utl_strlist.h include/utl_exprlist.h \ + include/ast_generator.h include/util.h include/utl_stack.h \ + include/utl_idlist.h include/utl_exceptlist.h include/utl_namelist.h \ + include/utl_labellist.h include/utl_decllist.h include/idl_global.h \ + include/utl_error.h include/utl_indenter.h include/idl_extern.h \ + include/fe_extern.h include/be_extern.h include/drv_extern.h \ + include/ast_extern.h include/nr_extern.h include/global_extern.h \ + be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + be_include/be_decl.h be_include/be_scope.h be_include/be_generator.h \ + be_include/be_type.h be_include/be_predefined_type.h \ + be_include/be_module.h be_include/be_interface.h \ + be_include/be_interface_fwd.h be_include/be_structure.h \ + be_include/be_exception.h be_include/be_expression.h \ + be_include/be_enum.h be_include/be_operation.h be_include/be_field.h \ + be_include/be_argument.h be_include/be_attribute.h \ + be_include/be_union.h be_include/be_union_branch.h \ + be_include/be_union_label.h be_include/be_constant.h \ + be_include/be_enum_val.h be_include/be_array.h \ + be_include/be_sequence.h be_include/be_string.h \ + be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ + be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h be_include/be_visitor_union_branch.h \ + be_include/be_visitor_decl.h .obj/be_interpretive.o .obj/be_interpretive.so .shobj/be_interpretive.o .shobj/be_interpretive.so: be/be_interpretive.cpp include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -5819,7 +6858,15 @@ realclean.old: be_include/be_typedef.h be_include/be_root.h be_include/be_native.h \ be_include/be_helper.h be_include/be_state.h be_include/be_codegen.h \ be_include/be_factory.h be_include/be_visitor.h \ - be_include/be_interpretive.h be_include/be_visitor_root.h \ - be_include/be_visitor_sequence.h + be_include/be_visitor_context.h be_include/be_interpretive.h \ + be_include/be_visitor_args.h be_include/be_visitor_decl.h \ + be_include/be_visitor_attribute.h be_include/be_visitor_scope.h \ + be_include/be_visitor_constant.h be_include/be_visitor_enum.h \ + be_include/be_visitor_field.h be_include/be_visitor_interface.h \ + be_include/be_visitor_interface_fwd.h be_include/be_visitor_module.h \ + be_include/be_visitor_operation.h be_include/be_visitor_root.h \ + be_include/be_visitor_sequence.h be_include/be_visitor_structure.h \ + be_include/be_visitor_typedef.h be_include/be_visitor_union.h \ + be_include/be_visitor_union_branch.h # IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/TAO_IDL/be/Makefile b/TAO/TAO_IDL/be/Makefile index 9f6d12cb428..800fe304055 100644 --- a/TAO/TAO_IDL/be/Makefile +++ b/TAO/TAO_IDL/be/Makefile @@ -57,10 +57,24 @@ BE_FILES = \ be_decl \ be_scope \ be_visitor \ - be_visitor_interface \ be_visitor_args \ + be_visitor_attribute \ + be_visitor_constant \ + be_visitor_context \ + be_visitor_decl \ + be_visitor_enum \ + be_visitor_field \ + be_visitor_interface \ + be_visitor_interface_fwd \ + be_visitor_module \ + be_visitor_operation \ be_visitor_root \ + be_visitor_scope \ be_visitor_sequence \ + be_visitor_structure \ + be_visitor_typedef \ + be_visitor_union \ + be_visitor_union_branch \ be_interpretive FILES = $(BE_FILES) @@ -182,7 +196,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_argument.o .obj/be_argument.so .shobj/be_argument.o .shobj/be_argument.so: be_argument.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -258,7 +273,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_attribute.o .obj/be_attribute.so .shobj/be_attribute.o .shobj/be_attribute.so: be_attribute.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -334,7 +350,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_constant.o .obj/be_constant.so .shobj/be_constant.o .shobj/be_constant.so: be_constant.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -410,7 +427,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_enum.o .obj/be_enum.so .shobj/be_enum.o .shobj/be_enum.so: be_enum.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -486,7 +504,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_enum_val.o .obj/be_enum_val.so .shobj/be_enum_val.o .shobj/be_enum_val.so: be_enum_val.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -562,7 +581,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_exception.o .obj/be_exception.so .shobj/be_exception.o .shobj/be_exception.so: be_exception.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -638,7 +658,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_expression.o .obj/be_expression.so .shobj/be_expression.o .shobj/be_expression.so: be_expression.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -714,7 +735,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_field.o .obj/be_field.so .shobj/be_field.o .shobj/be_field.so: be_field.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -790,7 +812,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_interface.o .obj/be_interface.so .shobj/be_interface.o .shobj/be_interface.so: be_interface.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -834,7 +857,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../include/fe_extern.h ../include/be_extern.h ../include/drv_extern.h \ ../include/ast_extern.h ../include/nr_extern.h \ ../include/global_extern.h ../be_include/be_visitor_interface.h \ - ../be_include/be_visitor.h ../be_include/be.h \ + ../be_include/be_visitor_scope.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_decl.h ../be_include/be.h \ $(ACE_ROOT)/ace/Singleton.h \ $(ACE_ROOT)/ace/Synch.h \ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ @@ -867,7 +891,7 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h + ../be_include/be_factory.h ../be_include/be_visitor_context.h .obj/be_interface_fwd.o .obj/be_interface_fwd.so .shobj/be_interface_fwd.o .shobj/be_interface_fwd.so: be_interface_fwd.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -943,7 +967,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_module.o .obj/be_module.so .shobj/be_module.o .shobj/be_module.so: be_module.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -1019,7 +1044,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_native.o .obj/be_native.so .shobj/be_native.o .shobj/be_native.so: be_native.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -1095,7 +1121,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_operation.o .obj/be_operation.so .shobj/be_operation.o .shobj/be_operation.so: be_operation.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -1171,7 +1198,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_predefined_type.o .obj/be_predefined_type.so .shobj/be_predefined_type.o .shobj/be_predefined_type.so: be_predefined_type.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -1247,7 +1275,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_root.o .obj/be_root.so .shobj/be_root.o .shobj/be_root.so: be_root.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -1323,7 +1352,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_sequence.o .obj/be_sequence.so .shobj/be_sequence.o .shobj/be_sequence.so: be_sequence.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -1400,7 +1430,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ ../be_include/be_factory.h ../be_include/be_visitor.h \ - ../be_include/be_visitor_sequence.h + ../be_include/be_visitor_context.h \ + ../be_include/be_visitor_sequence.h ../be_include/be_visitor_decl.h .obj/be_string.o .obj/be_string.so .shobj/be_string.o .shobj/be_string.so: be_string.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -1476,7 +1507,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_structure.o .obj/be_structure.so .shobj/be_structure.o .shobj/be_structure.so: be_structure.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -1552,7 +1584,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_type.o .obj/be_type.so .shobj/be_type.o .shobj/be_type.so: be_type.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -1628,7 +1661,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_typedef.o .obj/be_typedef.so .shobj/be_typedef.o .shobj/be_typedef.so: be_typedef.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -1704,7 +1738,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_union.o .obj/be_union.so .shobj/be_union.o .shobj/be_union.so: be_union.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -1780,7 +1815,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_union_branch.o .obj/be_union_branch.so .shobj/be_union_branch.o .shobj/be_union_branch.so: be_union_branch.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -1856,7 +1892,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_union_label.o .obj/be_union_label.so .shobj/be_union_label.o .shobj/be_union_label.so: be_union_label.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -1932,7 +1969,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_generator.o .obj/be_generator.so .shobj/be_generator.o .shobj/be_generator.so: be_generator.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -2008,7 +2046,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_init.o .obj/be_init.so .shobj/be_init.o .shobj/be_init.so: be_init.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -2084,7 +2123,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_produce.o .obj/be_produce.so .shobj/be_produce.o .shobj/be_produce.so: be_produce.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -2161,7 +2201,7 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ ../be_include/be_factory.h ../be_include/be_visitor.h \ - ../be_include/be_interpretive.h + ../be_include/be_visitor_context.h ../be_include/be_interpretive.h .obj/be_args.o .obj/be_args.so .shobj/be_args.o .shobj/be_args.so: be_args.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -2237,7 +2277,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_helper.o .obj/be_helper.so .shobj/be_helper.o .shobj/be_helper.so: be_helper.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -2313,7 +2354,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_state.o .obj/be_state.so .shobj/be_state.o .shobj/be_state.so: be_state.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -2389,7 +2431,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_state_array.o .obj/be_state_array.so .shobj/be_state_array.o .shobj/be_state_array.so: be_state_array.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -2465,7 +2508,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_state_argument.o .obj/be_state_argument.so .shobj/be_state_argument.o .shobj/be_state_argument.so: be_state_argument.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -2541,7 +2585,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_state_attribute.o .obj/be_state_attribute.so .shobj/be_state_attribute.o .shobj/be_state_attribute.so: be_state_attribute.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -2617,7 +2662,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_state_exception.o .obj/be_state_exception.so .shobj/be_state_exception.o .shobj/be_state_exception.so: be_state_exception.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -2693,7 +2739,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_state_operation.o .obj/be_state_operation.so .shobj/be_state_operation.o .shobj/be_state_operation.so: be_state_operation.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -2769,7 +2816,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_state_sequence.o .obj/be_state_sequence.so .shobj/be_state_sequence.o .shobj/be_state_sequence.so: be_state_sequence.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -2845,7 +2893,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_state_structure.o .obj/be_state_structure.so .shobj/be_state_structure.o .shobj/be_state_structure.so: be_state_structure.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -2921,7 +2970,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_state_typedef.o .obj/be_state_typedef.so .shobj/be_state_typedef.o .shobj/be_state_typedef.so: be_state_typedef.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -2997,7 +3047,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_state_union.o .obj/be_state_union.so .shobj/be_state_union.o .shobj/be_state_union.so: be_state_union.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3073,7 +3124,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_codegen.o .obj/be_codegen.so .shobj/be_codegen.o .shobj/be_codegen.so: be_codegen.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3149,7 +3201,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_factory.o .obj/be_factory.so .shobj/be_factory.o .shobj/be_factory.so: be_factory.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3226,7 +3279,7 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ ../be_include/be_factory.h ../be_include/be_visitor.h \ - ../be_include/be_sunsoft.h + ../be_include/be_visitor_context.h ../be_include/be_sunsoft.h .obj/be_sunsoft.o .obj/be_sunsoft.so .shobj/be_sunsoft.o .shobj/be_sunsoft.so: be_sunsoft.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3303,7 +3356,7 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ ../be_include/be_factory.h ../be_include/be_visitor.h \ - ../be_include/be_sunsoft.h + ../be_include/be_visitor_context.h ../be_include/be_sunsoft.h .obj/be_decl.o .obj/be_decl.so .shobj/be_decl.o .shobj/be_decl.so: be_decl.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3379,7 +3432,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_scope.o .obj/be_scope.so .shobj/be_scope.o .shobj/be_scope.so: be_scope.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3455,7 +3509,8 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h .obj/be_visitor.o .obj/be_visitor.so .shobj/be_visitor.o .shobj/be_visitor.so: be_visitor.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3528,7 +3583,472 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_typedef.h ../be_include/be_root.h \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ - ../be_include/be_factory.h ../be_include/be_visitor.h + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h +.obj/be_visitor_args.o .obj/be_visitor_args.so .shobj/be_visitor_args.o .shobj/be_visitor_args.so: be_visitor_args.cpp ../include/idl.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + ../include/intlmacros.h ../include/idl_narrow.h \ + ../include/idl_defines.h ../include/idl_fwd.h ../include/idl_bool.h \ + ../include/utl_string.h ../include/utl_identifier.h ../include/ast.h \ + ../include/utl_scoped_name.h ../include/ast_decl.h \ + ../include/ast_expression.h ../include/utl_scope.h \ + ../include/ast_type.h ../include/ast_concrete_type.h \ + ../include/ast_predefined_type.h ../include/ast_module.h \ + ../include/ast_root.h ../include/ast_interface.h \ + ../include/ast_interface_fwd.h ../include/ast_structure.h \ + ../include/ast_exception.h ../include/ast_enum.h \ + ../include/ast_operation.h ../include/utl_list.h \ + ../include/ast_field.h ../include/ast_argument.h \ + ../include/ast_attribute.h ../include/ast_union.h \ + ../include/ast_union_branch.h ../include/ast_union_label.h \ + ../include/ast_constant.h ../include/ast_enum_val.h \ + ../include/ast_array.h ../include/ast_sequence.h \ + ../include/ast_string.h ../include/ast_typedef.h \ + ../include/ast_native.h ../include/utl_strlist.h \ + ../include/utl_exprlist.h ../include/ast_generator.h \ + ../include/util.h ../include/utl_stack.h ../include/utl_idlist.h \ + ../include/utl_exceptlist.h ../include/utl_namelist.h \ + ../include/utl_labellist.h ../include/utl_decllist.h \ + ../include/idl_global.h ../include/utl_error.h \ + ../include/utl_indenter.h ../be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + ../be_include/be_decl.h ../be_include/be_scope.h \ + ../be_include/be_generator.h ../be_include/be_type.h \ + ../be_include/be_predefined_type.h ../be_include/be_module.h \ + ../be_include/be_interface.h ../be_include/be_interface_fwd.h \ + ../be_include/be_structure.h ../be_include/be_exception.h \ + ../be_include/be_expression.h ../be_include/be_enum.h \ + ../be_include/be_operation.h ../be_include/be_field.h \ + ../be_include/be_argument.h ../be_include/be_attribute.h \ + ../be_include/be_union.h ../be_include/be_union_branch.h \ + ../be_include/be_union_label.h ../be_include/be_constant.h \ + ../be_include/be_enum_val.h ../be_include/be_array.h \ + ../be_include/be_sequence.h ../be_include/be_string.h \ + ../be_include/be_typedef.h ../be_include/be_root.h \ + ../be_include/be_native.h ../be_include/be_helper.h \ + ../be_include/be_state.h ../be_include/be_codegen.h \ + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h ../be_include/be_visitor_args.h \ + ../be_include/be_visitor_decl.h +.obj/be_visitor_constant.o .obj/be_visitor_constant.so .shobj/be_visitor_constant.o .shobj/be_visitor_constant.so: be_visitor_constant.cpp ../include/idl.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + ../include/intlmacros.h ../include/idl_narrow.h \ + ../include/idl_defines.h ../include/idl_fwd.h ../include/idl_bool.h \ + ../include/utl_string.h ../include/utl_identifier.h ../include/ast.h \ + ../include/utl_scoped_name.h ../include/ast_decl.h \ + ../include/ast_expression.h ../include/utl_scope.h \ + ../include/ast_type.h ../include/ast_concrete_type.h \ + ../include/ast_predefined_type.h ../include/ast_module.h \ + ../include/ast_root.h ../include/ast_interface.h \ + ../include/ast_interface_fwd.h ../include/ast_structure.h \ + ../include/ast_exception.h ../include/ast_enum.h \ + ../include/ast_operation.h ../include/utl_list.h \ + ../include/ast_field.h ../include/ast_argument.h \ + ../include/ast_attribute.h ../include/ast_union.h \ + ../include/ast_union_branch.h ../include/ast_union_label.h \ + ../include/ast_constant.h ../include/ast_enum_val.h \ + ../include/ast_array.h ../include/ast_sequence.h \ + ../include/ast_string.h ../include/ast_typedef.h \ + ../include/ast_native.h ../include/utl_strlist.h \ + ../include/utl_exprlist.h ../include/ast_generator.h \ + ../include/util.h ../include/utl_stack.h ../include/utl_idlist.h \ + ../include/utl_exceptlist.h ../include/utl_namelist.h \ + ../include/utl_labellist.h ../include/utl_decllist.h \ + ../include/idl_global.h ../include/utl_error.h \ + ../include/utl_indenter.h ../include/idl_extern.h \ + ../include/fe_extern.h ../include/be_extern.h ../include/drv_extern.h \ + ../include/ast_extern.h ../include/nr_extern.h \ + ../include/global_extern.h ../be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + ../be_include/be_decl.h ../be_include/be_scope.h \ + ../be_include/be_generator.h ../be_include/be_type.h \ + ../be_include/be_predefined_type.h ../be_include/be_module.h \ + ../be_include/be_interface.h ../be_include/be_interface_fwd.h \ + ../be_include/be_structure.h ../be_include/be_exception.h \ + ../be_include/be_expression.h ../be_include/be_enum.h \ + ../be_include/be_operation.h ../be_include/be_field.h \ + ../be_include/be_argument.h ../be_include/be_attribute.h \ + ../be_include/be_union.h ../be_include/be_union_branch.h \ + ../be_include/be_union_label.h ../be_include/be_constant.h \ + ../be_include/be_enum_val.h ../be_include/be_array.h \ + ../be_include/be_sequence.h ../be_include/be_string.h \ + ../be_include/be_typedef.h ../be_include/be_root.h \ + ../be_include/be_native.h ../be_include/be_helper.h \ + ../be_include/be_state.h ../be_include/be_codegen.h \ + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h \ + ../be_include/be_visitor_constant.h ../be_include/be_visitor_scope.h \ + ../be_include/be_visitor_decl.h +.obj/be_visitor_context.o .obj/be_visitor_context.so .shobj/be_visitor_context.o .shobj/be_visitor_context.so: be_visitor_context.cpp ../include/idl.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + ../include/intlmacros.h ../include/idl_narrow.h \ + ../include/idl_defines.h ../include/idl_fwd.h ../include/idl_bool.h \ + ../include/utl_string.h ../include/utl_identifier.h ../include/ast.h \ + ../include/utl_scoped_name.h ../include/ast_decl.h \ + ../include/ast_expression.h ../include/utl_scope.h \ + ../include/ast_type.h ../include/ast_concrete_type.h \ + ../include/ast_predefined_type.h ../include/ast_module.h \ + ../include/ast_root.h ../include/ast_interface.h \ + ../include/ast_interface_fwd.h ../include/ast_structure.h \ + ../include/ast_exception.h ../include/ast_enum.h \ + ../include/ast_operation.h ../include/utl_list.h \ + ../include/ast_field.h ../include/ast_argument.h \ + ../include/ast_attribute.h ../include/ast_union.h \ + ../include/ast_union_branch.h ../include/ast_union_label.h \ + ../include/ast_constant.h ../include/ast_enum_val.h \ + ../include/ast_array.h ../include/ast_sequence.h \ + ../include/ast_string.h ../include/ast_typedef.h \ + ../include/ast_native.h ../include/utl_strlist.h \ + ../include/utl_exprlist.h ../include/ast_generator.h \ + ../include/util.h ../include/utl_stack.h ../include/utl_idlist.h \ + ../include/utl_exceptlist.h ../include/utl_namelist.h \ + ../include/utl_labellist.h ../include/utl_decllist.h \ + ../include/idl_global.h ../include/utl_error.h \ + ../include/utl_indenter.h ../include/idl_extern.h \ + ../include/fe_extern.h ../include/be_extern.h ../include/drv_extern.h \ + ../include/ast_extern.h ../include/nr_extern.h \ + ../include/global_extern.h ../be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + ../be_include/be_decl.h ../be_include/be_scope.h \ + ../be_include/be_generator.h ../be_include/be_type.h \ + ../be_include/be_predefined_type.h ../be_include/be_module.h \ + ../be_include/be_interface.h ../be_include/be_interface_fwd.h \ + ../be_include/be_structure.h ../be_include/be_exception.h \ + ../be_include/be_expression.h ../be_include/be_enum.h \ + ../be_include/be_operation.h ../be_include/be_field.h \ + ../be_include/be_argument.h ../be_include/be_attribute.h \ + ../be_include/be_union.h ../be_include/be_union_branch.h \ + ../be_include/be_union_label.h ../be_include/be_constant.h \ + ../be_include/be_enum_val.h ../be_include/be_array.h \ + ../be_include/be_sequence.h ../be_include/be_string.h \ + ../be_include/be_typedef.h ../be_include/be_root.h \ + ../be_include/be_native.h ../be_include/be_helper.h \ + ../be_include/be_state.h ../be_include/be_codegen.h \ + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h +.obj/be_visitor_decl.o .obj/be_visitor_decl.so .shobj/be_visitor_decl.o .shobj/be_visitor_decl.so: be_visitor_decl.cpp ../include/idl.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + ../include/intlmacros.h ../include/idl_narrow.h \ + ../include/idl_defines.h ../include/idl_fwd.h ../include/idl_bool.h \ + ../include/utl_string.h ../include/utl_identifier.h ../include/ast.h \ + ../include/utl_scoped_name.h ../include/ast_decl.h \ + ../include/ast_expression.h ../include/utl_scope.h \ + ../include/ast_type.h ../include/ast_concrete_type.h \ + ../include/ast_predefined_type.h ../include/ast_module.h \ + ../include/ast_root.h ../include/ast_interface.h \ + ../include/ast_interface_fwd.h ../include/ast_structure.h \ + ../include/ast_exception.h ../include/ast_enum.h \ + ../include/ast_operation.h ../include/utl_list.h \ + ../include/ast_field.h ../include/ast_argument.h \ + ../include/ast_attribute.h ../include/ast_union.h \ + ../include/ast_union_branch.h ../include/ast_union_label.h \ + ../include/ast_constant.h ../include/ast_enum_val.h \ + ../include/ast_array.h ../include/ast_sequence.h \ + ../include/ast_string.h ../include/ast_typedef.h \ + ../include/ast_native.h ../include/utl_strlist.h \ + ../include/utl_exprlist.h ../include/ast_generator.h \ + ../include/util.h ../include/utl_stack.h ../include/utl_idlist.h \ + ../include/utl_exceptlist.h ../include/utl_namelist.h \ + ../include/utl_labellist.h ../include/utl_decllist.h \ + ../include/idl_global.h ../include/utl_error.h \ + ../include/utl_indenter.h ../include/idl_extern.h \ + ../include/fe_extern.h ../include/be_extern.h ../include/drv_extern.h \ + ../include/ast_extern.h ../include/nr_extern.h \ + ../include/global_extern.h ../be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + ../be_include/be_decl.h ../be_include/be_scope.h \ + ../be_include/be_generator.h ../be_include/be_type.h \ + ../be_include/be_predefined_type.h ../be_include/be_module.h \ + ../be_include/be_interface.h ../be_include/be_interface_fwd.h \ + ../be_include/be_structure.h ../be_include/be_exception.h \ + ../be_include/be_expression.h ../be_include/be_enum.h \ + ../be_include/be_operation.h ../be_include/be_field.h \ + ../be_include/be_argument.h ../be_include/be_attribute.h \ + ../be_include/be_union.h ../be_include/be_union_branch.h \ + ../be_include/be_union_label.h ../be_include/be_constant.h \ + ../be_include/be_enum_val.h ../be_include/be_array.h \ + ../be_include/be_sequence.h ../be_include/be_string.h \ + ../be_include/be_typedef.h ../be_include/be_root.h \ + ../be_include/be_native.h ../be_include/be_helper.h \ + ../be_include/be_state.h ../be_include/be_codegen.h \ + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h ../be_include/be_visitor_decl.h +.obj/be_visitor_enum.o .obj/be_visitor_enum.so .shobj/be_visitor_enum.o .shobj/be_visitor_enum.so: be_visitor_enum.cpp ../include/idl.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + ../include/intlmacros.h ../include/idl_narrow.h \ + ../include/idl_defines.h ../include/idl_fwd.h ../include/idl_bool.h \ + ../include/utl_string.h ../include/utl_identifier.h ../include/ast.h \ + ../include/utl_scoped_name.h ../include/ast_decl.h \ + ../include/ast_expression.h ../include/utl_scope.h \ + ../include/ast_type.h ../include/ast_concrete_type.h \ + ../include/ast_predefined_type.h ../include/ast_module.h \ + ../include/ast_root.h ../include/ast_interface.h \ + ../include/ast_interface_fwd.h ../include/ast_structure.h \ + ../include/ast_exception.h ../include/ast_enum.h \ + ../include/ast_operation.h ../include/utl_list.h \ + ../include/ast_field.h ../include/ast_argument.h \ + ../include/ast_attribute.h ../include/ast_union.h \ + ../include/ast_union_branch.h ../include/ast_union_label.h \ + ../include/ast_constant.h ../include/ast_enum_val.h \ + ../include/ast_array.h ../include/ast_sequence.h \ + ../include/ast_string.h ../include/ast_typedef.h \ + ../include/ast_native.h ../include/utl_strlist.h \ + ../include/utl_exprlist.h ../include/ast_generator.h \ + ../include/util.h ../include/utl_stack.h ../include/utl_idlist.h \ + ../include/utl_exceptlist.h ../include/utl_namelist.h \ + ../include/utl_labellist.h ../include/utl_decllist.h \ + ../include/idl_global.h ../include/utl_error.h \ + ../include/utl_indenter.h ../include/idl_extern.h \ + ../include/fe_extern.h ../include/be_extern.h ../include/drv_extern.h \ + ../include/ast_extern.h ../include/nr_extern.h \ + ../include/global_extern.h ../be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + ../be_include/be_decl.h ../be_include/be_scope.h \ + ../be_include/be_generator.h ../be_include/be_type.h \ + ../be_include/be_predefined_type.h ../be_include/be_module.h \ + ../be_include/be_interface.h ../be_include/be_interface_fwd.h \ + ../be_include/be_structure.h ../be_include/be_exception.h \ + ../be_include/be_expression.h ../be_include/be_enum.h \ + ../be_include/be_operation.h ../be_include/be_field.h \ + ../be_include/be_argument.h ../be_include/be_attribute.h \ + ../be_include/be_union.h ../be_include/be_union_branch.h \ + ../be_include/be_union_label.h ../be_include/be_constant.h \ + ../be_include/be_enum_val.h ../be_include/be_array.h \ + ../be_include/be_sequence.h ../be_include/be_string.h \ + ../be_include/be_typedef.h ../be_include/be_root.h \ + ../be_include/be_native.h ../be_include/be_helper.h \ + ../be_include/be_state.h ../be_include/be_codegen.h \ + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h ../be_include/be_visitor_enum.h \ + ../be_include/be_visitor_scope.h ../be_include/be_visitor_decl.h +.obj/be_visitor_field.o .obj/be_visitor_field.so .shobj/be_visitor_field.o .shobj/be_visitor_field.so: be_visitor_field.cpp ../include/idl.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + ../include/intlmacros.h ../include/idl_narrow.h \ + ../include/idl_defines.h ../include/idl_fwd.h ../include/idl_bool.h \ + ../include/utl_string.h ../include/utl_identifier.h ../include/ast.h \ + ../include/utl_scoped_name.h ../include/ast_decl.h \ + ../include/ast_expression.h ../include/utl_scope.h \ + ../include/ast_type.h ../include/ast_concrete_type.h \ + ../include/ast_predefined_type.h ../include/ast_module.h \ + ../include/ast_root.h ../include/ast_interface.h \ + ../include/ast_interface_fwd.h ../include/ast_structure.h \ + ../include/ast_exception.h ../include/ast_enum.h \ + ../include/ast_operation.h ../include/utl_list.h \ + ../include/ast_field.h ../include/ast_argument.h \ + ../include/ast_attribute.h ../include/ast_union.h \ + ../include/ast_union_branch.h ../include/ast_union_label.h \ + ../include/ast_constant.h ../include/ast_enum_val.h \ + ../include/ast_array.h ../include/ast_sequence.h \ + ../include/ast_string.h ../include/ast_typedef.h \ + ../include/ast_native.h ../include/utl_strlist.h \ + ../include/utl_exprlist.h ../include/ast_generator.h \ + ../include/util.h ../include/utl_stack.h ../include/utl_idlist.h \ + ../include/utl_exceptlist.h ../include/utl_namelist.h \ + ../include/utl_labellist.h ../include/utl_decllist.h \ + ../include/idl_global.h ../include/utl_error.h \ + ../include/utl_indenter.h ../include/idl_extern.h \ + ../include/fe_extern.h ../include/be_extern.h ../include/drv_extern.h \ + ../include/ast_extern.h ../include/nr_extern.h \ + ../include/global_extern.h ../be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + ../be_include/be_decl.h ../be_include/be_scope.h \ + ../be_include/be_generator.h ../be_include/be_type.h \ + ../be_include/be_predefined_type.h ../be_include/be_module.h \ + ../be_include/be_interface.h ../be_include/be_interface_fwd.h \ + ../be_include/be_structure.h ../be_include/be_exception.h \ + ../be_include/be_expression.h ../be_include/be_enum.h \ + ../be_include/be_operation.h ../be_include/be_field.h \ + ../be_include/be_argument.h ../be_include/be_attribute.h \ + ../be_include/be_union.h ../be_include/be_union_branch.h \ + ../be_include/be_union_label.h ../be_include/be_constant.h \ + ../be_include/be_enum_val.h ../be_include/be_array.h \ + ../be_include/be_sequence.h ../be_include/be_string.h \ + ../be_include/be_typedef.h ../be_include/be_root.h \ + ../be_include/be_native.h ../be_include/be_helper.h \ + ../be_include/be_state.h ../be_include/be_codegen.h \ + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h ../be_include/be_visitor_field.h \ + ../be_include/be_visitor_decl.h .obj/be_visitor_interface.o .obj/be_visitor_interface.so .shobj/be_visitor_interface.o .shobj/be_visitor_interface.so: be_visitor_interface.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3568,7 +4088,10 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../include/utl_exceptlist.h ../include/utl_namelist.h \ ../include/utl_labellist.h ../include/utl_decllist.h \ ../include/idl_global.h ../include/utl_error.h \ - ../include/utl_indenter.h ../include/nr_extern.h ../be_include/be.h \ + ../include/utl_indenter.h ../include/idl_extern.h \ + ../include/fe_extern.h ../include/be_extern.h ../include/drv_extern.h \ + ../include/ast_extern.h ../include/nr_extern.h \ + ../include/global_extern.h ../be_include/be.h \ $(ACE_ROOT)/ace/Singleton.h \ $(ACE_ROOT)/ace/Synch.h \ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ @@ -3602,8 +4125,89 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ ../be_include/be_factory.h ../be_include/be_visitor.h \ - ../be_include/be_visitor_args.h ../be_include/be_visitor_interface.h -.obj/be_visitor_args.o .obj/be_visitor_args.so .shobj/be_visitor_args.o .shobj/be_visitor_args.so: be_visitor_args.cpp ../include/idl.h \ + ../be_include/be_visitor_context.h \ + ../be_include/be_visitor_interface.h ../be_include/be_visitor_scope.h \ + ../be_include/be_visitor_decl.h +.obj/be_visitor_interface_fwd.o .obj/be_visitor_interface_fwd.so .shobj/be_visitor_interface_fwd.o .shobj/be_visitor_interface_fwd.so: be_visitor_interface_fwd.cpp \ + ../include/idl.h $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + ../include/intlmacros.h ../include/idl_narrow.h \ + ../include/idl_defines.h ../include/idl_fwd.h ../include/idl_bool.h \ + ../include/utl_string.h ../include/utl_identifier.h ../include/ast.h \ + ../include/utl_scoped_name.h ../include/ast_decl.h \ + ../include/ast_expression.h ../include/utl_scope.h \ + ../include/ast_type.h ../include/ast_concrete_type.h \ + ../include/ast_predefined_type.h ../include/ast_module.h \ + ../include/ast_root.h ../include/ast_interface.h \ + ../include/ast_interface_fwd.h ../include/ast_structure.h \ + ../include/ast_exception.h ../include/ast_enum.h \ + ../include/ast_operation.h ../include/utl_list.h \ + ../include/ast_field.h ../include/ast_argument.h \ + ../include/ast_attribute.h ../include/ast_union.h \ + ../include/ast_union_branch.h ../include/ast_union_label.h \ + ../include/ast_constant.h ../include/ast_enum_val.h \ + ../include/ast_array.h ../include/ast_sequence.h \ + ../include/ast_string.h ../include/ast_typedef.h \ + ../include/ast_native.h ../include/utl_strlist.h \ + ../include/utl_exprlist.h ../include/ast_generator.h \ + ../include/util.h ../include/utl_stack.h ../include/utl_idlist.h \ + ../include/utl_exceptlist.h ../include/utl_namelist.h \ + ../include/utl_labellist.h ../include/utl_decllist.h \ + ../include/idl_global.h ../include/utl_error.h \ + ../include/utl_indenter.h ../include/idl_extern.h \ + ../include/fe_extern.h ../include/be_extern.h ../include/drv_extern.h \ + ../include/ast_extern.h ../include/nr_extern.h \ + ../include/global_extern.h ../be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + ../be_include/be_decl.h ../be_include/be_scope.h \ + ../be_include/be_generator.h ../be_include/be_type.h \ + ../be_include/be_predefined_type.h ../be_include/be_module.h \ + ../be_include/be_interface.h ../be_include/be_interface_fwd.h \ + ../be_include/be_structure.h ../be_include/be_exception.h \ + ../be_include/be_expression.h ../be_include/be_enum.h \ + ../be_include/be_operation.h ../be_include/be_field.h \ + ../be_include/be_argument.h ../be_include/be_attribute.h \ + ../be_include/be_union.h ../be_include/be_union_branch.h \ + ../be_include/be_union_label.h ../be_include/be_constant.h \ + ../be_include/be_enum_val.h ../be_include/be_array.h \ + ../be_include/be_sequence.h ../be_include/be_string.h \ + ../be_include/be_typedef.h ../be_include/be_root.h \ + ../be_include/be_native.h ../be_include/be_helper.h \ + ../be_include/be_state.h ../be_include/be_codegen.h \ + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h \ + ../be_include/be_visitor_interface_fwd.h \ + ../be_include/be_visitor_scope.h ../be_include/be_visitor_decl.h +.obj/be_visitor_module.o .obj/be_visitor_module.so .shobj/be_visitor_module.o .shobj/be_visitor_module.so: be_visitor_module.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ @@ -3642,7 +4246,88 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../include/utl_exceptlist.h ../include/utl_namelist.h \ ../include/utl_labellist.h ../include/utl_decllist.h \ ../include/idl_global.h ../include/utl_error.h \ - ../include/utl_indenter.h ../be_include/be.h \ + ../include/utl_indenter.h ../include/idl_extern.h \ + ../include/fe_extern.h ../include/be_extern.h ../include/drv_extern.h \ + ../include/ast_extern.h ../include/nr_extern.h \ + ../include/global_extern.h ../be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + ../be_include/be_decl.h ../be_include/be_scope.h \ + ../be_include/be_generator.h ../be_include/be_type.h \ + ../be_include/be_predefined_type.h ../be_include/be_module.h \ + ../be_include/be_interface.h ../be_include/be_interface_fwd.h \ + ../be_include/be_structure.h ../be_include/be_exception.h \ + ../be_include/be_expression.h ../be_include/be_enum.h \ + ../be_include/be_operation.h ../be_include/be_field.h \ + ../be_include/be_argument.h ../be_include/be_attribute.h \ + ../be_include/be_union.h ../be_include/be_union_branch.h \ + ../be_include/be_union_label.h ../be_include/be_constant.h \ + ../be_include/be_enum_val.h ../be_include/be_array.h \ + ../be_include/be_sequence.h ../be_include/be_string.h \ + ../be_include/be_typedef.h ../be_include/be_root.h \ + ../be_include/be_native.h ../be_include/be_helper.h \ + ../be_include/be_state.h ../be_include/be_codegen.h \ + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h ../be_include/be_visitor_module.h \ + ../be_include/be_visitor_scope.h ../be_include/be_visitor_decl.h +.obj/be_visitor_operation.o .obj/be_visitor_operation.so .shobj/be_visitor_operation.o .shobj/be_visitor_operation.so: be_visitor_operation.cpp ../include/idl.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + ../include/intlmacros.h ../include/idl_narrow.h \ + ../include/idl_defines.h ../include/idl_fwd.h ../include/idl_bool.h \ + ../include/utl_string.h ../include/utl_identifier.h ../include/ast.h \ + ../include/utl_scoped_name.h ../include/ast_decl.h \ + ../include/ast_expression.h ../include/utl_scope.h \ + ../include/ast_type.h ../include/ast_concrete_type.h \ + ../include/ast_predefined_type.h ../include/ast_module.h \ + ../include/ast_root.h ../include/ast_interface.h \ + ../include/ast_interface_fwd.h ../include/ast_structure.h \ + ../include/ast_exception.h ../include/ast_enum.h \ + ../include/ast_operation.h ../include/utl_list.h \ + ../include/ast_field.h ../include/ast_argument.h \ + ../include/ast_attribute.h ../include/ast_union.h \ + ../include/ast_union_branch.h ../include/ast_union_label.h \ + ../include/ast_constant.h ../include/ast_enum_val.h \ + ../include/ast_array.h ../include/ast_sequence.h \ + ../include/ast_string.h ../include/ast_typedef.h \ + ../include/ast_native.h ../include/utl_strlist.h \ + ../include/utl_exprlist.h ../include/ast_generator.h \ + ../include/util.h ../include/utl_stack.h ../include/utl_idlist.h \ + ../include/utl_exceptlist.h ../include/utl_namelist.h \ + ../include/utl_labellist.h ../include/utl_decllist.h \ + ../include/idl_global.h ../include/utl_error.h \ + ../include/utl_indenter.h ../include/idl_extern.h \ + ../include/fe_extern.h ../include/be_extern.h ../include/drv_extern.h \ + ../include/ast_extern.h ../include/nr_extern.h \ + ../include/global_extern.h ../be_include/be.h \ $(ACE_ROOT)/ace/Singleton.h \ $(ACE_ROOT)/ace/Synch.h \ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ @@ -3676,7 +4361,9 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ ../be_include/be_factory.h ../be_include/be_visitor.h \ - ../be_include/be_visitor_args.h + ../be_include/be_visitor_context.h \ + ../be_include/be_visitor_operation.h ../be_include/be_visitor_scope.h \ + ../be_include/be_visitor_decl.h .obj/be_visitor_root.o .obj/be_visitor_root.so .shobj/be_visitor_root.o .shobj/be_visitor_root.so: be_visitor_root.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3753,7 +4440,86 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ ../be_include/be_factory.h ../be_include/be_visitor.h \ - ../be_include/be_visitor_root.h + ../be_include/be_visitor_context.h ../be_include/be_visitor_root.h \ + ../be_include/be_visitor_scope.h ../be_include/be_visitor_decl.h +.obj/be_visitor_scope.o .obj/be_visitor_scope.so .shobj/be_visitor_scope.o .shobj/be_visitor_scope.so: be_visitor_scope.cpp ../include/idl.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + ../include/intlmacros.h ../include/idl_narrow.h \ + ../include/idl_defines.h ../include/idl_fwd.h ../include/idl_bool.h \ + ../include/utl_string.h ../include/utl_identifier.h ../include/ast.h \ + ../include/utl_scoped_name.h ../include/ast_decl.h \ + ../include/ast_expression.h ../include/utl_scope.h \ + ../include/ast_type.h ../include/ast_concrete_type.h \ + ../include/ast_predefined_type.h ../include/ast_module.h \ + ../include/ast_root.h ../include/ast_interface.h \ + ../include/ast_interface_fwd.h ../include/ast_structure.h \ + ../include/ast_exception.h ../include/ast_enum.h \ + ../include/ast_operation.h ../include/utl_list.h \ + ../include/ast_field.h ../include/ast_argument.h \ + ../include/ast_attribute.h ../include/ast_union.h \ + ../include/ast_union_branch.h ../include/ast_union_label.h \ + ../include/ast_constant.h ../include/ast_enum_val.h \ + ../include/ast_array.h ../include/ast_sequence.h \ + ../include/ast_string.h ../include/ast_typedef.h \ + ../include/ast_native.h ../include/utl_strlist.h \ + ../include/utl_exprlist.h ../include/ast_generator.h \ + ../include/util.h ../include/utl_stack.h ../include/utl_idlist.h \ + ../include/utl_exceptlist.h ../include/utl_namelist.h \ + ../include/utl_labellist.h ../include/utl_decllist.h \ + ../include/idl_global.h ../include/utl_error.h \ + ../include/utl_indenter.h ../include/idl_extern.h \ + ../include/fe_extern.h ../include/be_extern.h ../include/drv_extern.h \ + ../include/ast_extern.h ../include/nr_extern.h \ + ../include/global_extern.h ../be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + ../be_include/be_decl.h ../be_include/be_scope.h \ + ../be_include/be_generator.h ../be_include/be_type.h \ + ../be_include/be_predefined_type.h ../be_include/be_module.h \ + ../be_include/be_interface.h ../be_include/be_interface_fwd.h \ + ../be_include/be_structure.h ../be_include/be_exception.h \ + ../be_include/be_expression.h ../be_include/be_enum.h \ + ../be_include/be_operation.h ../be_include/be_field.h \ + ../be_include/be_argument.h ../be_include/be_attribute.h \ + ../be_include/be_union.h ../be_include/be_union_branch.h \ + ../be_include/be_union_label.h ../be_include/be_constant.h \ + ../be_include/be_enum_val.h ../be_include/be_array.h \ + ../be_include/be_sequence.h ../be_include/be_string.h \ + ../be_include/be_typedef.h ../be_include/be_root.h \ + ../be_include/be_native.h ../be_include/be_helper.h \ + ../be_include/be_state.h ../be_include/be_codegen.h \ + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h ../be_include/be_visitor_scope.h \ + ../be_include/be_visitor_decl.h .obj/be_visitor_sequence.o .obj/be_visitor_sequence.so .shobj/be_visitor_sequence.o .shobj/be_visitor_sequence.so: be_visitor_sequence.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3830,7 +4596,322 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ ../be_include/be_factory.h ../be_include/be_visitor.h \ - ../be_include/be_visitor_sequence.h + ../be_include/be_visitor_context.h \ + ../be_include/be_visitor_sequence.h ../be_include/be_visitor_decl.h +.obj/be_visitor_structure.o .obj/be_visitor_structure.so .shobj/be_visitor_structure.o .shobj/be_visitor_structure.so: be_visitor_structure.cpp ../include/idl.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + ../include/intlmacros.h ../include/idl_narrow.h \ + ../include/idl_defines.h ../include/idl_fwd.h ../include/idl_bool.h \ + ../include/utl_string.h ../include/utl_identifier.h ../include/ast.h \ + ../include/utl_scoped_name.h ../include/ast_decl.h \ + ../include/ast_expression.h ../include/utl_scope.h \ + ../include/ast_type.h ../include/ast_concrete_type.h \ + ../include/ast_predefined_type.h ../include/ast_module.h \ + ../include/ast_root.h ../include/ast_interface.h \ + ../include/ast_interface_fwd.h ../include/ast_structure.h \ + ../include/ast_exception.h ../include/ast_enum.h \ + ../include/ast_operation.h ../include/utl_list.h \ + ../include/ast_field.h ../include/ast_argument.h \ + ../include/ast_attribute.h ../include/ast_union.h \ + ../include/ast_union_branch.h ../include/ast_union_label.h \ + ../include/ast_constant.h ../include/ast_enum_val.h \ + ../include/ast_array.h ../include/ast_sequence.h \ + ../include/ast_string.h ../include/ast_typedef.h \ + ../include/ast_native.h ../include/utl_strlist.h \ + ../include/utl_exprlist.h ../include/ast_generator.h \ + ../include/util.h ../include/utl_stack.h ../include/utl_idlist.h \ + ../include/utl_exceptlist.h ../include/utl_namelist.h \ + ../include/utl_labellist.h ../include/utl_decllist.h \ + ../include/idl_global.h ../include/utl_error.h \ + ../include/utl_indenter.h ../include/idl_extern.h \ + ../include/fe_extern.h ../include/be_extern.h ../include/drv_extern.h \ + ../include/ast_extern.h ../include/nr_extern.h \ + ../include/global_extern.h ../be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + ../be_include/be_decl.h ../be_include/be_scope.h \ + ../be_include/be_generator.h ../be_include/be_type.h \ + ../be_include/be_predefined_type.h ../be_include/be_module.h \ + ../be_include/be_interface.h ../be_include/be_interface_fwd.h \ + ../be_include/be_structure.h ../be_include/be_exception.h \ + ../be_include/be_expression.h ../be_include/be_enum.h \ + ../be_include/be_operation.h ../be_include/be_field.h \ + ../be_include/be_argument.h ../be_include/be_attribute.h \ + ../be_include/be_union.h ../be_include/be_union_branch.h \ + ../be_include/be_union_label.h ../be_include/be_constant.h \ + ../be_include/be_enum_val.h ../be_include/be_array.h \ + ../be_include/be_sequence.h ../be_include/be_string.h \ + ../be_include/be_typedef.h ../be_include/be_root.h \ + ../be_include/be_native.h ../be_include/be_helper.h \ + ../be_include/be_state.h ../be_include/be_codegen.h \ + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h \ + ../be_include/be_visitor_structure.h ../be_include/be_visitor_scope.h \ + ../be_include/be_visitor_decl.h +.obj/be_visitor_typedef.o .obj/be_visitor_typedef.so .shobj/be_visitor_typedef.o .shobj/be_visitor_typedef.so: be_visitor_typedef.cpp ../include/idl.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + ../include/intlmacros.h ../include/idl_narrow.h \ + ../include/idl_defines.h ../include/idl_fwd.h ../include/idl_bool.h \ + ../include/utl_string.h ../include/utl_identifier.h ../include/ast.h \ + ../include/utl_scoped_name.h ../include/ast_decl.h \ + ../include/ast_expression.h ../include/utl_scope.h \ + ../include/ast_type.h ../include/ast_concrete_type.h \ + ../include/ast_predefined_type.h ../include/ast_module.h \ + ../include/ast_root.h ../include/ast_interface.h \ + ../include/ast_interface_fwd.h ../include/ast_structure.h \ + ../include/ast_exception.h ../include/ast_enum.h \ + ../include/ast_operation.h ../include/utl_list.h \ + ../include/ast_field.h ../include/ast_argument.h \ + ../include/ast_attribute.h ../include/ast_union.h \ + ../include/ast_union_branch.h ../include/ast_union_label.h \ + ../include/ast_constant.h ../include/ast_enum_val.h \ + ../include/ast_array.h ../include/ast_sequence.h \ + ../include/ast_string.h ../include/ast_typedef.h \ + ../include/ast_native.h ../include/utl_strlist.h \ + ../include/utl_exprlist.h ../include/ast_generator.h \ + ../include/util.h ../include/utl_stack.h ../include/utl_idlist.h \ + ../include/utl_exceptlist.h ../include/utl_namelist.h \ + ../include/utl_labellist.h ../include/utl_decllist.h \ + ../include/idl_global.h ../include/utl_error.h \ + ../include/utl_indenter.h ../include/idl_extern.h \ + ../include/fe_extern.h ../include/be_extern.h ../include/drv_extern.h \ + ../include/ast_extern.h ../include/nr_extern.h \ + ../include/global_extern.h ../be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + ../be_include/be_decl.h ../be_include/be_scope.h \ + ../be_include/be_generator.h ../be_include/be_type.h \ + ../be_include/be_predefined_type.h ../be_include/be_module.h \ + ../be_include/be_interface.h ../be_include/be_interface_fwd.h \ + ../be_include/be_structure.h ../be_include/be_exception.h \ + ../be_include/be_expression.h ../be_include/be_enum.h \ + ../be_include/be_operation.h ../be_include/be_field.h \ + ../be_include/be_argument.h ../be_include/be_attribute.h \ + ../be_include/be_union.h ../be_include/be_union_branch.h \ + ../be_include/be_union_label.h ../be_include/be_constant.h \ + ../be_include/be_enum_val.h ../be_include/be_array.h \ + ../be_include/be_sequence.h ../be_include/be_string.h \ + ../be_include/be_typedef.h ../be_include/be_root.h \ + ../be_include/be_native.h ../be_include/be_helper.h \ + ../be_include/be_state.h ../be_include/be_codegen.h \ + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h ../be_include/be_visitor_typedef.h \ + ../be_include/be_visitor_scope.h ../be_include/be_visitor_decl.h +.obj/be_visitor_union.o .obj/be_visitor_union.so .shobj/be_visitor_union.o .shobj/be_visitor_union.so: be_visitor_union.cpp ../include/idl.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + ../include/intlmacros.h ../include/idl_narrow.h \ + ../include/idl_defines.h ../include/idl_fwd.h ../include/idl_bool.h \ + ../include/utl_string.h ../include/utl_identifier.h ../include/ast.h \ + ../include/utl_scoped_name.h ../include/ast_decl.h \ + ../include/ast_expression.h ../include/utl_scope.h \ + ../include/ast_type.h ../include/ast_concrete_type.h \ + ../include/ast_predefined_type.h ../include/ast_module.h \ + ../include/ast_root.h ../include/ast_interface.h \ + ../include/ast_interface_fwd.h ../include/ast_structure.h \ + ../include/ast_exception.h ../include/ast_enum.h \ + ../include/ast_operation.h ../include/utl_list.h \ + ../include/ast_field.h ../include/ast_argument.h \ + ../include/ast_attribute.h ../include/ast_union.h \ + ../include/ast_union_branch.h ../include/ast_union_label.h \ + ../include/ast_constant.h ../include/ast_enum_val.h \ + ../include/ast_array.h ../include/ast_sequence.h \ + ../include/ast_string.h ../include/ast_typedef.h \ + ../include/ast_native.h ../include/utl_strlist.h \ + ../include/utl_exprlist.h ../include/ast_generator.h \ + ../include/util.h ../include/utl_stack.h ../include/utl_idlist.h \ + ../include/utl_exceptlist.h ../include/utl_namelist.h \ + ../include/utl_labellist.h ../include/utl_decllist.h \ + ../include/idl_global.h ../include/utl_error.h \ + ../include/utl_indenter.h ../include/idl_extern.h \ + ../include/fe_extern.h ../include/be_extern.h ../include/drv_extern.h \ + ../include/ast_extern.h ../include/nr_extern.h \ + ../include/global_extern.h ../be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + ../be_include/be_decl.h ../be_include/be_scope.h \ + ../be_include/be_generator.h ../be_include/be_type.h \ + ../be_include/be_predefined_type.h ../be_include/be_module.h \ + ../be_include/be_interface.h ../be_include/be_interface_fwd.h \ + ../be_include/be_structure.h ../be_include/be_exception.h \ + ../be_include/be_expression.h ../be_include/be_enum.h \ + ../be_include/be_operation.h ../be_include/be_field.h \ + ../be_include/be_argument.h ../be_include/be_attribute.h \ + ../be_include/be_union.h ../be_include/be_union_branch.h \ + ../be_include/be_union_label.h ../be_include/be_constant.h \ + ../be_include/be_enum_val.h ../be_include/be_array.h \ + ../be_include/be_sequence.h ../be_include/be_string.h \ + ../be_include/be_typedef.h ../be_include/be_root.h \ + ../be_include/be_native.h ../be_include/be_helper.h \ + ../be_include/be_state.h ../be_include/be_codegen.h \ + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h ../be_include/be_visitor_union.h \ + ../be_include/be_visitor_scope.h ../be_include/be_visitor_decl.h +.obj/be_visitor_union_branch.o .obj/be_visitor_union_branch.so .shobj/be_visitor_union_branch.o .shobj/be_visitor_union_branch.so: be_visitor_union_branch.cpp \ + ../include/idl.h $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + ../include/intlmacros.h ../include/idl_narrow.h \ + ../include/idl_defines.h ../include/idl_fwd.h ../include/idl_bool.h \ + ../include/utl_string.h ../include/utl_identifier.h ../include/ast.h \ + ../include/utl_scoped_name.h ../include/ast_decl.h \ + ../include/ast_expression.h ../include/utl_scope.h \ + ../include/ast_type.h ../include/ast_concrete_type.h \ + ../include/ast_predefined_type.h ../include/ast_module.h \ + ../include/ast_root.h ../include/ast_interface.h \ + ../include/ast_interface_fwd.h ../include/ast_structure.h \ + ../include/ast_exception.h ../include/ast_enum.h \ + ../include/ast_operation.h ../include/utl_list.h \ + ../include/ast_field.h ../include/ast_argument.h \ + ../include/ast_attribute.h ../include/ast_union.h \ + ../include/ast_union_branch.h ../include/ast_union_label.h \ + ../include/ast_constant.h ../include/ast_enum_val.h \ + ../include/ast_array.h ../include/ast_sequence.h \ + ../include/ast_string.h ../include/ast_typedef.h \ + ../include/ast_native.h ../include/utl_strlist.h \ + ../include/utl_exprlist.h ../include/ast_generator.h \ + ../include/util.h ../include/utl_stack.h ../include/utl_idlist.h \ + ../include/utl_exceptlist.h ../include/utl_namelist.h \ + ../include/utl_labellist.h ../include/utl_decllist.h \ + ../include/idl_global.h ../include/utl_error.h \ + ../include/utl_indenter.h ../include/idl_extern.h \ + ../include/fe_extern.h ../include/be_extern.h ../include/drv_extern.h \ + ../include/ast_extern.h ../include/nr_extern.h \ + ../include/global_extern.h ../be_include/be.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + ../be_include/be_decl.h ../be_include/be_scope.h \ + ../be_include/be_generator.h ../be_include/be_type.h \ + ../be_include/be_predefined_type.h ../be_include/be_module.h \ + ../be_include/be_interface.h ../be_include/be_interface_fwd.h \ + ../be_include/be_structure.h ../be_include/be_exception.h \ + ../be_include/be_expression.h ../be_include/be_enum.h \ + ../be_include/be_operation.h ../be_include/be_field.h \ + ../be_include/be_argument.h ../be_include/be_attribute.h \ + ../be_include/be_union.h ../be_include/be_union_branch.h \ + ../be_include/be_union_label.h ../be_include/be_constant.h \ + ../be_include/be_enum_val.h ../be_include/be_array.h \ + ../be_include/be_sequence.h ../be_include/be_string.h \ + ../be_include/be_typedef.h ../be_include/be_root.h \ + ../be_include/be_native.h ../be_include/be_helper.h \ + ../be_include/be_state.h ../be_include/be_codegen.h \ + ../be_include/be_factory.h ../be_include/be_visitor.h \ + ../be_include/be_visitor_context.h \ + ../be_include/be_visitor_union_branch.h \ + ../be_include/be_visitor_decl.h .obj/be_interpretive.o .obj/be_interpretive.so .shobj/be_interpretive.o .shobj/be_interpretive.so: be_interpretive.cpp ../include/idl.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ @@ -3907,7 +4988,17 @@ CPPFLAGS += -I../include -I../be_include -I. -DCPP_LOCATION=\"$(CXX)\" \ ../be_include/be_native.h ../be_include/be_helper.h \ ../be_include/be_state.h ../be_include/be_codegen.h \ ../be_include/be_factory.h ../be_include/be_visitor.h \ - ../be_include/be_interpretive.h ../be_include/be_visitor_root.h \ - ../be_include/be_visitor_sequence.h + ../be_include/be_visitor_context.h ../be_include/be_interpretive.h \ + ../be_include/be_visitor_args.h ../be_include/be_visitor_decl.h \ + ../be_include/be_visitor_constant.h ../be_include/be_visitor_scope.h \ + ../be_include/be_visitor_enum.h ../be_include/be_visitor_field.h \ + ../be_include/be_visitor_interface.h \ + ../be_include/be_visitor_interface_fwd.h \ + ../be_include/be_visitor_module.h \ + ../be_include/be_visitor_operation.h ../be_include/be_visitor_root.h \ + ../be_include/be_visitor_sequence.h \ + ../be_include/be_visitor_structure.h \ + ../be_include/be_visitor_typedef.h ../be_include/be_visitor_union.h \ + ../be_include/be_visitor_union_branch.h # IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp index 34954f23a7d..e613db990e8 100644 --- a/TAO/TAO_IDL/be/be_codegen.cpp +++ b/TAO/TAO_IDL/be/be_codegen.cpp @@ -5,7 +5,7 @@ // TAO IDL // // = FILENAME -// be_codegen.h +// be_codegen.cpp // // = DESCRIPTION // @@ -19,6 +19,8 @@ #include "idl_extern.h" #include "be.h" +TAO_CodeGen *tao_cg = TAO_CODEGEN::instance (); + static const int CHUNK = 100; /* BE global Data */ @@ -55,10 +57,10 @@ TAO_CodeGen::~TAO_CodeGen (void) // visitor factory method be_visitor * -TAO_CodeGen::make_visitor (TAO_CodeGen::CG_STATE st) +TAO_CodeGen::make_visitor (be_visitor_context *ctx) { ACE_ASSERT (this->visitor_factory_ != 0); - return this->visitor_factory_->make_visitor (st); + return this->visitor_factory_->make_visitor (ctx); } // factory method @@ -363,12 +365,11 @@ TAO_CodeGen::server_header (const char *fname) ACE_OS::sprintf (macro_name, "_TAO_IDL_"); // convert letters in fname to upcase for (int i=0; i < (suffix - fname); i++) - { - if (isalpha (fname [i])) - { - macro_name[i+9] = toupper (fname [i]); - } - } + if (isalpha (fname [i])) + macro_name[i+9] = toupper (fname [i]); + else + macro_name[i+9] = fname[i]; + ACE_OS::strcat (macro_name, "_H_"); this->server_header_->print ("#if !defined (%s)\n", macro_name); diff --git a/TAO/TAO_IDL/be/be_decl.cpp b/TAO/TAO_IDL/be/be_decl.cpp index ee34e886839..53914febf1a 100644 --- a/TAO/TAO_IDL/be/be_decl.cpp +++ b/TAO/TAO_IDL/be/be_decl.cpp @@ -466,12 +466,103 @@ be_decl::scope (void) } } +// boolean methods to test if code was already generated +idl_bool +be_decl::cli_hdr_gen (void) +{ + return this->cli_hdr_gen_; +} + +idl_bool +be_decl::cli_stub_gen (void) +{ + return this->cli_stub_gen_; +} + +idl_bool +be_decl::cli_inline_gen (void) +{ + return this->cli_inline_gen_; +} + +idl_bool +be_decl::srv_hdr_gen (void) +{ + return this->srv_hdr_gen_; +} + +idl_bool +be_decl::srv_skel_gen (void) +{ + return this->srv_skel_gen_; +} + +idl_bool +be_decl::srv_inline_gen (void) +{ + return this->srv_inline_gen_; +} + +// set the flag indicating that code generation is done +void +be_decl::cli_hdr_gen (idl_bool val) +{ + this->cli_hdr_gen_ = val; +} + +void +be_decl::cli_stub_gen (idl_bool val) +{ + this->cli_stub_gen_ = val; +} + +void +be_decl::cli_inline_gen (idl_bool val) +{ + this->cli_inline_gen_ = val; +} + +void +be_decl::srv_hdr_gen (idl_bool val) +{ + this->srv_hdr_gen_ = val; +} + +void +be_decl::srv_skel_gen (idl_bool val) +{ + this->srv_skel_gen_ = val; +} + +void +be_decl::srv_inline_gen (idl_bool val) +{ + this->srv_inline_gen_ = val; +} + int be_decl::accept (be_visitor *visitor) { return visitor->visit_decl (this); } +idl_bool +be_decl::is_child (be_decl *node) +{ + if (this->defined_in ()) + { + be_decl *bd; + + bd = be_scope::narrow_from_scope (this->defined_in ())->decl (); + if (!bd) + return 0; + + if (!ACE_OS::strcmp (bd->fullname (), node->fullname ())) + return 1; // true + } + return 0; // not a child +} + // narrowing methods IMPL_NARROW_METHODS1 (be_decl, AST_Decl) IMPL_NARROW_FROM_DECL (be_decl) diff --git a/TAO/TAO_IDL/be/be_helper.cpp b/TAO/TAO_IDL/be/be_helper.cpp index 5281afdee8d..16b6ff39437 100644 --- a/TAO/TAO_IDL/be/be_helper.cpp +++ b/TAO/TAO_IDL/be/be_helper.cpp @@ -10,10 +10,10 @@ // Provides helper classes to print generated code to the output // // = AUTHOR -// Copyright 1994-1995 by Sun Microsystems, Inc. -// and // Aniruddha Gokhale // +// Improvements by Carlos O'Ryan +// // ============================================================================ #include "idl.h" @@ -21,7 +21,8 @@ #include "be.h" static const char copyright [] = -"// ****** Code generated by the The ACE ORB (TAO) IDL Compiler *******\n\ +"/* -*- C++ -*- */\n\n\ +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler *******\n\ // TAO ORB and the TAO IDL Compiler have been developed by Washington \n\ // University Computer Science's Distributed Object Computing Group.\n\ //\n\ @@ -145,7 +146,7 @@ TAO_OutStream::indent (void) for (i=0; i < this->indent_level_; i++) { ACE_OS::fprintf (this->fp_, " "); - ACE_OS::fflush (fp_); + ACE_OS::fflush (this->fp_); } } return 0; diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp index 3d56b79a064..7938ec0ab0d 100644 --- a/TAO/TAO_IDL/be/be_interface.cpp +++ b/TAO/TAO_IDL/be/be_interface.cpp @@ -754,10 +754,11 @@ int be_interface::gen_server_header (void) *sh << "};\n\n"; +#if 0 be_visitor_collocated_sh visitor; this->accept (&visitor); *sh << "\n"; - +#endif cg->pop (); return 0; } @@ -933,10 +934,11 @@ int be_interface::gen_server_skeletons (void) cg->pop (); +#if 0 be_visitor_collocated_ss visitor; this->accept (&visitor); *ss << "\n"; - +#endif *ss << this->name () << "*" << be_nl << this->full_skel_name () << "::_this (CORBA_Environment &_env)" << be_nl diff --git a/TAO/TAO_IDL/be/be_interpretive.cpp b/TAO/TAO_IDL/be/be_interpretive.cpp index 8d96ea0844e..cb62a3486fe 100644 --- a/TAO/TAO_IDL/be/be_interpretive.cpp +++ b/TAO/TAO_IDL/be/be_interpretive.cpp @@ -25,8 +25,21 @@ // individual visitors included only here #include "be_interpretive.h" +#include "be_visitor_args.h" +#include "be_visitor_attribute.h" +#include "be_visitor_constant.h" +#include "be_visitor_enum.h" +#include "be_visitor_field.h" +#include "be_visitor_interface.h" +#include "be_visitor_interface_fwd.h" +#include "be_visitor_module.h" +#include "be_visitor_operation.h" #include "be_visitor_root.h" #include "be_visitor_sequence.h" +#include "be_visitor_structure.h" +#include "be_visitor_typedef.h" +#include "be_visitor_union.h" +#include "be_visitor_union_branch.h" TAO_Interpretive_Visitor_Factory::TAO_Interpretive_Visitor_Factory (void) { @@ -38,65 +51,218 @@ TAO_Interpretive_Visitor_Factory::~TAO_Interpretive_Visitor_Factory (void) } be_visitor * -TAO_Interpretive_Visitor_Factory::make_visitor (TAO_CodeGen::CG_STATE st) +TAO_Interpretive_Visitor_Factory::make_visitor (be_visitor_context *ctx) { + TAO_CodeGen::CG_STATE st = ctx->state (); + // create a new context so that ownership issues are not confused. This newly + // created context is a copy of what was sent by the caller. The newly + // created visitor will own this new copy. + be_visitor_context *new_ctx = new be_visitor_context (*ctx); + switch (st) { case TAO_CodeGen::TAO_ROOT_CH: - return TAO_BE_VISITOR_ROOT_CH::instance (); + return new be_visitor_root_ch (new_ctx); case TAO_CodeGen::TAO_ROOT_CI: - return TAO_BE_VISITOR_ROOT_CI::instance (); + return new be_visitor_root_ci (new_ctx); case TAO_CodeGen::TAO_ROOT_CS: - return TAO_BE_VISITOR_ROOT_CS::instance (); + return new be_visitor_root_cs (new_ctx); case TAO_CodeGen::TAO_ROOT_SH: - return TAO_BE_VISITOR_ROOT_SH::instance (); + return new be_visitor_root_sh (new_ctx); case TAO_CodeGen::TAO_ROOT_SI: - return TAO_BE_VISITOR_ROOT_SI::instance (); + return new be_visitor_root_si (new_ctx); case TAO_CodeGen::TAO_ROOT_SS: - return TAO_BE_VISITOR_ROOT_SS::instance (); - case TAO_CodeGen::TAO_SEQUENCE_BASE_CH: - case TAO_CodeGen::TAO_SEQUENCE_BODY_CH: - return TAO_BE_VISITOR_SEQUENCE_CH::instance (); - case TAO_CodeGen::TAO_SEQELEM_RETTYPE_CH: - case TAO_CodeGen::TAO_SEQELEM_RETTYPE_CI: - case TAO_CodeGen::TAO_SEQELEM_RETTYPE_CS: - case TAO_CodeGen::TAO_SEQUENCE_BASE_CS: - case TAO_CodeGen::TAO_SEQUENCE_BASE_CI: - case TAO_CodeGen::TAO_SEQUENCE_BODY_CS: - case TAO_CodeGen::TAO_SEQUENCE_BODY_CI: + return new be_visitor_root_ss (new_ctx); + + case TAO_CodeGen::TAO_MODULE_CH: + return new be_visitor_module_ch (new_ctx); + case TAO_CodeGen::TAO_MODULE_SH: + return new be_visitor_module_sh (new_ctx); + case TAO_CodeGen::TAO_MODULE_CI: + case TAO_CodeGen::TAO_MODULE_CS: + case TAO_CodeGen::TAO_MODULE_SI: + case TAO_CodeGen::TAO_MODULE_SS: + return new be_visitor_module (new_ctx); + + case TAO_CodeGen::TAO_INTERFACE_CH: + return new be_visitor_interface_ch (new_ctx); + case TAO_CodeGen::TAO_INTERFACE_CI: + return new be_visitor_interface_ci (new_ctx); + case TAO_CodeGen::TAO_INTERFACE_CS: + return new be_visitor_interface_cs (new_ctx); + case TAO_CodeGen::TAO_INTERFACE_SH: + return new be_visitor_interface_sh (new_ctx); + case TAO_CodeGen::TAO_INTERFACE_SI: + return new be_visitor_interface_si (new_ctx); + case TAO_CodeGen::TAO_INTERFACE_SS: + return new be_visitor_interface_ss (new_ctx); + case TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SH: + return new be_visitor_interface_collocated_sh (new_ctx); + case TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SS: + return new be_visitor_interface_collocated_ss (new_ctx); + + case TAO_CodeGen::TAO_INTERFACE_FWD_CH: + return new be_visitor_interface_fwd_ch (new_ctx); + case TAO_CodeGen::TAO_INTERFACE_FWD_CI: + return new be_visitor_interface_fwd_ci (new_ctx); + case TAO_CodeGen::TAO_STRUCT_CH: + return new be_visitor_structure_ch (new_ctx); case TAO_CodeGen::TAO_STRUCT_CS: + return new be_visitor_structure_cs (new_ctx); case TAO_CodeGen::TAO_STRUCT_CI: - case TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CH: - case TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CI: + return new be_visitor_structure_ci (new_ctx); + + case TAO_CodeGen::TAO_CONSTANT_CH: + return new be_visitor_constant_ch (new_ctx); + case TAO_CodeGen::TAO_CONSTANT_CS: + return new be_visitor_constant_cs (new_ctx); + + case TAO_CodeGen::TAO_ENUM_CH: + return new be_visitor_enum_ch (new_ctx); + case TAO_CodeGen::TAO_ENUM_CS: + return new be_visitor_enum_cs (new_ctx); + + case TAO_CodeGen::TAO_FIELD_CH: + return new be_visitor_field_ch (new_ctx); + case TAO_CodeGen::TAO_FIELD_CS: + return new be_visitor_field_cs (new_ctx); + case TAO_CodeGen::TAO_FIELD_CI: + return new be_visitor_field_ci (new_ctx); + + case TAO_CodeGen::TAO_UNION_CH: + return new be_visitor_union_ch (new_ctx); + case TAO_CodeGen::TAO_UNION_CI: + return new be_visitor_union_ci (new_ctx); + case TAO_CodeGen::TAO_UNION_CS: + return new be_visitor_union_cs (new_ctx); case TAO_CodeGen::TAO_UNION_PUBLIC_CH: + return new be_visitor_union_branch_public_ch (new_ctx); case TAO_CodeGen::TAO_UNION_PUBLIC_CI: + return new be_visitor_union_branch_public_ci (new_ctx); case TAO_CodeGen::TAO_UNION_PUBLIC_CS: + return new be_visitor_union_branch_public_cs (new_ctx); case TAO_CodeGen::TAO_UNION_PUBLIC_ASSIGN_CS: + return new be_visitor_union_branch_public_assign_cs (new_ctx); case TAO_CodeGen::TAO_UNION_PRIVATE_CH: + return new be_visitor_union_branch_private_ch (new_ctx); + case TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CH: + + return new be_visitor_union_discriminant_ch (new_ctx); + case TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CI: + return new be_visitor_union_discriminant_ci (new_ctx); + case TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CS: + return new be_visitor_union_discriminant_cs (new_ctx); + + case TAO_CodeGen::TAO_SEQUENCE_CH: + return new be_visitor_sequence_ch (new_ctx); + case TAO_CodeGen::TAO_SEQUENCE_CI: + return new be_visitor_sequence_ci (new_ctx); + case TAO_CodeGen::TAO_SEQUENCE_CS: + return new be_visitor_sequence_cs (new_ctx); + case TAO_CodeGen::TAO_SEQUENCE_BASE_CH: + case TAO_CodeGen::TAO_SEQUENCE_BASE_CI: + case TAO_CodeGen::TAO_SEQUENCE_BASE_CS: + return new be_visitor_sequence_base (new_ctx); + case TAO_CodeGen::TAO_SEQELEM_RETTYPE_CH: + case TAO_CodeGen::TAO_SEQELEM_RETTYPE_CI: + return new be_visitor_sequence_elemtype (new_ctx); + case TAO_CodeGen::TAO_SEQUENCE_BUFFER_TYPE_CH: + case TAO_CodeGen::TAO_SEQUENCE_BUFFER_TYPE_CI: + case TAO_CodeGen::TAO_SEQUENCE_BUFFER_TYPE_CS: + return new be_visitor_sequence_buffer_type (new_ctx); + + case TAO_CodeGen::TAO_TYPEDEF_CH: + return new be_visitor_typedef_ch (new_ctx); + case TAO_CodeGen::TAO_TYPEDEF_CS: + return new be_visitor_typedef_cs (new_ctx); + case TAO_CodeGen::TAO_TYPEDEF_CI: + return new be_visitor_typedef_ci (new_ctx); + case TAO_CodeGen::TAO_OPERATION_CH: - case TAO_CodeGen::TAO_OPERATION_RETURN_TYPE_CS: + return new be_visitor_operation_ch (new_ctx); + case TAO_CodeGen::TAO_OPERATION_CS: + return new be_visitor_operation_cs (new_ctx); + case TAO_CodeGen::TAO_OPERATION_SH: + return new be_visitor_operation_sh (new_ctx); + case TAO_CodeGen::TAO_OPERATION_SS: + return new be_visitor_operation_ss (new_ctx); + case TAO_CodeGen::TAO_OPERATION_COLLOCATED_SH: + return new be_visitor_operation_collocated_sh (new_ctx); + case TAO_CodeGen::TAO_OPERATION_COLLOCATED_SS: + return new be_visitor_operation_collocated_ss (new_ctx); + case TAO_CodeGen::TAO_OPERATION_RETTYPE_CH: + case TAO_CodeGen::TAO_OPERATION_RETTYPE_OTHERS: + return new be_visitor_operation_rettype (new_ctx); case TAO_CodeGen::TAO_OPERATION_RETVAL_DECL_CS: - case TAO_CodeGen::TAO_OPERATION_RETVAL_EXCEPTION_CS: + return new be_visitor_operation_rettype_vardecl_cs (new_ctx); + case TAO_CodeGen::TAO_OPERATION_RETVAL_PRE_DOCALL_CS: + return new be_visitor_operation_rettype_pre_docall_cs (new_ctx); + case TAO_CodeGen::TAO_OPERATION_RETVAL_DOCALL_CS: + return new be_visitor_operation_rettype_docall_cs (new_ctx); + case TAO_CodeGen::TAO_OPERATION_RETVAL_POST_DOCALL_CS: + return new be_visitor_operation_rettype_post_docall_cs (new_ctx); case TAO_CodeGen::TAO_OPERATION_RETVAL_RETURN_CS: - case TAO_CodeGen::TAO_OPERATION_SH: + return new be_visitor_operation_rettype_return_cs (new_ctx); case TAO_CodeGen::TAO_OPERATION_RETVAL_DECL_SS: + return new be_visitor_operation_rettype_vardecl_ss (new_ctx); + case TAO_CodeGen::TAO_OPERATION_RETVAL_DEMARSHAL_SS: + case TAO_CodeGen::TAO_OPERATION_RETVAL_MARSHAL_SS: + return new be_visitor_operation_rettype_marshal_ss (new_ctx); case TAO_CodeGen::TAO_OPERATION_RETVAL_ASSIGN_SS: - case TAO_CodeGen::TAO_OPERATION_RESULT_SS: - case TAO_CodeGen::TAO_ARGUMENT_CH: - case TAO_CodeGen::TAO_ARGUMENT_CS: + return new be_visitor_operation_rettype_assign_ss (new_ctx); + case TAO_CodeGen::TAO_OPERATION_RETVAL_POST_UPCALL_SS: + return new be_visitor_operation_rettype_post_upcall_ss (new_ctx); + case TAO_CodeGen::TAO_OPERATION_ARGLIST_CH: + case TAO_CodeGen::TAO_OPERATION_ARGLIST_SH: + case TAO_CodeGen::TAO_OPERATION_ARGLIST_COLLOCATED_SH: + case TAO_CodeGen::TAO_OPERATION_ARGLIST_OTHERS: + return new be_visitor_operation_arglist (new_ctx); + case TAO_CodeGen::TAO_OPERATION_ARG_PRE_DOCALL_CS: + case TAO_CodeGen::TAO_OPERATION_ARG_DOCALL_CS: + case TAO_CodeGen::TAO_OPERATION_ARG_POST_DOCALL_CS: + case TAO_CodeGen::TAO_OPERATION_ARG_PRE_UPCALL_SS: + case TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_SS: + case TAO_CodeGen::TAO_OPERATION_ARG_POST_UPCALL_SS: + case TAO_CodeGen::TAO_OPERATION_ARG_DECL_SS: + case TAO_CodeGen::TAO_OPERATION_ARG_DEMARSHAL_SS: + case TAO_CodeGen::TAO_OPERATION_ARG_MARSHAL_SS: + return new be_visitor_operation_argument (new_ctx); + + case TAO_CodeGen::TAO_ARGUMENT_ARGLIST_CH: + case TAO_CodeGen::TAO_ARGUMENT_ARGLIST_OTHERS: + return new be_visitor_args_arglist (new_ctx); case TAO_CodeGen::TAO_ARGUMENT_PRE_DOCALL_CS: + return new be_visitor_args_pre_docall_cs (new_ctx); case TAO_CodeGen::TAO_ARGUMENT_DOCALL_CS: + return new be_visitor_args_docall_cs (new_ctx); case TAO_CodeGen::TAO_ARGUMENT_POST_DOCALL_CS: - case TAO_CodeGen::TAO_ARGUMENT_SH: - case TAO_CodeGen::TAO_ARGUMENT_SS: + return new be_visitor_args_post_docall_cs (new_ctx); case TAO_CodeGen::TAO_ARGUMENT_VARDECL_SS: + return new be_visitor_args_vardecl_ss (new_ctx); case TAO_CodeGen::TAO_ARGUMENT_PRE_UPCALL_SS: + return new be_visitor_args_pre_upcall_ss (new_ctx); case TAO_CodeGen::TAO_ARGUMENT_UPCALL_SS: + return new be_visitor_args_upcall_ss (new_ctx); case TAO_CodeGen::TAO_ARGUMENT_POST_UPCALL_SS: - case TAO_CodeGen::TAO_TYPEDEF_CH: - case TAO_CodeGen::TAO_TYPEDEF_CS: - case TAO_CodeGen::TAO_TYPEDEF_CI: + return new be_visitor_args_post_upcall_ss (new_ctx); + case TAO_CodeGen::TAO_ARGUMENT_DEMARSHAL_SS: + case TAO_CodeGen::TAO_ARGUMENT_MARSHAL_SS: + return new be_visitor_args_marshal_ss (new_ctx); + + case TAO_CodeGen::TAO_ATTRIBUTE_CH: + case TAO_CodeGen::TAO_ATTRIBUTE_CS: + case TAO_CodeGen::TAO_ATTRIBUTE_SH: + case TAO_CodeGen::TAO_ATTRIBUTE_SS: + case TAO_CodeGen::TAO_ATTRIBUTE_COLLOCATED_SH: + case TAO_CodeGen::TAO_ATTRIBUTE_COLLOCATED_SS: + return new be_visitor_attribute (new_ctx); + + case TAO_CodeGen::TAO_OPERATION_RESULT_SS: + case TAO_CodeGen::TAO_ARGUMENT_CH: + case TAO_CodeGen::TAO_ARGUMENT_CS: + case TAO_CodeGen::TAO_ARGUMENT_SH: + case TAO_CodeGen::TAO_ARGUMENT_SS: case TAO_CodeGen::TAO_ARRAY_DEFN_CH: case TAO_CodeGen::TAO_ARRAY_OTHER_CH: case TAO_CodeGen::TAO_ARRAY_DEFN_CI: @@ -126,6 +292,6 @@ TAO_Interpretive_Visitor_Factory::make_visitor (TAO_CodeGen::CG_STATE st) case TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS: case TAO_CodeGen::TAO_EXCEPTION_CI: default: - return 0; + return new be_visitor_decl (new_ctx); } } diff --git a/TAO/TAO_IDL/be/be_module.cpp b/TAO/TAO_IDL/be/be_module.cpp index 19ce7adca4b..f51a834806b 100644 --- a/TAO/TAO_IDL/be/be_module.cpp +++ b/TAO/TAO_IDL/be/be_module.cpp @@ -1,3 +1,4 @@ +// $Id$ // ============================================================================ // // = LIBRARY diff --git a/TAO/TAO_IDL/be/be_operation.cpp b/TAO/TAO_IDL/be/be_operation.cpp index b0e2edcdf6f..a58f4a7de6e 100644 --- a/TAO/TAO_IDL/be/be_operation.cpp +++ b/TAO/TAO_IDL/be/be_operation.cpp @@ -102,6 +102,14 @@ be_operation::has_native (void) return this->has_native_; } +be_argument * +be_operation::add_argument_to_scope (be_argument *arg) +{ + this->add_to_scope (arg); + this->add_to_referenced (arg, 0); + return arg; +} + // ---------------------------------------- // CODE GENERATION METHODS // ---------------------------------------- @@ -571,6 +579,7 @@ be_operation::gen_server_header (void) // every operation is declared virtual *sh << "virtual "; + // first generate the return type bt = be_type::narrow_from_decl (this->return_type ()); s = cg->make_state (); // retrieve code gen object for this state diff --git a/TAO/TAO_IDL/be/be_predefined_type.cpp b/TAO/TAO_IDL/be/be_predefined_type.cpp index 1d0b9d19c53..5b55195a70d 100644 --- a/TAO/TAO_IDL/be/be_predefined_type.cpp +++ b/TAO/TAO_IDL/be/be_predefined_type.cpp @@ -239,12 +239,14 @@ be_predefined_type::compute_tc_name (void) } break; case AST_PredefinedType::PT_pseudo: - // @@@ XXXASG - // TODO: This is a kind of hack, there are other things that are - // pseudo objects, not only objref (aka CORBA::Object). { - this->tc_name_->nconc (new UTL_ScopedName (new Identifier ("_tc_Object", 1, 0, - I_FALSE), NULL)); + char tcname [100]; + ACE_OS::sprintf (tcname, "_tc_%s", + this->name ()->last_component ()->get_string ()); + this->tc_name_->nconc (new UTL_ScopedName (new Identifier + (ACE_OS::strdup (tcname), + 1, 0, + I_FALSE), NULL)); } break; default: @@ -391,6 +393,8 @@ be_predefined_type::gen_typecode (void) case AST_PredefinedType::PT_wchar: *cs << "CORBA::tk_wchar,\n\n"; break; + case AST_PredefinedType::PT_pseudo: + *cs << "CORBA::tk_objref,\n\n"; } return 0; } diff --git a/TAO/TAO_IDL/be/be_produce.cpp b/TAO/TAO_IDL/be/be_produce.cpp index 565157ee8b8..817fb6af65d 100644 --- a/TAO/TAO_IDL/be/be_produce.cpp +++ b/TAO/TAO_IDL/be/be_produce.cpp @@ -72,21 +72,27 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "be_interpretive.h" /* - * Do the work of this BE. This is the dummy BE so we dont do anything in - * particular here + * Do the work of this BE. This is the starting point for code generation. */ + void BE_produce() { - TAO_CodeGen *cg = TAO_CODEGEN::instance (); // code generator instance be_root *root; // root of the AST made up of BE nodes + be_visitor *root_visitor; // visitor for root + be_visitor_context ctx; // context information for the visitor root + + // XXXASG - Here is where we will have a choice of what to initialize i.e., + // whether we want a visitor generating "interpetive" or "compiled" form of + // stubs/skeletons + // TODO - to do this elegantly. + // right now we just force it to be the interpretive one. + tao_cg->visitor_factory (new TAO_Interpretive_Visitor_Factory); - // XXXASG - Here is where we will have a choice of what to initialize - cg->visitor_factory (new TAO_Interpretive_Visitor_Factory); + AST_Decl *d = idl_global->root (); // get the root - AST_Decl *d = idl_global->root (); - root = be_root::narrow_from_decl (d); - if (root == NULL) // no root + root = be_root::narrow_from_decl (d); // narrow it to the "be_root" + if (!root) // no root { ACE_ERROR ((LM_ERROR, "(%N:%l) be_produce - " @@ -94,81 +100,91 @@ BE_produce() BE_abort(); } - // get the appropriate visitor from the factory + // Code generation involves six steps because of the six files that we + // generate. // (1) generate client header - be_visitor *root_visitor_ch = cg->make_visitor (TAO_CodeGen::TAO_ROOT_CH); - if (root->accept (root_visitor_ch) == -1) + // instantiate a visitor context + ctx.state (TAO_CodeGen::TAO_ROOT_CH); // set the codegen state + // get a root visitor + root_visitor = tao_cg->make_visitor (&ctx); + if (root->accept (root_visitor) == -1) { ACE_ERROR ((LM_ERROR, "(%N:%l) be_produce - " "client header for Root failed\n")); BE_abort(); } - + (void) tao_cg->end_client_header (); // generate the last #endif + delete root_visitor; // it is our responsibility to free up the visitor // (2) generate client inline - be_visitor *root_visitor_ci = cg->make_visitor (TAO_CodeGen::TAO_ROOT_CI); - if (root->accept (root_visitor_ci) == -1) + // set the context information + ctx.state (TAO_CodeGen::TAO_ROOT_CI); + // create a visitor + root_visitor = tao_cg->make_visitor (&ctx); + if (root->accept (root_visitor) == -1) { ACE_ERROR ((LM_ERROR, "(%N:%l) be_produce - " "client inline for Root failed\n")); BE_abort(); } + delete root_visitor; // it is our responsibility to free up the visitor // (3) generate client stubs - be_visitor *root_visitor_cs = cg->make_visitor (TAO_CodeGen::TAO_ROOT_CS); - if (root->accept (root_visitor_cs) == -1) + ctx.state (TAO_CodeGen::TAO_ROOT_CS); + // create a visitor + root_visitor = tao_cg->make_visitor (&ctx); + if (root->accept (root_visitor) == -1) { ACE_ERROR ((LM_ERROR, "(%N:%l) be_produce - " "client stubs for Root failed\n")); BE_abort(); } - + delete root_visitor; // it is our responsibility to free up the visitor // (4) generate server header - be_visitor *root_visitor_sh = cg->make_visitor (TAO_CodeGen::TAO_ROOT_SH); - if (root->accept (root_visitor_sh) == -1) + ctx.state (TAO_CodeGen::TAO_ROOT_SH); + // create a visitor + root_visitor = tao_cg->make_visitor (&ctx); + if (root->accept (root_visitor) == -1) { ACE_ERROR ((LM_ERROR, "(%N:%l) be_produce - " "server header for Root failed\n")); BE_abort(); } - + (void) tao_cg->end_server_header (); // generate the last #endif + delete root_visitor; // it is our responsibility to free up the visitor // (5) generate server inline - be_visitor *root_visitor_si = cg->make_visitor (TAO_CodeGen::TAO_ROOT_SI); - if (root->accept (root_visitor_si) == -1) + ctx.state (TAO_CodeGen::TAO_ROOT_SI); + // create a visitor + root_visitor = tao_cg->make_visitor (&ctx); + if (root->accept (root_visitor) == -1) { ACE_ERROR ((LM_ERROR, "(%N:%l) be_produce - " "server inline for Root failed\n")); BE_abort(); } - + delete root_visitor; // it is our responsibility to free up the visitor // (6) generate server skeletons - be_visitor *root_visitor_ss = cg->make_visitor (TAO_CodeGen::TAO_ROOT_SS); - if (root->accept (root_visitor_ss) == -1) + ctx.state (TAO_CodeGen::TAO_ROOT_SS); + // create a visitor + root_visitor = tao_cg->make_visitor (&ctx); + if (root->accept (root_visitor) == -1) { ACE_ERROR ((LM_ERROR, "(%N:%l) be_produce - " "server skeletons for Root failed\n")); BE_abort(); } - -#if 0 - // start the code generation process - if (root->gen_idl2cplusplus_mapping() == -1) - { - cerr << "Mapping process failed" << endl; - BE_abort(); - } -#endif + delete root_visitor; // it is our responsibility to free up the visitor } /* diff --git a/TAO/TAO_IDL/be/be_sequence.cpp b/TAO/TAO_IDL/be/be_sequence.cpp index dd773852e48..ba8ba272fd1 100644 --- a/TAO/TAO_IDL/be/be_sequence.cpp +++ b/TAO/TAO_IDL/be/be_sequence.cpp @@ -111,35 +111,45 @@ be_sequence::gen_name (void) // create a name for ourselves int -be_sequence::create_name (void) +be_sequence::create_name (be_typedef *node) { static char namebuf [NAMEBUFSIZE]; UTL_ScopedName *n = NULL; be_decl *scope; // scope in which we are defined - ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE); // reset the buffer - ACE_OS::strcpy (namebuf, this->gen_name ()); // generate a local name - - // now see if we have a fully scoped name and if so, generate one - scope = be_scope::narrow_from_scope (this->defined_in ())->decl (); - if (scope) + // if there is a typedef node, we use its name as our name + if (node) { - // make a copy of the enclosing scope's name - n = (UTL_ScopedName *)scope->name ()->copy () ; - - // add our local name as the last component - n->nconc (new UTL_ScopedName (new Identifier (ACE_OS::strdup - (namebuf), 1, - 0, I_FALSE), - NULL)); - // set the fully scoped name - this->set_name (n); + n = (UTL_ScopedName *)node->name ()->copy (); + this->set_name (n); // set our name } else { - // We better be not here because we must be inside some scope, - // atleast the ROOT scope. - return -1; + + ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE); // reset the buffer + ACE_OS::strcpy (namebuf, this->gen_name ()); // generate a local name + + // now see if we have a fully scoped name and if so, generate one + scope = be_scope::narrow_from_scope (this->defined_in ())->decl (); + if (scope) + { + // make a copy of the enclosing scope's name + n = (UTL_ScopedName *)scope->name ()->copy () ; + + // add our local name as the last component + n->nconc (new UTL_ScopedName (new Identifier (ACE_OS::strdup + (namebuf), 1, + 0, I_FALSE), + NULL)); + // set the fully scoped name + this->set_name (n); + } + else + { + // We better be not here because we must be inside some scope, + // atleast the ROOT scope. + return -1; + } } return 0; } @@ -220,8 +230,8 @@ be_sequence::gen_client_header (void) -1); } - be_visitor *visitor_seq_ch = cg->make_visitor - (TAO_CodeGen::TAO_SEQUENCE_BODY_CH); + be_visitor *visitor_seq_ch = cg->make_visitor (0); + // (TAO_CodeGen::TAO_SEQUENCE_BODY_CH); if (this->accept (visitor_seq_ch) == -1) { @@ -1332,7 +1342,6 @@ be_sequence::gen_var_defn (void) } *ch << " &"; } -#endif be_visitor_sequence_elemtype elemtype (ch, this, bt); if (bt->accept (&elemtype) == -1) @@ -1343,6 +1352,7 @@ be_sequence::gen_var_defn (void) "[] ret type gen failed\n"), -1); } +#endif *ch << "operator[] (CORBA::ULong index);" << nl; @@ -1558,7 +1568,6 @@ be_sequence::gen_var_impl (void) } *ci << " &"; } -#endif be_visitor_sequence_elemtype elemtype (ci, 0, bt); if (bt->accept (&elemtype) == -1) @@ -1569,6 +1578,7 @@ be_sequence::gen_var_impl (void) "[] ret type gen failed\n"), -1); } +#endif *ci << nl; @@ -1741,7 +1751,7 @@ be_sequence::gen_out_defn (void) } *ch << " &"; } -#endif + be_visitor_sequence_elemtype elemtype(ch, this, bt); if (bt->accept (&elemtype) == -1) { @@ -1751,7 +1761,7 @@ be_sequence::gen_out_defn (void) "[] ret type gen failed\n"), -1); } - +#endif *ch << "operator[] (CORBA::ULong index);" << nl; *ch << "\n"; @@ -1926,7 +1936,6 @@ be_sequence::gen_out_impl (void) } *ci << " &"; } -#endif be_visitor_sequence_elemtype elemtype (ci, 0, bt); if (bt->accept (&elemtype) == -1) @@ -1937,6 +1946,7 @@ be_sequence::gen_out_impl (void) "[] ret type gen failed\n"), -1); } +#endif *ci << nl; diff --git a/TAO/TAO_IDL/be/be_structure.cpp b/TAO/TAO_IDL/be/be_structure.cpp index f0444fb26c0..211305f5a21 100644 --- a/TAO/TAO_IDL/be/be_structure.cpp +++ b/TAO/TAO_IDL/be/be_structure.cpp @@ -128,6 +128,7 @@ be_structure::gen_client_header (void) { // we have a scoped name ch->indent (); + *ch << "static CORBA::TypeCode_ptr " << this->tc_name ()->last_component () << ";\n\n"; } @@ -192,6 +193,7 @@ be_structure::gen_client_stubs (void) } return 0; + } // Generates the client-side inline information diff --git a/TAO/TAO_IDL/be/be_type.cpp b/TAO/TAO_IDL/be/be_type.cpp index 3d6dd90e05e..46d5be825ea 100644 --- a/TAO/TAO_IDL/be/be_type.cpp +++ b/TAO/TAO_IDL/be/be_type.cpp @@ -96,8 +96,8 @@ be_type::tc_name (void) // compiler. In this version, we choose to generate a relative path. // return the type name using the ACE_NESTED_CLASS macro -char * -be_type::nested_type_name (be_decl *use_scope, char *suffix) +const char * +be_type::nested_type_name (be_decl *use_scope, const char *suffix) { // some compilers do not like generating a fully scoped name for a type that // was defined in the same enclosing scope in which it was defined. For such, diff --git a/TAO/TAO_IDL/be/be_union.cpp b/TAO/TAO_IDL/be/be_union.cpp index 7a158726a31..69c646ca2c2 100644 --- a/TAO/TAO_IDL/be/be_union.cpp +++ b/TAO/TAO_IDL/be/be_union.cpp @@ -287,7 +287,7 @@ be_union::gen_client_header (void) this->cli_hdr_gen_ = I_TRUE; } return 0; - } +} int be_union::gen_client_stubs (void) @@ -1126,6 +1126,47 @@ be_union::tc_encap_len (void) return this->encap_len_; } +// compute the size type of the node in question +int +be_union::compute_size_type (void) +{ + UTL_ScopeActiveIterator *si; + AST_Decl *d; + be_decl *bd; + + if (this->nmembers () > 0) + { + // if there are elements in this scope + + si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls); + // instantiate a scope iterator. + + while (!(si->is_done ())) + { + // get the next AST decl node + d = si->item (); + bd = be_decl::narrow_from_decl (d); + if (bd != 0) + { + // our sizetype depends on the sizetype of our members. Although + // previous value of sizetype may get overwritten, we are + // guaranteed by the "size_type" call that once the value reached + // be_decl::VARIABLE, nothing else can overwrite it. + this->size_type (bd->size_type ()); + } + else + { + ACE_DEBUG ((LM_DEBUG, + "WARNING (%N:%l) be_structure::compute_size_type - " + "narrow_from_decl returned 0\n")); + } + si->next (); + } // end of while + delete si; // free the iterator object + } + return 0; +} + int be_union::write_as_return (TAO_OutStream *stream, be_type *type) { diff --git a/TAO/TAO_IDL/be/be_union_branch.cpp b/TAO/TAO_IDL/be/be_union_branch.cpp index a2fa645230d..78defae5d7b 100644 --- a/TAO/TAO_IDL/be/be_union_branch.cpp +++ b/TAO/TAO_IDL/be/be_union_branch.cpp @@ -184,6 +184,24 @@ be_union_branch::tc_encap_len (void) return this->encap_len_; } +// compute the size type of the node in question +int +be_union_branch::compute_size_type (void) +{ + be_type *type = be_type::narrow_from_decl (this->field_type ()); + if (!type) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_field::compute_size_type - " + "bad field type\n"), -1); + } + + // our size type is the same as our type + this->size_type (type->size_type ()); // as a side effect will also update + // the size type of parent + return 0; +} + int be_union_branch::accept (be_visitor *visitor) { diff --git a/TAO/TAO_IDL/be/be_visitor.cpp b/TAO/TAO_IDL/be/be_visitor.cpp index 1f89bfff529..38e10c4eb16 100644 --- a/TAO/TAO_IDL/be/be_visitor.cpp +++ b/TAO/TAO_IDL/be/be_visitor.cpp @@ -1,47 +1,39 @@ // // $Id$ // +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor.h +// +// = DESCRIPTION +// Abstract class for back end visitors. +// +// = NOTES +// This is not a pure abstract class +// +// = AUTHOR +// Aniruddha Gokhale and Carlos O'Ryan +// +// ============================================================================ #include "idl.h" #include "be.h" #include "be_visitor.h" be_visitor::be_visitor (void) - : node_ (0), - os_ (0) { } be_visitor::~be_visitor (void) { - this->node_ = 0; - this->os_ = 0; -} - -void -be_visitor::be_node (be_decl *node) -{ - this->node_ = node; -} - -be_decl * -be_visitor::be_node (void) -{ - return this->node_; -} - -TAO_OutStream & -be_visitor::stream (void) -{ - return *this->os_; -} - -void -be_visitor::stream (TAO_OutStream *os) -{ - this->os_ = os; } +// all the visit methods. Concrete visitors will selectively override each one int be_visitor::visit_decl (be_decl *) { return 0; @@ -49,30 +41,6 @@ int be_visitor::visit_decl (be_decl *) int be_visitor::visit_scope (be_scope *node) { - // proceed if the number of members in our scope is greater than 0 - if (node->nmembers () > 0) - { - // initialize an iterator to iterate thru our scope - UTL_ScopeActiveIterator *si; - ACE_NEW_RETURN (si, - UTL_ScopeActiveIterator (node, - UTL_Scope::IK_decls), - -1); - // continue until each element is visited - while (!si->is_done ()) - { - AST_Decl *d = si->item (); - be_decl *bd = be_decl::narrow_from_decl (d); - if (bd == 0 || bd->accept (this) == -1) - { - delete si; - return -1; - } - si->next (); - } // end of while loop - delete si; - } - return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_args.cpp b/TAO/TAO_IDL/be/be_visitor_args.cpp index 28a9d433ec4..bae23191820 100644 --- a/TAO/TAO_IDL/be/be_visitor_args.cpp +++ b/TAO/TAO_IDL/be/be_visitor_args.cpp @@ -2,122 +2,276 @@ // $Id$ // +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_args.cpp +// +// = DESCRIPTION +// Visitors for generation of code for Argument +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + #include "idl.h" #include "be.h" #include "be_visitor_args.h" -be_visitor_args_decl::be_visitor_args_decl (TAO_OutStream *stream) - : stream_ (stream) +be_visitor_args::be_visitor_args (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_args::~be_visitor_args (void) +{ +} + +int be_visitor_args::visit_argument (be_argument *node) { + return -1; } -be_visitor_args_decl::~be_visitor_args_decl (void) +// helper that returns the type name either as a nested type name (for header +// files) or as a fully scoped name. In addition, we make sure that if the type +// is an alias, we use that name +const char * +be_visitor_args::type_name (be_type *node, const char *suffix) { + static char namebuf [NAMEBUFSIZE]; + ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE); + + be_type *bt; // type to use + + // use the typedefed name if that is the one used in the IDL defn + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + // generate the NESTED_CLASS macro i.e., a relative path name to satisfy the + // MSVC++ compiler + switch (this->ctx_->stream ()->stream_type ()) + { + case TAO_OutStream::TAO_CLI_HDR: + ACE_OS::sprintf (namebuf, "%s", bt->nested_type_name + (this->ctx_->scope (), suffix)); + break; + default: // fullname for all other cases + ACE_OS::sprintf (namebuf, "%s", bt->fullname ()); + if (suffix) + ACE_OS::strcat (namebuf, suffix); + } + + return namebuf; } -void be_visitor_args_decl::argument_direction (int direction) +// helper that returns the direction type of the argument +AST_Argument::Direction +be_visitor_args::direction (void) { - this->argument_direction_ = direction; + // grab the argument node. We know that our context has stored the right + // argument node + be_argument *arg = this->ctx_->be_node_as_argument (); + + ACE_ASSERT (arg != 0); + return arg->direction (); } -void be_visitor_args_decl::current_type_name (UTL_ScopedName* name) +// ************************************************************ +// be_visitor_args_arglist for parameter list in method declarations and +// definitions +// ************************************************************ + +be_visitor_args_arglist::be_visitor_args_arglist (be_visitor_context *ctx) + : be_visitor_args (ctx) { - this->current_type_name_ = name; } -inline TAO_OutStream& be_visitor_args_decl::stream (void) const +be_visitor_args_arglist::~be_visitor_args_arglist (void) { - return *this->stream_; } -int be_visitor_args_decl::visit_operation (be_operation *node) +int be_visitor_args_arglist::visit_argument (be_argument *node) { - this->stream ().incr_indent (0); - this->stream ().incr_indent (0); - this->stream () << "(\n"; + TAO_OutStream *os = this->ctx_->stream (); // get output stream + this->ctx_->node (node); // save the argument node + + // retrieve the type + be_type *bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_arglist::" + "visit_argument - " + "Bad argument type\n"), + -1); + } + + os->indent (); // start with current indentation level + + // Different types have different mappings when used as in/out or + // inout parameters. Let this visitor deal with the type - // This will iterate over the arguments and call back upon us. - if (this->visit_scope (node) == -1) + if (bt->accept (this) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) visit_operation as scope failed\n"), -1); + "be_visitor_args_arglist::" + "visit_argument - " + "cannot accept visitor\n"), + -1); } - // last argument - is always CORBA::Environment - this->stream ().indent (); - this->stream () << "CORBA::Environment &_tao_environment\n"; - this->stream ().decr_indent (); - this->stream () << ")"; - this->stream ().decr_indent (0); + *os << " " << node->local_name () << ",\n"; return 0; } -int be_visitor_args_decl::visit_argument (be_argument *node) +int be_visitor_args_arglist::visit_array (be_array *node) { - be_type *type = be_type::narrow_from_decl (node->field_type ()); - this->stream ().indent (); + TAO_OutStream *os = this->ctx_->stream (); // get output stream - // Different types have different mappings when used as in/out or - // inout parameters. + switch (this->direction ()) + { + case AST_Argument::dir_IN: + *os << "const " << this->type_name (node); + break; + case AST_Argument::dir_INOUT: + *os << this->type_name (node); + break; + case AST_Argument::dir_OUT: + *os << this->type_name (node, "_out"); + break; + } + return 0; +} + +int be_visitor_args_arglist::visit_enum (be_enum *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + *os << this->type_name (node); + break; + case AST_Argument::dir_INOUT: + *os << this->type_name (node) << " &"; + break; + case AST_Argument::dir_OUT: + *os << this->type_name (node, "_out"); + break; + } + return 0; +} + +int be_visitor_args_arglist::visit_interface (be_interface *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + *os << this->type_name (node, "_ptr"); + break; + case AST_Argument::dir_INOUT: // inout + *os << this->type_name (node, "_ptr") << " &"; + break; + case AST_Argument::dir_OUT: + *os << this->type_name (node, "_out"); + break; + } + return 0; +} - this->argument_direction_ = node->direction (); +int be_visitor_args_arglist::visit_interface_fwd (be_interface_fwd *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream - // Use the actual type name, not the name for the node, this is - // useful for typedefs where the typedef name must be used, but the - // base type mapping rules must apply. - this->current_type_name_ = type->name (); + switch (this->direction ()) + { + case AST_Argument::dir_IN: + *os << this->type_name (node, "_ptr"); + break; + case AST_Argument::dir_INOUT: // inout + *os << this->type_name (node, "_ptr") << " &"; + break; + case AST_Argument::dir_OUT: + *os << this->type_name (node, "_out"); + break; + } + return 0; +} - type->accept (this); +int be_visitor_args_arglist::visit_native (be_native *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream - this->stream () << " " << node->local_name () << ",\n"; + switch (this->direction ()) + { + case AST_Argument::dir_IN: + *os << this->type_name (node); + break; + case AST_Argument::dir_INOUT: + *os << this->type_name (node) << " &"; + break; + case AST_Argument::dir_OUT: + *os << this->type_name (node) << " &"; + break; + } return 0; } -int be_visitor_args_decl::visit_predefined_type (be_predefined_type *node) +int be_visitor_args_arglist::visit_predefined_type (be_predefined_type *node) { + TAO_OutStream *os = this->ctx_->stream (); // get output stream + // check if the type is an any if (node->pt () == AST_PredefinedType::PT_any) { - switch (this->argument_direction_) + switch (this->direction ()) { case AST_Argument::dir_IN: - this->stream () << "const " << node->name () << " &"; + *os << "const " << this->type_name (node) << " &"; break; case AST_Argument::dir_INOUT: - this->stream () << node->name () << " &"; + *os << this->type_name (node) << " &"; break; case AST_Argument::dir_OUT: - this->stream () << node->name () << "_out "; + *os << this->type_name (node, "_out"); break; } // end switch direction } // end of if else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object { - switch (this->argument_direction_) + switch (this->direction ()) { case AST_Argument::dir_IN: - this->stream () << node->name () << "_ptr "; + *os << this->type_name (node, "_ptr"); break; case AST_Argument::dir_INOUT: - this->stream () << node->name () << "_ptr &"; + *os << this->type_name (node, "_ptr") << " &"; break; case AST_Argument::dir_OUT: - this->stream () << node->name () << "_out "; + *os << this->type_name (node, "_out"); break; } // end switch direction } // end else if else // simple predefined types { - switch (this->argument_direction_) + switch (this->direction ()) { case AST_Argument::dir_IN: - this->stream () << node->name (); + *os << this->type_name (node); break; case AST_Argument::dir_INOUT: - this->stream () << node->name () << " &"; + *os << this->type_name (node) << " &"; break; case AST_Argument::dir_OUT: - this->stream () << node->name () << "_out "; + *os << this->type_name (node, "_out"); break; } // end switch direction } // end of else @@ -125,138 +279,1880 @@ int be_visitor_args_decl::visit_predefined_type (be_predefined_type *node) return 0; } -int be_visitor_args_decl::visit_interface (be_interface *) +int be_visitor_args_arglist::visit_sequence (be_sequence *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get the stream + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + *os << "const " << this->type_name (node) << " &"; + break; + case AST_Argument::dir_INOUT: + *os << this->type_name (node) << " &"; + break; + case AST_Argument::dir_OUT: + *os << this->type_name (node, "_out"); + break; + } + return 0; +} + +int be_visitor_args_arglist::visit_string (be_string *) { - return this->dump_interface (); + TAO_OutStream *os = this->ctx_->stream (); // get the stream + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + *os << "const char *"; + break; + case AST_Argument::dir_INOUT: + *os << "char *&"; + break; + case AST_Argument::dir_OUT: + *os << "CORBA::String_out"; + break; + } + return 0; } -int be_visitor_args_decl::visit_interface_fwd (be_interface_fwd *) +int be_visitor_args_arglist::visit_structure (be_structure *node) { - return this->dump_interface (); + TAO_OutStream *os = this->ctx_->stream (); // get the stream + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + *os << "const " << this->type_name (node) << " &"; + break; + case AST_Argument::dir_INOUT: + *os << this->type_name (node) << " &"; + break; + case AST_Argument::dir_OUT: + *os << this->type_name (node, "_out"); + break; + } + return 0; } -int be_visitor_args_decl::dump_interface (void) const +int be_visitor_args_arglist::visit_union (be_union *node) { - switch (this->argument_direction_) + TAO_OutStream *os = this->ctx_->stream (); // get the stream + + switch (this->direction ()) { case AST_Argument::dir_IN: - this->stream () << this->current_type_name_ << "_ptr "; + *os << "const " << this->type_name (node) << " &"; break; - case AST_Argument::dir_INOUT: // inout - this->stream () << this->current_type_name_ << "_ptr &"; + case AST_Argument::dir_INOUT: + *os << this->type_name (node) << " &"; + break; + case AST_Argument::dir_OUT: + *os << this->type_name (node, "_out"); + break; + } + return 0; +} + +int be_visitor_args_arglist::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); + return node->primitive_base_type ()->accept (this); +} + +// ************************************************************************* +// visitor for argument to do any pre docall processing. Not all types need +// this. Only those that have an _out type need this. In addition, interfaces +// need it because we ned to convert from the interface type to the base Object +// type and vice versa. +// ************************************************************************* + +be_visitor_args_pre_docall_cs::be_visitor_args_pre_docall_cs +(be_visitor_context *ctx) + : be_visitor_args (ctx) +{ +} + +be_visitor_args_pre_docall_cs::~be_visitor_args_pre_docall_cs (void) +{ +} + +int be_visitor_args_pre_docall_cs::visit_argument (be_argument *node) +{ + this->ctx_->node (node); // save the argument node + + // retrieve the type of the argument + be_type *bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_pre_docall_cs::" + "visit_argument - " + "Bad argument type\n"), + -1); + } + + // Different types have different mappings when used as in/out or + // inout parameters. Let this visitor deal with the type + + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_pre_docall_cs::" + "visit_argument - " + "cannot accept visitor\n"), + -1); + } + + return 0; +} + +int +be_visitor_args_pre_docall_cs::visit_array (be_array *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + // if the current type is an alias, use that + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + switch (this->direction ()) + { + case AST_Argument::dir_OUT: + os->indent (); + *os << bt->name () << "_slice *&_tao_base_" << arg->local_name () + << " = " << arg->local_name () << ".ptr ();\n"; + *os << "ACE_NEW_RETURN (_tao_base_" << arg->local_name () + << ", " << bt->name () << "_slice, _tao_base_" + << arg->local_name () << ");\n"; + break; + default: + break; + } + return 0; + +} + +int +be_visitor_args_pre_docall_cs::visit_interface (be_interface *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + os->indent (); + *os << "CORBA::Object_ptr _tao_base_" << arg->local_name () + << " = " << arg->local_name () << ";\n"; + break; + case AST_Argument::dir_OUT: + os->indent (); + *os << "CORBA::Object_ptr _tao_base_" << arg->local_name () << ";\n"; + break; + default: + break; + } + return 0; +} + +int +be_visitor_args_pre_docall_cs::visit_interface_fwd (be_interface_fwd *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + os->indent (); + *os << "CORBA::Object_ptr _tao_base_" << arg->local_name () + << " = " << arg->local_name () << ";\n"; + break; + case AST_Argument::dir_OUT: + os->indent (); + *os << "CORBA::Object_ptr _tao_base_" << arg->local_name () << ";\n"; + break; + default: + break; + } + return 0; +} + +int +be_visitor_args_pre_docall_cs::visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + // if the current type is an alias, use that + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + // pre do_call processing is valid only for pseudo objects and for Any + switch (node->pt ()) + { + case AST_PredefinedType::PT_pseudo: + { + switch (this->direction ()) + { + case AST_Argument::dir_OUT: + os->indent (); + *os << bt->name () << "_ptr &_tao_base_" << arg->local_name () + << " = " << arg->local_name () << ".ptr ();\n"; + break; + default: + break; + } + } + break; + case AST_PredefinedType::PT_any: + { + switch (this->direction ()) + { + case AST_Argument::dir_OUT: + os->indent (); + *os << bt->name () << " *&_tao_base_" << arg->local_name () + << " = " << arg->local_name () << ".ptr ();" << be_nl; + *os << "ACE_NEW_RETURN (_tao_base_" << arg->local_name () + << ", CORBA::Any, _tao_base_" << arg->local_name () << ");\n"; + break; + default: + break; + } + } + break; + default: + break; + } + return 0; +} + +int +be_visitor_args_pre_docall_cs::visit_sequence (be_sequence *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + // if the current type is an alias, use that + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + switch (this->direction ()) + { + case AST_Argument::dir_OUT: + // caller must have allocated the pointer + os->indent (); + *os << bt->name () << " *&_tao_base_" << arg->local_name () + << " = " << arg->local_name () << ".ptr ();" << be_nl; + *os << "ACE_NEW_RETURN (_tao_base_" << arg->local_name () << ", " + << bt->name () << ", _tao_base_" << arg->local_name () << ");\n"; + break; + default: + break; + } + return 0; +} + +int +be_visitor_args_pre_docall_cs::visit_string (be_string *) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + + switch (this->direction ()) + { + case AST_Argument::dir_OUT: + // caller should have allocated the pointer + os->indent (); + *os << "char *&_tao_base_" << arg->local_name () + << " = " << arg->local_name () << ".ptr ();\n"; + break; + default: + break; + } + return 0; +} + +int +be_visitor_args_pre_docall_cs::visit_structure (be_structure *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + // if the current type is an alias, use that + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (node->size_type () == be_type::VARIABLE) + { + switch (this->direction ()) + { + case AST_Argument::dir_OUT: + // caller must have allocated the pointer + os->indent (); + *os << bt->name () << " *&_tao_base_" << arg->local_name () + << " = " << arg->local_name () << ".ptr ();" << be_nl; + *os << "ACE_NEW_RETURN (_tao_base_" << arg->local_name () << ", " + << bt->name () << ", _tao_base_" << arg->local_name () << ");\n"; + break; + default: + break; + } + } + return 0; +} + +int +be_visitor_args_pre_docall_cs::visit_union (be_union *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + // if the current type is an alias, use that + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (node->size_type () == be_type::VARIABLE) + { + switch (this->direction ()) + { + case AST_Argument::dir_OUT: + os->indent (); + *os << bt->name () << " *&_tao_base_" << arg->local_name () + << " = " << arg->local_name () << ".ptr ();" << be_nl; + *os << "ACE_NEW_RETURN (_tao_base_" << arg->local_name () << ", " + << bt->name () << ", _tao_base_" << arg->local_name () << ");\n"; + break; + default: + break; + } + } + return 0; +} + +int +be_visitor_args_pre_docall_cs::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); + return node->primitive_base_type ()->accept (this); +} + +// **************************************************************************** +// visitor for argument passing to do_call. The do_call method takes a variable +// number of parameters. The total number of parameters is determined by the +// "calldata" parameter that must be passed before the variable list +// starts. Each argument to the do_call is considered to be of type "void *". +// Hence we pass the address of each argument. The case for _out is a bit +// tricky where we must first retrieve the pointer, allocate memory and pass it +// to do_call. This is done in the "pre_do_call" processing. +// **************************************************************************** + +be_visitor_args_docall_cs::be_visitor_args_docall_cs (be_visitor_context *ctx) + : be_visitor_args (ctx) +{ +} + +be_visitor_args_docall_cs::~be_visitor_args_docall_cs (void) +{ +} + +int be_visitor_args_docall_cs::visit_argument (be_argument *node) +{ + this->ctx_->node (node); // save the argument node + + // retrieve the type of the argument + be_type *bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_docall_cs::" + "visit_argument - " + "Bad argument type\n"), + -1); + } + + // Different types have different mappings when used as in/out or + // inout parameters. Let this visitor deal with the type + + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_docall_cs::" + "visit_argument - " + "cannot accept visitor\n"), + -1); + } + + return 0; +} + +int be_visitor_args_docall_cs::visit_array (be_array *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + + os->indent (); + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + *os << arg->local_name (); + break; + case AST_Argument::dir_OUT: + // pass reference to the pointer to slice + *os << "_tao_base_" << arg->local_name (); + break; + } + return 0; +} + +int be_visitor_args_docall_cs::visit_enum (be_enum *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + + os->indent (); + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + // pass the address. Storage is already allocated + *os << "&" << arg->local_name (); + break; + } + return 0; +} + +int be_visitor_args_docall_cs::visit_interface (be_interface *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + + os->indent (); + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + *os << "&_tao_base_" << arg->local_name (); + break; + } + return 0; +} + +int be_visitor_args_docall_cs::visit_interface_fwd (be_interface_fwd *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + + os->indent (); + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + *os << "&_tao_base_" << arg->local_name (); + break; + } + return 0; +} + +int be_visitor_args_docall_cs::visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get argument node + + os->indent (); + // check if the type is an any + if (node->pt () == AST_PredefinedType::PT_any) + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + *os << "&" << arg->local_name (); + break; + case AST_Argument::dir_OUT: + *os << "_tao_base_" << arg->local_name (); + break; + } // end switch direction + } // end of if any + else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., + // CORBA::Object, + // CORBA::TypeCode + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + *os << "&" << arg->local_name (); + break; + case AST_Argument::dir_OUT: + *os << "&_tao_base_" << arg->local_name (); + break; + } // end switch direction + } // end else if pseudo + else // simple predefined types + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + *os << "&" << arg->local_name (); + break; + } // end switch direction + } // end of else + + return 0; +} + +int be_visitor_args_docall_cs::visit_sequence (be_sequence *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + + os->indent (); + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + *os << "&" << arg->local_name (); + break; + case AST_Argument::dir_OUT: + *os << "_tao_base_" << arg->local_name (); + break; + } + return 0; +} + +int be_visitor_args_docall_cs::visit_string (be_string *) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + + os->indent (); + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + *os << "&" << arg->local_name (); + break; + case AST_Argument::dir_OUT: + *os << "&_tao_base_" << arg->local_name (); + break; + } + return 0; +} + +int be_visitor_args_docall_cs::visit_structure (be_structure *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + + os->indent (); + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + *os << "&" << arg->local_name (); + break; + case AST_Argument::dir_OUT: + { + // check if the size type is VARIABLE + if (node->size_type () == be_type::VARIABLE) + *os << "_tao_base_" << arg->local_name (); + else + *os << "&" << arg->local_name (); + } + break; + } + return 0; +} + +int be_visitor_args_docall_cs::visit_union (be_union *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + + os->indent (); + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + *os << "&" << arg->local_name (); + break; + case AST_Argument::dir_OUT: + { + // check if the size type is VARIABLE + if (node->size_type () == be_type::VARIABLE) + *os << "_tao_base_" << arg->local_name (); + else + *os << "&" << arg->local_name (); + } + break; + } + return 0; +} + +int be_visitor_args_docall_cs::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); + return node->primitive_base_type ()->accept (this); +} + +// ************************************************************************* +// visitor for argument to do any pre docall processing. Not all types need +// this. Only those that have an _out type need this. In addition, interfaces +// need it because we ned to convert from the interface type to the base Object +// type and vice versa. +// ************************************************************************* + +be_visitor_args_post_docall_cs::be_visitor_args_post_docall_cs +(be_visitor_context *ctx) + : be_visitor_args (ctx) +{ +} + +be_visitor_args_post_docall_cs::~be_visitor_args_post_docall_cs (void) +{ +} + +int +be_visitor_args_post_docall_cs::visit_argument (be_argument *node) +{ + this->ctx_->node (node); // save the argument node + + // retrieve the type of the argument + be_type *bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_pre_docall_cs::" + "visit_argument - " + "Bad argument type\n"), + -1); + } + + // Different types have different mappings when used as in/out or + // inout parameters. Let this visitor deal with the type + + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_pre_docall_cs::" + "visit_argument - " + "cannot accept visitor\n"), + -1); + } + + return 0; +} + +int +be_visitor_args_post_docall_cs::visit_interface (be_interface *node) +{ + // we must narrow the out object reference to the appropriate type + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + + switch (this->direction ()) + { + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + { + os->indent (); + // assign the narrowed obj reference + *os << arg->local_name () << " = " << node->name () + << "::_narrow (_tao_base_" << arg->local_name () + << ", _tao_environment);" << be_nl; + *os << "CORBA::release (_tao_base_" << arg->local_name () + << ");\n"; + } + break; + } + return 0; +} + +int +be_visitor_args_post_docall_cs::visit_interface_fwd (be_interface_fwd *node) +{ + // we must narrow the out object reference to the appropriate type + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + + switch (this->direction ()) + { + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + { + os->indent (); + // assign the narrowed obj reference + *os << arg->local_name () << " = " << node->name () + << "::_narrow (_tao_base_" << arg->local_name () + << ", _tao_environment);" << be_nl; + *os << "CORBA::release (_tao_base_" << arg->local_name () + << ");\n"; + } + break; + } + return 0; +} + +int +be_visitor_args_post_docall_cs::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); + return node->primitive_base_type ()->accept (this); +} + +// ************************************************************************ +// Visitor to generate code for argument variable declaration +// ************************************************************************ + +be_visitor_args_vardecl_ss::be_visitor_args_vardecl_ss (be_visitor_context *ctx) + : be_visitor_args (ctx) +{ +} + +be_visitor_args_vardecl_ss::~be_visitor_args_vardecl_ss (void) +{ +} + +int be_visitor_args_vardecl_ss::visit_argument (be_argument *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + this->ctx_->node (node); // save the argument node + + // retrieve the type + be_type *bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_vardecl_ss::" + "visit_argument - " + "Bad argument type\n"), + -1); + } + + // Different types have different mappings when used as in/out or + // inout parameters. Let this visitor deal with the type + + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_vardecl_ss::" + "visit_argument - " + "cannot accept visitor\n"), + -1); + } + + return 0; +} + +int be_visitor_args_vardecl_ss::visit_array (be_array *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + // if the current type is an alias, use that + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + os->indent (); + *os << bt->name () << " " << arg->local_name () << ";\n"; + break; + case AST_Argument::dir_OUT: + os->indent (); + if (node->size_type () == be_type::VARIABLE) + { + *os << bt->name () << "_slice *_tao_ptr_" << arg->local_name () << ";" << be_nl; + *os << bt->name () << "_out " << arg->local_name () + << " (_tao_ptr_" << arg->local_name () << ");\n"; + } + else + *os << bt->name () << " " << arg->local_name () << ";\n"; + break; + } + return 0; +} + +int be_visitor_args_vardecl_ss::visit_enum (be_enum *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + // if the current type is an alias, use that + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + os->indent (); + *os << bt->name () << " " << arg->local_name () << ";\n"; + break; + } + return 0; +} + +int be_visitor_args_vardecl_ss::visit_interface (be_interface *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + // if the current type is an alias, use that + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + os->indent (); + *os << bt->name () << "_ptr " << arg->local_name () << ";" << be_nl; + *os << "CORBA::Object_ptr _tao_base_" << arg->local_name () << ";\n"; + break; + case AST_Argument::dir_OUT: + os->indent (); + *os << bt->name () << "_ptr _tao_ptr_" << arg->local_name () << ";" << be_nl; + *os << bt->name () << "_out " << arg->local_name () + << " (_tao_ptr_" << arg->local_name () << ");\n"; + break; + } + return 0; +} + +int be_visitor_args_vardecl_ss::visit_interface_fwd (be_interface_fwd *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + // if the current type is an alias, use that + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + os->indent (); + *os << bt->name () << "_ptr " << arg->local_name () << ";" << be_nl; + *os << "CORBA::Object_ptr _tao_base_" << arg->local_name () << ";\n"; + break; + case AST_Argument::dir_OUT: + os->indent (); + *os << bt->name () << "_ptr _tao_ptr_" << arg->local_name () << ";" << be_nl; + *os << bt->name () << "_out " << arg->local_name () + << " (_tao_ptr_" << arg->local_name () << ");\n"; + break; + } + return 0; +} + +int be_visitor_args_vardecl_ss::visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + // if the current type is an alias, use that + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + // check if the type is an any + if (node->pt () == AST_PredefinedType::PT_any) + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + os->indent (); + *os << bt->name () << " " << arg->local_name () << ";\n"; + break; + case AST_Argument::dir_OUT: + os->indent (); + *os << bt->name () << " *_tao_ptr_" << arg->local_name () << ";" << be_nl; + *os << bt->name () << "_out " << arg->local_name () + << " (_tao_ptr_" << arg->local_name () << ");\n"; + break; + } // end switch direction + } // end of if + else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + os->indent (); + *os << bt->name () << "_ptr " << arg->local_name () << ";\n"; + break; + case AST_Argument::dir_OUT: + os->indent (); + *os << bt->name () << "_ptr _tao_ptr_" << arg->local_name () << ";" << be_nl; + *os << bt->name () << "_out " << arg->local_name () + << " (_tao_ptr_" << arg->local_name () << ");\n"; + break; + } // end switch direction + } // end else if + else // simple predefined types + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + os->indent (); + *os << bt->name () << " " << arg->local_name () << ";\n"; + break; + } // end switch direction + } // end of else + + return 0; +} + +int be_visitor_args_vardecl_ss::visit_sequence (be_sequence *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + // if the current type is an alias, use that + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + os->indent (); + *os << bt->name () << " " << arg->local_name () << ";\n"; + break; + case AST_Argument::dir_OUT: + os->indent (); + *os << bt->name () << " *_tao_ptr_" << arg->local_name () << ";" << be_nl; + *os << bt->name () << "_out " << arg->local_name () + << " (_tao_ptr_" << arg->local_name () << ");\n"; + break; + } + return 0; +} + +int be_visitor_args_vardecl_ss::visit_string (be_string *) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + os->indent (); + *os << "char *" << arg->local_name () << ";\n"; break; case AST_Argument::dir_OUT: - this->stream () << this->current_type_name_ << "_out "; + os->indent (); + *os << "char *_tao_ptr_" << arg->local_name () << ";" << be_nl; + *os << "CORBA::String_out " << arg->local_name () + << " (_tao_ptr_" << arg->local_name () << ");\n"; break; } return 0; } -int be_visitor_args_decl::visit_structure (be_structure *) +int be_visitor_args_vardecl_ss::visit_structure (be_structure *node) { - return this->dump_structure (); + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + // if the current type is an alias, use that + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + os->indent (); + *os << bt->name () << " " << arg->local_name () << ";\n"; + break; + case AST_Argument::dir_OUT: + os->indent (); + // check if it is variable sized + if (node->size_type () == be_type::VARIABLE) + { + *os << bt->name () << " *_tao_ptr_" << arg->local_name () << ";" << be_nl; + *os << bt->name () << "_out " << arg->local_name () + << " (_tao_ptr_" << arg->local_name () << ");\n"; + } + else + *os << bt->name () << " " << arg->local_name () << ";\n"; + break; + } + return 0; } -int be_visitor_args_decl::dump_structure () const +int be_visitor_args_vardecl_ss::visit_union (be_union *node) { - switch (this->argument_direction_) + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + // if the current type is an alias, use that + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + switch (this->direction ()) { case AST_Argument::dir_IN: - this->stream () << "const " << this->current_type_name_ << " &"; + case AST_Argument::dir_INOUT: + os->indent (); + *os << bt->name () << " " << arg->local_name () << ";\n"; break; + case AST_Argument::dir_OUT: + os->indent (); + // check if it is variable sized + if (node->size_type () == be_type::VARIABLE) + { + *os << bt->name () << " *_tao_ptr_" << arg->local_name () << ";" << be_nl; + *os << bt->name () << "_out " << arg->local_name () + << " (_tao_ptr_" << arg->local_name () << ");\n"; + } + else + *os << bt->name () << " " << arg->local_name () << ";\n"; + break; + } + return 0; +} + +int be_visitor_args_vardecl_ss::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); + return node->primitive_base_type ()->accept (this); +} + +// ************************************************************************ +// Visitor to generate code for passing argument to the marshal/demarshal +// routines +// ************************************************************************ + +be_visitor_args_marshal_ss::be_visitor_args_marshal_ss (be_visitor_context *ctx) + : be_visitor_args (ctx) +{ +} + +be_visitor_args_marshal_ss::~be_visitor_args_marshal_ss (void) +{ +} + +int be_visitor_args_marshal_ss::visit_argument (be_argument *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + this->ctx_->node (node); // save the argument node + + // retrieve the type + be_type *bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_marshal_ss::" + "visit_argument - " + "Bad argument type\n"), + -1); + } + + // Different types have different mappings when used as in/out or + // inout parameters. Let this visitor deal with the type + + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_marshal_ss::" + "visit_argument - " + "cannot accept visitor\n"), + -1); + } + + return 0; +} + +int be_visitor_args_marshal_ss::visit_array (be_array *) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + switch (this->direction ()) + { + case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: - this->stream () << this->current_type_name_ << " &"; + os->indent (); + *os << arg->local_name (); break; case AST_Argument::dir_OUT: - this->stream () << this->current_type_name_ << "_out"; + os->indent (); + *os << "_tao_ptr_" << arg->local_name (); break; } return 0; } -int be_visitor_args_decl::visit_enum (be_enum *node) +int be_visitor_args_marshal_ss::visit_enum (be_enum *) { - switch (this->argument_direction_) + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + switch (this->direction ()) { case AST_Argument::dir_IN: - this->stream () << node->name (); + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + os->indent (); + *os << "&" << arg->local_name (); break; + } + return 0; +} + +int be_visitor_args_marshal_ss::visit_interface (be_interface *) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + switch (this->direction ()) + { + case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: - this->stream () << node->name () << " &"; + os->indent (); + if (this->ctx_->state () == TAO_CodeGen::TAO_ARGUMENT_DEMARSHAL_SS) + *os << "&_tao_base_" << arg->local_name (); + else + *os << "&" << arg->local_name (); break; case AST_Argument::dir_OUT: - this->stream () << node->name () << "_out"; + os->indent (); + *os << "&_tao_ptr_" << arg->local_name (); break; } return 0; } -int be_visitor_args_decl::visit_union (be_union *) +int be_visitor_args_marshal_ss::visit_interface_fwd (be_interface_fwd *) { - return this->dump_structure (); + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + os->indent (); + if (this->ctx_->state () == TAO_CodeGen::TAO_ARGUMENT_DEMARSHAL_SS) + *os << "&_tao_base_" << arg->local_name (); + else + *os << "&" << arg->local_name (); + break; + case AST_Argument::dir_OUT: + os->indent (); + *os << "&_tao_ptr_" << arg->local_name (); + break; + } + return 0; } -int be_visitor_args_decl::visit_array (be_array *node) +int be_visitor_args_marshal_ss::visit_predefined_type (be_predefined_type *node) { - switch (this->argument_direction_) + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + + // check if the type is an any + if (node->pt () == AST_PredefinedType::PT_any) + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + os->indent (); + *os << "&" << arg->local_name (); + break; + case AST_Argument::dir_OUT: + os->indent (); + *os << "_tao_ptr_" << arg->local_name (); + break; + } // end switch direction + } // end of if + else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + os->indent (); + *os << "&" << arg->local_name (); + break; + case AST_Argument::dir_OUT: + os->indent (); + *os << "&_tao_ptr_" << arg->local_name (); + break; + } // end switch direction + } // end else if + else // simple predefined types + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + os->indent (); + *os << "&" << arg->local_name (); + break; + } // end switch direction + } // end of else + + return 0; +} + +int be_visitor_args_marshal_ss::visit_sequence (be_sequence *) +{ + TAO_OutStream *os = this->ctx_->stream (); // get the stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + os->indent (); + *os << "&" << arg->local_name (); + break; + case AST_Argument::dir_OUT: + os->indent (); + *os << "_tao_ptr_" << arg->local_name (); + break; + } + return 0; +} + +int be_visitor_args_marshal_ss::visit_string (be_string *) +{ + TAO_OutStream *os = this->ctx_->stream (); // get the stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + os->indent (); + *os << "&" << arg->local_name (); + break; + case AST_Argument::dir_OUT: + os->indent (); + *os << "&_tao_ptr_" << arg->local_name (); + break; + } + return 0; +} + +int be_visitor_args_marshal_ss::visit_structure (be_structure *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get the stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + + switch (this->direction ()) { case AST_Argument::dir_IN: - this->stream () << "const " << this->current_type_name_; + case AST_Argument::dir_INOUT: + os->indent (); + *os << "&" << arg->local_name (); + break; + case AST_Argument::dir_OUT: + os->indent (); + if (node->size_type () == be_type::VARIABLE) + *os << "_tao_ptr_" << arg->local_name (); + else + *os << "&" << arg->local_name (); break; + } + return 0; +} + +int be_visitor_args_marshal_ss::visit_union (be_union *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get the stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + + switch (this->direction ()) + { + case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: - this->stream () << this->current_type_name_; - if (node->size_type () == be_decl::VARIABLE) + os->indent (); + *os << "&" << arg->local_name (); + break; + case AST_Argument::dir_OUT: + os->indent (); + if (node->size_type () == be_type::VARIABLE) + *os << "_tao_ptr_" << arg->local_name (); + else + *os << "&" << arg->local_name (); + break; + } + return 0; +} + +int be_visitor_args_marshal_ss::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); + return node->primitive_base_type ()->accept (this); +} + +// ************************************************************************ +// visitor for passing arguments to the upcall +// ************************************************************************ + +be_visitor_args_pre_upcall_ss::be_visitor_args_pre_upcall_ss (be_visitor_context *ctx) + : be_visitor_args (ctx) +{ +} + +be_visitor_args_pre_upcall_ss::~be_visitor_args_pre_upcall_ss (void) +{ +} + +int be_visitor_args_pre_upcall_ss::visit_argument (be_argument *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + this->ctx_->node (node); // save the argument node + + // retrieve the type + be_type *bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_pre_upcall_ss::" + "visit_argument - " + "Bad argument type\n"), + -1); + } + + // Different types have different mappings when used as in/out or + // inout parameters. Let this visitor deal with the type + + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_pre_upcall_ss::" + "visit_argument - " + "cannot accept visitor\n"), + -1); + } + + return 0; +} + +int be_visitor_args_pre_upcall_ss::visit_array (be_array *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + break; + case AST_Argument::dir_OUT: + break; + } + return 0; +} + +int be_visitor_args_pre_upcall_ss::visit_enum (be_enum *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + break; + case AST_Argument::dir_OUT: + break; + } + return 0; +} + +int be_visitor_args_pre_upcall_ss::visit_interface (be_interface *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: // inout + os->indent (); + *os << arg->local_name () << " = " << node->name () + << "::_narrow (_tao_base_" << arg->local_name () + << ", _tao_environment);\n"; + break; + case AST_Argument::dir_OUT: + break; + } + return 0; +} + +int be_visitor_args_pre_upcall_ss::visit_interface_fwd (be_interface_fwd *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: // inout + os->indent (); + *os << arg->local_name () << " = " << node->name () + << "::_narrow (_tao_base_" << arg->local_name () + << "_tao_environment);\n"; + break; + case AST_Argument::dir_OUT: + break; + } + return 0; +} + +int be_visitor_args_pre_upcall_ss::visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + // check if the type is an any + if (node->pt () == AST_PredefinedType::PT_any) + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + break; + case AST_Argument::dir_OUT: + break; + } // end switch direction + } // end of if + else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + break; + case AST_Argument::dir_OUT: + break; + } // end switch direction + } // end else if + else // simple predefined types + { + switch (this->direction ()) { - this->stream () << "_slice *"; - } + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + break; + case AST_Argument::dir_OUT: + break; + } // end switch direction + } // end of else + + return 0; +} + +int be_visitor_args_pre_upcall_ss::visit_sequence (be_sequence *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get the stream + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: break; case AST_Argument::dir_OUT: - this->stream () << this->current_type_name_ << "_out"; break; } return 0; } -int be_visitor_args_decl::visit_sequence (be_sequence *) +int be_visitor_args_pre_upcall_ss::visit_string (be_string *) { - return this->dump_structure (); + TAO_OutStream *os = this->ctx_->stream (); // get the stream + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + break; + case AST_Argument::dir_OUT: + break; + } + return 0; } -int be_visitor_args_decl::visit_string (be_string *) +int be_visitor_args_pre_upcall_ss::visit_structure (be_structure *node) { - switch (this->argument_direction_) + TAO_OutStream *os = this->ctx_->stream (); // get the stream + + switch (this->direction ()) { case AST_Argument::dir_IN: - this->stream () << "const char*"; break; case AST_Argument::dir_INOUT: - this->stream () << "char*&"; break; case AST_Argument::dir_OUT: - this->stream () << "CORBA::String_out"; break; } return 0; } -int be_visitor_args_decl::visit_typedef (be_typedef *node) +int be_visitor_args_pre_upcall_ss::visit_union (be_union *node) { + TAO_OutStream *os = this->ctx_->stream (); // get the stream + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + break; + case AST_Argument::dir_OUT: + break; + } + return 0; +} + +int be_visitor_args_pre_upcall_ss::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); return node->primitive_base_type ()->accept (this); } -int be_visitor_args_decl::visit_native (be_native *) +// ************************************************************************ +// visitor for passing arguments to the upcall +// ************************************************************************ + +be_visitor_args_upcall_ss::be_visitor_args_upcall_ss (be_visitor_context *ctx) + : be_visitor_args (ctx) +{ +} + +be_visitor_args_upcall_ss::~be_visitor_args_upcall_ss (void) +{ +} + +int be_visitor_args_upcall_ss::visit_argument (be_argument *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + this->ctx_->node (node); // save the argument node + + switch (node->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + os->indent (); + *os << node->local_name (); + break; + } + return 0; + +} + +// ************************************************************************ +// visitor for doing any post-processing after the upcall is made +// ************************************************************************ + +be_visitor_args_post_upcall_ss::be_visitor_args_post_upcall_ss (be_visitor_context *ctx) + : be_visitor_args (ctx) +{ +} + +be_visitor_args_post_upcall_ss::~be_visitor_args_post_upcall_ss (void) +{ +} + +int be_visitor_args_post_upcall_ss::visit_argument (be_argument *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + this->ctx_->node (node); // save the argument node + + // retrieve the type + be_type *bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_post_upcall_ss::" + "visit_argument - " + "Bad argument type\n"), + -1); + } + + // Different types have different mappings when used as in/out or + // inout parameters. Let this visitor deal with the type + + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_post_upcall_ss::" + "visit_argument - " + "cannot accept visitor\n"), + -1); + } + + return 0; +} + +int be_visitor_args_post_upcall_ss::visit_array (be_array *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + break; + case AST_Argument::dir_OUT: + break; + } + return 0; +} + +int be_visitor_args_post_upcall_ss::visit_enum (be_enum *node) { - switch (this->argument_direction_) + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + switch (this->direction ()) { case AST_Argument::dir_IN: - this->stream () << this->current_type_name_; break; case AST_Argument::dir_INOUT: - this->stream () << this->current_type_name_ << " &"; break; case AST_Argument::dir_OUT: - this->stream () << this->current_type_name_ << " &"; break; } return 0; } + +int be_visitor_args_post_upcall_ss::visit_interface (be_interface *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: // inout + break; + case AST_Argument::dir_OUT: + break; + } + return 0; +} + +int be_visitor_args_post_upcall_ss::visit_interface_fwd (be_interface_fwd *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: // inout + break; + case AST_Argument::dir_OUT: + break; + } + return 0; +} + +int be_visitor_args_post_upcall_ss::visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + // check if the type is an any + if (node->pt () == AST_PredefinedType::PT_any) + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + break; + case AST_Argument::dir_OUT: + break; + } // end switch direction + } // end of if + else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + break; + case AST_Argument::dir_OUT: + break; + } // end switch direction + } // end else if + else // simple predefined types + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + break; + case AST_Argument::dir_OUT: + break; + } // end switch direction + } // end of else + + return 0; +} + +int be_visitor_args_post_upcall_ss::visit_sequence (be_sequence *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get the stream + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + break; + case AST_Argument::dir_OUT: + break; + } + return 0; +} + +int be_visitor_args_post_upcall_ss::visit_string (be_string *) +{ + TAO_OutStream *os = this->ctx_->stream (); // get the stream + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + break; + case AST_Argument::dir_OUT: + break; + } + return 0; +} + +int be_visitor_args_post_upcall_ss::visit_structure (be_structure *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get the stream + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + break; + case AST_Argument::dir_OUT: + break; + } + return 0; +} + +int be_visitor_args_post_upcall_ss::visit_union (be_union *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get the stream + + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + break; + case AST_Argument::dir_OUT: + break; + } + return 0; +} + +int be_visitor_args_post_upcall_ss::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); + return node->primitive_base_type ()->accept (this); +} diff --git a/TAO/TAO_IDL/be/be_visitor_attribute.cpp b/TAO/TAO_IDL/be/be_visitor_attribute.cpp new file mode 100644 index 00000000000..4f51ea24be2 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_attribute.cpp @@ -0,0 +1,182 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_attribute.cpp +// +// = DESCRIPTION +// Visitors for generation of code for Attribute +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_attribute.h" + +// Attribute gets mapped to one or possibly two operations based on whether +// it is readonly or not. The two operations "get" and "set" the value of the +// attribute. +// +// code generation for attributes is achieved by mapping an attribute node to +// a corresponding operation node. The reason is that we do not want to +// duplicate the code. However, an attribute node and an operation node have +// different interfaces. Hence we need some form of an adapter that can take us +// from an attribute node to an operation node. The following paragraph +// describes how this is accomplished. +// +// For a "get" operation on the attribute, we create an operation node with the +// same name as the attribute and a return type which is the same as the type +// of the attribute. This operation has no arguments. +// +// For a "set" operation on the attribute (if it is not readonly), we create an +// operation node with a "void" return type and an "in" parameter of the same +// type as the attribute. + +// In both cases the context will hold sufficient information to indicate that +// the operation node is really an attribute node. + +// ************************************************************************* +// primary visitor for "attribute". The context state decides the next state +// ************************************************************************* + +be_visitor_attribute::be_visitor_attribute (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_attribute::~be_visitor_attribute (void) +{ +} + +int +be_visitor_attribute::visit_attribute (be_attribute *node) +{ + TAO_OutStream *os; // output stream + be_type *bt; // type node + + os = this->ctx_->stream (); + this->ctx_->node (node); // save the node + this->ctx_->attribute (node); // save this attribute node + + be_operation *op; + + // first the "get" operation + op = new be_operation (node->field_type (), AST_Operation::OP_noflags, + node->name (), 0); + op->set_name (node->name ()); + be_visitor_context ctx (*this->ctx_); + + // this switch statement eliminates the need for different classes that have + // exactly the same code except different states. + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_ATTRIBUTE_CH: + ctx.state (TAO_CodeGen::TAO_OPERATION_CH); + break; + case TAO_CodeGen::TAO_ATTRIBUTE_CS: + ctx.state (TAO_CodeGen::TAO_OPERATION_CS); + break; + case TAO_CodeGen::TAO_ATTRIBUTE_SH: + ctx.state (TAO_CodeGen::TAO_OPERATION_SH); + break; + case TAO_CodeGen::TAO_ATTRIBUTE_SS: + ctx.state (TAO_CodeGen::TAO_OPERATION_SS); + break; + case TAO_CodeGen::TAO_ATTRIBUTE_COLLOCATED_SH: + ctx.state (TAO_CodeGen::TAO_OPERATION_COLLOCATED_SH); + break; + case TAO_CodeGen::TAO_ATTRIBUTE_COLLOCATED_SS: + ctx.state (TAO_CodeGen::TAO_OPERATION_COLLOCATED_SS); + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor || !op || (op->accept (visitor) == -1)) + { + delete visitor; + delete op; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_attribute::" + "visit_attribute - " + "codegen for get_attribute failed\n"), + -1); + } + delete op; + delete visitor; + if (node->readonly ()) + return 0; // nothing else to do + + // the set method. + // the return type is "void" + be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, + new UTL_ScopedName + (new Identifier + ("void", 1, 0, I_FALSE), 0), + 0); + // argument type is the same as the attribute type + be_argument *arg = new be_argument (AST_Argument::dir_IN, + node->field_type (), + node->name (), + 0); + arg->set_name (node->name ()); + // create the operation + op = new be_operation (rt, AST_Operation::OP_noflags, + node->name (), 0); + op->set_name (node->name ()); + op->add_argument_to_scope (arg); + + ctx = *this->ctx_; + // this switch statement eliminates the need for different classes that have + // exactly the same code except different states. + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_ATTRIBUTE_CH: + ctx.state (TAO_CodeGen::TAO_OPERATION_CH); + break; + case TAO_CodeGen::TAO_ATTRIBUTE_CS: + ctx.state (TAO_CodeGen::TAO_OPERATION_CS); + break; + case TAO_CodeGen::TAO_ATTRIBUTE_SH: + ctx.state (TAO_CodeGen::TAO_OPERATION_SH); + break; + case TAO_CodeGen::TAO_ATTRIBUTE_SS: + ctx.state (TAO_CodeGen::TAO_OPERATION_SS); + break; + case TAO_CodeGen::TAO_ATTRIBUTE_COLLOCATED_SH: + ctx.state (TAO_CodeGen::TAO_OPERATION_COLLOCATED_SH); + break; + case TAO_CodeGen::TAO_ATTRIBUTE_COLLOCATED_SS: + ctx.state (TAO_CodeGen::TAO_OPERATION_COLLOCATED_SS); + break; + } + + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || !op || (op->accept (visitor) == -1)) + { + delete visitor; + delete op; + delete arg; + delete rt; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_attribute::" + "visit_attribute - " + "codegen for set_attribute failed\n"), + -1); + } + delete op; + delete visitor; + delete rt; + delete arg; + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_constant.cpp b/TAO/TAO_IDL/be/be_visitor_constant.cpp new file mode 100644 index 00000000000..f2b2d722164 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_constant.cpp @@ -0,0 +1,100 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_constant.cpp +// +// = DESCRIPTION +// Visitors for generation of code for Constant +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_constant.h" + +// ******************************************************************** +// Visitor implementation for the Constant type +// This one for the client header file +// ******************************************************************** + +be_visitor_constant_ch::be_visitor_constant_ch (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_constant_ch::~be_visitor_constant_ch (void) +{ +} + +// visit the Constant_Ch node and its scope +int +be_visitor_constant_ch::visit_constant (be_constant *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + + if (!node->cli_hdr_gen ()) + { + // if we are defined in the outermost scope, then the value is assigned + // to us here itself, else it will be in the *.cpp file + + os->indent (); // start from whatever indentation level we were at + *os << "static const " << node->exprtype_to_string () + << " " << node->local_name (); + if (!node->is_nested ()) + { + // We were defined at the outermost scope. So we put the value in the + // header itself + *os << " = " << node->constant_value (); + } + *os << ";\n\n"; + node->cli_hdr_gen (I_TRUE); + } + return 0; +} + +// ******************************************************************** +// Visitor implementation for the Constant type +// This one for the client stubs file +// ******************************************************************** + +be_visitor_constant_cs::be_visitor_constant_cs (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_constant_cs::~be_visitor_constant_cs (void) +{ +} + +// visit the Constant_cs node and its scope +int +be_visitor_constant_cs::visit_constant (be_constant *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + + if (!node->cli_hdr_gen ()) + { + if (node->is_nested ()) + { + // for those constants not defined in the outer most scope, they get + // assigned to their values in the impl file + os->indent (); // start from whatever indentation level we were at + *os << "const " << node->exprtype_to_string () << " " << node->name () + << " = " << node->constant_value () << ";\n\n"; + } + node->cli_stub_gen (I_TRUE); + } + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_context.cpp b/TAO/TAO_IDL/be/be_visitor_context.cpp new file mode 100644 index 00000000000..c95b42ddd16 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_context.cpp @@ -0,0 +1,448 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_context.cpp +// +// = DESCRIPTION +// Maintains the context information for visitors +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +// constructor +be_visitor_context::be_visitor_context (void) + : state_ (TAO_CodeGen::TAO_UNKNOWN), + os_ (0), + scope_ (0), + node_ (0), + alias_ (0), + tdef_ (0), + attr_ (0), + comma_ (0) +{ +} + +be_visitor_context::be_visitor_context (const be_visitor_context &ctx) + : state_ (ctx.state_), + os_ (ctx.os_), + scope_ (ctx.scope_), + node_ (ctx.node_), + alias_ (ctx.alias_), + tdef_ (ctx.tdef_), + attr_ (ctx.attr_), + comma_ (ctx.comma_) +{ +} + +be_visitor_context & +be_visitor_context::operator= (const be_visitor_context &ctx) +{ + this->state_ = ctx.state_; + this->os_ = ctx.os_; + this->scope_ = ctx.scope_; + this->node_ = ctx.node_; + this->alias_ = ctx.alias_; + this->tdef_ = ctx.tdef_; + this->attr_ = ctx.attr_; + this->comma_ = ctx.comma_; + + return *this; +} + +be_visitor_context::~be_visitor_context (void) +{ + // we do not own anything +} + +//= helpers + +void +be_visitor_context::stream (TAO_OutStream *os) +{ + this->os_ = os; +} + +TAO_OutStream * +be_visitor_context::stream (void) +{ + return this->os_; +} + +void +be_visitor_context::scope (be_decl *s) +{ + this->scope_ = s; +} + +be_decl * +be_visitor_context::scope (void) +{ + return this->scope_; +} + +void +be_visitor_context::node (be_decl *n) +{ + this->node_ = n; +} + +be_decl * +be_visitor_context::node (void) +{ + return this->node_; +} + +void +be_visitor_context::state (TAO_CodeGen::CG_STATE st) +{ + this->state_ = st; +} + +TAO_CodeGen::CG_STATE +be_visitor_context::state (void) +{ + return this->state_; +} + +void +be_visitor_context::tdef (be_typedef *node) +{ + this->tdef_ = node; +} + +be_typedef * +be_visitor_context::tdef (void) +{ + return this->tdef_; +} + +void +be_visitor_context::alias (be_typedef *node) +{ + this->alias_ = node; +} + +be_typedef * +be_visitor_context::alias (void) +{ + return this->alias_; +} + +void +be_visitor_context::attribute (be_attribute *node) +{ + this->attr_ = node; +} + +be_attribute * +be_visitor_context::attribute (void) +{ + return this->attr_; +} + +void +be_visitor_context::comma (idl_bool ib) +{ + this->comma_ = ib; +} + +idl_bool +be_visitor_context::comma (void) +{ + return this->comma_; +} + +// return the node as argument if possible +be_argument * +be_visitor_context::be_node_as_argument (void) +{ + if (this->node_) + return be_argument::narrow_from_decl (this->node_); + else + return (be_argument *)0; +} + +// return the node as array if possible +be_array * +be_visitor_context::be_node_as_array (void) +{ + if (this->node_) + return be_array::narrow_from_decl (this->node_); + else + return (be_array *)0; +} + +// return the node as attribute if possible +be_attribute * +be_visitor_context::be_node_as_attribute (void) +{ + if (this->node_) + return be_attribute::narrow_from_decl (this->node_); + else + return (be_attribute *)0; +} + +// return the node as constant if possible +be_constant * +be_visitor_context::be_node_as_constant (void) +{ + if (this->node_) + return be_constant::narrow_from_decl (this->node_); + else + return (be_constant *)0; +} + +// return the node as enum if possible +be_enum * +be_visitor_context::be_node_as_enum (void) +{ + if (this->node_) + return be_enum::narrow_from_decl (this->node_); + else + return (be_enum *)0; +} + +// return the node as enum_val if possible +be_enum_val * +be_visitor_context::be_node_as_enum_val (void) +{ + if (this->node_) + return be_enum_val::narrow_from_decl (this->node_); + else + return (be_enum_val *)0; +} + +// return the node as exception if possible +be_exception * +be_visitor_context::be_node_as_exception (void) +{ + if (this->node_) + return be_exception::narrow_from_decl (this->node_); + else + return (be_exception *)0; +} + +// return the node as field if possible +be_field * +be_visitor_context::be_node_as_field (void) +{ + if (this->node_) + return be_field::narrow_from_decl (this->node_); + else + return (be_field *)0; +} + +// return the node as interface if possible +be_interface * +be_visitor_context::be_node_as_interface (void) +{ + if (this->node_) + return be_interface::narrow_from_decl (this->node_); + else + return (be_interface *)0; +} + +// return the node as interface_fwd if possible +be_interface_fwd * +be_visitor_context::be_node_as_interface_fwd (void) +{ + if (this->node_) + return be_interface_fwd::narrow_from_decl (this->node_); + else + return (be_interface_fwd *)0; +} + +// return the node as module if possible +be_module * +be_visitor_context::be_node_as_module (void) +{ + if (this->node_) + return be_module::narrow_from_decl (this->node_); + else + return (be_module *)0; +} + +// return the node as operation if possible +be_operation * +be_visitor_context::be_node_as_operation (void) +{ + if (this->node_) + return be_operation::narrow_from_decl (this->node_); + else + return (be_operation *)0; +} + +// return the node as predefined_type if possible +be_predefined_type * +be_visitor_context::be_node_as_predefined_type (void) +{ + if (this->node_) + return be_predefined_type::narrow_from_decl (this->node_); + else + return (be_predefined_type *)0; +} + +// return the node as root if possible +be_root * +be_visitor_context::be_node_as_root (void) +{ + if (this->node_) + return be_root::narrow_from_decl (this->node_); + else + return (be_root *)0; +} + +// return the node as sequence if possible +be_sequence * +be_visitor_context::be_node_as_sequence (void) +{ + if (this->node_) + return be_sequence::narrow_from_decl (this->node_); + else + return (be_sequence *)0; +} + +// return the node as string if possible +be_string * +be_visitor_context::be_node_as_string (void) +{ + if (this->node_) + return be_string::narrow_from_decl (this->node_); + else + return (be_string *)0; +} + +// return the node as structure if possible +be_structure * +be_visitor_context::be_node_as_structure (void) +{ + if (this->node_) + return be_structure::narrow_from_decl (this->node_); + else + return (be_structure *)0; +} + +// return the node as typedef if possible +be_typedef * +be_visitor_context::be_node_as_typedef (void) +{ + if (this->node_) + return be_typedef::narrow_from_decl (this->node_); + else + return (be_typedef *)0; +} + +// return the node as union if possible +be_union * +be_visitor_context::be_node_as_union (void) +{ + if (this->node_) + return be_union::narrow_from_decl (this->node_); + else + return (be_union *)0; +} + +// return the node as union_branch if possible +be_union_branch * +be_visitor_context::be_node_as_union_branch (void) +{ + if (this->node_) + return be_union_branch::narrow_from_decl (this->node_); + else + return (be_union_branch *)0; +} + +// for scope + +// return the scope as enum if possible +be_enum * +be_visitor_context::be_scope_as_enum (void) +{ + if (this->scope_) + return be_enum::narrow_from_decl (this->scope_); + else + return (be_enum *)0; +} + +// return the scope as exception if possible +be_exception * +be_visitor_context::be_scope_as_exception (void) +{ + if (this->scope_) + return be_exception::narrow_from_decl (this->scope_); + else + return (be_exception *)0; +} + +// return the scope as interface if possible +be_interface * +be_visitor_context::be_scope_as_interface (void) +{ + if (this->scope_) + return be_interface::narrow_from_decl (this->scope_); + else + return (be_interface *)0; +} + +// return the scope as module if possible +be_module * +be_visitor_context::be_scope_as_module (void) +{ + if (this->scope_) + return be_module::narrow_from_decl (this->scope_); + else + return (be_module *)0; +} + +// return the scope as operation if possible +be_operation * +be_visitor_context::be_scope_as_operation (void) +{ + if (this->scope_) + return be_operation::narrow_from_decl (this->scope_); + else + return (be_operation *)0; +} + +// return the scope as root if possible +be_root * +be_visitor_context::be_scope_as_root (void) +{ + if (this->scope_) + return be_root::narrow_from_decl (this->scope_); + else + return (be_root *)0; +} + +// return the scope as structure if possible +be_structure * +be_visitor_context::be_scope_as_structure (void) +{ + if (this->scope_) + return be_structure::narrow_from_decl (this->scope_); + else + return (be_structure *)0; +} + +// return the scope as union if possible +be_union * +be_visitor_context::be_scope_as_union (void) +{ + if (this->scope_) + return be_union::narrow_from_decl (this->scope_); + else + return (be_union *)0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_decl.cpp b/TAO/TAO_IDL/be/be_visitor_decl.cpp new file mode 100644 index 00000000000..86b6a179068 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_decl.cpp @@ -0,0 +1,37 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_decl.cpp +// +// = DESCRIPTION +// Visitor for the base be_decl node. This serves to maintain the current +// state (context) of code generation for the derived visitor. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_decl.h" + +// Root visitor for client header +be_visitor_decl::be_visitor_decl (be_visitor_context *ctx) + : ctx_ (ctx) +{ +} + +be_visitor_decl::~be_visitor_decl (void) +{ + delete this->ctx_; +} diff --git a/TAO/TAO_IDL/be/be_visitor_enum.cpp b/TAO/TAO_IDL/be/be_visitor_enum.cpp new file mode 100644 index 00000000000..bb8dfad02e1 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_enum.cpp @@ -0,0 +1,158 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_enum.cpp +// +// = DESCRIPTION +// Visitors for generation of code for Enum +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_enum.h" + +// ******************************************************************** +// Visitor implementation for the Enum type +// This one for the client header file +// ******************************************************************** + +be_visitor_enum_ch::be_visitor_enum_ch (be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_enum_ch::~be_visitor_enum_ch (void) +{ +} + +// visit the Enum_Ch node and its scope +int +be_visitor_enum_ch::visit_enum (be_enum *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + this->ctx_->comma (1); // comma to be generated by the scope visitor + + if (!node->cli_hdr_gen ()) + { + os->indent (); // start from whatever indentation level we were at + *os << "enum " << node->local_name () << be_nl; + *os << "{\n"; + os->incr_indent (); + if (this->visit_scope (node) == 1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_enum_ch::" + "visit_enum - " + "scope generation failed\n" + ), -1); + } + *os << "\n"; + os->decr_indent (); + *os << "};" << be_nl; + // As per the ORBOS spec, we need the following typedef + *os << "typedef " << node->local_name () << " &" << node->local_name () + << "_out;\n"; + + // Generate the typecode decl + if (node->is_nested ()) + { + // we have a scoped name + os->indent (); + *os << "static CORBA::TypeCode_ptr " << node->tc_name + ()->last_component () << ";\n\n"; + } + else + { + // we are in the ROOT scope + os->indent (); + *os << "extern CORBA::TypeCode_ptr " << node->tc_name + ()->last_component () << ";\n\n"; + } + node->cli_hdr_gen (I_TRUE); + } + return 0; +} + +int +be_visitor_enum_ch::post_process (void) +{ + TAO_OutStream *os = this->ctx_->stream (); + + *os << "," << be_nl; + return 0; +} + +int +be_visitor_enum_ch::visit_enum_val (be_enum_val *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + + os->indent (); + *os << node->local_name (); + + return 0; +} + + +// ******************************************************************** +// Visitor implementation for the Enum type +// This one for the client stubs file +// ******************************************************************** + +be_visitor_enum_cs::be_visitor_enum_cs (be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_enum_cs::~be_visitor_enum_cs (void) +{ +} + +// visit the Enum_cs node and its scope +int +be_visitor_enum_cs::visit_enum (be_enum *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + + if (!node->cli_hdr_gen ()) + { + // generate the typecode information here + os->indent (); // start from current indentation level + *os << be_nl + << "static const CORBA::Long _oc_" << node->flatname () << "[] =" + << be_nl + << "{" << be_idt_nl; + if (node->gen_encapsulation () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_enum_cs::" + "visit_enum - " + "scope generation failed\n" + ), -1); + } + os->decr_indent (); + *os << "};" << be_nl; + + *os << "static CORBA::TypeCode _tc__tc_" << node->flatname () + << " (CORBA::tk_enum, sizeof (_oc_" << node->flatname () + << "), (unsigned char *) &_oc_" << node->flatname () + << ", CORBA::B_FALSE);" << be_nl; + *os << "CORBA::TypeCode_ptr " << node->tc_name () << " = &_tc__tc_" + << node->flatname () << ";\n\n"; + node->cli_stub_gen (I_TRUE); + } + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_exception.cpp b/TAO/TAO_IDL/be/be_visitor_exception.cpp new file mode 100644 index 00000000000..5b633b93b6f --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_exception.cpp @@ -0,0 +1,290 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_exception.cpp +// +// = DESCRIPTION +// Visitors for generation of code for Exception +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_exception.h" + +// generic struct visitor +be_visitor_exception::be_visitor_exception (be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_exception::~be_visitor_exception (void) +{ +} + +// visit the Exception node and its scope +int +be_visitor_exception::visit_exception (be_exception *node) +{ + return -1; // must be overriden +} + +int +be_visitor_exception::visit_field (be_field *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_STRUCT_CH: + ctx.state (TAO_CodeGen::TAO_FIELD_CH); + break; + case TAO_CodeGen::TAO_STRUCT_CI: + ctx.state (TAO_CodeGen::TAO_FIELD_CI); + break; + case TAO_CodeGen::TAO_STRUCT_CS: + ctx.state (TAO_CodeGen::TAO_FIELD_CS); + break; + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_exception::" + "visit_field - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_exception::" + "visit_field - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_exception::" + "visit_field - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// ****************************************************** +// for client header +// ****************************************************** + +be_visitor_exception_ch::be_visitor_exception_ch (be_visitor_context *ctx) + : be_visitor_exception (ctx) +{ +} + +be_visitor_exception_ch::~be_visitor_exception_ch (void) +{ +} + +// visit the Exception node and its scope +int be_visitor_exception_ch::visit_exception (be_exception *node) +{ + TAO_OutStream *os; // output stream + + if (!node->cli_hdr_gen ()) // not already generated + { + os = this->ctx_->stream (); + + os->indent (); // start from whatever indentation level we were at + *os << "struct " << node->local_name () << be_nl + << "{\n" << be_idt; + + // generate code for field members + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_exception_ch::" + "visit_exception - " + "codegen for scope failed\n"), -1); + } + + os->decr_indent (); + *os << "};\n\n"; + + // generate var defn + if (node->gen_var_defn () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_exception_ch::" + "visit_exception - " + "codegen for _var failed\n"), -1); + } + + // a class is generated for an out defn only for a variable length struct + if (node->size_type () == be_decl::VARIABLE) + { + if (node->gen_out_defn () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_exception_ch::" + "visit_exception - " + "codegen for _out failed\n"), -1); + } + } + else + { + os->indent (); + *os << "typedef " << node->local_name () << " &" << node->local_name + () << "_out;\n\n"; + } + + // generate the typecode decl + if (node->is_nested ()) + { + // we have a scoped name + os->indent (); + + *os << "static CORBA::TypeCode_ptr " << node->tc_name + ()->last_component () << ";\n\n"; + } + else + { + // we are in the ROOT scope + os->indent (); + *os << "extern CORBA::TypeCode_ptr " << node->tc_name + ()->last_component () << ";\n\n"; + } + node->cli_hdr_gen (I_TRUE); + } + return 0; +} + +// ****************************************************** +// for client inline +// ****************************************************** + +be_visitor_exception_ci::be_visitor_exception_ci (be_visitor_context *ctx) + : be_visitor_exception (ctx) +{ +} + +be_visitor_exception_ci::~be_visitor_exception_ci (void) +{ +} + +// visit the Exception node and its scope +int be_visitor_exception_ci::visit_exception (be_exception *node) +{ + if (!node->cli_inline_gen ()) + { + if (node->gen_var_impl () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_exception_ci::" + "visit_exception - " + "codegen for _var failed\n"), -1); + } + if (node->size_type () == be_decl::VARIABLE && + node->gen_out_impl () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_exception_ci::" + "visit_exception - " + "codegen for _out failed\n"), -1); + } + // all we have to do is to visit the scope + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_exception_ci::" + "visit_exception - " + "codegen for scope failed\n"), -1); + } + node->cli_inline_gen (I_TRUE); + } + return 0; +} + +// for client stubs +be_visitor_exception_cs::be_visitor_exception_cs (be_visitor_context *ctx) + : be_visitor_exception (ctx) +{ +} + +be_visitor_exception_cs::~be_visitor_exception_cs (void) +{ +} + +// visit the Exception_Cs node and its scope +int be_visitor_exception_cs::visit_exception (be_exception *node) +{ + TAO_OutStream *os; // output stream + + if (!node->cli_stub_gen ()) + { + os = this->ctx_->stream (); + + // generate the typecode information here + os->indent (); // start from current indentation level + *os << "static const CORBA::Long _oc_" << node->flatname () << "[] =" << + be_nl; + *os << "{\n"; + os->incr_indent (0); + // note that we just need the parameters here and hence we generate the + // encapsulation for the parameters + if (node->gen_encapsulation () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_exception_cs::" + "visit_exception - " + "codegen for typecode failed\n"), -1); + } + os->decr_indent (); + *os << "};" << be_nl; + + *os << "static CORBA::TypeCode _tc__tc_" << node->flatname () << + " (CORBA::tk_struct, sizeof (_oc_" << node->flatname () << + "), (unsigned char *) &_oc_" << node->flatname () << + ", CORBA::B_FALSE);" << be_nl; + *os << "CORBA::TypeCode_ptr " << node->tc_name () << " = &_tc__tc_" << + node->flatname () << ";\n\n"; + + // do any code generation required for the scope members + // all we have to do is to visit the scope + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_exception_cs::" + "visit_exception - " + "codegen for scope failed\n"), -1); + } + node->cli_stub_gen (I_TRUE); + } + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_field.cpp b/TAO/TAO_IDL/be/be_visitor_field.cpp new file mode 100644 index 00000000000..a3aa98deccf --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_field.cpp @@ -0,0 +1,740 @@ +// +// $Id$ +// +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_field.cpp +// +// = DESCRIPTION +// Concrete visitor for the base "BE_Field" node +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_field.h" + +// ********************************************** +// visitor for field in the client header file +// ********************************************** + +// constructor +be_visitor_field_ch::be_visitor_field_ch (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +// destructor +be_visitor_field_ch::~be_visitor_field_ch (void) +{ +} + +// visit the field node +int +be_visitor_field_ch::visit_field (be_field *node) +{ + TAO_OutStream *os; // output stream + be_type *bt; // field's type + + os = this->ctx_->stream (); + // first generate the type information + bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_ch::" + "visit_field - " + "Bad field type\n" + ), -1); + } + + this->ctx_->node (node); // save the node + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_ch::" + "visit_field - " + "codegen for field type failed\n" + ), -1); + } + // now output the field name + *os << " " << node->local_name () << ";\n"; + return 0; +} + +// =visit operations on all possible data types that a field can be + +// visit array type +int +be_visitor_field_ch::visit_array (be_array *node) +{ + return 0; +} + +// visit enum type +int +be_visitor_field_ch::visit_enum (be_enum *node) +{ + TAO_OutStream *os; // output stream + be_type *bt; + + os = this->ctx_->stream (); + + // set the right type; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + // if not a typedef and we are defined in the use scope, we must be defined + if (!this->ctx_->alias () // not a typedef + && node->is_child (this->ctx_->scope ())) + { + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope + // is still the same + + // first generate the enum declaration + ctx.state (TAO_CodeGen::TAO_ENUM_CH); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_ch::" + "visit_enum - " + "Bad visitor\n" + ), -1); + } + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_ch::" + "visit_enum - " + "codegen failed\n" + ), -1); + } + delete visitor; + } + + // now use this enum as a "type" for the subsequent declarator + os->indent (); // start from current indentation level + *os << bt->nested_type_name (this->ctx_->scope ()); + + return 0; +} + +// visit interface type +int +be_visitor_field_ch::visit_interface (be_interface *node) +{ + TAO_OutStream *os; // output stream + be_type *bt; + + os = this->ctx_->stream (); + // set the right type; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + // if not a typedef and we are defined in the use scope, we must be defined + os->indent (); // start from current indentation level + *os << bt->nested_type_name (this->ctx_->scope (), "_var"); + return 0; +} + +// visit interface forward type +int +be_visitor_field_ch::visit_interface_fwd (be_interface_fwd *node) +{ + TAO_OutStream *os; // output stream + be_type *bt; + + os = this->ctx_->stream (); + // set the right type; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + // if not a typedef and we are defined in the use scope, we must be defined + os->indent (); // start from current indentation level + *os << bt->nested_type_name (this->ctx_->scope (), "_var"); + return 0; +} + +// visit predefined type +int +be_visitor_field_ch::visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os; // output stream + be_type *bt; + + os = this->ctx_->stream (); + // set the right type; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + // if not a typedef and we are defined in the use scope, we must be defined + os->indent (); // start from current indentation level + if (node->pt () == AST_PredefinedType::PT_pseudo) // is a psuedo obj + *os << bt->nested_type_name (this->ctx_->scope (), "_var"); + else + *os << bt->nested_type_name (this->ctx_->scope ()); + return 0; +} + +// visit sequence type +int +be_visitor_field_ch::visit_sequence (be_sequence *node) +{ + TAO_OutStream *os; // output stream + be_type *bt; + + os = this->ctx_->stream (); + // set the right type; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + // if not a typedef and we are defined in the use scope, we must be defined + if (!this->ctx_->alias () // not a typedef + && node->is_child (this->ctx_->scope ())) + { + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope + // is still the same + + // first generate the sequence declaration + ctx.state (TAO_CodeGen::TAO_SEQUENCE_CH); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_ch::" + "visit_sequence - " + "Bad visitor\n" + ), -1); + } + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_ch::" + "visit_sequence - " + "codegen failed\n" + ), -1); + } + delete visitor; + } + + os->indent (); // start from current indentation level + *os << bt->nested_type_name (this->ctx_->scope ()); + return 0; +} + +// visit string type +int +be_visitor_field_ch::visit_string (be_string *node) +{ + TAO_OutStream *os; // output stream + + os = this->ctx_->stream (); + os->indent (); // start from current indentation level + *os << "CORBA::String_var"; + return 0; +} + +// visit structure type +int +be_visitor_field_ch::visit_structure (be_structure *node) +{ + TAO_OutStream *os; // output stream + be_type *bt; + + os = this->ctx_->stream (); + // set the right type; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + // if not a typedef and we are defined in the use scope, we must be defined + + if (!this->ctx_->alias () // not a typedef + && node->is_child (this->ctx_->scope ())) + { + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope + // is still the same + + // first generate the struct declaration + ctx.state (TAO_CodeGen::TAO_STRUCT_CH); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_ch::" + "visit_struct - " + "Bad visitor\n" + ), -1); + } + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_ch::" + "visit_struct - " + "codegen failed\n" + ), -1); + } + delete visitor; + } + + os->indent (); // start from current indentation level + *os << bt->nested_type_name (this->ctx_->scope ()); + return 0; +} + +// visit typedefed type +int +be_visitor_field_ch::visit_typedef (be_typedef *node) +{ + TAO_OutStream *os; // output stream + + os = this->ctx_->stream (); + os->indent (); // start from current indentation level + this->ctx_->alias (node); // save the node for use in code generation and + // indicate that the field of the field node + // is a typedefed quantity + + // make a decision based on the primitive base type + be_type *bt = node->primitive_base_type (); + if (!bt || (bt->accept (this) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_spec_ch::" + "visit_typedef - " + "Bad primitive type\n" + ), -1); + } + return 0; +} + +// visit union type +int +be_visitor_field_ch::visit_union (be_union *node) +{ + TAO_OutStream *os; // output stream + be_type *bt; + + os = this->ctx_->stream (); + // set the right type; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + // if not a typedef and we are defined in the use scope, we must be defined + if (!this->ctx_->alias () // not a typedef + && node->is_child (this->ctx_->scope ())) + { + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope + // is still the same + + // first generate the enum declaration + ctx.state (TAO_CodeGen::TAO_ENUM_CH); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_ch::" + "visit_enum - " + "Bad visitor\n" + ), -1); + } + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_ch::" + "visit_enum - " + "codegen failed\n" + ), -1); + } + delete visitor; + } + + os->indent (); // start from current indentation level + *os << bt->nested_type_name (this->ctx_->scope ()); + return 0; +} + +// ********************************************** +// visitor for field in the client inline file. +// +// Generate inline code for types that are defined +// inside the structure +// ********************************************** + +// constructor +be_visitor_field_ci::be_visitor_field_ci (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +// destructor +be_visitor_field_ci::~be_visitor_field_ci (void) +{ +} + +// visit the field node +int +be_visitor_field_ci::visit_field (be_field *node) +{ + TAO_OutStream *os; + be_type *bt; // field's type + + os = this->ctx_->stream (); + // first generate the type information + bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_ci::" + "visit_field - " + "Bad field type\n" + ), -1); + } + + this->ctx_->node (node); // save the node + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_ci::" + "visit_field - " + "codegen for field type failed\n" + ), -1); + } + return 0; +} + +// =visit operations on all possible data types that a field can be + +// visit array +int +be_visitor_field_ci::visit_array (be_array *node) +{ + return 0; +} + +// visit sequence +int +be_visitor_field_ci::visit_sequence (be_sequence *node) +{ + return 0; +} + +// visit structure type +int +be_visitor_field_ci::visit_structure (be_structure *node) +{ + if (node->node_type () != AST_Decl::NT_typedef // not a typedef + && node->is_child (this->ctx_->scope ())) // node is defined inside the + // structure + { + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope + // is still the same + + // generate the inline code for structs + ctx.state (TAO_CodeGen::TAO_STRUCT_CI); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_ci::" + "visit_struct - " + "Bad visitor\n" + ), -1); + } + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_ci::" + "visit_struct - " + "codegen failed\n" + ), -1); + } + delete visitor; + } + return 0; +} + +// visit typedef type +int +be_visitor_field_ci::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); // save the typedef node for use in code generation + // as we visit the base type + + // the node to be visited in the base primitve type that gets typedefed + be_type *bt = node->primitive_base_type (); + if (!bt || (bt->accept (this) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ci::" + "visit_typedef - " + "Bad primitive type\n" + ), -1); + } + + return 0; +} + +// visit union type +int +be_visitor_field_ci::visit_union (be_union *node) +{ + if (node->node_type () != AST_Decl::NT_typedef // not a typedef + && node->is_child (this->ctx_->scope ())) // node is defined inside the + // structure + { + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope + // is still the same + + // generate the inline code for union + ctx.state (TAO_CodeGen::TAO_UNION_CI); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_ci::" + "visit_struct - " + "Bad visitor\n" + ), -1); + } + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_ci::" + "visit_struct - " + "codegen failed\n" + ), -1); + } + delete visitor; + } + return 0; +} + +// ********************************************** +// visitor for field in the client stubs file +// ********************************************** + +// constructor +be_visitor_field_cs::be_visitor_field_cs (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +// destructor +be_visitor_field_cs::~be_visitor_field_cs (void) +{ +} + +// visit the field node +int +be_visitor_field_cs::visit_field (be_field *node) +{ + TAO_OutStream *os; // output stream + + be_type *bt; // field's type + + os = this->ctx_->stream (); + // first generate the type information + bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_cs::" + "visit_field - " + "Bad field type\n" + ), -1); + } + + this->ctx_->node (node); // save the node + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_cs::" + "visit_field - " + "codegen for field type failed\n" + ), -1); + } + return 0; +} + +// visit array +int +be_visitor_field_cs::visit_array (be_array *node) +{ + return 0; +} + +// visit enum type +int +be_visitor_field_cs::visit_enum (be_enum *node) +{ + if (node->node_type () != AST_Decl::NT_typedef // not a typedef + && node->is_child (this->ctx_->scope ())) // node is defined inside the + // structure + { + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope + // is still the same + + // generate the typcode for enums + ctx.state (TAO_CodeGen::TAO_ENUM_CS); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_cs::" + "visit_enum - " + "Bad visitor\n" + ), -1); + } + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_cs::" + "visit_enum - " + "codegen failed\n" + ), -1); + } + delete visitor; + } + return 0; +} + +// visit structure type +int +be_visitor_field_cs::visit_structure (be_structure *node) +{ + if (node->node_type () != AST_Decl::NT_typedef // not a typedef + && node->is_child (this->ctx_->scope ())) // node is defined inside the + // structure + { + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // generate the inline code for structs + ctx.state (TAO_CodeGen::TAO_STRUCT_CS); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_cs::" + "visit_struct - " + "Bad visitor\n" + ), -1); + } + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_cs::" + "visit_struct - " + "codegen failed\n" + ), -1); + } + delete visitor; + } + return 0; +} + +// visit typedef type +int +be_visitor_field_cs::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); // save the typedef node for use in code generation + // as we visit the base type + + // the node to be visited in the base primitve type that gets typedefed + be_type *bt = node->primitive_base_type (); + if (!bt || (bt->accept (this) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ci::" + "visit_typedef - " + "Bad primitive type\n" + ), -1); + } + + return 0; +} + +// visit union type +int +be_visitor_field_cs::visit_union (be_union *node) +{ + if (node->node_type () != AST_Decl::NT_typedef // not a typedef + && node->is_child (this->ctx_->scope ())) // node is defined inside the + // structure + { + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // generate the inline code for union + ctx.state (TAO_CodeGen::TAO_UNION_CS); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_cs::" + "visit_union - " + "Bad visitor\n" + ), -1); + } + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_cs::" + "visit_union - " + "codegen failed\n" + ), -1); + } + delete visitor; + } + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface.cpp index 87ff00c9a37..deb4191fa25 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface.cpp @@ -1,49 +1,1444 @@ // $Id$ +// +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_interface.cpp +// +// = DESCRIPTION +// Visitors for generation of code for Interface +// +// = AUTHOR +// Aniruddha Gokhale and Carlos O'Ryan +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" -#include "idl.h" -#include "global_extern.h" -#include "nr_extern.h" -#include "be.h" -#include "be_visitor_args.h" #include "be_visitor_interface.h" -be_visitor_collocated_sh::be_visitor_collocated_sh (void) +// ****************************************************** +// Generic Interface visitor +// ****************************************************** + +be_visitor_interface::be_visitor_interface (be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_interface::~be_visitor_interface (void) +{ +} + +// this method must be overridden by the derived interface visitors +int +be_visitor_interface::visit_interface (be_interface *node) +{ + return -1; +} + +// =all common visit methods for interface visitor + +// visit an attribute +int +be_visitor_interface::visit_attribute (be_attribute *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_INTERFACE_CH: + ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_CH); + break; + case TAO_CodeGen::TAO_INTERFACE_CS: + ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_CS); + break; + case TAO_CodeGen::TAO_INTERFACE_SH: + ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_SH); + break; + case TAO_CodeGen::TAO_INTERFACE_SS: + ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_SS); + break; + case TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SH: + ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_COLLOCATED_SH); + break; + case TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SS: + ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_COLLOCATED_SS); + break; + case TAO_CodeGen::TAO_INTERFACE_CI: + case TAO_CodeGen::TAO_INTERFACE_SI: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_attribute - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_attribute - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_attribute - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// visit a constant +int +be_visitor_interface::visit_constant (be_constant *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_INTERFACE_CH: + ctx.state (TAO_CodeGen::TAO_CONSTANT_CH); + break; + case TAO_CodeGen::TAO_INTERFACE_CS: + ctx.state (TAO_CodeGen::TAO_CONSTANT_CS); + break; + case TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SH: + case TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SS: + case TAO_CodeGen::TAO_INTERFACE_CI: + case TAO_CodeGen::TAO_INTERFACE_SH: + case TAO_CodeGen::TAO_INTERFACE_SI: + case TAO_CodeGen::TAO_INTERFACE_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_constant - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_constant - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_constant - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +//visit an enum +int +be_visitor_interface::visit_enum (be_enum *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_INTERFACE_CH: + ctx.state (TAO_CodeGen::TAO_ENUM_CH); + break; + case TAO_CodeGen::TAO_INTERFACE_CS: + ctx.state (TAO_CodeGen::TAO_ENUM_CS); + break; + case TAO_CodeGen::TAO_INTERFACE_CI: + case TAO_CodeGen::TAO_INTERFACE_SH: + case TAO_CodeGen::TAO_INTERFACE_SI: + case TAO_CodeGen::TAO_INTERFACE_SS: + case TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SH: + case TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_enum - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_enum - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_enum - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// visit an exception +int +be_visitor_interface::visit_exception (be_exception *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_INTERFACE_CH: + ctx.state (TAO_CodeGen::TAO_EXCEPTION_CH); + break; + case TAO_CodeGen::TAO_INTERFACE_CI: + ctx.state (TAO_CodeGen::TAO_EXCEPTION_CI); + break; + case TAO_CodeGen::TAO_INTERFACE_CS: + ctx.state (TAO_CodeGen::TAO_EXCEPTION_CS); + break; + case TAO_CodeGen::TAO_INTERFACE_SH: + case TAO_CodeGen::TAO_INTERFACE_SI: + case TAO_CodeGen::TAO_INTERFACE_SS: + case TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SH: + case TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_exception - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_exception - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_exception - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// visit an operation +int +be_visitor_interface::visit_operation (be_operation *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_INTERFACE_CH: + ctx.state (TAO_CodeGen::TAO_OPERATION_CH); + // return node->gen_client_header (); + break; + case TAO_CodeGen::TAO_INTERFACE_CS: + ctx.state (TAO_CodeGen::TAO_OPERATION_CS); + // return node->gen_client_stubs (); + break; + case TAO_CodeGen::TAO_INTERFACE_SH: + ctx.state (TAO_CodeGen::TAO_OPERATION_SH); + // return node->gen_server_header (); + break; + case TAO_CodeGen::TAO_INTERFACE_SS: + ctx.state (TAO_CodeGen::TAO_OPERATION_SS); + // return node->gen_server_skeletons (); + break; + case TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SH: + ctx.state (TAO_CodeGen::TAO_OPERATION_COLLOCATED_SH); + break; + case TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SS: + ctx.state (TAO_CodeGen::TAO_OPERATION_COLLOCATED_SS); + break; + case TAO_CodeGen::TAO_INTERFACE_CI: + case TAO_CodeGen::TAO_INTERFACE_SI: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_operation - " + "Bad context state\n" + ), -1); + } + break; + } + + // grab the appropriate visitor + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_operation - " + "NUL visitor\n" + ), -1); + } + + // visit the node using this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_operation - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// visit an structure +int +be_visitor_interface::visit_structure (be_structure *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_INTERFACE_CH: + ctx.state (TAO_CodeGen::TAO_STRUCT_CH); + break; + case TAO_CodeGen::TAO_INTERFACE_CI: + ctx.state (TAO_CodeGen::TAO_STRUCT_CI); + break; + case TAO_CodeGen::TAO_INTERFACE_CS: + ctx.state (TAO_CodeGen::TAO_STRUCT_CS); + break; + case TAO_CodeGen::TAO_INTERFACE_SH: + case TAO_CodeGen::TAO_INTERFACE_SI: + case TAO_CodeGen::TAO_INTERFACE_SS: + case TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SH: + case TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_structure - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_structure - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_structure - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// visit a union +int +be_visitor_interface::visit_union (be_union *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_INTERFACE_CH: + ctx.state (TAO_CodeGen::TAO_UNION_CH); + break; + case TAO_CodeGen::TAO_INTERFACE_CI: + ctx.state (TAO_CodeGen::TAO_UNION_CI); + break; + case TAO_CodeGen::TAO_INTERFACE_CS: + ctx.state (TAO_CodeGen::TAO_UNION_CS); + break; + case TAO_CodeGen::TAO_INTERFACE_SH: + case TAO_CodeGen::TAO_INTERFACE_SI: + case TAO_CodeGen::TAO_INTERFACE_SS: + case TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SH: + case TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_union - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_union - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_union - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// visit a typedef +int +be_visitor_interface::visit_typedef (be_typedef *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_INTERFACE_CH: + ctx.state (TAO_CodeGen::TAO_TYPEDEF_CH); + break; + case TAO_CodeGen::TAO_INTERFACE_CI: + ctx.state (TAO_CodeGen::TAO_TYPEDEF_CI); + break; + case TAO_CodeGen::TAO_INTERFACE_CS: + ctx.state (TAO_CodeGen::TAO_TYPEDEF_CS); + break; + case TAO_CodeGen::TAO_INTERFACE_SH: + case TAO_CodeGen::TAO_INTERFACE_SI: + case TAO_CodeGen::TAO_INTERFACE_SS: + case TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SH: + case TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_typedef - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_typedef - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_typedef - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// ****************************************************** +// Interface visitor for client header +// ****************************************************** + +be_visitor_interface_ch::be_visitor_interface_ch (be_visitor_context *ctx) + : be_visitor_interface (ctx) +{ +} + +be_visitor_interface_ch::~be_visitor_interface_ch (void) +{ +} + +int +be_visitor_interface_ch::visit_interface (be_interface *node) +{ + TAO_OutStream *os; // output stream + long i; // loop index + + if (!node->cli_hdr_gen ()) // not already generated + { + + os = this->ctx_->stream (); + + // == STEP 1: generate the class name and class names we inherit == + + // generate the ifdefined macro for the _ptr type + os->gen_ifdef_macro (node->flatname (), "_ptr"); + + // the following two are required to be under the ifdef macro to avoid + // multiple declarations + + os->indent (); // start with whatever indentation level we are at + // forward declaration + *os << "class " << node->local_name () << ";" << be_nl; + // generate the _ptr declaration + *os << "typedef " << node->local_name () << " *" << node->local_name () + << "_ptr;" << be_nl; + + os->gen_endif (); + + // generate the ifdefined macro for the var type + os->gen_ifdef_macro (node->flatname (), "_var"); + + // generate the _var declaration + if (node->gen_var_defn () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface_ch::" + "visit_interface - " + "codegen for _var failed\n"), -1); + } + os->gen_endif (); + + // generate the ifdef macro for the _out class + os->gen_ifdef_macro (node->flatname (), "_out"); + + // generate the _out declaration - ORBOS/97-05-15 pg 16-20 spec + if (node->gen_out_defn () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface_ch::" + "visit_interface - " + "codegen for _out failed\n"), -1); + } + // generate the endif macro + os->gen_endif (); + + // now the interface definition itself + os->gen_ifdef_macro (node->flatname ()); + + // now generate the class definition + os->indent (); + *os << "class " << node->local_name (); + + if (node->n_inherits () > 0) // node interface inherits from other + // interfaces + { + *os << ": "; + for (i = 0; i < node->n_inherits (); i++) + { + be_interface *inherited = + be_interface::narrow_from_decl (node->inherits ()[i]); + be_decl *scope = 0; + if (inherited->is_nested ()) + { + // inherited node is used in the scope of "node" node + scope = be_scope::narrow_from_scope (node->defined_in ()) + ->decl (); + } + + *os << "public virtual "; + *os << inherited->nested_type_name (scope); // dump the scoped name + if (i < node->n_inherits () - 1) // node is the case of multiple + // inheritance, so put a comma + { + *os << ", "; + } + } // end of for loop + *os << be_nl; + } + else + { + // we do not inherit from anybody, hence we do so from the base + // CORBA::Object class + *os << ": public virtual CORBA::Object" << be_nl; + } + + // generate the body + + *os << "{" << be_nl + << "public:" << be_idt_nl + // generate the static _duplicate, _narrow, and _nil operations + << "// the static operations" << be_nl + << "static " << node->local_name () << "_ptr " << "_duplicate (" + << node->local_name () << "_ptr obj);" << be_nl + << "static " << node->local_name () << "_ptr " << "_narrow (" + << "CORBA::Object_ptr obj, CORBA::Environment &env);" << be_nl + << "static " << node->local_name () << "_ptr " << "_nil (void);\n\n"; + + // generate code for the interface definition by traversing thru the + // elements of its scope. We depend on the front-end to have made sure + // that only legal syntactic elements appear in our scope. + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface_ch::" + "visit_interface - " + "codegen for scope failed\n"), -1); + } + // the _is_a method + os->indent (); + *os << "virtual CORBA::Boolean _is_a (const CORBA::Char *type_id, " + << "CORBA::Environment &env);\n"; + + // generate the "protected" constructor so that users cannot instantiate + // us + os->decr_indent (); + *os << "protected:\n"; + os->incr_indent (); + *os << node->local_name () << " (void); // default constructor" << be_nl + << node->local_name () << " (STUB_Object *objref, " + << "TAO_ServantBase *_tao_servant = 0, " + << "CORBA::Boolean _tao_collocated = 0);" << be_nl + << "virtual ~" << node->local_name () << " (void);\n"; + os->decr_indent (); + + // private copy constructor and assignment operator. These are not + // allowed, hence they are private. + *os << "private:\n"; + os->incr_indent (); + *os << node->local_name () << " (const " << node->local_name () << " &);" + << be_nl + << "void operator= (const " << node->local_name () << " &);\n"; + os->decr_indent (); + *os << "};\n\n"; + os->gen_endif (); + + + // generate the typecode decl. If we are in the outermost scope, our typecode + // decl is extern + if (node->is_nested ()) + { + // we have a scoped name + os->indent (); + *os << "static CORBA::TypeCode_ptr " << node->tc_name + ()->last_component () << ";\n\n"; + } + else + { + // we are in the ROOT scope + os->indent (); + *os << "extern CORBA::TypeCode_ptr " << node->tc_name + ()->last_component () << ";\n\n"; + } + + node->cli_hdr_gen (I_TRUE); + } // if !cli_hdr_gen + return 0; +} + +// ************************************************** +// Interface visitor for client inline +// ************************************************** +be_visitor_interface_ci::be_visitor_interface_ci (be_visitor_context *ctx) + : be_visitor_interface (ctx) { } -be_visitor_collocated_sh::~be_visitor_collocated_sh (void) +be_visitor_interface_ci::~be_visitor_interface_ci (void) { } -int be_visitor_collocated_sh::visit_interface (be_interface *node) +int +be_visitor_interface_ci::visit_interface (be_interface *node) { - TAO_NL nl; // end line + TAO_OutStream *os; // output stream - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - TAO_OutStream *os = cg->server_header (); + os = this->ctx_->stream (); + + os->indent (); // start from the current indentation level + + // generate the constructors and destructor + *os << "ACE_INLINE" << be_nl; + *os << node->name () << "::" << node->local_name () << + " (void) // default constructor" << be_nl; + *os << "{}" << be_nl << be_nl; + + *os << "ACE_INLINE" << be_nl; + *os << node->name () << "::" << node->local_name () << + " (STUB_Object *objref, TAO_ServantBase *_tao_servant, " + << "CORBA::Boolean _tao_collocated) // constructor" << be_nl; + *os << "\t: CORBA_Object (objref, _tao_servant, _tao_collocated)" << be_nl; + *os << "{}" << be_nl << be_nl; + + *os << "ACE_INLINE" << be_nl; + *os << node->name () << "::~" << node->local_name () << + " (void) // destructor" << be_nl; + *os << "{}\n\n"; + + // generate the ifdefined macro for the _var type + os->gen_ifdef_macro (node->flatname (), "_var"); + if (node->gen_var_impl () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface_ci::" + "visit_interface - " + "codegen for _var failed\n"), -1); + } + os->gen_endif (); + + // generate the ifdefined macro for the _out type + os->gen_ifdef_macro (node->flatname (), "_out"); + if (node->gen_out_impl () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface_ci::" + "visit_interface - " + "codegen for _out failed\n"), -1); + } + os->gen_endif (); + + // generate inline methods for elements of our scope + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface_ci::" + "visit_interface - " + "codegen for scope failed\n"), -1); + } + + return 0; +} + +// ************************************************************ +// Interface visitor for client stubs +// ************************************************************ + +be_visitor_interface_cs::be_visitor_interface_cs (be_visitor_context *ctx) + : be_visitor_interface (ctx) +{ +} + +be_visitor_interface_cs::~be_visitor_interface_cs (void) +{ +} + +int +be_visitor_interface_cs::visit_interface (be_interface *node) +{ + TAO_OutStream *os; // output stream + + os = this->ctx_->stream (); + + os->indent (); // start with whatever indentation level we are at + + // first generate the code for the static methods + + // The _duplicate method + *os << node->name () << "_ptr " << node->name () << "::_duplicate (" + << node->name () << "_ptr obj)" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "if (!CORBA::is_nil (obj))\n"; + os->incr_indent (); + *os << "obj->AddRef ();\n"; + os->decr_indent (); + *os << be_nl; + *os << "return obj;\n"; + os->decr_indent (); + *os << "} // end of _duplicate" << be_nl << be_nl; + + // The _narrow method + *os << node->name () << "_ptr " << node->name () + << "::_narrow (" << be_idt << be_idt_nl + << "CORBA::Object_ptr obj," << be_nl + << "CORBA::Environment &env" << be_uidt_nl + << ")" << be_uidt_nl + << "{" << be_idt_nl + << "if (CORBA::is_nil (obj))" << be_idt_nl + << "return " << node->name () << "::_nil ();" << be_uidt_nl + << "if (!obj->_is_a (\"" << node->repoID () << "\", env))" + << be_idt_nl + << "return " << node->name () << "::_nil ();" << be_uidt_nl; + + *os << "if (!obj->_is_collocated () || !obj->_servant())" << be_nl + << "{" << be_idt_nl; + *os << node->name () << "_ptr new_obj = new " << node->name () << "(obj->_get_parent ());" << be_nl + << "return new_obj;" << be_uidt_nl + << "} // end of if" << be_nl; + + *os << "STUB_Object *stub = obj->_servant ()->_create_stub (env);" << be_nl + << "if (env.exception () != 0)" << be_idt_nl + << "return " << node->name () << "::_nil ();" << be_uidt_nl + << "void* servant = obj->_servant ()->_downcast (\"" + << node->repoID () << "\");" << be_nl + << "return new "; + + // This may be necessary to work around a GCC compiler bug! + const char *coll_name = node->full_coll_name (); + const char *skel_name = node->full_skel_name (); + + *os << coll_name << "(" << be_idt << be_idt_nl + << "ACE_reinterpret_cast(" << skel_name + << "_ptr, servant)," << be_nl + << "stub" << be_uidt_nl + << ");" << be_uidt << be_uidt_nl + << "}" << be_nl << be_nl; + + // _nil method + *os << node->name () << "_ptr " << node->name () << "::_nil (void)" << + be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "return (" << node->name () << "_ptr)NULL;\n"; + os->decr_indent (); + *os << "} // end of _nil" << be_nl << be_nl; + + // generate code for the elements of the interface + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface_cs::" + "visit_interface - " + "codegen for scope failed\n"), -1); + } + + // generate the is_a method + os->indent (); + *os << "CORBA::Boolean " << node->name () << "::_is_a (" << + "const CORBA::Char *value, CORBA::Environment &env)" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "if (\n"; + os->incr_indent (0); + if (node->traverse_inheritance_graph (be_interface::is_a_helper, os) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface_cs::" + "visit_interface - " + "_is_a method codegen failed\n"), -1); + } + + os->indent (); + *os << "(!ACE_OS::strcmp ((char *)value, CORBA::_tc_Object->id (env))))\n"; + *os << "\treturn 1; // success using local knowledge\n"; + os->decr_indent (); + *os << "else" << be_nl; + *os << "\treturn this->CORBA_Object::_is_a (value, env); // remote call\n"; + os->decr_indent (); + *os << "}\n\n"; + + // generate the typecode information here + os->indent (); // start from current indentation level + *os << "static const CORBA::Long _oc_" << node->flatname () << "[] =" << + be_nl; + *os << "{\n"; + os->incr_indent (0); + if (node->gen_encapsulation () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface_cs::" + "visit_interface - " + "codegen for typecode failed\n"), -1); + } + + os->decr_indent (); + *os << "};" << be_nl; + + *os << "static CORBA::TypeCode _tc__tc_" << node->flatname () << + " (CORBA::tk_objref, sizeof (_oc_" << node->flatname () << + "), (unsigned char *) &_oc_" << node->flatname () << + ", CORBA::B_FALSE);" << be_nl; + *os << "CORBA::TypeCode_ptr " << node->tc_name () << " = &_tc__tc_" << + node->flatname () << ";\n\n"; + + return 0; +} + +// ************************************************************ +// Interface visitor for server header +// ************************************************************ + +be_visitor_interface_sh::be_visitor_interface_sh (be_visitor_context *ctx) + : be_visitor_interface (ctx) +{ +} + +be_visitor_interface_sh::~be_visitor_interface_sh (void) +{ +} + +int +be_visitor_interface_sh::visit_interface (be_interface *node) +{ + TAO_OutStream *os; // output stream + unsigned long i; // loop index + static char namebuf [NAMEBUFSIZE]; // holds the class name + + ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE); + + os = this->ctx_->stream (); + + // generate the skeleton class name + + os->indent (); // start with whatever indentation level we are at + + // we shall have a POA_ prefix only if we are at the topmost level + if (!node->is_nested ()) + { + // we are outermost + ACE_OS::sprintf (namebuf, "POA_%s", node->local_name ()->get_string ()); + } + else + { + ACE_OS::sprintf (namebuf, "%s", node->local_name ()->get_string ()); + } + + *os << "class " << namebuf << ";" << be_nl; + + // generate the _ptr declaration + *os << "typedef " << namebuf << " *" << namebuf + << "_ptr;" << be_nl; + + // now generate the class definition + *os << "class " << namebuf << " : "; + if (node->n_inherits () > 0) // this interface inherits from other interfaces + { + be_interface *intf; // inherited interface + + *os << "public virtual "; + intf = be_interface::narrow_from_decl (node->inherits ()[0]); + *os << intf->relative_skel_name (node->full_skel_name ()); + for (i = 1; i < node->n_inherits (); i++) + { + *os << ", public virtual "; + intf = be_interface::narrow_from_decl (node->inherits ()[i]); + *os << intf->relative_skel_name (node->full_skel_name ()); + } // end of for loop + } + else + { + // We don't inherit from another user defined object, hence our + // base class is the ServantBase class. + *os << " public virtual PortableServer::ServantBase"; + } + *os << be_nl + << "{" << be_nl + << "protected:" << be_idt_nl + << namebuf << " (void);" << be_uidt_nl + << "public:" << be_idt_nl + << "virtual ~" << namebuf << " (void);" << be_nl; + + *os << "virtual CORBA::Boolean _is_a (" << be_idt << be_idt_nl + << "const char* logical_type_id," << be_nl + << "CORBA::Environment &_tao_environment" << be_uidt + << ");\n" << be_uidt; + + os->indent (); + *os << "virtual void* _downcast (" << be_idt << be_idt_nl + << "const char* logical_type_id" << be_uidt_nl + << ");\n" << be_uidt; + + // generate code for elements in the scope (e.g., operations) + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_sh::" + "visit_interface - " + "codegen for scope failed\n"), + -1); + } + // add a skeleton for our _is_a method + os->indent (); + *os << "static void _is_a_skel (CORBA::ServerRequest &req, " << + "void *obj, void *context, CORBA::Environment &_tao_enviroment);\n\n"; + + // generate skeletons for operations of our base classes. These skeletons + // just cast the pointer to the appropriate type before invoking the call + if (node->traverse_inheritance_graph (be_interface::gen_skel_helper, os) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_sh::" + "visit_interface - " + "inheritance graph traversal failed\n"), + -1); + } + + // add the dispatch method + os->indent (); + *os << "virtual void _dispatch (CORBA::ServerRequest &_tao_req, " + << "void *_tao_context, CORBA::Environment &_tao_env);\n\n"; + + // Print out the _this() method. + os->indent (); + *os << node->name () << " *_this (CORBA::Environment &_tao_environment);\n"; + // the _interface_repository_id method + os->indent (); + *os << "virtual const char* _interface_repository_id" + << " (void) const;\n"; + + os->decr_indent (); + + *os << "};\n\n"; + + // generate the collocated class + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SH); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_sh::" + "visit_interface - " + "codegen for collocated class failed\n"), + -1); + } + + *os << "\n"; + + return 0; +} + +// ************************************************************************ +// Interface visitor for server inline +// ************************************************************************ + +be_visitor_interface_si::be_visitor_interface_si (be_visitor_context *ctx) + : be_visitor_interface (ctx) +{ +} + +be_visitor_interface_si::~be_visitor_interface_si (void) +{ +} + +int +be_visitor_interface_si::visit_interface (be_interface *node) +{ + TAO_OutStream *os; // output stream + + os = this->ctx_->stream (); + + os->indent (); // start with whatever indentation level we are at + + // Generate skeletons for operations of our base classes. These skeletons + // just cast the pointer to the appropriate type before invoking the + // call. Hence we generate these in the inline file + if (node->traverse_inheritance_graph (be_interface::gen_skel_helper, os) + == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface_si::" + "visit_interface - " + "codegen for base class skeletons failed\n"), -1); + } + + return 0; +} + +// ************************************************************ +// Interface visitor for server skeletons +// ************************************************************ + +be_visitor_interface_ss::be_visitor_interface_ss (be_visitor_context *ctx) + : be_visitor_interface (ctx) +{ +} + +be_visitor_interface_ss::~be_visitor_interface_ss (void) +{ +} + +int +be_visitor_interface_ss::visit_interface (be_interface *node) +{ + TAO_OutStream *os; // output stream + + os = this->ctx_->stream (); + + // generate the skeleton class name + + os->indent (); // start with whatever indentation level we are at + + if (node->gen_operation_table () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_ss::" + "visit_interface - " + "codegen for operation table failed\n"), + -1); + } + + // constructor + *os << "// skeleton constructor" << be_nl; + // find if we are at the top scope or inside some module + if (!node->is_nested ()) + { + // we are outermost. So the POA_ prefix is prepended to our name + *os << node->full_skel_name () << "::POA_" << node->local_name () << + " (void)" << be_nl; + } + else + { + // the POA_ prefix is prepended to our outermost module name + *os << node->full_skel_name () << "::" << node->local_name () << + " (void)" << be_nl; + } + + *os << "{" << be_idt_nl + << "this->optable_ = &tao_" << node->flatname () + << "_optable;" << be_uidt_nl + << "}\n\n"; + + // destructor + os->indent (); + *os << "// skeleton destructor" << be_nl; + + if (!node->is_nested ()) + { + // we are outermost. So the POA_ prefix is prepended to our name + *os << node->full_skel_name () << "::~POA_" << node->local_name () << + " (void)" << be_nl; + } + else + { + // the POA_ prefix is prepended to our outermost module name + *os << node->full_skel_name () << "::~" << node->local_name () << + " (void)" << be_nl; + } + *os << "{\n"; + *os << "}\n"; + + + // generate code for elements in the scope (e.g., operations) + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_ss::" + "visit_interface - " + "codegen for scope failed\n"), + -1); + } + + // generate code for the _is_a skeleton + os->indent (); + *os << "void " << node->full_skel_name () + << "::_is_a_skel (" << be_idt << be_idt_nl + << "CORBA::ServerRequest &req, " << be_nl + << "void * _tao_object_reference," << be_nl + << "void * /*context*/," << be_nl + << "CORBA::Environment &_tao_environment" << be_uidt_nl + << ")" << be_uidt_nl; + + *os << "{\n"; + os->incr_indent (); + *os << "CORBA::NVList_ptr nvlist;" << be_nl; + *os << "CORBA::NamedValue_ptr nv;" << be_nl; + *os << "CORBA::Any temp_value (CORBA::_tc_string);" << be_nl; + *os << "CORBA::Any *any;" << be_nl; + *os << "CORBA::Boolean *retval = new CORBA::Boolean;" << be_nl; + *os << "CORBA::String value;" << be_nl; + *os << be_nl; + *os << "req.orb()->create_list (0, nvlist);" << be_nl; + *os << "nv = nvlist->add_value (0, temp_value, " + << "CORBA::ARG_IN, _tao_environment);" << be_nl; + *os << "req.params (nvlist, _tao_environment); // parse the args" << be_nl; + *os << "if (_tao_environment.exception () != 0) return;" << be_nl; + *os << "value = *(CORBA::String *)nv->value ()->value ();" << be_nl; + + *os << node->full_skel_name () << "_ptr \t impl = (" + << node->full_skel_name () << "_ptr) _tao_object_reference;" + << be_nl; + + *os << "*retval = impl->_is_a (value, _tao_environment);" << be_nl + << "if (_tao_environment.exception () != 0) return;" << be_nl; + *os << "any = new CORBA::Any (CORBA::_tc_boolean, " + << "retval, CORBA::B_TRUE);" << be_nl; + *os << "req.result (any, _tao_environment);\n"; + os->decr_indent (); + *os << "}\n\n"; + + os->indent (); + *os << "CORBA::Boolean " << node->full_skel_name () + << "::_is_a (" << be_idt << be_idt_nl + << "const char* value," << be_nl + << "CORBA::Environment &_tao_environment" << be_uidt_nl + << ")" << be_uidt_nl + << "{" << be_idt_nl + << "if (\n" << be_idt; + if (node->traverse_inheritance_graph (be_interface::is_a_helper, os) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_ss::" + "visit_interface - " + "traversal of inhertance graph failed\n"), + -1); + } + + os->indent (); + *os << "(!ACE_OS::strcmp ((char *)value, " + << "CORBA::_tc_Object->id (_tao_environment))))" + << be_idt_nl << "return CORBA::B_TRUE;" << be_uidt_nl + << "else" << be_idt_nl + << "return CORBA::B_FALSE;" << be_uidt << be_uidt << be_uidt_nl + << "}\n\n"; + + os->indent (); + *os << "void* " << node->full_skel_name () + << "::_downcast (" << be_idt << be_idt_nl + << "const char* logical_type_id" << be_uidt_nl + << ")" << be_uidt_nl + << "{" << be_idt_nl; + + if (node->traverse_inheritance_graph (be_interface::downcast_helper, os) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_ss::" + "visit_interface - " + "traversal of inhertance graph failed\n"), + -1); + } + + *os << "if (ACE_OS::strcmp (logical_type_id, " + << "\"IDL:omg.org/CORBA/Object:1.0\") == 0)" << be_idt_nl + << "return ACE_static_cast(PortableServer::Servant, this);" + << be_uidt_nl; + + *os << "return 0;" << be_uidt_nl + << "}\n\n"; + + + // now the dispatch method + os->indent (); + *os << "void " << node->full_skel_name () << + "::_dispatch (CORBA::ServerRequest &req, " << + "void *context, CORBA::Environment &env)" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "TAO_Skeleton skel; // pointer to skeleton for operation" << be_nl; + *os << "CORBA::String opname = req.op_name (); // retrieve operation name" + << be_nl; + *os << "// find the skeleton corresponding to this opname" << be_nl; + *os << "if (this->_find (opname, skel) == -1)" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "env.exception (new CORBA_BAD_OPERATION (CORBA::COMPLETED_NO));" + << be_nl; + *os << "ACE_ERROR ((LM_ERROR, \"Bad operation <%s>\\n\", opname));\n"; + os->decr_indent (); + *os << "}\n"; + *os << "else" << be_nl; + *os << "\tskel (req, this, context, env);\n"; + os->decr_indent (); + *os << "}\n\n"; + + os->indent (); + *os << "const char* " << node->full_skel_name () + << "::_interface_repository_id (void) const" + << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "return \"" << node->repoID () << "\";\n"; + os->decr_indent (); + *os << "}\n\n"; + + // generate the collocated class impl + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SS); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_ss::" + "visit_interface - " + "Bad visitor for collocated class\n"), + -1); + } + + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_ss::" + "visit_interface - " + "codegen for collocated class failed\n"), + -1); + } + delete visitor; + + *os << "\n"; + + // the _this () operation + *os << node->name () << "*" << be_nl + << node->full_skel_name () + << "::_this (CORBA_Environment &_env)" << be_nl + << "{" << be_idt_nl + << "STUB_Object *stub = this->_create_stub (_env);" << be_nl + << "if (_env.exception () != 0)" << be_idt_nl + << "return 0;" << be_uidt_nl + << "return new " << node->full_coll_name () + << " (this, stub);" << be_uidt << be_nl; + + *os << "}\n\n"; + + return 0; +} + +// ************************************************************ +// collocated class in header +// ************************************************************ + +be_visitor_interface_collocated_sh::be_visitor_interface_collocated_sh +(be_visitor_context *ctx) + : be_visitor_interface (ctx) +{ +} + +be_visitor_interface_collocated_sh::~be_visitor_interface_collocated_sh (void) +{ +} + +int be_visitor_interface_collocated_sh::visit_interface (be_interface *node) +{ + TAO_OutStream *os = this->ctx_->stream (); os->gen_ifdef_macro (node->flatname (), "_collocated"); + // output the class defn os->indent (); *os << "class " << idl_global->export_macro () << " " << node->local_coll_name (); os->incr_indent (); *os << ": public virtual " << node->name (); + // generate base classes if any if (node->n_inherits () > 0) { for (int i = 0; i < node->n_inherits (); ++i) - { - *os << "," << nl; - be_interface* parent = - be_interface::narrow_from_decl (node->inherits()[i]); - *os << " public virtual " - << parent->relative_coll_name (node->full_coll_name ()); - } + { + *os << "," << be_nl; + be_interface* parent = + be_interface::narrow_from_decl (node->inherits()[i]); + *os << " public virtual " + << parent->relative_coll_name (node->full_coll_name ()); + } } *os << "\n"; os->decr_indent (); - *os << "{" << nl; + *os << "{" << be_nl; *os << "public:\n"; os->incr_indent (); @@ -51,8 +1446,9 @@ int be_visitor_collocated_sh::visit_interface (be_interface *node) os->incr_indent (0); os->incr_indent (); - AST_Decl *d = ScopeAsDecl (node->defined_in ()); - if (d->node_type () == AST_Decl::NT_root) + + // XXXASG - can we make this a method to return the right name ?? + if (!node->is_nested ()) { // The skeleton name is the outermost, we need to printout the // POA_ prefix that goes with it. @@ -60,7 +1456,7 @@ int be_visitor_collocated_sh::visit_interface (be_interface *node) } *os << node->local_name () << "_ptr " - << " servant," << nl; + << " servant," << be_nl; *os << "STUB_Object *stub\n"; os->decr_indent (); @@ -68,7 +1464,7 @@ int be_visitor_collocated_sh::visit_interface (be_interface *node) os->decr_indent (0); os->indent (); - if (d->node_type () == AST_Decl::NT_root) + if (!node->is_nested ()) { // The skeleton name is the outermost, we need to printout the // POA_ prefix that goes with it. @@ -82,6 +1478,18 @@ int be_visitor_collocated_sh::visit_interface (be_interface *node) << "CORBA::Environment &_tao_environment" << be_uidt_nl << ");\n" << be_uidt; + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_collocated_sh::" + "visit_interface - " + "codegen for scope failed\n"), + -1); + } + +#if 0 + // XXXASG - don't remove until we are sure that the scope visitor is doing + // the task we expect it to do if (node->nmembers () > 0) { UTL_ScopeActiveIterator *si; @@ -106,12 +1514,13 @@ int be_visitor_collocated_sh::visit_interface (be_interface *node) } delete si; } +#endif os->decr_indent (); - *os << nl << "private:\n"; + *os << be_nl << "private:\n"; os->incr_indent (); - if (d->node_type () == AST_Decl::NT_root) + if (!node->is_nested ()) { // The skeleton name is the outermost, we need to printout the // POA_ prefix that goes with it. @@ -126,113 +1535,130 @@ int be_visitor_collocated_sh::visit_interface (be_interface *node) return 0; } -int be_visitor_collocated_sh::visit_operation (be_operation *node) +#if 0 +int be_visitor_interface_collocated_sh::visit_operation (be_operation *node) { - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - cg->push (TAO_CodeGen::TAO_OPERATION_SH); + TAO_OutStream *os = this->ctx_->stream (); - TAO_OutStream *sh = cg->server_header (); - sh->indent (); // start with the current indentation level + os->indent (); // start with the current indentation level // every operation is declared virtual - *sh << "virtual "; + *os << "virtual "; // first generate the return type be_type *bt = be_type::narrow_from_decl (node->return_type ()); - if (bt->write_as_return (sh, bt) == -1) + // XXASG - this changes + if (bt->write_as_return (os, bt) == -1) { return -1; } // generate the operation name - *sh << " " << node->local_name () << " "; + *os << " " << node->local_name () << " "; - be_visitor_args_decl visitor (sh); - if (node->accept (&visitor) == -1) + // XXXASG - TODO + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_OTHERS); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) args decl failed\n"), -1); + "be_visitor_interface_colocated_sh::" + "visit_operation - " + "Bad visitor for arglist\n"), + -1); + } + + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_colocated_sh::" + "visit_operation - " + "codegen for arglist failed\n"), + -1); } - *sh << ";\n"; + *os << ";\n"; return 0; } -int be_visitor_collocated_sh::visit_attribute (be_attribute *node) +int be_visitor_interface_collocated_sh::visit_attribute (be_attribute *node) { - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - TAO_OutStream *sh = cg->server_header (); - sh->indent (); // start with the current indentation level + TAO_OutStream *os = this->ctx_->stream (); + os->indent (); // start with the current indentation level be_type* bt = be_type::narrow_from_decl (node->field_type ()); // the retrieve method is defined virtual - *sh << "virtual "; + *os << "virtual "; - if (bt->write_as_return (sh, bt) == -1) + // XXXASG - change this + if (bt->write_as_return (os, bt) == -1) { return -1; } - *sh << " " << node->local_name () << " (" << be_idt << be_idt_nl + *os << " " << node->local_name () << " (" << be_idt << be_idt_nl << "CORBA::Environment &env" << be_uidt_nl << ");\n" << be_uidt; if (!node->readonly ()) { - sh->indent (); - *sh << "virtual void " << node->local_name () - << " (" << be_idt << be_idt; + os->indent (); + *os << "virtual void " << node->local_name () + << " (" << be_idt << be_idt; - be_visitor_args_decl vdecl (sh); + // XXXASG - TODO + be_visitor_args_decl vdecl (os); vdecl.current_type_name (bt->name ()); vdecl.argument_direction (AST_Argument::dir_IN); if (bt->accept (&vdecl) == -1) - return -1; - + return -1; - *sh << " _tao_value," << be_nl - << "CORBA::Environment &_tao_environment" << be_uidt_nl - << ");\n" << be_uidt; + *os << " _tao_value," << be_nl + << "CORBA::Environment &_tao_environment" << be_uidt_nl + << ");\n" << be_uidt; } return 0; } +#endif - +// ************************************************************ +// be_visitor_interface_collacted_ss +// ************************************************************ -be_visitor_collocated_ss::be_visitor_collocated_ss (void) - : current_interface_ (0) +be_visitor_interface_collocated_ss::be_visitor_interface_collocated_ss +(be_visitor_context *ctx) + : be_visitor_interface (ctx) { } -be_visitor_collocated_ss::~be_visitor_collocated_ss (void) +be_visitor_interface_collocated_ss::~be_visitor_interface_collocated_ss (void) { } -int be_visitor_collocated_ss::visit_interface (be_interface *node) +int be_visitor_interface_collocated_ss::visit_interface (be_interface *node) { - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - TAO_OutStream *ss = cg->server_skeletons (); + TAO_OutStream *os = tao_cg->server_skeletons (); + unsigned long i; - this->current_interface_ = node; + this->ctx_->node (node); - *ss << this->current_interface_->full_coll_name () << "::" - << this->current_interface_->local_coll_name () << " (\n"; + *os << node->full_coll_name () << "::" + << node->local_coll_name () << " (\n"; - ss->incr_indent (0); - ss->incr_indent (); - *ss << node->full_skel_name () << "_ptr " + os->incr_indent (0); + os->incr_indent (); + *os << node->full_skel_name () << "_ptr " << " servant," << be_nl; - *ss << "STUB_Object *stub\n"; - ss->decr_indent (); - *ss << ")\n"; - ss->decr_indent (0); + *os << "STUB_Object *stub\n"; + os->decr_indent (); + *os << ")\n"; + os->decr_indent (0); - ss->incr_indent (); + os->incr_indent (); #if defined (ACE_WIN32) // @@ TODO MSVC++ compiler has some kind of issue (read // *bug*) wrt nested classes in constructors, if the fully @@ -241,58 +1667,59 @@ int be_visitor_collocated_ss::visit_interface (be_interface *node) // the base class! // I wish I never have to know why the symbol table for // MSVC++ can get so confused ;-) (coryan) - *ss << ": " << node->local_name () + *os << ": " << node->local_name () << " (stub, servant, CORBA::B_TRUE)," << be_nl; #else - *ss << ": " << node->name () + *os << ": " << node->name () << " (stub, servant, CORBA::B_TRUE)," << be_nl; #endif /* ACE_WIN32 */ // @@ We should call the constructor for all base classes, since we // are using multiple inheritance. - if (this->current_interface_->n_inherits () > 0) + + if (node->n_inherits () > 0) { - for (int i = 0; i < node->n_inherits (); ++i) - { - be_interface* parent = - be_interface::narrow_from_decl (this->current_interface_->inherits()[i]); + for (i = 0; i < node->n_inherits (); ++i) + { + be_interface* parent = + be_interface::narrow_from_decl (node->inherits()[i]); #if defined (ACE_WIN32) - // @@ TODO MSVC++ compiler has some kind of issue (read - // *bug*) wrt nested classes in constructors, if the fully - // qualified name is used it gets all confused. Quite to my - // dismay the work around is to use a non-qualified name for - // the base class! - // I wish I never have to know why the symbol table for - // MSVC++ can get so confused ;-) (coryan) - *ss << " " << parent->local_coll_name () << " (servant, stub)," - << be_nl; + // @@ TODO MSVC++ compiler has some kind of issue (read + // *bug*) wrt nested classes in constructors, if the fully + // qualified name is used it gets all confused. Quite to my + // dismay the work around is to use a non-qualified name for + // the base class! + // I wish I never have to know why the symbol table for + // MSVC++ can get so confused ;-) (coryan) + *os << " " << parent->local_coll_name () << " (servant, stub)," + << be_nl; #else - *ss << " " << parent->full_coll_name () << " (servant, stub)," - << be_nl; + *os << " " << parent->full_coll_name () << " (servant, stub)," + << be_nl; #endif /* ACE_WIN32 */ } } - *ss << " CORBA_Object (stub, servant, CORBA::B_TRUE)," << be_nl + *os << " CORBA_Object (stub, servant, CORBA::B_TRUE)," << be_nl << " servant_ (servant)"; - *ss << "\n"; - ss->decr_indent (); - *ss << "{\n"; - *ss << "}\n\n"; + *os << "\n"; + os->decr_indent (); + *os << "{\n"; + *os << "}\n\n"; - ss->indent (); - *ss << this->current_interface_->full_skel_name () << "_ptr " - << this->current_interface_->full_coll_name () << "::" + os->indent (); + *os << node->full_skel_name () << "_ptr " + << node->full_coll_name () << "::" << "_get_servant (void) const\n" << "{\n"; - ss->incr_indent (); - *ss << "return this->servant_;\n"; - ss->decr_indent (); - *ss << "}\n\n"; + os->incr_indent (); + *os << "return this->servant_;\n"; + os->decr_indent (); + *os << "}\n\n"; - ss->indent (); - *ss << "CORBA::Boolean " << this->current_interface_->full_coll_name () + os->indent (); + *os << "CORBA::Boolean " << node->full_coll_name () << "::_is_a (" << be_idt << be_idt_nl << "const char* logical_type_id," << be_nl << "CORBA::Environment &_tao_environment" << be_uidt_nl @@ -304,6 +1731,17 @@ int be_visitor_collocated_ss::visit_interface (be_interface *node) << ");" << be_uidt << be_uidt_nl << "}\n\n"; + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_collocated_ss::" + "visit_scope - " + "codegen for scope failed\n"), + -1); + } + +#if 0 + // XXXASG - DO NOT DELETE until the visit_scope has been tested if (node->nmembers () > 0) { UTL_ScopeActiveIterator *si; @@ -330,78 +1768,85 @@ int be_visitor_collocated_ss::visit_interface (be_interface *node) } delete si; } +#endif return 0; } -int be_visitor_collocated_ss::visit_operation (be_operation *node) +#if 0 +int be_visitor_interface_collocated_ss::visit_operation (be_operation *node) { - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - TAO_OutStream *ss = cg->server_skeletons (); + TAO_OutStream *os = tao_cg->server_skeletons (); + be_interface *intf = this->ctx_->be_scope_as_interface (); // retrieve the return type again because we have used bt to also retrieve // the argument types be_type *bt = be_type::narrow_from_decl (node->return_type ()); - if (bt->write_as_return (ss, bt) == -1) + if (bt->write_as_return (os, bt) == -1) { return -1; } - *ss << " " << current_interface_->full_coll_name () << "::" + *os << " " << intf->full_coll_name () << "::" << node->local_name () << " "; - be_visitor_args_decl visitor (ss); + be_visitor_args_decl visitor (os); if (node->accept (&visitor) == -1) { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) args decl failed\n"), -1); } - - *ss << "\n"; - ss->indent (); - *ss << "{\n"; - ss->incr_indent (); + *os << "\n"; + os->indent (); + *os << "{\n"; + os->incr_indent (); if (bt->node_type () != AST_Decl::NT_pre_defined || be_predefined_type::narrow_from_decl (bt)->pt () != AST_PredefinedType::PT_void) { - *ss << "return "; + *os << "return "; } - *ss << "this->servant_->" << node->local_name () << " (\n"; - ss->incr_indent (0); - ss->incr_indent (0); + *os << "this->servant_->" << node->local_name () << " (\n"; + os->incr_indent (0); + os->incr_indent (0); - this->visit_scope (node); + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_collocated_ss::" + "visit_operation - " + "codegen for scope failed\n"), + -1); + } - ss->indent (); - *ss << " _tao_environment\n"; - ss->decr_indent (); - *ss << ");\n"; - ss->decr_indent (0); - ss->decr_indent (0); - *ss << "}\n\n"; + os->indent (); + *os << " _tao_environment\n"; + os->decr_indent (); + *os << ");\n"; + os->decr_indent (0); + os->decr_indent (0); + *os << "}\n\n"; return 0; } -int be_visitor_collocated_ss::visit_attribute (be_attribute *node) +int be_visitor_interface_collocated_ss::visit_attribute (be_attribute *node) { - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - TAO_OutStream *ss = cg->server_skeletons (); - ss->indent (); // start with the current indentation level + TAO_OutStream *os = this->ctx_->stream (); + be_interface *intf = this->ctx_->be_scope_as_interface (); + + os->indent (); // start with the current indentation level be_type* bt = be_type::narrow_from_decl (node->field_type ()); - if (bt->write_as_return (ss, bt) == -1) + if (bt->write_as_return (os, bt) == -1) { return -1; } - *ss << be_nl << this->current_interface_->full_coll_name () + *os << be_nl << intf->full_coll_name () << "::" << node->local_name () << " (" << be_idt << be_idt_nl << "CORBA::Environment &_tao_environment" << be_uidt_nl << ")" << be_uidt_nl @@ -412,39 +1857,38 @@ int be_visitor_collocated_ss::visit_attribute (be_attribute *node) if (!node->readonly ()) { - *ss << be_nl - << "void " - << this->current_interface_->full_coll_name () - << "::" << node->local_name () - << " (" << be_idt << be_idt_nl; - - be_visitor_args_decl vdecl (ss); + *os << be_nl + << "void " + << intf->full_coll_name () + << "::" << node->local_name () + << " (" << be_idt << be_idt_nl; + // XXXASG - TODO + be_visitor_args_decl vdecl (os); vdecl.current_type_name (bt->name ()); vdecl.argument_direction (AST_Argument::dir_IN); if (bt->accept (&vdecl) == -1) - return -1; - - *ss << "_tao_value," << be_nl - << "CORBA::Environment &_tao_environment" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl - << "this->servant_->" << node->local_name () - << " (" << be_idt << be_idt_nl - << "_tao_value," << be_nl - << "_tao_environment" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl - << "}\n\n"; + return -1; + + *os << " _tao_value," << be_nl + << "CORBA::Environment &_tao_environment" << be_uidt_nl + << ")" << be_uidt_nl + << "{" << be_idt_nl + << "this->servant_->" << node->local_name () + << " (" << be_idt << be_idt_nl + << "_tao_value," << be_nl + << "_tao_environment" << be_uidt_nl + << ");" << be_uidt << be_uidt_nl + << "}\n\n"; } return 0; } -int be_visitor_collocated_ss::visit_argument (be_argument *node) +int be_visitor_interface_collocated_ss::visit_argument (be_argument *node) { - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - TAO_OutStream *ss = cg->server_skeletons (); + TAO_OutStream *os = this->ctx_->stream (); - ss->indent (); - *ss << node->local_name () << ",\n"; + os->indent (); + *os << node->local_name () << ",\n"; return 0; } +#endif diff --git a/TAO/TAO_IDL/be/be_visitor_interface_fwd.cpp b/TAO/TAO_IDL/be/be_visitor_interface_fwd.cpp new file mode 100644 index 00000000000..03fa5598afc --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_interface_fwd.cpp @@ -0,0 +1,146 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_interface_fwd.cpp +// +// = DESCRIPTION +// Visitors for generation of code for Interface_Fwd +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_interface_fwd.h" + +// ******************************************************************** +// Visitor implementation for the Interface_Fwd type +// This one for the client header file +// ******************************************************************** + +be_visitor_interface_fwd_ch::be_visitor_interface_fwd_ch (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_interface_fwd_ch::~be_visitor_interface_fwd_ch (void) +{ +} + +// visit the Interface_Fwd_Ch node and its scope +int +be_visitor_interface_fwd_ch::visit_interface_fwd (be_interface_fwd *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + + if (!node->cli_hdr_gen ()) + { + os->indent (); // start from the current + + // all we do in this is generate a forward declaration of the class + *os << "class " << node->local_name () << ";" << be_nl; + + // generate the ifdefined macro for the _ptr type + os->gen_ifdef_macro (node->flatname (), "_ptr"); + + // generate the _ptr declaration + *os << "typedef " << node->local_name () << " *" << node->local_name () + << "_ptr;\n"; + + os->gen_endif (); + + // enclose under an ifdef macro + os->gen_ifdef_macro (node->flatname (), "_var"); + + // generate the _var declaration + if (node->gen_var_defn () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface_fwd_ch::" + "visit_interface_fwd - " + "codegen for _var failed\n"), -1); + } + // gen an endif + os->gen_endif (); + + // enclose under an ifdef macro + os->gen_ifdef_macro (node->flatname (), "_out"); + + // generate the _out declaration - ORBOS/97-05-15 pg 16-20 spec + if (node->gen_out_defn () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface_fwd_ch::" + "visit_interface_fwd - " + "codegen for _out failed\n"), -1); + } + // generate the endif macro + os->gen_endif (); + node->cli_hdr_gen (I_TRUE); + } + return 0; +} + +// ******************************************************************** +// Visitor implementation for the Interface_Fwd type +// This one for the client inline file +// ******************************************************************** + +be_visitor_interface_fwd_ci::be_visitor_interface_fwd_ci (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_interface_fwd_ci::~be_visitor_interface_fwd_ci (void) +{ +} + +// visit the Interface_Fwd_ci node and its scope +int +be_visitor_interface_fwd_ci::visit_interface_fwd (be_interface_fwd *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + + if (!node->cli_inline_gen ()) + { + + // generate the ifdefined macro for the _var type + os->gen_ifdef_macro (node->flatname (), "_var"); + + if (node->gen_var_impl () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface_fwd_ci::" + "visit_interface_fwd - " + "codegen for _var failed\n"), -1); + } + + os->gen_endif (); + + // generate the ifdefined macro for the _out type + os->gen_ifdef_macro (node->flatname (), "_out"); + + if (node->gen_out_impl () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface_fwd_ci::" + "visit_interface_fwd - " + "codegen for _out failed\n"), -1); + } + os->gen_endif (); + + node->cli_stub_gen (I_TRUE); + } + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_module.cpp b/TAO/TAO_IDL/be/be_visitor_module.cpp new file mode 100644 index 00000000000..09911f2e72c --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_module.cpp @@ -0,0 +1,649 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_module.cpp +// +// = DESCRIPTION +// Visitors for generation of code for Module +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_module.h" + +// ****************************************************** +// Generic Module visitor +// ****************************************************** + +be_visitor_module::be_visitor_module (be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_module::~be_visitor_module (void) +{ +} + +// visit the Module node and its scope +int be_visitor_module::visit_module (be_module *node) +{ + // all we have to do is to visit the scope + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::visit_module - " + "codegen for scope failed\n"), -1); + } + return 0; +} + +// =all common visit methods for module visitor + +// visit a constant +int +be_visitor_module::visit_constant (be_constant *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_MODULE_CH: + ctx.state (TAO_CodeGen::TAO_CONSTANT_CH); + break; + case TAO_CodeGen::TAO_MODULE_CS: + ctx.state (TAO_CodeGen::TAO_CONSTANT_CS); + break; + case TAO_CodeGen::TAO_MODULE_CI: + case TAO_CodeGen::TAO_MODULE_SH: + case TAO_CodeGen::TAO_MODULE_SI: + case TAO_CodeGen::TAO_MODULE_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_constant - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_constant - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_constant - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +//visit an enum +int +be_visitor_module::visit_enum (be_enum *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_MODULE_CH: + ctx.state (TAO_CodeGen::TAO_ENUM_CH); + break; + case TAO_CodeGen::TAO_MODULE_CS: + ctx.state (TAO_CodeGen::TAO_ENUM_CS); + break; + case TAO_CodeGen::TAO_MODULE_CI: + case TAO_CodeGen::TAO_MODULE_SH: + case TAO_CodeGen::TAO_MODULE_SI: + case TAO_CodeGen::TAO_MODULE_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_enum - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_enum - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_enum - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// visit an exception +int +be_visitor_module::visit_exception (be_exception *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_MODULE_CH: + ctx.state (TAO_CodeGen::TAO_EXCEPTION_CH); + break; + case TAO_CodeGen::TAO_MODULE_CI: + ctx.state (TAO_CodeGen::TAO_EXCEPTION_CI); + break; + case TAO_CodeGen::TAO_MODULE_CS: + ctx.state (TAO_CodeGen::TAO_EXCEPTION_CS); + break; + case TAO_CodeGen::TAO_MODULE_SH: + case TAO_CodeGen::TAO_MODULE_SI: + case TAO_CodeGen::TAO_MODULE_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_exception - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_exception - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_exception - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// visit an interface +int +be_visitor_module::visit_interface (be_interface *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_MODULE_CH: + ctx.state (TAO_CodeGen::TAO_INTERFACE_CH); + break; + case TAO_CodeGen::TAO_MODULE_CI: + ctx.state (TAO_CodeGen::TAO_INTERFACE_CI); + break; + case TAO_CodeGen::TAO_MODULE_CS: + ctx.state (TAO_CodeGen::TAO_INTERFACE_CS); + break; + case TAO_CodeGen::TAO_MODULE_SH: + ctx.state (TAO_CodeGen::TAO_INTERFACE_SH); + break; + case TAO_CodeGen::TAO_MODULE_SI: + ctx.state (TAO_CodeGen::TAO_INTERFACE_SI); + break; + case TAO_CodeGen::TAO_MODULE_SS: + ctx.state (TAO_CodeGen::TAO_INTERFACE_SS); + break; + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_interface - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_interface - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_interface - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// visit an interface_fwd +int +be_visitor_module::visit_interface_fwd (be_interface_fwd *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_MODULE_CH: + ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CH); + break; + case TAO_CodeGen::TAO_MODULE_CI: + ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CI); + break; + case TAO_CodeGen::TAO_MODULE_CS: + case TAO_CodeGen::TAO_MODULE_SH: + case TAO_CodeGen::TAO_MODULE_SI: + case TAO_CodeGen::TAO_MODULE_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_interface_fwd - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_interface_fwd - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_interface_fwd - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// visit an structure +int +be_visitor_module::visit_structure (be_structure *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_MODULE_CH: + ctx.state (TAO_CodeGen::TAO_STRUCT_CH); + break; + case TAO_CodeGen::TAO_MODULE_CI: + ctx.state (TAO_CodeGen::TAO_STRUCT_CI); + break; + case TAO_CodeGen::TAO_MODULE_CS: + ctx.state (TAO_CodeGen::TAO_STRUCT_CS); + break; + case TAO_CodeGen::TAO_MODULE_SH: + case TAO_CodeGen::TAO_MODULE_SI: + case TAO_CodeGen::TAO_MODULE_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_structure - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_structure - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_structure - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// visit an union +int +be_visitor_module::visit_union (be_union *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_MODULE_CH: + ctx.state (TAO_CodeGen::TAO_UNION_CH); + break; + case TAO_CodeGen::TAO_MODULE_CI: + ctx.state (TAO_CodeGen::TAO_UNION_CI); + break; + case TAO_CodeGen::TAO_MODULE_CS: + ctx.state (TAO_CodeGen::TAO_UNION_CS); + break; + case TAO_CodeGen::TAO_MODULE_SH: + case TAO_CodeGen::TAO_MODULE_SI: + case TAO_CodeGen::TAO_MODULE_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_union - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_union - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_union - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// visit a typedef +int +be_visitor_module::visit_typedef (be_typedef *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_MODULE_CH: + ctx.state (TAO_CodeGen::TAO_TYPEDEF_CH); + break; + case TAO_CodeGen::TAO_MODULE_CI: + ctx.state (TAO_CodeGen::TAO_TYPEDEF_CI); + break; + case TAO_CodeGen::TAO_MODULE_CS: + ctx.state (TAO_CodeGen::TAO_TYPEDEF_CS); + break; + case TAO_CodeGen::TAO_MODULE_SH: + case TAO_CodeGen::TAO_MODULE_SI: + case TAO_CodeGen::TAO_MODULE_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_typedef - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_typedef - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_typedef - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// ****************************************************** +// Module visitor for client header +// ****************************************************** + +be_visitor_module_ch::be_visitor_module_ch (be_visitor_context *ctx) + : be_visitor_module (ctx) +{ +} + +be_visitor_module_ch::~be_visitor_module_ch (void) +{ +} + +int +be_visitor_module_ch::visit_module (be_module *node) +{ + TAO_OutStream *os; // output stream + + os = this->ctx_->stream (); + + // XXXASG - Modules really map to namespace. We need to see if our target + // compiler supports namespaces or not. This visitor generates a class for a + // module. We can have the factory generate another module visitor that can + // generate namespaces + + os->indent (); // start from whatever indentation level we were at + // now generate the class definition + *os << "class " << node->local_name () << be_nl + << "{" << be_nl + << "public:\n"; + os->incr_indent (0); + + // generate code for the module definition by traversing thru the + // elements of its scope. We depend on the front-end to have made sure + // that only legal syntactic elements appear in our scope. + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module_ch::" + "visit_module - " + "codegen for scope failed\n"), -1); + } + + *os << be_uidt_nl + << "}; // module " << node->name () << "\n\n"; + + return 0; +} + +// ************************************************************ +// Module visitor for server header +// ************************************************************ + +be_visitor_module_sh::be_visitor_module_sh (be_visitor_context *ctx) + : be_visitor_module (ctx) +{ +} + +be_visitor_module_sh::~be_visitor_module_sh (void) +{ +} + +int +be_visitor_module_sh::visit_module (be_module *node) +{ + TAO_OutStream *os; // output stream + + os = this->ctx_->stream (); + + // generate the skeleton class name + + os->indent (); // start with whatever indentation level we are at + + // now generate the class definition. The prefix POA_ is prepended to our + // name only if we are the outermost module + if (!node->is_nested ()) + // we are outermost module + *os << "class POA_" << node->local_name () << be_nl; + else + // we are inside another module + *os << "class " << node->local_name () << be_nl; + + *os << "{" << be_nl + << "public:" + << be_idt; + + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module_sh::" + "visit_module - " + "codegen for scope failed\n"), -1); + } + + os->decr_indent (); + *os << "};\n\n"; + return 0; + +} diff --git a/TAO/TAO_IDL/be/be_visitor_operation.cpp b/TAO/TAO_IDL/be/be_visitor_operation.cpp new file mode 100644 index 00000000000..62397f6b561 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation.cpp @@ -0,0 +1,3035 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_operation.cpp +// +// = DESCRIPTION +// Visitors for generation of code for Operation +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_operation.h" + +// ****************************************************** +// primary visitor for "operation" in client header +// ****************************************************** + +be_visitor_operation_ch::be_visitor_operation_ch (be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_operation_ch::~be_visitor_operation_ch (void) +{ +} + +int +be_visitor_operation_ch::visit_operation (be_operation *node) +{ + TAO_OutStream *os; // output stream + be_type *bt; // type node + + os = this->ctx_->stream (); + this->ctx_->node (node); // save the node + + os->indent (); // start with the current indentation level + + // every operation is declared virtual in the client code + *os << "virtual "; + + // STEP I: generate the return type + bt = be_type::narrow_from_decl (node->return_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_ch::" + "visit_operation - " + "Bad return type\n"), + -1); + } + + // grab the right visitor to generate the return type + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_CH); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_ch::" + "visit_operation - " + "Bad visitor to return type\n"), + -1); + } + + if (bt->accept (visitor) == -1) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_ch::" + "visit_operation - " + "codegen for return type failed\n"), + -1); + } + delete visitor; + + // STEP 2: generate the operation name + *os << " " << node->local_name (); + + // STEP 3: generate the argument list with the appropriate mapping. For these + // we grab a visitor that generates the parameter listing + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_CH); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_ch::" + "visit_operation - " + "Bad visitor to return type\n"), + -1); + } + + if (node->accept (visitor) == -1) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_ch::" + "visit_operation - " + "codegen for argument list failed\n"), + -1); + } + delete visitor; + + return 0; +} + +// ************************************************************ +// Operation visitor for client stubs +// ************************************************************ + +be_visitor_operation_cs::be_visitor_operation_cs (be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_operation_cs::~be_visitor_operation_cs (void) +{ +} + +// processing to be done after every element in the scope is processed +int +be_visitor_operation_cs::post_process () +{ + // all we do here is to insert a comma and a newline + TAO_OutStream *os = this->ctx_->stream (); + *os << ",\n"; + return 0; +} + +int +be_visitor_operation_cs::visit_operation (be_operation *node) +{ + TAO_OutStream *os; // output stream + be_type *bt; // type node + + os = this->ctx_->stream (); + this->ctx_->node (node); // save the node for future use + + os->indent (); // start with the current indentation level + + // retrieve the operation return type + bt = be_type::narrow_from_decl (node->return_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_cs::" + "visit_operation - " + "Bad return type\n"), + -1); + } + + // STEP 1: + // generate the param_data and call_data tables. We generate these if and + // only if none of our arguments is of "native" type. Native types cannot be + // marshaled. Hence, stubs for such operations will generate MARSHAL + // exceptions. As a result it is pointless generating these tables + if (!node->has_native ()) + { + // native type does not exist. Generate the static tables + + // STEP 1A: generate the TAO_Param_Data table + *os << "static const TAO_Param_Data "; + // check if we are an attribute node in disguise + if (this->ctx_->attribute ()) + { + // now check if we are a "get" or "set" operation + if (node->nmembers () == 1) // set + *os << "_set_"; + else + *os << "_get_"; + } + *os << node->flatname () << + "_paramdata [] = " << be_nl; + *os << "{\n"; + os->incr_indent (); + + // entry for the return type + *os << "{" << bt->tc_name () << ", PARAM_RETURN, 0}"; + if (node->nmembers () > 0) + *os << ",\n"; + + // generate entries for the param data table for arguments + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_cs::" + "visit_operation - " + "visit scope failed\n"), + -1); + } + *os << "\n"; + os->decr_indent (); + *os << "}; // " << node->flatname () << "_paramdata\n\n"; + + // STEP 1B: now generate the calldata table + os->indent (); + *os << "static const TAO_Call_Data "; + // check if we are an attribute node in disguise + if (this->ctx_->attribute ()) + { + // now check if we are a "get" or "set" operation + if (node->nmembers () == 1) // set + *os << "_set_"; + else + *os << "_get_"; + } + *os << node->flatname () + << "_calldata = " << be_nl + << "{" + << "\"" << node->local_name () << "\", "; + + // are we oneway or two operation? + if (node->flags () == AST_Operation::OP_oneway) + { + *os << "0, "; // for false + } + else + { + *os << "1, "; // for true + } + // insert the size of the paramdata table i.e., number of arguments + 1 + // for return type + *os << (node->argument_count () + 1) << ", "; + + // insert the address of the paramdata table + // first check if we are an attribute node in disguise + if (this->ctx_->attribute ()) + { + // now check if we are a "get" or "set" operation + if (node->nmembers () == 1) // set + *os << "_set_"; + else + *os << "_get_"; + } + *os << node->flatname () << "_paramdata, "; + + // XXXASG - Exception list goes here (if it exists) - TODO + *os << "0, 0};\n\n"; + } // end of if !(native) + + // STEP 2: generate the return type mapping (same as in the header file) + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_OTHERS); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_cs::" + "visit_operation - " + "Bad visitor for return type\n"), + -1); + } + + if (bt->accept (visitor) == -1) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_cs::" + "visit_operation - " + "codegen for return type failed\n"), + -1); + } + delete visitor; + + // STEP 3: generate the operation name + *os << " " << node->name (); + + // STEP 4: generate the argument list with the appropriate mapping (same as + // in the header file) + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_OTHERS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_cs::" + "visit_operation - " + "Bad visitor to return type\n"), + -1); + } + + if (node->accept (visitor) == -1) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_cs::" + "visit_operation - " + "codegen for argument list failed\n"), + -1); + } + delete visitor; + + // STEP 5: + // generate the actual code for the stub. However, if any of the argument + // types is "native", we flag a MARSHAL exception. + // last argument - is always CORBA::Environment + *os << "{\n"; + os->incr_indent (0); + + // STEP 5A: declare a return type + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_DECL_CS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (bt->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_cs::" + "visit_operation - " + "codegen for return var decl failed\n"), + -1); + } + + os->indent (); + if (node->has_native ()) // native exists => no stub + { + *os << "_tao_environment.exception (new CORBA::MARSHAL " + << "(CORBA::COMPLETED_NO));" << be_nl; + *os << "return _tao_retval;\n"; + } + else + { + // STEP 5B: + // generate code that retrieves the underlying stub object and then + // invokes do_call on it. + *os << "STUB_Object *istub = this->stubobj (_tao_environment);" << be_nl + << "if (istub)" << be_nl + << "{\n"; + os->incr_indent (0); + + // STEP 5C: + // do any pre do_call processing with return type. This includes + // allocating memory, initialization. + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_PRE_DOCALL_CS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (bt->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_cs::" + "visit_operation - " + "codegen for retval pre do_call failed\n"), + -1); + } + + + // STEP 5D: + // do any pre do_call stuff with arguments + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_PRE_DOCALL_CS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_cs::" + "visit_operation - " + "codegen for argument pre do_call failed\n"), + -1); + } + + // STEP 5E: + // call do_call with appropriate number of arguments + os->indent (); + *os << "istub->do_call (" << be_idt_nl + << "_tao_environment, " << be_nl + << "&"; + // check if we are an attribute node in disguise + if (this->ctx_->attribute ()) + { + // now check if we are a "get" or "set" operation + if (node->nmembers () == 1) // set + *os << "_set_"; + else + *os << "_get_"; + } + *os << node->flatname () << "_calldata,\n"; + + // pass the appropriate return value to docall + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_DOCALL_CS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (bt->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_cs::" + "visit_operation - " + "codegen for return var in do_call failed\n"), + -1); + } + // insert a comma after the return val if there are arguments + if (node->argument_count () > 0) + { + *os << ",\n"; + } + + // pass each argument to do_call + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_DOCALL_CS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_cs::" + "visit_operation - " + "codegen for return var in do_call failed\n"), + -1); + } + + // end the do_call + *os << be_uidt_nl; + *os << ");\n"; + + // STEP 5F: + // do any post processing for the retval + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_POST_DOCALL_CS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (bt->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_cs::" + "visit_operation - " + "codegen for return type post do_call failed\n"), + -1); + } + + // STEP 5G: do any post processing for the arguments + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_POST_DOCALL_CS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_cs::" + "visit_operation - " + "codegen for args in post do_call failed\n"), + -1); + } + + } // end of if (!native) + + os->decr_indent (); + *os << "} // end of if (istub)\n"; + // STEP 5H: return the appropriate return value + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_RETURN_CS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (bt->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_cs::" + "visit_operation - " + "codegen for return var failed\n"), + -1); + } + os->decr_indent (); + *os << "}\n\n"; + return 0; +} + +int +be_visitor_operation_cs::visit_argument (be_argument *node) +{ + // this method is used to generate the ParamData table entry + + TAO_OutStream *os = this->ctx_->stream (); + be_type *bt; // argument type + + // retrieve the type for this argument + bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_cs::" + "visit_argument - " + "Bad argument type\n"), + -1); + } + + os->indent (); + *os << "{" << bt->tc_name () << ", "; + switch (node->direction ()) + { + case AST_Argument::dir_IN: + *os << "PARAM_IN, "; + break; + case AST_Argument::dir_INOUT: + *os << "PARAM_INOUT, "; + break; + case AST_Argument::dir_OUT: + *os << "PARAM_OUT, "; + break; + } + *os << "0}"; + + return 0; +} + +// ************************************************************ +// Operation visitor for server header +// ************************************************************ + +be_visitor_operation_sh::be_visitor_operation_sh (be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_operation_sh::~be_visitor_operation_sh (void) +{ +} + +int +be_visitor_operation_sh::visit_operation (be_operation *node) +{ + TAO_OutStream *os; // output stream + be_type *bt; // type node representing the return type + + os = this->ctx_->stream (); + this->ctx_->node (node); // save the node + + os->indent (); // start with the current indentation level + + // every operation is declared virtual in the client code + *os << "virtual "; + + // STEP I: generate the return type + bt = be_type::narrow_from_decl (node->return_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_sh::" + "visit_operation - " + "Bad return type\n"), + -1); + } + + // grab the right visitor to generate the return type + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_OTHERS); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_sh::" + "visit_operation - " + "Bad visitor to return type\n"), + -1); + } + + if (bt->accept (visitor) == -1) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_sh::" + "visit_operation - " + "codegen for return type failed\n"), + -1); + } + delete visitor; + + // STEP 2: generate the operation name + *os << " " << node->local_name (); + + // STEP 3: generate the argument list with the appropriate mapping. For these + // we grab a visitor that generates the parameter listing + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_SH); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_sh::" + "visit_operation - " + "Bad visitor to return type\n"), + -1); + } + + if (node->accept (visitor) == -1) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_sh::" + "visit_operation - " + "codegen for argument list failed\n"), + -1); + } + delete visitor; + + // generate the corresponding static skeleton method for this operation only + // if there was no "native" type + if (!node->has_native ()) + { + os->indent (); + *os << "static void "; + // check if we are an attribute node in disguise + if (this->ctx_->attribute ()) + { + // now check if we are a "get" or "set" operation + if (node->nmembers () == 1) // set + *os << "_set_"; + else + *os << "_get_"; + } + *os << node->local_name () << + "_skel (" << be_idt << be_idt_nl + << "CORBA::ServerRequest &_tao_req, " << be_nl + << "void *_tao_obj, " << be_nl + << "void *_tao_context, " << be_nl + << "CORBA::Environment &_tao_env" + << be_uidt_nl << be_uidt << ");\n\n"; + } + + return 0; +} + +// ************************************************************ +// Operation visitor for server skeletons +// ************************************************************ + +be_visitor_operation_ss::be_visitor_operation_ss (be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_operation_ss::~be_visitor_operation_ss (void) +{ +} + +// processing to be done after every element in the scope is processed +int +be_visitor_operation_ss::post_process () +{ + // all we do here is to insert a comma and a newline + TAO_OutStream *os = this->ctx_->stream (); + *os << ",\n"; + return 0; +} + +int +be_visitor_operation_ss::visit_operation (be_operation *node) +{ + TAO_OutStream *os; // output stream + be_type *bt; // type node for return type + + os = this->ctx_->stream (); // grab the o/p stream + this->ctx_->node (node); // save the node for future use + + os->indent (); // start with the current indentation level + + // if there is an argument of type "native", return immediately + if (node->has_native ()) + return 0; + + // retrieve the operation return type + bt = be_type::narrow_from_decl (node->return_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_ss::" + "visit_operation - " + "Bad return type\n"), + -1); + } + + // STEP 1: + // generate the param_data and call_data tables. We generate these if and + // only if none of our arguments is of "native" type. Native types cannot be + // marshaled. + // native type does not exist. Generate the static tables + + // STEP 1A: generate the TAO_Param_Data_Skel table + *os << "static const TAO_Param_Data_Skel "; + // check if we are an attribute node in disguise + if (this->ctx_->attribute ()) + { + // now check if we are a "get" or "set" operation + if (node->nmembers () == 1) // set + *os << "_set_"; + else + *os << "_get_"; + } + *os << node->flatname () << + "_paramdata [] = " << be_nl; + *os << "{\n"; + os->incr_indent (); + + // entry for the return type + *os << "{" << bt->tc_name () << ", 0, 0}"; + if (node->nmembers () > 0) + *os << ",\n"; + + // generate entries for the param data table for arguments + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_cs::" + "visit_operation - " + "visit scope failed\n"), + -1); + } + *os << "\n"; + os->decr_indent (); + *os << "}; // " << node->flatname () << "_paramdata\n\n"; + + // STEP 1B: now generate the calldata table + os->indent (); + *os << "static const TAO_Call_Data_Skel "; + // check if we are an attribute node in disguise + if (this->ctx_->attribute ()) + { + // now check if we are a "get" or "set" operation + if (node->nmembers () == 1) // set + *os << "_set_"; + else + *os << "_get_"; + } + *os << node->flatname () + << "_calldata = " << be_nl + << "{" + << "\"" << node->local_name () << "\", "; + + // are we oneway or two operation? + if (node->flags () == AST_Operation::OP_oneway) + { + *os << "0, "; // for false + } + else + { + *os << "1, "; // for true + } + // insert the size of the paramdata table i.e., number of arguments + 1 + // for return type + *os << (node->argument_count () + 1) << ", "; + + // insert the address of the paramdata table + // check if we are an attribute node in disguise + if (this->ctx_->attribute ()) + { + // now check if we are a "get" or "set" operation + if (node->nmembers () == 1) // set + *os << "_set_"; + else + *os << "_get_"; + } + *os << node->flatname () << "_paramdata};\n\n"; + + // We need the interface node in which this operation was defined. However, + // if this operation node was an attribute node in disguise, we get this + // information from the context + be_interface *intf; + intf = this->ctx_->attribute () + ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ()) + : be_interface::narrow_from_scope (node->defined_in ()); + + if (!intf) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_ss::" + "visit_operation - " + "bad interface scope\n"), + -1); + } + + // STEP 2: generate the signature of the static skeleton + os->indent (); + *os << "void " << intf->full_skel_name () << "::"; + // check if we are an attribute node in disguise + if (this->ctx_->attribute ()) + { + // now check if we are a "get" or "set" operation + if (node->nmembers () == 1) // set + *os << "_set_"; + else + *os << "_get_"; + } + *os << node->local_name () + << "_skel (" << be_idt << be_idt_nl + << "CORBA::ServerRequest &_tao_server_request, " << be_nl + << "void *_tao_object_reference, " << be_nl + << "void * /* context */, " << be_nl + << "CORBA::Environment &_tao_environment" << be_uidt << be_uidt_nl + << ")" << be_nl; + + // STEP 3: + // generate the actual code for the skeleton. However, if any of the argument + // types is "native", we do not generate any skeleton + // last argument - is always CORBA::Environment + *os << "{" << be_idt_nl; + + // get the right object implementation. + *os << intf->full_skel_name () << " *_tao_impl = (" + << intf->full_skel_name () << " *)_tao_object_reference;\n"; + + // STEP 3A: declare a return type variable + be_visitor_context ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_DECL_SS); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (bt->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_cs::" + "visit_operation - " + "codegen for return var decl failed\n"), + -1); + } + + // STEP 3B: declare variables for arguments + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_DECL_SS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_cs::" + "visit_operation - " + "codegen for return var decl failed\n"), + -1); + } + + + // STEP 3C: setup parameters for demarshaling and demarshal them + os->indent (); + *os << "_tao_server_request.demarshal (" << be_idt_nl + << "_tao_environment, " << be_nl + << "&"; + // check if we are an attribute node in disguise + if (this->ctx_->attribute ()) + { + // now check if we are a "get" or "set" operation + if (node->nmembers () == 1) // set + *os << "_set_"; + else + *os << "_get_"; + } + *os << node->flatname () << "_calldata,\n"; + + // pass the appropriate return value to the demarshal operation + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_DEMARSHAL_SS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (bt->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_ss::" + "visit_operation - " + "codegen for return var in demarshal failed\n"), + -1); + } + // insert a comma after the return val if there are arguments + if (node->argument_count () > 0) + *os << ",\n"; + + // pass each argument to the demarshal operation + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_DEMARSHAL_SS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_cs::" + "visit_operation - " + "codegen for argument in demarshal failed\n"), + -1); + } + + // end the demarshal call + *os << be_uidt_nl; + *os << ");\n"; + + // STEP 3D: check for exception + os->indent (); + *os << "if (_tao_environment.exception ()) return;\n"; + + // do pre upcall processing if any + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_PRE_UPCALL_SS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_ss::" + "visit_operation - " + "codegen for making upcall failed\n"), + -1); + } + // STEP 3E: make the upcall and assign to the return val + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_ASSIGN_SS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (bt->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_ss::" + "visit_operation - " + "codegen for retval assignment failed\n"), + -1); + } + + // make the upcall + *os << "_tao_impl->" << node->local_name () << " (" << be_idt << "\n"; + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_SS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_ss::" + "visit_operation - " + "codegen for making upcall failed\n"), + -1); + } + // last argument is the environment + if (node->argument_count () > 0) + *os << ",\n"; + os->indent (); + *os << "_tao_environment"; + // end the upcall + *os << be_uidt_nl; + *os << ");" << be_nl; + + // STEP 3C: setup parameters for marshaling and marshal them into the + // outgoing stream + *os << "_tao_server_request.marshal (" << be_idt_nl + << "_tao_environment, " << be_nl + << "&"; + // check if we are an attribute node in disguise + if (this->ctx_->attribute ()) + { + // now check if we are a "get" or "set" operation + if (node->nmembers () == 1) // set + *os << "_set_"; + else + *os << "_get_"; + } + *os << node->flatname () << "_calldata,\n"; + + // pass the appropriate return value to the marshal operation + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_MARSHAL_SS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (bt->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_ss::" + "visit_operation - " + "codegen for return var in marshal failed\n"), + -1); + } + // insert a comma after the return val if there are arguments + if (node->argument_count () > 0) + { + *os << ",\n"; + } + + // pass each argument to the marshal operation + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_MARSHAL_SS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_cs::" + "visit_operation - " + "codegen for argument in marshal failed\n"), + -1); + } + // end the marshal call + *os << be_uidt_nl; + *os << ");\n"; + + // STEP 3E: + // do any post processing for the retval + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_POST_UPCALL_SS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (bt->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_ss::" + "visit_operation - " + "codegen for return type post upcall failed\n"), + -1); + } + + // STEP 3F: do any post processing for the arguments + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_POST_UPCALL_SS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_ss::" + "visit_operation - " + "codegen for args in post upcall failed\n"), + -1); + } + + os->decr_indent (); + *os << "}\n\n"; + return 0; +} + +int +be_visitor_operation_ss::visit_argument (be_argument *node) +{ + // this method is used to generate the ParamData table entry + + TAO_OutStream *os = this->ctx_->stream (); + be_type *bt; // argument type + + // retrieve the type for this argument + bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_cs::" + "visit_argument - " + "Bad argument type\n"), + -1); + } + + os->indent (); + *os << "{" << bt->tc_name () << ", "; + switch (node->direction ()) + { + case AST_Argument::dir_IN: + *os << "CORBA::ARG_IN, "; + break; + case AST_Argument::dir_INOUT: + *os << "CORBA::ARG_INOUT, "; + break; + case AST_Argument::dir_OUT: + *os << "CORBA::ARG_OUT, "; + break; + } + *os << "0}"; + + return 0; +} + +// ************************************************************************* +// be_visitor_operation_collocated_sh -- +// This visitor generates code for the collocated operation signature in a +// server header file +// ************************************************************************* + +be_visitor_operation_collocated_sh::be_visitor_operation_collocated_sh +(be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_operation_collocated_sh::~be_visitor_operation_collocated_sh (void) +{ +} + +int be_visitor_operation_collocated_sh::visit_operation (be_operation *node) +{ + TAO_OutStream *os; // output stream + be_type *bt; // type node representing the return type + + os = this->ctx_->stream (); + this->ctx_->node (node); // save the node + + os->indent (); // start with the current indentation level + + // every operation is declared virtual in the client code + *os << "virtual "; + + // STEP I: generate the return type + bt = be_type::narrow_from_decl (node->return_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_sh::" + "visit_operation - " + "Bad return type\n"), + -1); + } + + // grab the right visitor to generate the return type + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_OTHERS); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_sh::" + "visit_operation - " + "Bad visitor to return type\n"), + -1); + } + + if (bt->accept (visitor) == -1) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_sh::" + "visit_operation - " + "codegen for return type failed\n"), + -1); + } + delete visitor; + + // STEP 2: generate the operation name + *os << " " << node->local_name (); + + // STEP 3: generate the argument list with the appropriate mapping. For these + // we grab a visitor that generates the parameter listing + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_COLLOCATED_SH); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_sh::" + "visit_operation - " + "Bad visitor to return type\n"), + -1); + } + + if (node->accept (visitor) == -1) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_sh::" + "visit_operation - " + "codegen for argument list failed\n"), + -1); + } + delete visitor; + + return 0; +} + +// ************************************************************************* +// be_visitor_operation_collocated_ss -- +// This visitor generates code for the collocated operation signature in a +// server skeletons file +// ************************************************************************* + +be_visitor_operation_collocated_ss::be_visitor_operation_collocated_ss +(be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_operation_collocated_ss::~be_visitor_operation_collocated_ss (void) +{ +} + +int be_visitor_operation_collocated_ss::visit_operation (be_operation *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + + // We need the interface node in which this operation was defined. However, + // if this operation node was an attribute node in disguise, we get this + // information from the context + be_interface *intf; + intf = this->ctx_->attribute () + ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ()) + : be_interface::narrow_from_scope (node->defined_in ()); + + if (!intf) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_collocated_ss::" + "visit_operation - " + "bad interface scope\n"), + -1); + } + + // retrieve the operation return type + be_type *bt = be_type::narrow_from_decl (node->return_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_collocated_ss::" + "visit_operation - " + "Bad return type\n"), + -1); + } + + // STEP 2: generate the return type mapping (same as in the header file) + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_OTHERS); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_collocated_ss::" + "visit_operation - " + "Bad visitor for return type\n"), + -1); + } + + if (bt->accept (visitor) == -1) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_collocated_ss::" + "visit_operation - " + "codegen for return type failed\n"), + -1); + } + delete visitor; + + *os << " " << intf->full_coll_name () << "::" + << node->local_name () << " "; + + // STEP 4: generate the argument list with the appropriate mapping (same as + // in the header file) + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_OTHERS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_cs::" + "visit_operation - " + "Bad visitor to return type\n"), + -1); + } + + if (node->accept (visitor) == -1) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_cs::" + "visit_operation - " + "codegen for argument list failed\n"), + -1); + } + delete visitor; + + *os << "{" << be_idt << "\n"; + + os->indent (); + if (bt->node_type () != AST_Decl::NT_pre_defined + || be_predefined_type::narrow_from_decl (bt)->pt () != AST_PredefinedType::PT_void) + { + *os << "return "; + } + + *os << "this->servant_->" << node->local_name () << " (" << be_idt << "\n"; + + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_SS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_ss::" + "visit_operation - " + "codegen for making upcall failed\n"), + -1); + } + // last argument is the environment + if (node->argument_count () > 0) + *os << ",\n"; + os->indent (); + *os << "_tao_environment"; + // end the upcall + *os << be_uidt_nl; + *os << ");" << be_uidt_nl; + *os << "}\n\n"; + + return 0; +} + +// **************************************************************************** +// Operation visitor for return types. This generates the mapping for a return +// type in an operation signature +// **************************************************************************** + +be_visitor_operation_rettype::be_visitor_operation_rettype (be_visitor_context + *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_operation_rettype::~be_visitor_operation_rettype (void) +{ +} + +int +be_visitor_operation_rettype::visit_array (be_array *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + if (this->ctx_->state () == TAO_CodeGen::TAO_OPERATION_RETTYPE_CH) + *os << bt->nested_type_name (this->ctx_->scope (), "_slice") << " *"; + else + *os << bt->name () << "_slice *"; + return 0; +} + +int +be_visitor_operation_rettype::visit_enum (be_enum *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + if (this->ctx_->state () == TAO_CodeGen::TAO_OPERATION_RETTYPE_CH) + *os << bt->nested_type_name (this->ctx_->scope ()); + else + *os << bt->name (); + return 0; +} + +int +be_visitor_operation_rettype::visit_interface (be_interface *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + if (this->ctx_->state () == TAO_CodeGen::TAO_OPERATION_RETTYPE_CH) + *os << bt->nested_type_name (this->ctx_->scope (), "_ptr"); + else + *os << bt->name () << "_ptr"; + return 0; +} + +int +be_visitor_operation_rettype::visit_interface_fwd (be_interface_fwd *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + if (this->ctx_->state () == TAO_CodeGen::TAO_OPERATION_RETTYPE_CH) + *os << bt->nested_type_name (this->ctx_->scope (), "_ptr"); + else + *os << bt->name () << "_ptr"; + return 0; +} + +int +be_visitor_operation_rettype::visit_native (be_native *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + if (this->ctx_->state () == TAO_CodeGen::TAO_OPERATION_RETTYPE_CH) + *os << bt->nested_type_name (this->ctx_->scope ()) << " *"; + else + *os << bt->name () << " *"; + return 0; +} + +int +be_visitor_operation_rettype::visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + switch (node->pt ()) + { + case AST_PredefinedType::PT_pseudo: + if (this->ctx_->state () == TAO_CodeGen::TAO_OPERATION_RETTYPE_CH) + *os << bt->nested_type_name (this->ctx_->scope (), "_ptr"); + else + *os << bt->name () << "_ptr"; + break; + case AST_PredefinedType::PT_any: + if (this->ctx_->state () == TAO_CodeGen::TAO_OPERATION_RETTYPE_CH) + *os << bt->nested_type_name (this->ctx_->scope ()) << " *"; + else + *os << bt->name () << " *"; + break; + default: + if (this->ctx_->state () == TAO_CodeGen::TAO_OPERATION_RETTYPE_CH) + *os << bt->nested_type_name (this->ctx_->scope ()); + else + *os << bt->name (); + break; + } + return 0; +} + +int +be_visitor_operation_rettype::visit_sequence (be_sequence *node) +{ + // we should never directly be here because anonymous sequence return types + // are not allowed + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + if (this->ctx_->state () == TAO_CodeGen::TAO_OPERATION_RETTYPE_CH) + *os << bt->nested_type_name (this->ctx_->scope ()) << " *"; + else + *os << bt->name () << " *"; + return 0; +} + +int +be_visitor_operation_rettype::visit_string (be_string * /* node*/) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + *os << "char *"; + return 0; +} + +int +be_visitor_operation_rettype::visit_structure (be_structure *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + if (this->ctx_->state () == TAO_CodeGen::TAO_OPERATION_RETTYPE_CH) + *os << bt->nested_type_name (this->ctx_->scope ()); + else + *os << bt->name (); + + // based on whether we are variable or not, we return a pointer or the + // aggregate type + if (node->size_type () == be_decl::VARIABLE) + *os << " *"; + return 0; +} + +int +be_visitor_operation_rettype::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); // set the alias node + return node->primitive_base_type ()->accept (this); +} + +int +be_visitor_operation_rettype::visit_union (be_union *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + if (this->ctx_->state () == TAO_CodeGen::TAO_OPERATION_RETTYPE_CH) + *os << bt->nested_type_name (this->ctx_->scope ()); + else + *os << bt->name (); + + // based on whether we are variable or not, we return a pointer or the + // aggregate type + if (node->size_type () == be_decl::VARIABLE) + *os << " *"; + return 0; +} + +// ************************************************************ +// operation visitor to generate the argument list. +// We have separated code generation for this from the 4 main +// visitors to avoid code duplication and tight coupling +// ************************************************************ + +be_visitor_operation_arglist::be_visitor_operation_arglist (be_visitor_context + *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_operation_arglist::~be_visitor_operation_arglist (void) +{ +} + +int +be_visitor_operation_arglist::visit_operation (be_operation *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + + os->incr_indent (0); // these are for pretty printing + os->incr_indent (0); + *os << " (\n"; + + // all we do is hand over code generation to our scope + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_arglist::" + "visit_operation - " + "codegen for scope failed\n"), + -1); + } + + // last argument - is always CORBA::Environment + os->indent (); + *os << "CORBA::Environment &_tao_environment\n"; + os->decr_indent (); + *os << " )"; + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_OPERATION_ARGLIST_CH: + case TAO_CodeGen::TAO_OPERATION_ARGLIST_COLLOCATED_SH: + *os << ";\n"; + break; + case TAO_CodeGen::TAO_OPERATION_ARGLIST_SH: + // each method is pure virtual in the server header + *os << " = 0;\n"; + break; + default: + *os << "\n"; + } + + os->decr_indent (0); + return 0; +} + +int +be_visitor_operation_arglist::visit_argument (be_argument *node) +{ + // get the visitor that will dump the argument's mapping in the operation + // signature. + be_visitor_context ctx (*this->ctx_); + + // first grab the interface definition inside which this operation is + // defined. We need this since argument types may very well be declared + // inside the scope of the interface node. In such cases, we would like to + // generate the appropriate relative scoped names. + be_operation *op = this->ctx_->be_scope_as_operation (); + if (!op) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_arglist::" + "visit_argument - " + "Bad operation\n"), + -1); + } + + // We need the interface node in which this operation was defined. However, + // if this operation node was an attribute node in disguise, we get this + // information from the context + be_interface *intf; + intf = this->ctx_->attribute () + ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ()) + : be_interface::narrow_from_scope (op->defined_in ()); + + if (!intf) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_arglist::" + "visit_argument - " + "Bad interface\n"), + -1); + } + ctx.scope (intf); // set new scope + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_OPERATION_ARGLIST_CH: + ctx.state (TAO_CodeGen::TAO_ARGUMENT_ARGLIST_CH); + break; + case TAO_CodeGen::TAO_OPERATION_ARGLIST_OTHERS: + case TAO_CodeGen::TAO_OPERATION_ARGLIST_SH: + case TAO_CodeGen::TAO_OPERATION_ARGLIST_COLLOCATED_SH: + ctx.state (TAO_CodeGen::TAO_ARGUMENT_ARGLIST_OTHERS); + break; + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_arglist::" + "visit_argument - " + "Bad context\n"), + -1); + } + } + + // grab a visitor + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_arglist::" + "visit_argument - " + "Bad visitor\n"), + -1); + } + if (node->accept (visitor) == -1) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_arglist::" + + "visit_argument - " + "codegen for arglist failed\n"), + -1); + } + delete visitor; + return 0; +} + +// ************************************************************ +// be_visitor_operation_rettype_vardecl_cs +// This visitor generates code for variable declaration and initialization +// of the return type. +// ************************************************************ + +be_visitor_operation_rettype_vardecl_cs:: +be_visitor_operation_rettype_vardecl_cs (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_operation_rettype_vardecl_cs:: +~be_visitor_operation_rettype_vardecl_cs (void) +{ +} + +int +be_visitor_operation_rettype_vardecl_cs::visit_array (be_array *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + os->indent (); + *os << bt->name () << "_slice *_tao_retval = 0;\n"; + return 0; +} + +int +be_visitor_operation_rettype_vardecl_cs::visit_enum (be_enum *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + os->indent (); + *os << bt->name () << " _tao_retval = (" << bt->name () << ")0;\n"; + return 0; +} + +int +be_visitor_operation_rettype_vardecl_cs::visit_interface (be_interface *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + os->indent (); + *os << bt->name () << "_ptr _tao_retval = " << bt->name () << "::_nil ();\n"; + return 0; +} + +int +be_visitor_operation_rettype_vardecl_cs::visit_interface_fwd (be_interface_fwd *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + os->indent (); + *os << bt->name () << "_ptr _tao_retval = " << bt->name () << "::_nil ();\n"; + return 0; +} + +int +be_visitor_operation_rettype_vardecl_cs::visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + switch (node->pt ()) + { + case AST_PredefinedType::PT_pseudo: + os->indent (); + *os << bt->name () << "_ptr _tao_retval = 0;\n"; + break; + case AST_PredefinedType::PT_any: + os->indent (); + *os << bt->name () << " *_tao_retval = 0;\n"; + break; + case AST_PredefinedType::PT_void: + break; + default: + os->indent (); + *os << bt->name () << " _tao_retval = 0;\n"; + break; + } + return 0; +} + +int +be_visitor_operation_rettype_vardecl_cs::visit_sequence (be_sequence *node) +{ + // we should never directly be here because anonymous sequence return types + // are not allowed + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + os->indent (); + *os << bt->name () << " *_tao_retval = 0;\n"; + return 0; +} + +int +be_visitor_operation_rettype_vardecl_cs::visit_string (be_string * /* node*/) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "char *_tao_retval = 0;\n"; + return 0; +} + +int +be_visitor_operation_rettype_vardecl_cs::visit_structure (be_structure *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + os->indent (); + // based on whether we are variable or not, we return a pointer or the + // aggregate type + if (node->size_type () == be_decl::VARIABLE) + *os << bt->name () << " *_tao_retval = 0;\n"; + else + { + *os << bt->name () << " _tao_retval;" << be_nl; + *os << "ACE_OS::memset (&_tao_retval, 0, sizeof (" << bt->name () << "));\n"; + } + return 0; +} + +int +be_visitor_operation_rettype_vardecl_cs::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); // set the alias node + return node->primitive_base_type ()->accept (this); +} + +int +be_visitor_operation_rettype_vardecl_cs::visit_union (be_union *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + os->indent (); + // based on whether we are variable or not, we return a pointer or the + // aggregate type + if (node->size_type () == be_decl::VARIABLE) + *os << bt->name () << " *_tao_retval = 0;\n"; + else + { + *os << bt->name () << " _tao_retval;" << be_nl; + *os << "ACE_OS::memset (&_tao_retval, 0, sizeof (" << bt->name () << "));\n"; + } + return 0; +} + +// ***************************************************************************** +// be_visitor_operation_rettype_pre_docall_cs +// +// This visitor generates code that passes the return type variable to the +// do_call method +// ***************************************************************************** + +be_visitor_operation_rettype_pre_docall_cs:: +be_visitor_operation_rettype_pre_docall_cs (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_operation_rettype_pre_docall_cs:: +~be_visitor_operation_rettype_pre_docall_cs (void) +{ +} + +int +be_visitor_operation_rettype_pre_docall_cs::visit_array (be_array *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "_tao_retval"; + return 0; +} + +int +be_visitor_operation_rettype_pre_docall_cs::visit_interface (be_interface *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "CORBA::Object_ptr _tao_base_retval = CORBA::Object::_nil ();\n"; + return 0; +} + +int +be_visitor_operation_rettype_pre_docall_cs::visit_interface_fwd (be_interface_fwd *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "CORBA::Object_ptr _tao_base_retval = CORBA::Object::_nil ();\n"; + return 0; +} + +int +be_visitor_operation_rettype_pre_docall_cs:: +visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + switch (node->pt ()) + { + case AST_PredefinedType::PT_any: + os->indent (); + *os << "ACE_NEW_RETURN (_tao_retval, CORBA::Any, _tao_retval);\n"; + break; + default: + break; + } + return 0; +} + +int +be_visitor_operation_rettype_pre_docall_cs::visit_sequence (be_sequence *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "ACE_NEW_RETURN (_tao_retval, " << node->name () << ", _tao_retval);\n"; + return 0; +} + +int +be_visitor_operation_rettype_pre_docall_cs::visit_structure (be_structure *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + // check if the union is variable + if (node->size_type () == be_type::VARIABLE) + { + os->indent (); + *os << "ACE_NEW_RETURN (_tao_retval, " << node->name () << ", _tao_retval);\n"; + } + return 0; +} + +int +be_visitor_operation_rettype_pre_docall_cs::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); // set the alias node + return node->primitive_base_type ()->accept (this); +} + +int +be_visitor_operation_rettype_pre_docall_cs::visit_union (be_union *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + // check if the union is variable + if (node->size_type () == be_type::VARIABLE) + { + os->indent (); + *os << "ACE_NEW_RETURN (_tao_retval, " << node->name () << ", _tao_retval);\n"; + } + return 0; +} + +// ***************************************************************************** +// be_visitor_operation_rettype_docall_cs +// +// This visitor generates code that passes the return type variable to the +// do_call method +// ***************************************************************************** + +be_visitor_operation_rettype_docall_cs::be_visitor_operation_rettype_docall_cs +(be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_operation_rettype_docall_cs:: +~be_visitor_operation_rettype_docall_cs (void) +{ +} + +int +be_visitor_operation_rettype_docall_cs::visit_array (be_array *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "_tao_retval"; + return 0; +} + +int +be_visitor_operation_rettype_docall_cs::visit_enum (be_enum *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "&_tao_retval"; + return 0; +} + +int +be_visitor_operation_rettype_docall_cs::visit_interface (be_interface *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "&_tao_base_retval"; + return 0; +} + +int +be_visitor_operation_rettype_docall_cs::visit_interface_fwd (be_interface_fwd *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "&_tao_base_retval"; + return 0; +} + +int +be_visitor_operation_rettype_docall_cs::visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + switch (node->pt ()) + { + case AST_PredefinedType::PT_void: + *os << "0"; + break; + case AST_PredefinedType::PT_any: + *os << "_tao_retval"; + break; + default: + *os << "&_tao_retval"; + break; + } + return 0; +} + +int +be_visitor_operation_rettype_docall_cs::visit_sequence (be_sequence *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "_tao_retval"; + return 0; +} + +int +be_visitor_operation_rettype_docall_cs::visit_string (be_string *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "&_tao_retval"; + return 0; +} + +int +be_visitor_operation_rettype_docall_cs::visit_structure (be_structure *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + // check if the struct is variable + if (node->size_type () == be_type::VARIABLE) + *os << "_tao_retval"; + else + *os << "&_tao_retval"; + return 0; +} + +int +be_visitor_operation_rettype_docall_cs::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); // set the alias node + return node->primitive_base_type ()->accept (this); +} + +int +be_visitor_operation_rettype_docall_cs::visit_union (be_union *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + // check if the union is variable + if (node->size_type () == be_type::VARIABLE) + *os << "_tao_retval"; + else + *os << "&_tao_retval"; + return 0; +} + +// ******************************************************************************* +// be_visitor_operation_rettype_post_docall_cs +// +// This visitor generates code that passes the return type variable to the +// do_call method +// ******************************************************************************** + +be_visitor_operation_rettype_post_docall_cs:: +be_visitor_operation_rettype_post_docall_cs (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_operation_rettype_post_docall_cs:: +~be_visitor_operation_rettype_post_docall_cs (void) +{ +} + +int +be_visitor_operation_rettype_post_docall_cs::visit_interface (be_interface *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "_tao_retval = " << node->name () + << "::_narrow (_tao_base_retval, _tao_environment);" << be_nl; + *os << "CORBA::release (_tao_base_retval);\n"; + return 0; +} + +int +be_visitor_operation_rettype_post_docall_cs:: +visit_interface_fwd (be_interface_fwd *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "_tao_retval = " << node->name () + << "::_narrow (_tao_base_retval, _tao_environment);" << be_nl; + *os << "CORBA::release (_tao_base_retval);\n"; + return 0; +} + +// ************************************************************ +// be_visitor_operation_rettype_return_cs +// +// code to generate the return statement of the stub. +// ************************************************************ + +be_visitor_operation_rettype_return_cs::be_visitor_operation_rettype_return_cs +(be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_operation_rettype_return_cs::~be_visitor_operation_rettype_return_cs (void) +{ +} + +int +be_visitor_operation_rettype_return_cs::visit_array (be_array *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "return _tao_retval;\n"; + return 0; +} + +int +be_visitor_operation_rettype_return_cs::visit_enum (be_enum *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "return _tao_retval;\n"; + return 0; +} + +int +be_visitor_operation_rettype_return_cs::visit_interface (be_interface *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + // we must narrow it + *os << "return _tao_retval;\n"; + return 0; +} + +int +be_visitor_operation_rettype_return_cs::visit_interface_fwd (be_interface_fwd *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + // we must narrow it + *os << "return _tao_retval;\n"; + return 0; +} + +int +be_visitor_operation_rettype_return_cs::visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + switch (node->pt ()) + { + case AST_PredefinedType::PT_void: + *os << "return;\n"; + break; + default: + *os << "return _tao_retval;\n"; + break; + } + return 0; +} + +int +be_visitor_operation_rettype_return_cs::visit_sequence (be_sequence *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "return _tao_retval;\n"; + return 0; +} + +int +be_visitor_operation_rettype_return_cs::visit_string (be_string *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "return _tao_retval;\n"; + return 0; +} + +int +be_visitor_operation_rettype_return_cs::visit_structure (be_structure *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "return _tao_retval;\n"; + return 0; +} + +int +be_visitor_operation_rettype_return_cs::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); // set the alias node + return node->primitive_base_type ()->accept (this); +} + +int +be_visitor_operation_rettype_return_cs::visit_union (be_union *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "return _tao_retval;\n"; + return 0; +} + +// ******************************************************************************** +// be_visitor_operation_rettype_vardecl_ss +// This visitor generates code for variable declaration and initialization +// of the return type. +// ******************************************************************************** + +be_visitor_operation_rettype_vardecl_ss::be_visitor_operation_rettype_vardecl_ss +(be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_operation_rettype_vardecl_ss:: +~be_visitor_operation_rettype_vardecl_ss (void) +{ +} + +int +be_visitor_operation_rettype_vardecl_ss::visit_array (be_array *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + os->indent (); + *os << bt->name () << "_slice *_tao_retval = 0;\n"; + return 0; +} + +int +be_visitor_operation_rettype_vardecl_ss::visit_enum (be_enum *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + os->indent (); + *os << bt->name () << " _tao_retval;\n"; + return 0; +} + +int +be_visitor_operation_rettype_vardecl_ss::visit_interface (be_interface *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + os->indent (); + *os << bt->name () << "_ptr _tao_retval = " << bt->name () << "::_nil ();\n"; + return 0; +} + +int +be_visitor_operation_rettype_vardecl_ss:: +visit_interface_fwd (be_interface_fwd *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + os->indent (); + *os << bt->name () << "_ptr _tao_retval = " << bt->name () << "::_nil ();\n"; + return 0; +} + +int +be_visitor_operation_rettype_vardecl_ss:: +visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + switch (node->pt ()) + { + case AST_PredefinedType::PT_pseudo: + os->indent (); + *os << bt->name () << "_ptr _tao_retval = 0;\n"; + break; + case AST_PredefinedType::PT_any: + os->indent (); + *os << bt->name () << " *_tao_retval = 0;\n"; + break; + case AST_PredefinedType::PT_void: + break; + default: + os->indent (); + *os << bt->name () << " _tao_retval = 0;\n"; + break; + } + return 0; +} + +int +be_visitor_operation_rettype_vardecl_ss::visit_sequence (be_sequence *node) +{ + // we should never directly be here because anonymous sequence return types + // are not allowed + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + os->indent (); + *os << bt->name () << " *_tao_retval = 0;\n"; + return 0; +} + +int +be_visitor_operation_rettype_vardecl_ss::visit_string (be_string * /* node*/) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "char *_tao_retval = 0;\n"; + return 0; +} + +int +be_visitor_operation_rettype_vardecl_ss::visit_structure (be_structure *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + os->indent (); + // based on whether we are variable or not, we return a pointer or the + // aggregate type + if (node->size_type () == be_decl::VARIABLE) + *os << bt->name () << " *_tao_retval = 0;\n"; + else + *os << bt->name () << " _tao_retval;\n"; + return 0; +} + +int +be_visitor_operation_rettype_vardecl_ss::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); // set the alias node + return node->primitive_base_type ()->accept (this); +} + +int +be_visitor_operation_rettype_vardecl_ss::visit_union (be_union *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + os->indent (); + // based on whether we are variable or not, we return a pointer or the + // aggregate type + if (node->size_type () == be_decl::VARIABLE) + *os << bt->name () << " *_tao_retval = 0;\n"; + else + *os << bt->name () << " _tao_retval;\n"; + return 0; +} + +// **************************************************************************** +// Visitor that passes the return value to the marshal/demarshal routine +// **************************************************************************** + +be_visitor_operation_rettype_marshal_ss:: +be_visitor_operation_rettype_marshal_ss (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_operation_rettype_marshal_ss:: +~be_visitor_operation_rettype_marshal_ss (void) +{ +} + +int +be_visitor_operation_rettype_marshal_ss::visit_array (be_array *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "_tao_retval"; + return 0; +} + +int +be_visitor_operation_rettype_marshal_ss::visit_enum (be_enum *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "&_tao_retval"; + + return 0; +} + +int +be_visitor_operation_rettype_marshal_ss::visit_interface (be_interface *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "&_tao_retval"; + + return 0; +} + +int +be_visitor_operation_rettype_marshal_ss:: +visit_interface_fwd (be_interface_fwd *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "&_tao_retval"; + + return 0; +} + +int +be_visitor_operation_rettype_marshal_ss:: +visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + switch (node->pt ()) + { + case AST_PredefinedType::PT_void: + os->indent (); + *os << "0"; + break; + case AST_PredefinedType::PT_pseudo: + case AST_PredefinedType::PT_any: + default: + os->indent (); + *os << "&_tao_retval"; + break; + } + return 0; +} + +int +be_visitor_operation_rettype_marshal_ss::visit_sequence (be_sequence *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "_tao_retval"; + + return 0; +} + +int +be_visitor_operation_rettype_marshal_ss::visit_string (be_string * /* node*/) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "&_tao_retval"; + + return 0; +} + +int +be_visitor_operation_rettype_marshal_ss::visit_structure (be_structure *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + if (node->size_type () == be_type::VARIABLE) + *os << "_tao_retval"; + else + *os << "&_tao_retval"; + + return 0; +} + +int +be_visitor_operation_rettype_marshal_ss::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); // set the alias node + return node->primitive_base_type ()->accept (this); +} + +int +be_visitor_operation_rettype_marshal_ss::visit_union (be_union *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + if (node->size_type () == be_type::VARIABLE) + *os << "_tao_retval"; + else + *os << "&_tao_retval"; + + return 0; +} + +// **************************************************************************** +// visitor for assignment to a return value variable from the upcall +// **************************************************************************** + +be_visitor_operation_rettype_assign_ss:: +be_visitor_operation_rettype_assign_ss (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_operation_rettype_assign_ss:: +~be_visitor_operation_rettype_assign_ss (void) +{ +} + +int +be_visitor_operation_rettype_assign_ss::visit_array (be_array *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "_tao_retval = "; + return 0; +} + +int +be_visitor_operation_rettype_assign_ss::visit_enum (be_enum *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "_tao_retval = "; + + return 0; +} + +int +be_visitor_operation_rettype_assign_ss::visit_interface (be_interface *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "_tao_retval = "; + + return 0; +} + +int +be_visitor_operation_rettype_assign_ss:: +visit_interface_fwd (be_interface_fwd *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "_tao_retval = "; + + return 0; +} + +int +be_visitor_operation_rettype_assign_ss:: +visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + switch (node->pt ()) + { + case AST_PredefinedType::PT_void: + break; + case AST_PredefinedType::PT_pseudo: + case AST_PredefinedType::PT_any: + default: + *os << "_tao_retval = "; + break; + } + return 0; +} + +int +be_visitor_operation_rettype_assign_ss::visit_sequence (be_sequence *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "_tao_retval = "; + + return 0; +} + +int +be_visitor_operation_rettype_assign_ss::visit_string (be_string * /* node*/) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "_tao_retval = "; + + return 0; +} + +int +be_visitor_operation_rettype_assign_ss::visit_structure (be_structure *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "_tao_retval = "; + + return 0; +} + +int +be_visitor_operation_rettype_assign_ss::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); // set the alias node + return node->primitive_base_type ()->accept (this); +} + +int +be_visitor_operation_rettype_assign_ss::visit_union (be_union *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "_tao_retval = "; + + return 0; +} + +// **************************************************************************** +// visitor to do any post processing for return type after an upcall +// **************************************************************************** + +be_visitor_operation_rettype_post_upcall_ss::be_visitor_operation_rettype_post_upcall_ss (be_visitor_context + *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_operation_rettype_post_upcall_ss::~be_visitor_operation_rettype_post_upcall_ss (void) +{ +} + +int +be_visitor_operation_rettype_post_upcall_ss::visit_array (be_array *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "delete _tao_retval;\n"; + return 0; +} + +int +be_visitor_operation_rettype_post_upcall_ss::visit_enum (be_enum *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + return 0; +} + +int +be_visitor_operation_rettype_post_upcall_ss::visit_interface (be_interface *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + return 0; +} + +int +be_visitor_operation_rettype_post_upcall_ss::visit_interface_fwd (be_interface_fwd *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + return 0; +} + +int +be_visitor_operation_rettype_post_upcall_ss::visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + switch (node->pt ()) + { + case AST_PredefinedType::PT_pseudo: + break; + case AST_PredefinedType::PT_any: + break; + case AST_PredefinedType::PT_void: + break; + default: + break; + } + return 0; +} + +int +be_visitor_operation_rettype_post_upcall_ss::visit_sequence (be_sequence *node) +{ + // we should never directly be here because anonymous sequence return types + // are not allowed + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + return 0; +} + +int +be_visitor_operation_rettype_post_upcall_ss::visit_string (be_string * /* node*/) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + return 0; +} + +int +be_visitor_operation_rettype_post_upcall_ss::visit_structure (be_structure *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + return 0; +} + +int +be_visitor_operation_rettype_post_upcall_ss::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); // set the alias node + return node->primitive_base_type ()->accept (this); +} + +int +be_visitor_operation_rettype_post_upcall_ss::visit_union (be_union *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + return 0; +} + +// ************************************************************ +// generic operation visitor to handle the pre/post do_call/upcall stuff with +// arguments +// ************************************************************ + +be_visitor_operation_argument::be_visitor_operation_argument (be_visitor_context + *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_operation_argument::~be_visitor_operation_argument (void) +{ +} + +int +be_visitor_operation_argument::post_process (void) +{ + TAO_OutStream *os = this->ctx_->stream (); + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_OPERATION_ARG_DOCALL_CS: + case TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_SS: + case TAO_CodeGen::TAO_OPERATION_ARG_DEMARSHAL_SS: + case TAO_CodeGen::TAO_OPERATION_ARG_MARSHAL_SS: + *os << ",\n"; + break; + default: + break; + } + return 0; +} + +int +be_visitor_operation_argument::visit_operation (be_operation *node) +{ + // all we do is hand over code generation to our scope + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_argument::" + "visit_operation - " + "codegen for scope failed\n"), + -1); + } + + return 0; +} + +int +be_visitor_operation_argument::visit_argument (be_argument *node) +{ + // get the visitor that will dump the argument's mapping in the operation + // signature. + be_visitor_context ctx (*this->ctx_); + + // first grab the interface definition inside which this operation is + // defined. We need this since argument types may very well be declared + // inside the scope of the interface node. In such cases, we would like to + // generate the appropriate relative scoped names. + be_operation *op = this->ctx_->be_scope_as_operation (); + if (!op) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_argument::" + "visit_argument - " + "Bad operation\n"), + -1); + } + + // We need the interface node in which this operation was defined. However, + // if this operation node was an attribute node in disguise, we get this + // information from the context + be_interface *intf; + intf = this->ctx_->attribute () + ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ()) + : be_interface::narrow_from_scope (op->defined_in ()); + + if (!intf) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_argument::" + "visit_argument - " + "Bad interface\n"), + -1); + } + ctx.scope (intf); // set new scope + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_OPERATION_ARG_PRE_DOCALL_CS: + ctx.state (TAO_CodeGen::TAO_ARGUMENT_PRE_DOCALL_CS); + break; + case TAO_CodeGen::TAO_OPERATION_ARG_DOCALL_CS: + ctx.state (TAO_CodeGen::TAO_ARGUMENT_DOCALL_CS); + break; + case TAO_CodeGen::TAO_OPERATION_ARG_POST_DOCALL_CS: + ctx.state (TAO_CodeGen::TAO_ARGUMENT_POST_DOCALL_CS); + break; + case TAO_CodeGen::TAO_OPERATION_ARG_DECL_SS: + ctx.state (TAO_CodeGen::TAO_ARGUMENT_VARDECL_SS); + break; + case TAO_CodeGen::TAO_OPERATION_ARG_DEMARSHAL_SS: + ctx.state (TAO_CodeGen::TAO_ARGUMENT_DEMARSHAL_SS); + break; + case TAO_CodeGen::TAO_OPERATION_ARG_MARSHAL_SS: + ctx.state (TAO_CodeGen::TAO_ARGUMENT_MARSHAL_SS); + break; + case TAO_CodeGen::TAO_OPERATION_ARG_PRE_UPCALL_SS: + ctx.state (TAO_CodeGen::TAO_ARGUMENT_PRE_UPCALL_SS); + break; + case TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_SS: + ctx.state (TAO_CodeGen::TAO_ARGUMENT_UPCALL_SS); + break; + case TAO_CodeGen::TAO_OPERATION_ARG_POST_UPCALL_SS: + ctx.state (TAO_CodeGen::TAO_ARGUMENT_POST_UPCALL_SS); + break; + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_argument::" + "visit_argument - " + "Bad context\n"), + -1); + } + } + + // grab a visitor + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_argument::" + "visit_argument - " + "Bad visitor\n"), + -1); + } + if (node->accept (visitor) == -1) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_argument::" + + "visit_argument - " + "codegen for argument failed\n"), + -1); + } + delete visitor; + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_root.cpp b/TAO/TAO_IDL/be/be_visitor_root.cpp index 422ef6ecaef..cd291424a39 100644 --- a/TAO/TAO_IDL/be/be_visitor_root.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root.cpp @@ -21,286 +21,776 @@ #include "be.h" #include "be_visitor_root.h" -// Root visitor for client header -be_visitor_root_ch::be_visitor_root_ch (void) +// Generic Root visitor +be_visitor_root::be_visitor_root (be_visitor_context *ctx) + : be_visitor_scope (ctx) { - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - this->os_ = cg->client_header (); } -be_visitor_root_ch::~be_visitor_root_ch (void) +be_visitor_root::~be_visitor_root (void) { } -int be_visitor_root_ch::visit_root (be_root *node) +// this method must be overridden by the derived root visitors +int +be_visitor_root::init (void) { - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - cg->push (TAO_CodeGen::TAO_ROOT_CH); // set the code generation state + return -1; +} - // open the client-side header file - if (cg->client_header (idl_global->be_get_client_hdr_fname ()) == -1) +// visit the Root node and its scope +int be_visitor_root::visit_root (be_root *node) +{ + // open the appropriate output file based on what state we are in. The + // overridden "init" method of derived classes will do the job. + if (this->init () == -1) { - ACE_ERROR ((LM_ERROR, "be_root: Error opening client header\n")); - return -1; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::init - " + "failed to initialize context\n"), -1); } - // delegate the task of code generation to the scope - if (node->be_scope::gen_client_header () == -1) + + // all we have to do is to visit the scope + if (this->visit_scope (node) == -1) { - ACE_ERROR ((LM_ERROR, "be_root: code generation for scope failed\n")); - return -1; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::visit_root - " + "codegen for scope failed\n"), -1); } - cg->pop (); - - // at this point, we must be in the initial state - ACE_ASSERT (cg->state () == TAO_CodeGen::TAO_INITIAL); - - (void) cg->end_client_header (); // generate the last #endif return 0; } -int be_visitor_root_ch::visit_sequence (be_sequence *node) +// =all common visit methods for root visitor + +// visit a constant +int +be_visitor_root::visit_constant (be_constant *node) { - ACE_UNUSED_ARG (node); + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_ROOT_CH: + ctx.state (TAO_CodeGen::TAO_CONSTANT_CH); + break; + case TAO_CodeGen::TAO_ROOT_CS: + ctx.state (TAO_CodeGen::TAO_CONSTANT_CS); + break; + case TAO_CodeGen::TAO_ROOT_CI: + case TAO_CodeGen::TAO_ROOT_SH: + case TAO_CodeGen::TAO_ROOT_SI: + case TAO_CodeGen::TAO_ROOT_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_constant - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_constant - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_constant - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; return 0; } -// Root visitor for client inline - -be_visitor_root_ci::be_visitor_root_ci (void) +//visit an enum +int +be_visitor_root::visit_enum (be_enum *node) { - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - this->os_ = cg->client_inline (); + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_ROOT_CH: + ctx.state (TAO_CodeGen::TAO_ENUM_CH); + break; + case TAO_CodeGen::TAO_ROOT_CS: + ctx.state (TAO_CodeGen::TAO_ENUM_CS); + break; + case TAO_CodeGen::TAO_ROOT_CI: + case TAO_CodeGen::TAO_ROOT_SH: + case TAO_CodeGen::TAO_ROOT_SI: + case TAO_CodeGen::TAO_ROOT_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_enum - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_enum - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_enum - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; } -be_visitor_root_ci::~be_visitor_root_ci (void) +// visit an exception +int +be_visitor_root::visit_exception (be_exception *node) { + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_ROOT_CH: + ctx.state (TAO_CodeGen::TAO_EXCEPTION_CH); + break; + case TAO_CodeGen::TAO_ROOT_CI: + ctx.state (TAO_CodeGen::TAO_EXCEPTION_CI); + break; + case TAO_CodeGen::TAO_ROOT_CS: + ctx.state (TAO_CodeGen::TAO_EXCEPTION_CS); + break; + case TAO_CodeGen::TAO_ROOT_SH: + case TAO_CodeGen::TAO_ROOT_SI: + case TAO_CodeGen::TAO_ROOT_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_exception - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_exception - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_exception - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; } -int be_visitor_root_ci::visit_root (be_root *node) +// visit an interface +int +be_visitor_root::visit_interface (be_interface *node) { - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - cg->push (TAO_CodeGen::TAO_ROOT_CI); // set the code generation state + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set - // open the client-side inline file - if (cg->client_inline (idl_global->be_get_client_inline_fname ()) == -1) + switch (this->ctx_->state ()) { - ACE_ERROR ((LM_ERROR, "be_root: Error opening client inline file\n")); - return -1; + case TAO_CodeGen::TAO_ROOT_CH: + ctx.state (TAO_CodeGen::TAO_INTERFACE_CH); + break; + case TAO_CodeGen::TAO_ROOT_CI: + ctx.state (TAO_CodeGen::TAO_INTERFACE_CI); + break; + case TAO_CodeGen::TAO_ROOT_CS: + ctx.state (TAO_CodeGen::TAO_INTERFACE_CS); + break; + case TAO_CodeGen::TAO_ROOT_SH: + ctx.state (TAO_CodeGen::TAO_INTERFACE_SH); + break; + case TAO_CodeGen::TAO_ROOT_SI: + ctx.state (TAO_CodeGen::TAO_INTERFACE_SI); + break; + case TAO_CodeGen::TAO_ROOT_SS: + ctx.state (TAO_CodeGen::TAO_INTERFACE_SS); + break; + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_interface - " + "Bad context state\n" + ), -1); + } + break; } - // delegate the task of code generation to the scope - if (node->be_scope::gen_client_inline () == -1) + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) { - ACE_ERROR ((LM_ERROR, "be_root: code generation for scope failed\n")); - return -1; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_interface - " + "NUL visitor\n" + ), -1); } - cg->pop (); - - // at this point, we must be in the initial state - // ACE_ASSERT (cg->state () == TAO_CodeGen::TAO_INITIAL); + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_interface - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; return 0; } -int be_visitor_root_ci::visit_sequence (be_sequence *) +// visit an interface_fwd +int +be_visitor_root::visit_interface_fwd (be_interface_fwd *node) { + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_ROOT_CH: + ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CH); + break; + case TAO_CodeGen::TAO_ROOT_CI: + ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CI); + break; + case TAO_CodeGen::TAO_ROOT_CS: + case TAO_CodeGen::TAO_ROOT_SH: + case TAO_CodeGen::TAO_ROOT_SI: + case TAO_CodeGen::TAO_ROOT_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_interface_fwd - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_interface_fwd - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_interface_fwd - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; return 0; } -// Root visitor for client stubs - -be_visitor_root_cs::be_visitor_root_cs (void) +// visit an module +int +be_visitor_root::visit_module (be_module *node) { - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - this->os_ = cg->client_stubs (); + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_ROOT_CH: + ctx.state (TAO_CodeGen::TAO_MODULE_CH); + break; + case TAO_CodeGen::TAO_ROOT_CI: + ctx.state (TAO_CodeGen::TAO_MODULE_CI); + break; + case TAO_CodeGen::TAO_ROOT_CS: + ctx.state (TAO_CodeGen::TAO_MODULE_CS); + break; + case TAO_CodeGen::TAO_ROOT_SH: + ctx.state (TAO_CodeGen::TAO_MODULE_SH); + break; + case TAO_CodeGen::TAO_ROOT_SI: + ctx.state (TAO_CodeGen::TAO_MODULE_SI); + break; + case TAO_CodeGen::TAO_ROOT_SS: + ctx.state (TAO_CodeGen::TAO_MODULE_SS); + break; + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_module - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_module - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_module - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; } -be_visitor_root_cs::~be_visitor_root_cs (void) +// visit an structure +int +be_visitor_root::visit_structure (be_structure *node) { + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_ROOT_CH: + ctx.state (TAO_CodeGen::TAO_STRUCT_CH); + break; + case TAO_CodeGen::TAO_ROOT_CI: + ctx.state (TAO_CodeGen::TAO_STRUCT_CI); + break; + case TAO_CodeGen::TAO_ROOT_CS: + ctx.state (TAO_CodeGen::TAO_STRUCT_CS); + break; + case TAO_CodeGen::TAO_ROOT_SH: + case TAO_CodeGen::TAO_ROOT_SI: + case TAO_CodeGen::TAO_ROOT_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_structure - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_structure - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_structure - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; } -int be_visitor_root_cs::visit_root (be_root *node) +// visit an union +int +be_visitor_root::visit_union (be_union *node) { - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - cg->push (TAO_CodeGen::TAO_ROOT_CS); // set the code generation state + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set - // open the client-side stub file - if (cg->client_stubs (idl_global->be_get_client_stub_fname ()) == -1) + switch (this->ctx_->state ()) { - ACE_ERROR ((LM_ERROR, "be_root: Error opening client stubs file\n")); - return -1; + case TAO_CodeGen::TAO_ROOT_CH: + ctx.state (TAO_CodeGen::TAO_UNION_CH); + break; + case TAO_CodeGen::TAO_ROOT_CI: + ctx.state (TAO_CodeGen::TAO_UNION_CI); + break; + case TAO_CodeGen::TAO_ROOT_CS: + ctx.state (TAO_CodeGen::TAO_UNION_CS); + break; + case TAO_CodeGen::TAO_ROOT_SH: + case TAO_CodeGen::TAO_ROOT_SI: + case TAO_CodeGen::TAO_ROOT_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_union - " + "Bad context state\n" + ), -1); + } + break; } - // delegate the task of code generation to the scope - if (node->be_scope::gen_client_stubs () == -1) + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) { - ACE_ERROR ((LM_ERROR, "be_root: code generation for scope failed\n")); - return -1; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_union - " + "NUL visitor\n" + ), -1); } - cg->pop (); - - // at this point, we must be in the initial state - // ACE_ASSERT (cg->state () == TAO_CodeGen::TAO_INITIAL); + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_union - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; return 0; } -int be_visitor_root_cs::visit_sequence (be_sequence *) +// visit an typedef +int +be_visitor_root::visit_typedef (be_typedef *node) { + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_ROOT_CH: + ctx.state (TAO_CodeGen::TAO_TYPEDEF_CH); + break; + case TAO_CodeGen::TAO_ROOT_CI: + ctx.state (TAO_CodeGen::TAO_TYPEDEF_CI); + break; + case TAO_CodeGen::TAO_ROOT_CS: + ctx.state (TAO_CodeGen::TAO_TYPEDEF_CS); + break; + case TAO_CodeGen::TAO_ROOT_SH: + case TAO_CodeGen::TAO_ROOT_SI: + case TAO_CodeGen::TAO_ROOT_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_typedef - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_typedef - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_typedef - " + "failed to accept visitor" + ), -1); + } + delete visitor; return 0; } -// Root visitor for server header +// ******************************** +// Root visitor for client header +// ******************************** -be_visitor_root_sh::be_visitor_root_sh (void) +be_visitor_root_ch::be_visitor_root_ch (be_visitor_context *ctx) + : be_visitor_root (ctx) { - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - this->os_ = cg->server_header (); } -be_visitor_root_sh::~be_visitor_root_sh (void) +be_visitor_root_ch::~be_visitor_root_ch (void) { } -int be_visitor_root_sh::visit_root (be_root *node) +int +be_visitor_root_ch::init (void) { - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - cg->push (TAO_CodeGen::TAO_ROOT_SH); // set the code generation state - - // open the server-side header file - if (cg->server_header (idl_global->be_get_server_hdr_fname ()) == -1) - { - ACE_ERROR ((LM_ERROR, "be_root: Error opening server header\n")); - return -1; - } - // delegate the task of code generation to the scope - if (node->be_scope::gen_server_header () == -1) + // first open the client-side header file for writing + if (tao_cg->client_header (idl_global->be_get_client_hdr_fname ()) == -1) { ACE_ERROR ((LM_ERROR, - "be_root: server code generation for scope failed\n")); + "(%N:%l) be_visitor_root_ch::init - " + "Error opening client header file\n")); return -1; } - cg->pop (); + this->ctx_->stream (tao_cg->client_header ()); + return 0; +} - // at this point, we must be in the initial state - // ACE_ASSERT (cg->state () == TAO_CodeGen::TAO_INITIAL); +// ********************************* +// Root visitor for client inline +// ********************************* - (void) cg->end_server_header (); // generate the last #endif statement - return 0; +be_visitor_root_ci::be_visitor_root_ci (be_visitor_context *ctx) + : be_visitor_root (ctx) +{ } -int be_visitor_root_sh::visit_sequence (be_sequence *) +be_visitor_root_ci::~be_visitor_root_ci (void) { +} + +int +be_visitor_root_ci::init (void) +{ + // first open the client-side inline file for writing + if (tao_cg->client_inline (idl_global->be_get_client_inline_fname ()) == -1) + { + ACE_ERROR ((LM_ERROR, + "(%N:%l) be_visitor_root_ci - " + "Error opening client inline file\n")); + return -1; + } + + this->ctx_->stream (tao_cg->client_inline ()); return 0; } -// Root visitor for server inline +// *********************************** +// Root visitor for client stubs +// *********************************** -be_visitor_root_si::be_visitor_root_si (void) +be_visitor_root_cs::be_visitor_root_cs (be_visitor_context *ctx) + : be_visitor_root (ctx) { - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - this->os_ = cg->server_inline (); } -be_visitor_root_si::~be_visitor_root_si (void) +be_visitor_root_cs::~be_visitor_root_cs (void) { } -int be_visitor_root_si::visit_root (be_root *node) +int +be_visitor_root_cs::init (void) { - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - cg->push (TAO_CodeGen::TAO_ROOT_SI); // set the code generation state - - // open the server-side inline file - if (cg->server_inline (idl_global->be_get_server_inline_fname ()) == -1) + // first open the file + if (tao_cg->client_stubs (idl_global->be_get_client_stub_fname ()) == -1) { - ACE_ERROR ((LM_ERROR, "be_root: Error opening server inline file\n")); - return -1; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root_cs - " + "Error opening client stub file\n"), -1); } - // delegate the task of code generation to the scope - if (node->be_scope::gen_server_inline () == -1) - { - ACE_ERROR ((LM_ERROR, "be_root: code generation for scope failed\n")); - return -1; - } - cg->pop (); - - // at this point, we must be in the initial state - // ACE_ASSERT (cg->state () == TAO_CodeGen::TAO_INITIAL); + this->ctx_->stream (tao_cg->client_stubs ()); // init stream return 0; } -int be_visitor_root_si::visit_sequence (be_sequence *) +// *********************************** +// Root visitor for server header +// *********************************** + +be_visitor_root_sh::be_visitor_root_sh (be_visitor_context *ctx) + : be_visitor_root (ctx) { - return 0; } -// Root visitor for server server +be_visitor_root_sh::~be_visitor_root_sh (void) +{ +} -be_visitor_root_ss::be_visitor_root_ss (void) +int +be_visitor_root_sh::init (void) { - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - this->os_ = cg->server_skeletons (); + // open the file + if (tao_cg->server_header (idl_global->be_get_server_hdr_fname ()) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root_sh::init - " + "Error opening server header file\n"), -1); + } + + // set the stream and the next state + this->ctx_->stream (tao_cg->server_header ()); + return 0; } -be_visitor_root_ss::~be_visitor_root_ss (void) +// *********************************************** +// Root visitor for server inline +// *********************************************** + +be_visitor_root_si::be_visitor_root_si (be_visitor_context *ctx) + : be_visitor_root (ctx) { } -int be_visitor_root_ss::visit_root (be_root *node) +be_visitor_root_si::~be_visitor_root_si (void) { - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - cg->push (TAO_CodeGen::TAO_ROOT_SS); // set the code generation state +} - // open the server-side skeleton file - if (cg->server_skeletons (idl_global->be_get_server_skeleton_fname ()) == -1) - { - ACE_ERROR ((LM_ERROR, "be_root: Error opening server skeletons file\n")); - return -1; - } - // delegate the task of code generation to the scope - if (node->be_scope::gen_server_skeletons () == -1) +int +be_visitor_root_si::init (void) +{ + // first open the file for writing + if (tao_cg->server_inline (idl_global->be_get_server_inline_fname ()) == -1) { - ACE_ERROR ((LM_ERROR, "be_root: code generation for scope failed\n")); - return -1; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root_si::init - " + "server inline open failed\n"), -1); } - cg->pop (); - - // at this point, we must be in the initial state - // ACE_ASSERT (cg->state () == TAO_CodeGen::TAO_INITIAL); + this->ctx_->stream (tao_cg->server_inline ()); // init stream return 0; } -int be_visitor_root_ss::visit_sequence (be_sequence *) +// ****************************************************** +// Root visitor for server skeletons +// ****************************************************** + +be_visitor_root_ss::be_visitor_root_ss (be_visitor_context *ctx) + : be_visitor_root (ctx) { - return 0; } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Singleton<be_visitor_root_ch, ACE_SYNCH_RECURSIVE_MUTEX>; -template class ACE_Singleton<be_visitor_root_ci, ACE_SYNCH_RECURSIVE_MUTEX>; -template class ACE_Singleton<be_visitor_root_cs, ACE_SYNCH_RECURSIVE_MUTEX>; -template class ACE_Singleton<be_visitor_root_sh, ACE_SYNCH_RECURSIVE_MUTEX>; -template class ACE_Singleton<be_visitor_root_si, ACE_SYNCH_RECURSIVE_MUTEX>; -template class ACE_Singleton<be_visitor_root_ss, ACE_SYNCH_RECURSIVE_MUTEX>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Singleton<be_visitor_root_ch, ACE_SYNCH_RECURSIVE_MUTEX> -#pragma instantiate ACE_Singleton<be_visitor_root_ci, ACE_SYNCH_RECURSIVE_MUTEX> -#pragma instantiate ACE_Singleton<be_visitor_root_cs, ACE_SYNCH_RECURSIVE_MUTEX> -#pragma instantiate ACE_Singleton<be_visitor_root_sh, ACE_SYNCH_RECURSIVE_MUTEX> -#pragma instantiate ACE_Singleton<be_visitor_root_si, ACE_SYNCH_RECURSIVE_MUTEX> -#pragma instantiate ACE_Singleton<be_visitor_root_ss, ACE_SYNCH_RECURSIVE_MUTEX> -#endif +be_visitor_root_ss::~be_visitor_root_ss (void) +{ +} + +int +be_visitor_root_ss::init (void) +{ + // first open the file for writing + if (tao_cg->server_skeletons (idl_global->be_get_server_skeleton_fname ()) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root_ss::init - " + "Error opening server skeletons file\n"), -1); + } + + this->ctx_->stream (tao_cg->server_skeletons ()); // set stream + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_scope.cpp b/TAO/TAO_IDL/be/be_visitor_scope.cpp new file mode 100644 index 00000000000..126e18ca3e2 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_scope.cpp @@ -0,0 +1,89 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_scope.cpp +// +// = DESCRIPTION +// Visitor for the base be_scope node. This serves to maintain the current +// state (context) of code generation for the derived visitor. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_scope.h" + +// ****************************************************** +// Generic visitor for a scope. +// All elements that give rise to a scope inherit from +// this class +// ****************************************************** + +be_visitor_scope::be_visitor_scope (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_scope::~be_visitor_scope (void) +{ +} + +// visit the scope and its elements +int +be_visitor_scope::visit_scope (be_scope *node) +{ + // proceed if the number of members in our scope is greater than 0 + if (node->nmembers () > 0) + { + // initialize an iterator to iterate thru our scope + UTL_ScopeActiveIterator *si; + ACE_NEW_RETURN (si, + UTL_ScopeActiveIterator (node, + UTL_Scope::IK_decls), + -1); + // continue until each element is visited + while (!si->is_done ()) + { + AST_Decl *d = si->item (); + be_decl *bd = be_decl::narrow_from_decl (d); + // set the scope node in which the code is being generated + this->ctx_->scope (node->decl ()); + // set the node to be visited + this->ctx_->node (bd); + if (bd == 0 || bd->accept (this) == -1) + { + delete si; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_scope::visit_scope - " + "codegen for scope failed\n"), -1); + + } + si->next (); + if (!si->is_done ()) + this->post_process (); // anything to be done after each element + // except the last one is processed? + + } // end of while loop + delete si; + } // end of if + + return 0; +} + +int +be_visitor_scope::post_process (void) +{ + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_sequence.cpp b/TAO/TAO_IDL/be/be_visitor_sequence.cpp index 2d5b57849aa..95598b848b1 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence.cpp @@ -12,7 +12,7 @@ // Visitors for generation of code for Sequence // // = AUTHOR -// Aniruddha Gokhale +// Aniruddha Gokhale and Carlos O'Ryan // // ============================================================================ @@ -22,154 +22,1117 @@ #include "be_visitor_sequence.h" // Root visitor for client header -be_visitor_sequence_ch::be_visitor_sequence_ch (void) +be_visitor_sequence_ch::be_visitor_sequence_ch (be_visitor_context *ctx) + : be_visitor_decl (ctx) { - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - this->os_ = cg->client_header (); } be_visitor_sequence_ch::~be_visitor_sequence_ch (void) { } -int be_visitor_sequence_ch::visit_sequence (be_sequence *node) +int +be_visitor_sequence_ch::gen_base_sequence_class (be_sequence *node) { - TAO_NL nl; // end line - be_type *bt; // type node - // retrieve a singleton instance of the code generator - // UNUSED: TAO_CodeGen *cg = TAO_CODEGEN::instance (); - TAO_OutStream &os = this->stream (); + TAO_OutStream *os = this->ctx_->stream (); + be_type *bt; - // generate the ifdefined macro for the sequence type - os.gen_ifdef_macro (node->flatname ()); - - os.indent (); // start with the current indentation level - - // retrieve the base type since we may need to do some code - // generation for the base type. + // retrieve the base type since we may need to do some code + // generation for the base type. bt = be_type::narrow_from_decl (node->base_type ()); if (!bt) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_sequence.cpp - " - "Bad base type\n"), - -1); + "(%N:%l) be_visitor_sequence_ch::" + "visit_sequence - " + "Bad element type\n"), -1); } - os << "// *************************************************************" - << nl; - os << "// " << node->local_name () << nl; - os << "// *************************************************************" - << nl << nl; - - // generate a typedef to a parametrized sequence - os << "typedef "; // generate the appropriate sequence type switch (node->managed_type ()) { case be_sequence::MNG_OBJREF: // sequence of objrefs if (node->unbounded ()) - os << "TAO_Unbounded_Object_Sequence<"; + *os << "TAO_Unbounded_Object_Sequence<"; else - os << "TAO_Bounded_Object_Sequence<"; + *os << "TAO_Bounded_Object_Sequence<"; break; case be_sequence::MNG_STRING: // sequence of strings if (node->unbounded ()) - os << "TAO_Unbounded_String_Sequence"; + *os << "TAO_Unbounded_String_Sequence"; else - os << "TAO_Bounded_String_Sequence<"; + *os << "TAO_Bounded_String_Sequence<"; break; default: // not a managed type if (node->unbounded ()) - os << "TAO_Unbounded_Sequence<"; + *os << "TAO_Unbounded_Sequence<"; else - os << "TAO_Bounded_Sequence<"; + *os << "TAO_Bounded_Sequence<"; break; } + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CH); + be_visitor *visitor = tao_cg->make_visitor (&ctx); - be_visitor_sequence_base_ch base (&os, node, bt); - if (bt->accept (&base) == -1) + if (bt->accept (visitor) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_sequence.cpp - " + "(%N:%l) be_visitor_sequence_ch::" + "visit_sequence - " "base type visit failed\n"), -1); } + delete visitor; + // find out if the sequence is of a managed type and if it is bounded or not if (node->managed_type () == be_sequence::MNG_STRING) { if (!node->unbounded ()) - { - os << "<" << node->max_size () << ">"; - } + { + *os << node->max_size () << ">"; + } } else { if (node->unbounded ()) - { - os << " >"; - } + { + *os << ">"; + } else - { - os << ", " << node->max_size () << " >"; - } + { + *os << ", " << node->max_size () << ">"; + } } + return 0; +} - os << " " << node->local_name () << ";" << nl; +int be_visitor_sequence_ch::visit_sequence (be_sequence *node) +{ + be_type *bt; // type node + TAO_OutStream *os = this->ctx_->stream (); - os << "typedef " << node->local_name () << "* " - << node->local_name () << "_ptr;\n"; + // first create a name for ourselves + if (node->create_name (this->ctx_->tdef ()) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_ch::" + "visit_sequence - " + "failed creating name\n"), -1); + } + + // generate the ifdefined macro for the sequence type + os->gen_ifdef_macro (node->flatname ()); + + os->indent (); // start with the current indentation level + + // retrieve the base type since we may need to do some code + // generation for the base type. + bt = be_type::narrow_from_decl (node->base_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_ch::" + "visit_sequence - " + "Bad element type\n"), -1); + } + + *os << "// *************************************************************" + << be_nl + << "// " << node->local_name () << be_nl + << "// *************************************************************" + << be_nl << be_nl; + + // generate a typedef to a parametrized sequence + *os << "class " << node->local_name () << ": public "; + if (this->gen_base_sequence_class (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_ch::" + "visit_sequence - " + "codegen for base sequence class\n"), -1); + } + + *os << be_nl + << "{" << be_nl + << "public:" << be_idt_nl + << node->local_name () << " (void); // default ctor" << be_nl; + // for unbounded sequences, we have a different set of constructors + if (node->unbounded ()) + { + *os << node->local_name () << " (CORBA::ULong max); // uses max size" + << be_nl; + } + + *os << node->local_name () << " ("; + if (node->unbounded ()) + { + *os << "CORBA::ULong max, "; // unbounded seq takes this extra parameter + } + *os << "CORBA::ULong length, "; + // generate the base type for the buffer + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_SEQUENCE_BUFFER_TYPE_CH); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_ch::" + "visit_sequence - " + "Bad visitor\n"), -1); + } + + if (bt->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_ch::" + "visit_sequence - " + "base type visit failed\n"), + -1); + } + delete visitor; + *os << " *buffer, CORBA::Boolean release=0);" << be_nl; + *os << node->local_name () << " (const " << node->local_name () + << " &); // copy ctor" << be_nl; + *os << "~" << node->local_name () << " (void); // dtor\n"; + os->decr_indent (); + *os << "};" << be_nl; + + // define a _ptr type. This is just an extension for convenience + *os << "typedef " << node->local_name () << " *" + << node->local_name () << "_ptr;\n"; // Generate the typecode decl if (node->is_nested ()) { // we have a scoped name - os.indent (); - os << "static CORBA::TypeCode_ptr " << node->tc_name - ()->last_component () << ";\n\n"; + os->indent (); + *os << "static CORBA::TypeCode_ptr " + << node->tc_name ()->last_component () << "_seq;\n\n"; } else { // we are in the ROOT scope - os.indent (); - os << "extern " - << idl_global->export_macro () - << " CORBA::TypeCode_ptr " - << node->tc_name ()->last_component () << ";\n\n"; + os->indent (); + *os << "extern " + << idl_global->export_macro () + << " CORBA::TypeCode_ptr " + << node->tc_name ()->last_component () << ";\n\n"; } - os.gen_endif (); // endif macro + os->gen_endif (); // endif macro // generate the ifdefined macro for the var type - os.gen_ifdef_macro (node->flatname (), "_var"); + os->gen_ifdef_macro (node->flatname (), "_var"); // generate the var and out types - if (node->gen_var_defn () == -1) + if (this->gen_var_defn (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_ch::" + "visit_sequence - " + "codegen for _var failed\n"), -1); + } + + os->gen_endif (); + + // generate the ifdefined macro for the _out type + os->gen_ifdef_macro (node->flatname (), "_out"); + + if (this->gen_out_defn (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_ch::" + "visit_sequence - " + "codegen for _out failed\n"), + -1); + } + os->gen_endif (); + + return 0; +} + +// generate the _var definition for ourself +int +be_visitor_sequence_ch::gen_var_defn (be_sequence *node) +{ + TAO_OutStream *os; // output stream + char namebuf [NAMEBUFSIZE]; // names + be_type *bt; // base type + + ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE); + ACE_OS::sprintf (namebuf, "%s_var", node->local_name ()->get_string ()); + + os = this->ctx_->stream (); + + *os << "// *************************************************************" + << be_nl; + *os << "// class " << node->name () << "_var" << be_nl; + *os << "// *************************************************************\n\n"; + + // retrieve base type + bt = be_type::narrow_from_decl (node->base_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_ch::" + "gen_var_defn - " + "Bad base type\n"), + -1); + } + + // generate the var definition (always in the client header). + // Depending upon the data type, there are some differences which we account + // for over here. + + os->indent (); // start with whatever was our current indent level + *os << "class " << namebuf << be_nl; + *os << "{" << be_nl; + *os << "public:\n"; + os->incr_indent (); + // default constr + *os << namebuf << " (void); // default constructor" << be_nl; + // constr + *os << namebuf << " (" << node->local_name () << " *);" << be_nl; + // copy constructor + *os << namebuf << " (const " << namebuf << + " &); // copy constructor" << be_nl; + // destructor + *os << "~" << namebuf << " (void); // destructor" << be_nl; + *os << be_nl; + // assignment operator from a pointer + *os << namebuf << " &operator= (" << node->local_name () << " *);" << be_nl; + // assignment from _var + *os << namebuf << " &operator= (const " << namebuf << + " &);" << be_nl; + + // arrow operator + *os << node->local_name () << " *operator-> (void);" << be_nl; + *os << "const " << node->local_name () << " *operator-> (void) const;" << be_nl; + *os << be_nl; + + // other extra types (cast operators, [] operator, and others) + + // cast operator + *os << "operator const " << node->local_name () << " &() const;" << be_nl; + *os << "operator " << node->local_name () << " &();" << be_nl; + *os << "operator " << node->local_name () << " &() const;" << be_nl; + + // overloaded [] operator. The const version is not required for sequences + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_SEQELEM_RETTYPE_CH); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_ch::" + "gen_var_defn - " + "Bad visitor\n"), -1); + } + + if (bt->accept (visitor) == -1) { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_sequence::" - "gen_client_header - " - "codegen for _var failed\n"), + "gen_var_defn - " + "[] ret type gen failed\n"), -1); } + delete visitor; + + *os << "operator[] (CORBA::ULong index);" << be_nl; + + *os << "// in, inout, out, _retn " << be_nl; + // the return types of in, out, inout, and _retn are based on the parameter + // passing rules and the base type + *os << "const " << node->local_name () << " &in (void) const;" << be_nl; + *os << node->local_name () << " &inout (void);" << be_nl; + *os << node->local_name () << " *&out (void);" << be_nl; + *os << node->local_name () << " *_retn (void);" << be_nl; + + // generate an additional member function that returns the underlying pointer + *os << node->local_name () << " *ptr (void) const;\n"; + + *os << "\n"; + os->decr_indent (); - os.gen_endif (); + // generate the private section + *os << "private:\n"; + os->incr_indent (); + *os << node->local_name () << " *ptr_;\n"; - // generate the ifdefined macro for the var type - os.gen_ifdef_macro (node->flatname (), "_out"); + os->decr_indent (); + *os << "};\n\n"; + + return 0; +} + +// generate the _out definition +int +be_visitor_sequence_ch::gen_out_defn (be_sequence *node) +{ + TAO_OutStream *os; // output stream + char namebuf [NAMEBUFSIZE]; // to hold the _out name + be_type *bt; // base type - if (node->gen_out_defn () == -1) + ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE); + ACE_OS::sprintf (namebuf, "%s_out", node->local_name ()->get_string ()); + os = this->ctx_->stream (); + + // retrieve base type + bt = be_type::narrow_from_decl (node->base_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_ch::" + "gen_out_defn - " + "Bad base type\n"), + -1); + } + + // generate the out definition (always in the client header) + os->indent (); // start with whatever was our current indent level + + *os << "class " << namebuf << be_nl; + *os << "{" << be_nl; + *os << "public:\n"; + os->incr_indent (); + + // No default constructor + + // constructor from a pointer + *os << namebuf << " (" << node->local_name () << " *&);" << be_nl; + // constructor from a _var & + *os << namebuf << " (" << node->local_name () << "_var &);" << be_nl; + // constructor from a _out & + *os << namebuf << " (" << namebuf << " &);" << be_nl; + // assignment operator from a _out & + *os << namebuf << " &operator= (" << namebuf << " &);" << be_nl; + // assignment operator from a pointer &, cast operator, ptr fn, operator + // -> and any other extra operators + // assignment + *os << namebuf << " &operator= (" << node->local_name () << " *);" << be_nl; + // operator () + *os << "operator " << node->local_name () << " *&();" << be_nl; + // ptr fn + *os << node->local_name () << " *&ptr (void);" << be_nl; + // operator -> + *os << node->local_name () << " *operator-> (void);" << be_nl; + + // overloaded [] operator only for sequence. The const version is not + // required + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_SEQELEM_RETTYPE_CH); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_ch::" + "gen_out_defn - " + "Bad visitor\n"), -1); + } + + if (bt->accept (visitor) == -1) { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_sequence::" - "gen_client_header - " - "codegen for _out failed\n"), + "gen_var_defn - " + "[] ret type gen failed\n"), + -1); + } + delete visitor; + *os << "operator[] (CORBA::ULong index);" << be_nl; + *os << "\n"; + os->decr_indent (); + *os << "private:\n"; + os->incr_indent (); + + *os << node->local_name () << " *&ptr_;" << be_nl; + *os << "// assignment from T_var not allowed" << be_nl; + *os << "void operator= (const " << node->local_name () << "_var &);\n"; + + os->decr_indent (); + *os << "};\n\n"; + + return 0; +} + +// *********************************************************** +// sequence visitor for inline generation +// *********************************************************** + + +be_visitor_sequence_ci::be_visitor_sequence_ci (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_sequence_ci::~be_visitor_sequence_ci (void) +{ +} + +be_visitor_sequence_ci::visit_sequence (be_sequence *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + + // all we do is generate the _var and _out implementations + if (this->gen_var_impl (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_ci::" + "visit_sequence - " + "codegen for _var failed\n"), -1); + } + + if (this->gen_out_impl (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_ci::" + "visit_sequence - " + "codegen for _out failed\n"), -1); + } + + return 0; +} + +int +be_visitor_sequence_ci::gen_var_impl (be_sequence *node) +{ + TAO_OutStream *os; // output stream + char fname [NAMEBUFSIZE]; // to hold the full and + char lname [NAMEBUFSIZE]; // local _var names + be_type *bt; // base type + + + ACE_OS::memset (fname, '\0', NAMEBUFSIZE); + ACE_OS::sprintf (fname, "%s_var", node->fullname ()); + + ACE_OS::memset (lname, '\0', NAMEBUFSIZE); + ACE_OS::sprintf (lname, "%s_var", node->local_name ()->get_string ()); + + os = this->ctx_->stream (); + + // retrieve base type + bt = be_type::narrow_from_decl (node->base_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_ci::" + "visit_sequence - " + "Bad element type\n"), -1); + } + + // generate the var implementation in the inline file + os->indent (); // start with whatever was our current indent level + + *os << "// *************************************************************" + << be_nl; + *os << "// Inline operations for class " << fname << be_nl; + *os << "// *************************************************************\n\n"; + + // default constr + *os << "ACE_INLINE" << be_nl + << fname << "::" << lname + << " (void) // default constructor" << be_nl + << "\t" << ": ptr_ (0)" << be_nl + << "{}\n\n"; + + // constr from a _ptr + os->indent (); + *os << "ACE_INLINE" << be_nl; + *os << fname << "::" << lname << " (" << node->name () << " *p)" << be_nl; + *os << "\t: ptr_ (p)" << be_nl; + *os << "{}\n\n"; + + // copy constructor + os->indent (); + *os << "ACE_INLINE" << be_nl; + *os << fname << "::" << lname << " (const " << fname << + " &p) // copy constructor" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "if (p.ptr_)" << be_nl; + *os << "\tthis->ptr_ = new " << node->name () << "(*p.ptr_);" << be_nl; + *os << "else" << be_nl; + *os << "\tthis->ptr_ = 0;\n"; + os->decr_indent (); + *os << "}\n\n"; + + // destructor + os->indent (); + *os << "ACE_INLINE" << be_nl; + *os << fname << "::~" << lname << " (void) // destructor" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "delete this->ptr_;\n"; + os->decr_indent (); + *os << "}\n\n"; + + // assignment operator from a pointer + os->indent (); + *os << "ACE_INLINE " << fname << " &" << be_nl; + *os << fname << "::operator= (" << node->name () << + " *p)" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "delete this->ptr_;" << be_nl; + *os << "this->ptr_ = p;" << be_nl; + *os << "return *this;\n"; + os->decr_indent (); + *os << "}\n\n"; + + // assignment operator from _var + os->indent (); + *os << "ACE_INLINE " << fname << " &" << be_nl; + *os << fname << "::operator= (const " << fname << + " &p) // deep copy" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "if (this != &p)" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "delete this->ptr_;" << be_nl; + *os << "this->ptr_ = new " << node->name () << " (*p.ptr_);\n"; + os->decr_indent (); + *os << "}" << be_nl; + *os << "return *this;\n"; + os->decr_indent (); + *os << "}\n\n"; + + // two arrow operators + os->indent (); + *os << "ACE_INLINE const " << node->name () << " *" << be_nl; + *os << fname << "::operator-> (void) const" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "return this->ptr_;\n"; + os->decr_indent (); + *os << "}\n\n"; + + os->indent (); + *os << "ACE_INLINE " << node->name () << " *" << be_nl; + *os << fname << "::operator-> (void)" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "return this->ptr_;\n"; + os->decr_indent (); + *os << "}\n\n"; + + // other extra methods - 3 cast operator () + os->indent (); + *os << "ACE_INLINE " << be_nl; + *os << fname << "::operator const " << node->name () << + " &() const // cast" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "return *this->ptr_;\n"; + os->decr_indent (); + *os << "}\n\n"; + + os->indent (); + *os << "ACE_INLINE " << be_nl; + *os << fname << "::operator " << node->name () << " &() // cast " << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "return *this->ptr_;\n"; + os->decr_indent (); + *os << "}\n\n"; + + os->indent (); + *os << "ACE_INLINE " << be_nl; + *os << fname << "::operator " << node->name () << " &() const// cast " << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "return *this->ptr_;\n"; + os->decr_indent (); + *os << "}\n\n"; + + // operator [] + os->indent (); + *os << "ACE_INLINE "; + + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_SEQELEM_RETTYPE_CI); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_ci::" + "gen_var_impl - " + "Bad visitor\n"), -1); + } + + if (bt->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_ci::" + "gen_var_impl - " + "[] ret type gen failed\n"), + -1); + } + delete visitor; + + *os << be_nl; + *os << fname << "::operator[] (CORBA::ULong index)" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "return this->ptr_->operator[] (index);\n"; + os->decr_indent (); + *os << "}\n\n"; + + // in, inout, out, and _retn + os->indent (); + *os << "ACE_INLINE const " << node->name () << " &" << be_nl; + *os << fname << "::in (void) const" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "return *this->ptr_;\n"; + os->decr_indent (); + *os << "}\n\n"; + + os->indent (); + *os << "ACE_INLINE " << node->name () << " &" << be_nl; + *os << fname << "::inout (void)" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "return *this->ptr_;\n"; + os->decr_indent (); + *os << "}\n\n"; + + os->indent (); + *os << "// mapping for variable size " << be_nl; + *os << "ACE_INLINE " << node->name () << " *&" << be_nl; + *os << fname << "::out (void)" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "delete this->ptr_;" << be_nl; + *os << "this->ptr_ = 0;" << be_nl; + *os << "return this->ptr_;\n"; + os->decr_indent (); + *os << "}\n\n"; + + os->indent (); + *os << "ACE_INLINE " << node->name () << " *" << be_nl; + *os << fname << "::_retn (void)" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << node->name () << " *tmp = this->ptr_;" << be_nl; + *os << "this->ptr_ = 0;" << be_nl; + *os << "return tmp;\n"; + os->decr_indent (); + *os << "}\n\n"; + + // the additional ptr () member function + os->indent (); + *os << "ACE_INLINE " << node->name () << " *" << be_nl; + *os << fname << "::ptr (void) const" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "return this->ptr_;\n"; + os->decr_indent (); + *os << "}\n\n"; + + return 0; +} + +int +be_visitor_sequence_ci::gen_out_impl (be_sequence *node) +{ + TAO_OutStream *os; // output stream + char fname [NAMEBUFSIZE]; // to hold the full and + char lname [NAMEBUFSIZE]; // local _out names + be_type *bt; // base type + + + ACE_OS::memset (fname, '\0', NAMEBUFSIZE); + ACE_OS::sprintf (fname, "%s_out", node->fullname ()); + + ACE_OS::memset (lname, '\0', NAMEBUFSIZE); + ACE_OS::sprintf (lname, "%s_out", node->local_name ()->get_string ()); + + os = this->ctx_->stream (); + + // retrieve base type + bt = be_type::narrow_from_decl (node->base_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_ci::" + "gen_out_impl - " + "Bad element type\n"), -1); + } + + // generate the out implementation in the inline file + + os->indent (); // start with whatever was our current indent level + + *os << "// *************************************************************" + << be_nl; + *os << "// Inline operations for class " << fname << be_nl; + *os << "// *************************************************************\n\n"; + + // constr from a pointer + os->indent (); + *os << "ACE_INLINE" << be_nl; + *os << fname << "::" << lname << " (" << node->name () << " *&p)" << be_nl; + *os << "\t: ptr_ (p)" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "this->ptr_ = 0;\n"; + os->decr_indent (); + *os << "}\n\n"; + + // constructor from _var & + os->indent (); + *os << "ACE_INLINE" << be_nl; + *os << fname << "::" << lname << " (" << node->name () << + "_var &p) // constructor from _var" << be_nl; + *os << "\t: ptr_ (p.out ())" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "delete this->ptr_;" << be_nl; + *os << "this->ptr_ = 0;\n"; + os->decr_indent (); + *os << "}\n\n"; + + // copy constructor + os->indent (); + *os << "ACE_INLINE" << be_nl; + *os << fname << "::" << lname << " (" << fname << + " &p) // copy constructor" << be_nl; + *os << "\t: ptr_ (p.ptr_)" << be_nl; + *os << "{}\n\n"; + + // assignment operator from _out & + os->indent (); + *os << "ACE_INLINE " << fname << " &" << be_nl; + *os << fname << "::operator= (" << fname << + " &p)" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "this->ptr_ = p.ptr_;" << be_nl; + *os << "return *this;\n"; + os->decr_indent (); + *os << "}\n\n"; + + // assignment from _var is not allowed by a private declaration + + // assignment operator from pointer + os->indent (); + *os << "ACE_INLINE " << fname << " &" << be_nl; + *os << fname << "::operator= (" << node->name () << + " *p)" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "this->ptr_ = p;" << be_nl; + *os << "return *this;\n"; + os->decr_indent (); + *os << "}\n\n"; + + // other extra methods - cast operator () + os->indent (); + *os << "ACE_INLINE " << be_nl; + *os << fname << "::operator " << node->name () << + " *&() // cast" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "return this->ptr_;\n"; + os->decr_indent (); + *os << "}\n\n"; + + // ptr function + os->indent (); + *os << "ACE_INLINE " << node->name () << " *&" << be_nl; + *os << fname << "::ptr (void) // ptr" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "return this->ptr_;\n"; + os->decr_indent (); + *os << "}\n\n"; + + // operator -> + os->indent (); + *os << "ACE_INLINE " << node->name () << " *" << be_nl; + *os << fname << "::operator-> (void)" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "return this->ptr_;\n"; + os->decr_indent (); + *os << "}\n\n"; + + // sequence has an additional method + os->indent (); + *os << "ACE_INLINE "; + + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_SEQELEM_RETTYPE_CI); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_ci::" + "gen_out_impl - " + "Bad visitor\n"), -1); + } + + if (bt->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_ci::" + "gen_out_impl - " + "[] ret type gen failed\n"), + -1); + } + delete visitor; + + *os << be_nl; + *os << fname << "::operator[] (CORBA::ULong index)" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "return this->ptr_->operator[] (index);\n"; + os->decr_indent (); + *os << "}\n\n"; + + return 0; +} + +// ************************************************************ +// Root visitor for client stub class +// ************************************************************ + +be_visitor_sequence_cs::be_visitor_sequence_cs (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_sequence_cs::~be_visitor_sequence_cs (void) +{ +} + +// XXXASG - this method is same as that in the _ch visitor. So we need some +// abstraction for this + +int +be_visitor_sequence_cs::gen_base_sequence_class (be_sequence *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + be_type *bt; + + // retrieve the base type since we may need to do some code + // generation for the base type. + bt = be_type::narrow_from_decl (node->base_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_cs::" + "gen_base_sequence_class - " + "Bad element type\n"), -1); + } + + // generate the appropriate sequence type + switch (node->managed_type ()) + { + case be_sequence::MNG_OBJREF: // sequence of objrefs + if (node->unbounded ()) + *os << "TAO_Unbounded_Object_Sequence<"; + else + *os << "TAO_Bounded_Object_Sequence<"; + break; + case be_sequence::MNG_STRING: // sequence of strings + if (node->unbounded ()) + *os << "TAO_Unbounded_String_Sequence"; + else + *os << "TAO_Bounded_String_Sequence<"; + break; + default: // not a managed type + if (node->unbounded ()) + *os << "TAO_Unbounded_Sequence<"; + else + *os << "TAO_Bounded_Sequence<"; + break; + } + + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CS); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + + if (bt->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_cs::" + "visit_sequence - " + "base type visit failed\n"), -1); } - os.gen_endif (); + delete visitor; + + // find out if the sequence is of a managed type and if it is bounded or not + if (node->managed_type () == be_sequence::MNG_STRING) + { + if (!node->unbounded ()) + { + *os << "<" << node->max_size () << ">"; + } + } + else + { + if (node->unbounded ()) + { + *os << ">"; + } + else + { + *os << ", " << node->max_size () << ">"; + } + } + return 0; +} + +int be_visitor_sequence_cs::visit_sequence (be_sequence *node) +{ + // generate the constructors + be_type *bt; // type node + TAO_OutStream *os = this->ctx_->stream (); + + // generate the ifdefined macro for the sequence type + os->gen_ifdef_macro (node->flatname ()); + + os->indent (); // start with the current indentation level + + // retrieve the base type since we may need to do some code + // generation for the base type. + bt = be_type::narrow_from_decl (node->base_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_cs::" + "visit_sequence - " + "Bad element type\n"), -1); + } + + *os << "// *************************************************************" + << be_nl + << "// " << node->name () << be_nl + << "// *************************************************************" + << be_nl << be_nl; + + // default constructor + *os << node->name () << "::" << node->local_name () << " (void)" << be_nl + << "{}" << be_nl; + + // for unbounded sequences, we have a different set of constructors + if (node->unbounded ()) + { + *os << node->name () << "::" << node->local_name () + << " (CORBA::ULong max) // uses max size" << be_nl + << " : "; + // pass it to the base constructor + if (this->gen_base_sequence_class (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_cs::" + "visit_sequence - " + "codegen for base sequence class\n"), -1); + } + *os << " (max)" << be_nl + << "{}" << be_nl; + } + + // constructor with the buffer + *os << node->name () << "::" << node->local_name () << " ("; + if (node->unbounded ()) + { + *os << "CORBA::ULong max, "; // unbounded seq takes this extra parameter + } + *os << "CORBA::ULong length, "; + // generate the base type for the buffer + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_SEQUENCE_BUFFER_TYPE_CS); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_ch::" + "visit_sequence - " + "Bad visitor\n"), -1); + } + + if (bt->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_ch::" + "visit_sequence - " + "base type visit failed\n"), + -1); + } + delete visitor; + *os << " *buffer, CORBA::Boolean release)" << be_nl + << " : "; + // pass it to the base constructor + if (this->gen_base_sequence_class (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_cs::" + "visit_sequence - " + "codegen for base sequence class\n"), -1); + } + *os << " ("; + if (node->unbounded ()) + { + *os << "max, "; + } + *os << "length, buffer, release)" << be_nl + << "{}" << be_nl; + + // copy constructor + *os << node->name () << "::" << node->local_name () + << " (const " << node->local_name () + << " &seq) // copy ctor" << be_nl + << " : "; + // pass it to the base constructor + if (this->gen_base_sequence_class (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_cs::" + "visit_sequence - " + "codegen for base sequence class\n"), -1); + } + *os << " (seq)" << be_nl + << "{}" << be_nl; + + // destructor + *os << node->name () << "::~" << node->local_name () + << " (void) // dtor" << be_nl + << "{}" << be_nl << be_nl; + + // generate the typecode information here + os->indent (); // start from current indentation level + *os << "static const CORBA::Long _oc_" << node->flatname () << "_seq[] =" + << be_nl; + *os << "{\n"; + os->incr_indent (0); + if (node->gen_encapsulation () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_sequence::" + "gen_client_stubs - " + "codegen for encapsulation failed\n"), + -1); + } + + os->decr_indent (); + *os << "};" << be_nl; + + *os << "static CORBA::TypeCode _tc__tc_" << node->flatname () + << "_seq (CORBA::tk_sequence, sizeof (_oc_" << node->flatname () + << "_seq), (unsigned char *) &_oc_" << node->flatname () + << "_seq, CORBA::B_FALSE);" << be_nl; + *os << "CORBA::TypeCode_ptr " << node->tc_name () << "_seq = &_tc__tc_" + << node->flatname () << "_seq;\n\n"; + os->gen_endif (); return 0; } @@ -179,157 +1142,263 @@ int be_visitor_sequence_ch::visit_sequence (be_sequence *node) // each sequence type. // **************************************************************** -be_visitor_sequence_base_ch:: -be_visitor_sequence_base_ch (TAO_OutStream *stream, - be_decl *sequence_scope, - be_type *base_type) +be_visitor_sequence_base:: +be_visitor_sequence_base (be_visitor_context *ctx) + : be_visitor_decl (ctx) { - this->os_ = stream; - this->be_node (sequence_scope); - this->current_type_ = base_type; } -be_visitor_sequence_base_ch::~be_visitor_sequence_base_ch (void) +be_visitor_sequence_base::~be_visitor_sequence_base (void) { } -be_decl * -be_visitor_sequence_base_ch::seq_scope (void) +int +be_visitor_sequence_base::visit_predefined_type (be_predefined_type *node) { - if (this->node_ == 0) - return 0; + TAO_OutStream *os = this->ctx_->stream (); + *os << node->name (); + return 0; +} + +// helper +int +be_visitor_sequence_base::visit_node (be_type *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + be_type *bt; - be_decl *scope = 0; - if (this->node_->is_nested ()) - scope = be_scope::narrow_from_scope (this->node_->defined_in ())->decl (); - return scope; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (this->ctx_->state () == TAO_CodeGen::TAO_SEQUENCE_BASE_CH) + *os << bt->nested_type_name (this->ctx_->scope ()); + else + *os << bt->name (); + return 0; } int -be_visitor_sequence_base_ch::visit_predefined_type (be_predefined_type *node) +be_visitor_sequence_base::visit_sequence (be_sequence *node) { - TAO_OutStream &os = this->stream (); - switch (node->pt ()) - { - case AST_PredefinedType::PT_pseudo: - os << "CORBA::Object"; - default: - os << node->name (); - } + return this->visit_node (node); +} + +int +be_visitor_sequence_base::visit_interface (be_interface *node) +{ + return this->visit_node (node); +} + +int +be_visitor_sequence_base::visit_interface_fwd (be_interface_fwd *node) +{ + return this->visit_node (node); +} + +int +be_visitor_sequence_base::visit_string (be_string *) +{ + // NO-OP, we have ad-hoc classes from strings. return 0; } int -be_visitor_sequence_base_ch::visit_sequence (be_sequence *node) +be_visitor_sequence_base::visit_structure (be_structure *node) +{ + return this->visit_node (node); +} + +int +be_visitor_sequence_base::visit_union (be_union *node) { return this->visit_node (node); } +int +be_visitor_sequence_base::visit_enum (be_enum *node) +{ + return this->visit_node (node); +} + +int +be_visitor_sequence_base::visit_array (be_array *node) +{ + return this->visit_node (node); +} + +int +be_visitor_sequence_base::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); // set the alias node + return node->primitive_base_type ()->accept (this); +} + +// **************************************************************** +// We have to generate the buffer type in the constructor +// **************************************************************** + +be_visitor_sequence_buffer_type:: +be_visitor_sequence_buffer_type (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_sequence_buffer_type::~be_visitor_sequence_buffer_type (void) +{ +} + // helper int -be_visitor_sequence_base_ch::visit_node (be_type *) +be_visitor_sequence_buffer_type::visit_node (be_type *node) { - TAO_OutStream &os = this->stream (); - os << this->current_type_->nested_type_name (this->seq_scope ()); + TAO_OutStream *os = this->ctx_->stream (); + be_type *bt; + + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (this->ctx_->state () == TAO_CodeGen::TAO_SEQUENCE_BUFFER_TYPE_CH) + *os << bt->nested_type_name (this->ctx_->scope ()); + else + *os << bt->name (); return 0; } int -be_visitor_sequence_base_ch::visit_interface (be_interface *) +be_visitor_sequence_buffer_type::visit_predefined_type (be_predefined_type *node) { - TAO_OutStream &os = this->stream (); - os << this->current_type_->nested_type_name (this->seq_scope ()); + TAO_OutStream *os = this->ctx_->stream (); + if (node->pt () == AST_PredefinedType::PT_pseudo) + *os << node->name () << "_ptr"; + else + *os << node->name (); return 0; } int -be_visitor_sequence_base_ch::visit_interface_fwd (be_interface_fwd *) +be_visitor_sequence_buffer_type::visit_sequence (be_sequence *node) +{ + return this->visit_node (node); +} + +int +be_visitor_sequence_buffer_type::visit_interface (be_interface *node) { - TAO_OutStream &os = this->stream (); - os << this->current_type_->nested_type_name (this->seq_scope ()); + TAO_OutStream *os = this->ctx_->stream (); + if (this->ctx_->state () == TAO_CodeGen::TAO_SEQUENCE_BUFFER_TYPE_CH) + *os << node->nested_type_name (this->ctx_->scope (), "_ptr"); + else + *os << node->name () << "_ptr"; return 0; } int -be_visitor_sequence_base_ch::visit_string (be_string * ) +be_visitor_sequence_buffer_type::visit_interface_fwd (be_interface_fwd *node) { - // NO-OP, we have ad-hoc classes from strings. + TAO_OutStream *os = this->ctx_->stream (); + if (this->ctx_->state () == TAO_CodeGen::TAO_SEQUENCE_BUFFER_TYPE_CH) + *os << node->nested_type_name (this->ctx_->scope (), "_ptr"); + else + *os << node->name () << "_ptr"; + return 0; +} + +int +be_visitor_sequence_buffer_type::visit_string (be_string *) +{ + TAO_OutStream *os = this->ctx_->stream (); + *os << "char *"; return 0; } int -be_visitor_sequence_base_ch::visit_structure (be_structure *node) +be_visitor_sequence_buffer_type::visit_structure (be_structure *node) { return this->visit_node (node); } int -be_visitor_sequence_base_ch::visit_union (be_union *node) +be_visitor_sequence_buffer_type::visit_union (be_union *node) { return this->visit_node (node); } int -be_visitor_sequence_base_ch::visit_enum (be_enum *node) +be_visitor_sequence_buffer_type::visit_enum (be_enum *node) { return this->visit_node (node); } int -be_visitor_sequence_base_ch::visit_array (be_array *node) +be_visitor_sequence_buffer_type::visit_array (be_array *node) { return this->visit_node (node); } int -be_visitor_sequence_base_ch::visit_typedef (be_typedef *node) +be_visitor_sequence_buffer_type::visit_typedef (be_typedef *node) { + this->ctx_->alias (node); // set the alias node return node->primitive_base_type ()->accept (this); } // *********************************************************** -// sequence element type visitor for return typs of [] methods +// sequence element type visitor for return types of [] methods // *********************************************************** be_visitor_sequence_elemtype:: -be_visitor_sequence_elemtype (TAO_OutStream *stream, - be_decl *sequence_scope, - be_type *base_type) +be_visitor_sequence_elemtype (be_visitor_context *ctx) + : be_visitor_decl (ctx) { - this->os_ = stream; - this->be_node (sequence_scope); - this->current_type_ = base_type; } be_visitor_sequence_elemtype::~be_visitor_sequence_elemtype (void) { } -be_decl * -be_visitor_sequence_elemtype::seq_scope (void) +// helper +int +be_visitor_sequence_elemtype::visit_node (be_type *node) { - if (this->node_ == 0) - return 0; + TAO_OutStream *os = this->ctx_->stream (); + be_type *bt; + + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; - be_decl *scope = 0; - if (this->node_->is_nested ()) - scope = be_scope::narrow_from_scope (this->node_->defined_in ())->decl (); - return scope; + if (this->ctx_->state () == TAO_CodeGen::TAO_SEQELEM_RETTYPE_CH) + *os << bt->nested_type_name (this->ctx_->scope ()) << " &"; + else + *os << bt->name () << " &"; + return 0; } int be_visitor_sequence_elemtype::visit_predefined_type (be_predefined_type *node) { - TAO_OutStream &os = this->stream (); + TAO_OutStream *os = this->ctx_->stream (); + be_type *bt; + + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + switch (node->pt ()) { case AST_PredefinedType::PT_pseudo: - os << "TAO_Object_Manager<CORBA::Object> "; + *os << "TAO_Object_Manager<" << bt->name () << "> "; break; default: - os << this->current_type_->name () << " &"; + *os << bt->name () << " &"; } return 0; } @@ -340,39 +1409,40 @@ be_visitor_sequence_elemtype::visit_sequence (be_sequence *node) return this->visit_node (node); } -// helper int -be_visitor_sequence_elemtype::visit_node (be_type *) +be_visitor_sequence_elemtype::visit_interface (be_interface *node) { - TAO_OutStream &os = this->stream (); + TAO_OutStream *os = this->ctx_->stream (); + be_type *bt; - if (os.stream_type () == TAO_OutStream::TAO_CLI_HDR) - os << this->current_type_->nested_type_name (this->seq_scope ()) << " &"; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); else - os << this->current_type_->name () << " &"; - return 0; -} + bt = node; -int -be_visitor_sequence_elemtype::visit_interface (be_interface *) -{ - TAO_OutStream &os = this->stream (); - os << "TAO_Object_Manager <" - << this->current_type_->nested_type_name (this->seq_scope ()) - << " > "; + *os << "TAO_Object_Manager <" + << bt->nested_type_name (this->ctx_->scope ()) + << " > "; return 0; } int -be_visitor_sequence_elemtype::visit_interface_fwd (be_interface_fwd *) +be_visitor_sequence_elemtype::visit_interface_fwd (be_interface_fwd *node) { - TAO_OutStream &os = this->stream (); + TAO_OutStream *os = this->ctx_->stream (); + be_type *bt; + + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + - os << "TAO_Object_Manager <" - << this->current_type_->nested_type_name (this->seq_scope ()) - << " > "; + *os << "TAO_Object_Manager <" + << bt->nested_type_name (this->ctx_->scope ()) + << " > "; return 0; } @@ -380,9 +1450,9 @@ be_visitor_sequence_elemtype::visit_interface_fwd (be_interface_fwd *) int be_visitor_sequence_elemtype::visit_string (be_string *) { - TAO_OutStream &os = this->stream (); + TAO_OutStream *os = this->ctx_->stream (); - os << "TAO_String_Manager "; + *os << "TAO_String_Manager "; return 0; } @@ -413,11 +1483,6 @@ be_visitor_sequence_elemtype::visit_array (be_array *node) int be_visitor_sequence_elemtype::visit_typedef (be_typedef *node) { + this->ctx_->alias (node); return node->primitive_base_type ()->accept (this); } - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Singleton<be_visitor_sequence_ch, ACE_SYNCH_RECURSIVE_MUTEX>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Singleton<be_visitor_sequence_ch, ACE_SYNCH_RECURSIVE_MUTEX> -#endif diff --git a/TAO/TAO_IDL/be/be_visitor_structure.cpp b/TAO/TAO_IDL/be/be_visitor_structure.cpp new file mode 100644 index 00000000000..2c40ffa194d --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_structure.cpp @@ -0,0 +1,290 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_structure.cpp +// +// = DESCRIPTION +// Visitors for generation of code for Structure +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_structure.h" + +// generic struct visitor +be_visitor_structure::be_visitor_structure (be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_structure::~be_visitor_structure (void) +{ +} + +// visit the Structure node and its scope +int +be_visitor_structure::visit_structure (be_structure *node) +{ + return -1; // must be overriden +} + +int +be_visitor_structure::visit_field (be_field *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_STRUCT_CH: + ctx.state (TAO_CodeGen::TAO_FIELD_CH); + break; + case TAO_CodeGen::TAO_STRUCT_CI: + ctx.state (TAO_CodeGen::TAO_FIELD_CI); + break; + case TAO_CodeGen::TAO_STRUCT_CS: + ctx.state (TAO_CodeGen::TAO_FIELD_CS); + break; + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_structure::" + "visit_field - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_structure::" + "visit_field - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_structure::" + "visit_field - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// ****************************************************** +// for client header +// ****************************************************** + +be_visitor_structure_ch::be_visitor_structure_ch (be_visitor_context *ctx) + : be_visitor_structure (ctx) +{ +} + +be_visitor_structure_ch::~be_visitor_structure_ch (void) +{ +} + +// visit the Structure node and its scope +int be_visitor_structure_ch::visit_structure (be_structure *node) +{ + TAO_OutStream *os; // output stream + + if (!node->cli_hdr_gen ()) // not already generated + { + os = this->ctx_->stream (); + + os->indent (); // start from whatever indentation level we were at + *os << "struct " << node->local_name () << be_nl + << "{\n" << be_idt; + + // generate code for field members + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_structure_ch::" + "visit_structure - " + "codegen for scope failed\n"), -1); + } + + os->decr_indent (); + *os << "};\n\n"; + + // generate var defn + if (node->gen_var_defn () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_structure_ch::" + "visit_structure - " + "codegen for _var failed\n"), -1); + } + + // a class is generated for an out defn only for a variable length struct + if (node->size_type () == be_decl::VARIABLE) + { + if (node->gen_out_defn () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_structure_ch::" + "visit_structure - " + "codegen for _out failed\n"), -1); + } + } + else + { + os->indent (); + *os << "typedef " << node->local_name () << " &" << node->local_name + () << "_out;\n\n"; + } + + // generate the typecode decl + if (node->is_nested ()) + { + // we have a scoped name + os->indent (); + + *os << "static CORBA::TypeCode_ptr " << node->tc_name + ()->last_component () << ";\n\n"; + } + else + { + // we are in the ROOT scope + os->indent (); + *os << "extern CORBA::TypeCode_ptr " << node->tc_name + ()->last_component () << ";\n\n"; + } + node->cli_hdr_gen (I_TRUE); + } + return 0; +} + +// ****************************************************** +// for client inline +// ****************************************************** + +be_visitor_structure_ci::be_visitor_structure_ci (be_visitor_context *ctx) + : be_visitor_structure (ctx) +{ +} + +be_visitor_structure_ci::~be_visitor_structure_ci (void) +{ +} + +// visit the Structure node and its scope +int be_visitor_structure_ci::visit_structure (be_structure *node) +{ + if (!node->cli_inline_gen ()) + { + if (node->gen_var_impl () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_structure_ci::" + "visit_structure - " + "codegen for _var failed\n"), -1); + } + if (node->size_type () == be_decl::VARIABLE && + node->gen_out_impl () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_structure_ci::" + "visit_structure - " + "codegen for _out failed\n"), -1); + } + // all we have to do is to visit the scope + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_structure_ci::" + "visit_structure - " + "codegen for scope failed\n"), -1); + } + node->cli_inline_gen (I_TRUE); + } + return 0; +} + +// for client stubs +be_visitor_structure_cs::be_visitor_structure_cs (be_visitor_context *ctx) + : be_visitor_structure (ctx) +{ +} + +be_visitor_structure_cs::~be_visitor_structure_cs (void) +{ +} + +// visit the Structure_Cs node and its scope +int be_visitor_structure_cs::visit_structure (be_structure *node) +{ + TAO_OutStream *os; // output stream + + if (!node->cli_stub_gen ()) + { + os = this->ctx_->stream (); + + // generate the typecode information here + os->indent (); // start from current indentation level + *os << "static const CORBA::Long _oc_" << node->flatname () << "[] =" << + be_nl; + *os << "{\n"; + os->incr_indent (0); + // note that we just need the parameters here and hence we generate the + // encapsulation for the parameters + if (node->gen_encapsulation () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_structure_cs::" + "visit_structure - " + "codegen for typecode failed\n"), -1); + } + os->decr_indent (); + *os << "};" << be_nl; + + *os << "static CORBA::TypeCode _tc__tc_" << node->flatname () << + " (CORBA::tk_struct, sizeof (_oc_" << node->flatname () << + "), (unsigned char *) &_oc_" << node->flatname () << + ", CORBA::B_FALSE);" << be_nl; + *os << "CORBA::TypeCode_ptr " << node->tc_name () << " = &_tc__tc_" << + node->flatname () << ";\n\n"; + + // do any code generation required for the scope members + // all we have to do is to visit the scope + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_structure_cs::" + "visit_structure - " + "codegen for scope failed\n"), -1); + } + node->cli_stub_gen (I_TRUE); + } + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_typedef.cpp b/TAO/TAO_IDL/be/be_visitor_typedef.cpp new file mode 100644 index 00000000000..af9f996eacf --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_typedef.cpp @@ -0,0 +1,1117 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_typedef.cpp +// +// = DESCRIPTION +// Visitors for generation of code for Typedef +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_typedef.h" + +// ****************************************************** +// Generic Typedef visitor +// ****************************************************** + +be_visitor_typedef::be_visitor_typedef (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_typedef::~be_visitor_typedef (void) +{ +} + +// visit the Typedef node and its scope +int be_visitor_typedef::visit_typedef (be_typedef *node) +{ + return -1; // must be overridden +} + +// =all common visit methods for typedef visitor + +// visit a array +int +be_visitor_typedef::visit_array (be_array *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_TYPEDEF_CH: + ctx.state (TAO_CodeGen::TAO_ARRAY_CH); + break; + case TAO_CodeGen::TAO_TYPEDEF_CS: + ctx.state (TAO_CodeGen::TAO_ARRAY_CS); + break; + case TAO_CodeGen::TAO_TYPEDEF_CI: + ctx.state (TAO_CodeGen::TAO_ARRAY_CI); + break; + case TAO_CodeGen::TAO_TYPEDEF_SH: + case TAO_CodeGen::TAO_TYPEDEF_SI: + case TAO_CodeGen::TAO_TYPEDEF_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef::" + "visit_array - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef::" + "visit_array - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef::" + "visit_array - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +//visit an enum +int +be_visitor_typedef::visit_enum (be_enum *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_TYPEDEF_CH: + ctx.state (TAO_CodeGen::TAO_ENUM_CH); + break; + case TAO_CodeGen::TAO_TYPEDEF_CS: + ctx.state (TAO_CodeGen::TAO_ENUM_CS); + break; + case TAO_CodeGen::TAO_TYPEDEF_CI: + case TAO_CodeGen::TAO_TYPEDEF_SH: + case TAO_CodeGen::TAO_TYPEDEF_SI: + case TAO_CodeGen::TAO_TYPEDEF_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef::" + "visit_enum - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef::" + "visit_enum - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef::" + "visit_enum - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// visit an predefined type +int +be_visitor_typedef::visit_predefined_type (be_predefined_type *node) +{ + return 0; +} + +// visit an sequence +int +be_visitor_typedef::visit_sequence (be_sequence *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_TYPEDEF_CH: + ctx.state (TAO_CodeGen::TAO_SEQUENCE_CH); + break; + case TAO_CodeGen::TAO_TYPEDEF_CI: + ctx.state (TAO_CodeGen::TAO_SEQUENCE_CI); + break; + case TAO_CodeGen::TAO_TYPEDEF_CS: + ctx.state (TAO_CodeGen::TAO_SEQUENCE_CS); + break; + case TAO_CodeGen::TAO_TYPEDEF_SH: + case TAO_CodeGen::TAO_TYPEDEF_SI: + case TAO_CodeGen::TAO_TYPEDEF_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef::" + "visit_sequence - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef::" + "visit_sequence - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef::" + "visit_sequence - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// visit an structure +int +be_visitor_typedef::visit_string (be_string *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_TYPEDEF_CH: + ctx.state (TAO_CodeGen::TAO_STRUCT_CH); + break; + case TAO_CodeGen::TAO_TYPEDEF_CI: + ctx.state (TAO_CodeGen::TAO_STRUCT_CI); + break; + case TAO_CodeGen::TAO_TYPEDEF_CS: + ctx.state (TAO_CodeGen::TAO_STRUCT_CS); + break; + case TAO_CodeGen::TAO_TYPEDEF_SH: + case TAO_CodeGen::TAO_TYPEDEF_SI: + case TAO_CodeGen::TAO_TYPEDEF_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef::" + "visit_string - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef::" + "visit_string - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef::" + "visit_string - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// visit an structure +int +be_visitor_typedef::visit_structure (be_structure *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_TYPEDEF_CH: + ctx.state (TAO_CodeGen::TAO_STRUCT_CH); + break; + case TAO_CodeGen::TAO_TYPEDEF_CI: + ctx.state (TAO_CodeGen::TAO_STRUCT_CI); + break; + case TAO_CodeGen::TAO_TYPEDEF_CS: + ctx.state (TAO_CodeGen::TAO_STRUCT_CS); + break; + case TAO_CodeGen::TAO_TYPEDEF_SH: + case TAO_CodeGen::TAO_TYPEDEF_SI: + case TAO_CodeGen::TAO_TYPEDEF_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef::" + "visit_structure - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef::" + "visit_structure - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef::" + "visit_structure - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// visit an union +int +be_visitor_typedef::visit_union (be_union *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_TYPEDEF_CH: + ctx.state (TAO_CodeGen::TAO_UNION_CH); + break; + case TAO_CodeGen::TAO_TYPEDEF_CI: + ctx.state (TAO_CodeGen::TAO_UNION_CI); + break; + case TAO_CodeGen::TAO_TYPEDEF_CS: + ctx.state (TAO_CodeGen::TAO_UNION_CS); + break; + case TAO_CodeGen::TAO_TYPEDEF_SH: + case TAO_CodeGen::TAO_TYPEDEF_SI: + case TAO_CodeGen::TAO_TYPEDEF_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef::" + "visit_union - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef::" + "visit_union - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef::" + "visit_union - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// ****************************************************** +// Typedef visitor for client header +// ****************************************************** + +be_visitor_typedef_ch::be_visitor_typedef_ch (be_visitor_context *ctx) + : be_visitor_typedef (ctx) +{ +} + +be_visitor_typedef_ch::~be_visitor_typedef_ch (void) +{ +} + +int +be_visitor_typedef_ch::visit_typedef (be_typedef *node) +{ + TAO_OutStream *os; // output stream + + os = this->ctx_->stream (); + + // In general, we may have a chain of typedefs. i.e., + // typedef sequence<long> X; + // typedef X Y; + // typedef Y Z; and so on + // The first time we will be in will be for node Z for which the code + // generation has to take place. However, it is not enough to just generate + // code that looks like - + // typedef Y Z; + // For different types (in this case we have a sequence), we will need + // typedefs for the _var and _out types for Z. If it had been an array, we + // will additionally have the _forany type as well as inlined *_alloc, _dup, + // and _free methods. + // + // Finally, we need to differentiate between the case where we were + // generating code for + // typedef sequence<long> X; and + // typedef Y Z; where Y was somehow aliased to the sequence. In the former + // case, we will need to generate all the code for sequence<long> or whatever + // the type maybe. In the latter, we just need typedefs for the type and all + // associated _var, _out, and other types. + + be_type *bt; // base type + + if (this->ctx_->tdef ()) + { + // the fact that we are here indicates that we were generating code for a + // typedef node whose base type also happens to be another typedef-ed + // (i.e. an alias) node for another (possibly alias) node + + this->ctx_->alias (node); // save this alias + + // grab the most primitive base type in the chain to avoid recusrsively + // going thru this visit method + bt = node->primitive_base_type (); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef_ch::" + "visit_typedef - " + "bad primitive base type\n" + ), -1); + } + } + else + { + // the context has not stored any "tdef" node. So we must be in here for + // the first time + this->ctx_->tdef (node); // save the typedef node + + // grab the immediate base type node + bt = be_type::narrow_from_decl (node->base_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef_ch::" + "visit_typedef - " + "bad base type\n" + ), -1); + } + } + + // accept on this base type, but generate code for the typedef node + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef_ch::" + "visit_typedef - " + "failed to accept visitor\n" + ), -1); + } + + be_typedef *tdef = this->ctx_->tdef (); + // generate the typecode decl for this typedef node + if (tdef->is_nested ()) + { + // we have a scoped name + os->indent (); + *os << "static CORBA::TypeCode_ptr " + << tdef->tc_name ()->last_component () << ";\n\n"; + } + else + { + // we are in the ROOT scope + os->indent (); + *os << "extern CORBA::TypeCode_ptr " + << tdef->tc_name ()->last_component () << ";\n\n"; + } + + return 0; +} + +int +be_visitor_typedef_ch::visit_array (be_array *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // output stream + be_typedef *tdef = this->ctx_->tdef (); // typedef node + be_decl *scope = this->ctx_->scope (); // scope in which it is used + be_type *bt; + + if (this->ctx_->alias ()) // typedef of a typedef + bt = this->ctx_->alias (); + else + bt = node; + + if (bt->node_type () == AST_Decl::NT_array) // direct typedef of a base node + // type + { + // let the base class visitor handle this case + if (this->be_visitor_typedef::visit_array (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef_ch::" + "visit_array - " + "base class visitor failed \n" + ), -1); + } + } + + // now generate the typedefs + os->indent (); + // typedef the type and the _slice type + *os << "typedef " << bt->nested_type_name (scope) + << " " << tdef->nested_type_name (scope) << ";" << be_nl; + *os << "typedef " << bt->nested_type_name (scope, "_slice") + << " " << tdef->nested_type_name (scope, "_slice") << ";" << be_nl; + // typedef the _var, _out, and _forany types + *os << "typedef " << bt->nested_type_name (scope, "_var") + << " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl; + *os << "typedef " << bt->nested_type_name (scope, "_out") + << " " << tdef->nested_type_name (scope, "_out") << ";" << be_nl; + *os << "typedef " << bt->nested_type_name (scope, "_forany") + << " " << tdef->nested_type_name (scope, "_forany") << ";" << be_nl; + // the _alloc, _dup, and free methods + *os << tdef->nested_type_name (scope, "_slice") << " *" + << tdef->nested_type_name (scope, "_alloc") << " (void);" << be_nl; + *os << tdef->nested_type_name (scope, "_slice") << " *" + << tdef->nested_type_name (scope, "_dup") << " (" + << tdef->nested_type_name (scope, "_slice") << " *slice);" << be_nl; + *os << tdef->nested_type_name (scope, "_slice") << " *" + << tdef->nested_type_name (scope, "_free") << " (" + << tdef->nested_type_name (scope, "_slice") << " *slice);" << be_nl; + return 0; +} + +int +be_visitor_typedef_ch::visit_enum (be_enum *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // output stream + be_typedef *tdef = this->ctx_->tdef (); // typedef node + be_decl *scope = this->ctx_->scope (); // scope in which it is used + be_type *bt; + + if (this->ctx_->alias ()) // typedef of a typedef + bt = this->ctx_->alias (); + else + bt = node; + + if (bt->node_type () == AST_Decl::NT_enum) // direct typedef of a base node + // type + { + // let the base class visitor handle this case + if (this->be_visitor_typedef::visit_enum (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef_ch::" + "visit_enum - " + "base class visitor failed \n" + ), -1); + } + } + + // now generate the typedefs + os->indent (); + // typedef the type and the _slice type + *os << "typedef " << bt->nested_type_name (scope) + << " " << tdef->nested_type_name (scope) << ";" << be_nl; + // typedef the _out + *os << "typedef " << bt->nested_type_name (scope, "_out") + << " " << tdef->nested_type_name (scope, "_out") << ";" << be_nl; + return 0; +} + +int +be_visitor_typedef_ch::visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // output stream + be_typedef *tdef = this->ctx_->tdef (); // typedef node + be_decl *scope = this->ctx_->scope (); // scope in which it is used + be_type *bt; + + if (this->ctx_->alias ()) // typedef of a typedef + bt = this->ctx_->alias (); + else + bt = node; + + // now generate the typedefs + os->indent (); + // typedef the type and the _slice type + *os << "typedef " << bt->nested_type_name (scope) + << " " << tdef->nested_type_name (scope) << ";" << be_nl; + // typedef the _out + *os << "typedef " << bt->nested_type_name (scope, "_out") + << " " << tdef->nested_type_name (scope, "_out") << ";" << be_nl; + return 0; +} + +int +be_visitor_typedef_ch::visit_string (be_string *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // output stream + be_typedef *tdef = this->ctx_->tdef (); // typedef node + be_decl *scope = this->ctx_->scope (); // scope in which it is used + + // now generate the typedefs + os->indent (); + // typedef the type and the _slice type + *os << "typedef char *" + << " " << tdef->nested_type_name (scope) << ";" << be_nl; + // typedef the _var, _out, and _forany types + *os << "typedef CORBA::String_var" + << " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl; + *os << "typedef CORBA::String_out" + << " " << tdef->nested_type_name (scope, "_out") << ";" << be_nl; + return 0; +} + +int +be_visitor_typedef_ch::visit_sequence (be_sequence *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // output stream + be_typedef *tdef = this->ctx_->tdef (); // typedef node + be_decl *scope = this->ctx_->scope (); // scope in which it is used + be_type *bt; + + if (this->ctx_->alias ()) // typedef of a typedef + bt = this->ctx_->alias (); + else + bt = node; + + if (bt->node_type () == AST_Decl::NT_sequence) // direct typedef of a base node + // type + { + // let the base class visitor handle this case + if (this->be_visitor_typedef::visit_sequence (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef_ch::" + "visit_sequence - " + "base class visitor failed \n" + ), -1); + } + } + else + { + // now generate the typedefs + os->indent (); + // typedef the type and the _slice type + *os << "typedef " << bt->nested_type_name (scope) + << " " << tdef->nested_type_name (scope) << ";" << be_nl; + // typedef the _var, _out types + *os << "typedef " << bt->nested_type_name (scope, "_var") + << " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl; + *os << "typedef " << bt->nested_type_name (scope, "_out") + << " " << tdef->nested_type_name (scope, "_out") << ";" << be_nl; + } + return 0; +} + +int +be_visitor_typedef_ch::visit_structure (be_structure *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // output stream + be_typedef *tdef = this->ctx_->tdef (); // typedef node + be_decl *scope = this->ctx_->scope (); // scope in which it is used + be_type *bt; + + if (this->ctx_->alias ()) // typedef of a typedef + bt = this->ctx_->alias (); + else + bt = node; + + if (bt->node_type () == AST_Decl::NT_struct) // direct typedef of a base node + // type + { + // let the base class visitor handle this case + if (this->be_visitor_typedef::visit_structure (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef_ch::" + "visit_structure - " + "base class visitor failed \n" + ), -1); + } + } + + // now generate the typedefs + os->indent (); + // typedef the type + *os << "typedef " << bt->nested_type_name (scope) + << " " << tdef->nested_type_name (scope) << ";" << be_nl; + // typedef the _var, _out types + *os << "typedef " << bt->nested_type_name (scope, "_var") + << " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl; + *os << "typedef " << bt->nested_type_name (scope, "_out") + << " " << tdef->nested_type_name (scope, "_out") << ";" << be_nl; + return 0; +} + +int +be_visitor_typedef_ch::visit_union (be_union *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // output stream + be_typedef *tdef = this->ctx_->tdef (); // typedef node + be_decl *scope = this->ctx_->scope (); // scope in which it is used + be_type *bt; + + if (this->ctx_->alias ()) // typedef of a typedef + bt = this->ctx_->alias (); + else + bt = node; + + if (bt->node_type () == AST_Decl::NT_union) // direct typedef of a base node + // type + { + // let the base class visitor handle this case + if (this->be_visitor_typedef::visit_union (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef_ch::" + "visit_union - " + "base class visitor failed \n" + ), -1); + } + } + + // now generate the typedefs + os->indent (); + // typedef the type and the _slice type + *os << "typedef " << bt->nested_type_name (scope) + << " " << tdef->nested_type_name (scope) << ";" << be_nl; + // typedef the _var, _out types + *os << "typedef " << bt->nested_type_name (scope, "_var") + << " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl; + *os << "typedef " << bt->nested_type_name (scope, "_out") + << " " << tdef->nested_type_name (scope, "_out") << ";" << be_nl; + return 0; +} + +// ****************************************************** +// Typedef visitor for client inline +// ****************************************************** + +be_visitor_typedef_ci::be_visitor_typedef_ci (be_visitor_context *ctx) + : be_visitor_typedef (ctx) +{ +} + +be_visitor_typedef_ci::~be_visitor_typedef_ci (void) +{ +} + +int +be_visitor_typedef_ci::visit_typedef (be_typedef *node) +{ + TAO_OutStream *os; // output stream + + os = this->ctx_->stream (); + + // In general, we may have a chain of typedefs. i.e., + // typedef sequence<long> X; + // typedef X Y; + // typedef Y Z; and so on + // The first time we will be in will be for node Z for which the code + // generation has to take place. However, it is not enough to just generate + // code that looks like - + // typedef Y Z; + // For different types (in this case we have a sequence), we will need + // typedefs for the _var and _out types for Z. If it had been an array, we + // will additionally have the _forany type as well as inlined *_alloc + // methods. + // + // Finally, we need to differentiate between the case where we were + // generating code for + // typedef sequence<long> X; and + // typedef Y Z; where Y was somehow aliased to the sequence. In the former + // case, we will need to generate all the code for sequence<long> or whatever + // the type maybe. In the latter, we just need typedefs for the type and all + // associated _var, _out, and other types. + + be_type *bt; // base type + + if (this->ctx_->tdef ()) + { + // the fact that we are here indicates that we were generating code for a + // typedef node whose base type also happens to be another typedef-ed + // (i.e. an alias) node for another (possibly alias) node + + this->ctx_->alias (node); // save this alias + + // grab the most primitive base type in the chain to avoid recusrsively + // going thru this visit method + bt = node->primitive_base_type (); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef_ch::" + "visit_typedef - " + "bad primitive base type\n" + ), -1); + } + } + else + { + // the context has not stored any "tdef" node. So we must be in here for + // the first time + this->ctx_->tdef (node); // save the typedef node + + // grab the immediate base type node + bt = be_type::narrow_from_decl (node->base_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef_ch::" + "visit_typedef - " + "bad base type\n" + ), -1); + } + } + + // accept on this base type + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef_ch::" + "visit_typedef - " + "failed to accept visitor\n" + ), -1); + } + + return 0; +} + +int +be_visitor_typedef_ci::visit_array (be_array *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // output stream + be_typedef *tdef = this->ctx_->tdef (); // typedef node + be_decl *scope = this->ctx_->scope (); // scope in which it is used + be_type *bt; + + if (this->ctx_->alias ()) // typedef of a typedef + bt = this->ctx_->alias (); + else + bt = node; + + if (bt->node_type () == AST_Decl::NT_array) // direct typedef of a base node + // type + { + // let the base class visitor handle this case + if (this->be_visitor_typedef::visit_array (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef_ci::" + "visit_array - " + "base class visitor failed \n" + ), -1); + } + } + return 0; +} + +int +be_visitor_typedef_ci::visit_sequence (be_sequence *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // output stream + be_typedef *tdef = this->ctx_->tdef (); // typedef node + be_decl *scope = this->ctx_->scope (); // scope in which it is used + be_type *bt; + + if (this->ctx_->alias ()) // typedef of a typedef + bt = this->ctx_->alias (); + else + bt = node; + + if (bt->node_type () == AST_Decl::NT_sequence) // direct typedef of a base node + // type + { + // let the base class visitor handle this case + if (this->be_visitor_typedef::visit_sequence (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef_ci::" + "visit_sequence - " + "base class visitor failed \n" + ), -1); + } + } + return 0; +} + +int +be_visitor_typedef_ci::visit_structure (be_structure *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // output stream + be_typedef *tdef = this->ctx_->tdef (); // typedef node + be_decl *scope = this->ctx_->scope (); // scope in which it is used + be_type *bt; + + if (this->ctx_->alias ()) // typedef of a typedef + bt = this->ctx_->alias (); + else + bt = node; + + if (bt->node_type () == AST_Decl::NT_struct) // direct typedef of a base node + // type + { + // let the base class visitor handle this case + if (this->be_visitor_typedef::visit_structure (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef_ci::" + "visit_structure - " + "base class visitor failed \n" + ), -1); + } + } + return 0; +} + +int +be_visitor_typedef_ci::visit_union (be_union *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // output stream + be_typedef *tdef = this->ctx_->tdef (); // typedef node + be_decl *scope = this->ctx_->scope (); // scope in which it is used + be_type *bt; + + if (this->ctx_->alias ()) // typedef of a typedef + bt = this->ctx_->alias (); + else + bt = node; + + if (bt->node_type () == AST_Decl::NT_union) // direct typedef of a base node + // type + { + // let the base class visitor handle this case + if (this->be_visitor_typedef::visit_union (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef_ci::" + "visit_union - " + "base class visitor failed \n" + ), -1); + } + } + return 0; +} + +// ****************************************************** +// Typedef visitor for client stubs +// ****************************************************** + +be_visitor_typedef_cs::be_visitor_typedef_cs (be_visitor_context *ctx) + : be_visitor_typedef (ctx) +{ +} + +be_visitor_typedef_cs::~be_visitor_typedef_cs (void) +{ +} + +int +be_visitor_typedef_cs::visit_typedef (be_typedef *node) +{ + TAO_OutStream *os; // output stream + + os = this->ctx_->stream (); + + // In general, we may have a chain of typedefs. i.e., + // typedef sequence<long> X; + // typedef X Y; + // typedef Y Z; and so on + // The first time we will be in will be for node Z for which the code + // generation has to take place. However, it is not enough to just generate + // code that looks like - + // typedef Y Z; + // For different types (in this case we have a sequence), we will need + // typedefs for the _var and _out types for Z. If it had been an array, we + // will additionally have the _forany type as well as inlined *_alloc + // methods. + // + // Finally, we need to differentiate between the case where we were + // generating code for + // typedef sequence<long> X; and + // typedef Y Z; where Y was somehow aliased to the sequence. In the former + // case, we will need to generate all the code for sequence<long> or whatever + // the type maybe. In the latter, we just need typedefs for the type and all + // associated _var, _out, and other types. + + be_type *bt; // base type + + if (this->ctx_->tdef ()) + { + // the fact that we are here indicates that we were generating code for a + // typedef node whose base type also happens to be another typedef-ed + // (i.e. an alias) node for another (possibly alias) node + + this->ctx_->alias (node); // save this alias + + // grab the most primitive base type in the chain to avoid recusrsively + // going thru this visit method + bt = node->primitive_base_type (); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef_ch::" + "visit_typedef - " + "bad primitive base type\n" + ), -1); + } + } + else + { + // the context has not stored any "tdef" node. So we must be in here for + // the first time + this->ctx_->tdef (node); // save the typedef node + + // grab the immediate base type node + bt = be_type::narrow_from_decl (node->base_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef_ch::" + "visit_typedef - " + "bad base type\n" + ), -1); + } + } + + // accept on this base type + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef_ch::" + "visit_typedef - " + "failed to accept visitor\n" + ), -1); + } + + // generate the typecode information here + os->indent (); // start from current indentation level + *os << "static const CORBA::Long _oc_" << node->flatname () << "[] =" + << be_nl; + *os << "{\n"; + os->incr_indent (0); + if (node->gen_encapsulation () == -1) + { + ACE_ERROR ((LM_ERROR, "Error generating typecode\n\n")); + return -1; + } + os->decr_indent (); + *os << "};" << be_nl; + + *os << "static CORBA::TypeCode _tc__tc_" << node->flatname () + << " (CORBA::tk_alias, sizeof (_oc_" << node->flatname () + << "), (unsigned char *) &_oc_" << node->flatname () + << ", CORBA::B_FALSE);" << be_nl; + *os << "CORBA::TypeCode_ptr " << node->tc_name () << " = &_tc__tc_" + << node->flatname () << ";\n\n"; + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_union.cpp b/TAO/TAO_IDL/be/be_visitor_union.cpp new file mode 100644 index 00000000000..09cfd704c7c --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_union.cpp @@ -0,0 +1,850 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_union.cpp +// +// = DESCRIPTION +// Visitors for generation of code for Union +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_union.h" + +// generic struct visitor +be_visitor_union::be_visitor_union (be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_union::~be_visitor_union (void) +{ +} + +// visit the Union node and its scope +int +be_visitor_union::visit_union (be_union *node) +{ + return -1; // must be overriden +} + +int +be_visitor_union::visit_union_branch (be_union_branch *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // this switch is acceptable rather than having derived visitors overriding + // this method and differing only in what state they set + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_UNION_PUBLIC_CH: + ctx.state (TAO_CodeGen::TAO_UNION_PUBLIC_CH); + break; + case TAO_CodeGen::TAO_UNION_PRIVATE_CH: + ctx.state (TAO_CodeGen::TAO_UNION_PRIVATE_CH); + break; + case TAO_CodeGen::TAO_UNION_PUBLIC_CI: + ctx.state (TAO_CodeGen::TAO_UNION_PUBLIC_CI); + break; + case TAO_CodeGen::TAO_UNION_PUBLIC_CS: + ctx.state (TAO_CodeGen::TAO_UNION_PUBLIC_CS); + break; + case TAO_CodeGen::TAO_UNION_PUBLIC_ASSIGN_CS: + ctx.state (TAO_CodeGen::TAO_UNION_PUBLIC_ASSIGN_CS); + break; + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union::" + "visit_union_branch - " + "Bad context state\n" + ), -1); + } + break; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union::" + "visit_union_branch - " + "NUL visitor\n" + ), -1); + } + + // let the node accept this visitor + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union::" + "visit_union_branch - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// ****************************************************** +// for client header +// ****************************************************** + +be_visitor_union_ch::be_visitor_union_ch (be_visitor_context *ctx) + : be_visitor_union (ctx) +{ +} + +be_visitor_union_ch::~be_visitor_union_ch (void) +{ +} + +// visit the Union node and its scope +int be_visitor_union_ch::visit_union (be_union *node) +{ + TAO_OutStream *os; // output stream + be_type *bt; // type node + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + + if (!node->cli_hdr_gen ()) + { + os = this->ctx_->stream (); + + // generate the ifdefined macro for the union type + os->gen_ifdef_macro (node->flatname ()); + os->indent (); // start with the current indentation level + *os << "class " << node->local_name () << be_nl + << "{" << be_nl + << "public:" << be_idt_nl + + // generate default and copy constructors + << node->local_name () << " (void); // default constructor" << be_nl + << node->local_name () << " (const " << node->local_name () + << " &); // copy constructor" << be_nl + // generate destructor + << "~" << node->local_name () << " (void); // destructor" << be_nl + // generate assignment operator + << node->local_name () << " &operator= (const " + << node->local_name () << " &); // copy constructor\n\n"; + + // retrieve the disriminant type + bt = be_type::narrow_from_decl (node->disc_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_ch::" + "visit_union - " + "bad disciminant type\n"), -1); + } + + // the discriminant type may have to be defined here if it was an enum + // declaration inside of the union statement. + + ctx.state (TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CH); // set current code + // gen state + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_ch::" + "visit_union - " + "bad visitor\n"), -1); + } + + if (bt->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_ch::" + " visit_union - " + "codegen for discriminant failed\n"), -1); + } + delete visitor; + + // now generate the public defn for the union branch members. For this, + // set our state to reflect what we are aiming to do + this->ctx_->state (TAO_CodeGen::TAO_UNION_PUBLIC_CH); // set current code + // gen state + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_ch::" + "visit_union - " + "codegen for public defn of union members\n"), + -1); + } + + // now generate the private data members of the union + os->decr_indent (); + *os << "private:\n"; + os->incr_indent (); + *os << bt->nested_type_name (node) << " disc_;" << be_nl; // emit the + // ACE_NESTED_CLASS macro + + // the members are inside of a union + *os << "union" << be_nl; + *os << "{\n"; + os->incr_indent (0); + this->ctx_->state (TAO_CodeGen::TAO_UNION_PRIVATE_CH); // set current + // code gen state + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_ch::" + "visit_union - " + "codegen for private members of union\n"), -1); + } + + os->decr_indent (); + *os << "}; // end of union \n"; + + os->decr_indent (); + *os << "}; // " << node->name () << "\n\n"; + + // Generate the typecode decl + if (node->is_nested ()) + { + // we have a scoped name + os->indent (); + *os << "static CORBA::TypeCode_ptr " << node->tc_name + ()->last_component () << ";\n\n"; + } + else + { + // we are in the ROOT scope + os->indent (); + *os << "extern CORBA::TypeCode_ptr " << node->tc_name + ()->last_component () << ";\n\n"; + } + os->gen_endif (); + + // generate the ifdefined macro for the _var type + os->gen_ifdef_macro (node->flatname (), "_var"); + // generate var defn + if (node->gen_var_defn () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_ch::" + "visit_union - " + "codegen for _var\n"), -1); + } + os->gen_endif (); + + // generate the ifdefined macro for the array type + os->gen_ifdef_macro (node->flatname (), "_out"); + // a class is generated for an out defn only for a variable length struct + if (node->size_type () == be_decl::VARIABLE) + { + if (node->gen_out_defn () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_ch::" + "visit_union - " + "codegen for _out\n"), -1); + } + } + else + { + os->indent (); + *os << "typedef " << node->local_name () << " &" << node->local_name + () << "_out;\n\n"; + } + os->gen_endif (); + + node->cli_hdr_gen (I_TRUE); + } + + return 0; +} + +// ****************************************************** +// for client inline +// ****************************************************** + +be_visitor_union_ci::be_visitor_union_ci (be_visitor_context *ctx) + : be_visitor_union (ctx) +{ +} + +be_visitor_union_ci::~be_visitor_union_ci (void) +{ +} + +// visit the Union node and its scope +int be_visitor_union_ci::visit_union (be_union *node) +{ + TAO_OutStream *os; // output stream + be_type *bt; // type node + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + + if (!node->cli_inline_gen ()) + { + os = this->ctx_->stream (); + + *os << "// *************************************************************" + << be_nl; + *os << "// Inline operations for union " << node->name () << be_nl; + *os << "// *************************************************************\n\n"; + + // generate the default constructor and the destructor here + os->indent (); + *os << "// default constructor" << be_nl + << "ACE_INLINE" << be_nl + << node->name () << "::" << node->local_name () << " (void)" << be_nl + << "{" << be_nl + << "}" << be_nl << be_nl; + + *os << "// destructor" << be_nl + << "ACE_INLINE" << be_nl + << node->name () << "::~" << node->local_name () << " (void)" << be_nl + << "{" << be_nl + << "}\n\n"; + + // the discriminant type may have to be defined here if it was an enum + // declaration inside of the union statement. + + bt = be_type::narrow_from_decl (node->disc_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_ci::" + "visit_union - " + "bad discriminant type\n"), -1); + } + + ctx.state (TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CI); // set current code + // gen state + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_ci::" + "visit_union - " + "bad visitor\n"), -1); + } + // generate code for the discriminant + if (bt->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_ci::" + "visit union - " + "codegen for discrminant failed\n"), -1); + } + + // now generate the implementation of the access methods for the + // union. For this set our state + this->ctx_->state (TAO_CodeGen::TAO_UNION_PUBLIC_CI); + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_ci::" + "visit_union - " + "codegen for scope failed\n"), -1); + } + + // generate the ifdefined macro for the array type + os->gen_ifdef_macro (node->flatname (), "_var"); + if (node->gen_var_impl () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_ci::" + "visit_union - " + "codegen for _var failed\n"), -1); + } + os->gen_endif (); + + // generate the ifdefined macro for the array type then generate the _out + // impl + os->gen_ifdef_macro (node->flatname (), "_out"); + if (node->size_type () == be_decl::VARIABLE + && node->gen_out_impl () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_ci::" + "visit_union - " + "codegen for _out failed\n"), -1); + } + os->gen_endif (); + + node->cli_inline_gen (I_TRUE); + } + return 0; +} + +// ****************************************************** +// for client stubs +// ****************************************************** + +be_visitor_union_cs::be_visitor_union_cs (be_visitor_context *ctx) + : be_visitor_union (ctx) +{ +} + +be_visitor_union_cs::~be_visitor_union_cs (void) +{ +} + +// visit the Union_cs node and its scope +int be_visitor_union_cs::visit_union (be_union *node) +{ + TAO_OutStream *os; // output stream + be_type *bt; // for discriminant type + + if (!node->cli_stub_gen ()) + { + os = this->ctx_->stream (); + + be_visitor_context ctx (*this->ctx_); + // the discriminant type may have to be defined here if it was an enum + // declaration inside of the union statement. We need to generate its + // typecode + + bt = be_type::narrow_from_decl (node->disc_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_cs::" + "visit_union - " + "bad discriminant type\n"), -1); + } + + ctx.state (TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CS); // set current code + // gen state + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_cs::" + "visit_union - " + "bad visitor\n"), -1); + } + // generate code for the discriminant + if (bt->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_cs::" + "visit union - " + "codegen for discrminant failed\n"), -1); + } + + // first generate code for any of the members (if required, e.g., + // anonymous sequences, structs, unions, arrays) + this->ctx_->state (TAO_CodeGen::TAO_UNION_PUBLIC_CS); // set current code + // gen state + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_cs" + "visit_union - " + "codegen for scope failed\n"), -1); + } + + // now generate the operations on the union such as the copy constructor + // and the assignment operator + + *os << "// *************************************************************" + << be_nl; + *os << "// Operations for union " << node->name () << be_nl; + *os << "// *************************************************************\n\n"; + + this->ctx_->state (TAO_CodeGen::TAO_UNION_PUBLIC_ASSIGN_CS); + + // generate the copy constructor and the assignment operator here + os->indent (); + *os << "// copy constructor" << be_nl; + *os << node->name () << "::" << node->local_name () << " (const " << + node->name () << " &u)" << be_nl; + *os << "{\n"; + os->incr_indent (); + // first set the discriminant + *os << "this->disc_ = u.disc_;" << be_nl; + // now switch based on the disc value + *os << "switch (this->disc_)" << be_nl; + *os << "{\n"; + os->incr_indent (0); + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_cs" + "visit_union - " + "codegen for copy ctor failed\n"), -1); + } + + os->decr_indent (); + *os << "}\n"; + os->decr_indent (); + *os << "}\n\n"; + + // assignment operator + os->indent (); + *os << "// assignment operator" << be_nl; + *os << node->name () << " &" << be_nl; // return type + *os << node->name () << "::operator= (const " << + node->name () << " &u)" << be_nl; + *os << "{\n"; + os->incr_indent (); + // first set the discriminant + *os << "this->disc_ = u.disc_;" << be_nl; + // now switch based on the disc value + *os << "switch (this->disc_)" << be_nl; + *os << "{\n"; + os->incr_indent (0); + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_cs" + "visit_union - " + "codegen for assign op failed\n"), -1); + } + + os->decr_indent (); + *os << "}" << be_nl; + *os << "return *this;\n"; + os->decr_indent (); + *os << "}\n\n"; + + // generate the typecode information here + os->indent (); // start from current indentation level + *os << "static const CORBA::Long _oc_" << node->flatname () << "[] =" << + be_nl; + *os << "{\n"; + os->incr_indent (0); + if (node->gen_encapsulation () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_cs" + "visit_union - " + "codegen for encapsulation failed\n"), -1); + } + + os->decr_indent (); + *os << "};" << be_nl; + + *os << "static CORBA::TypeCode _tc__tc_" << node->flatname () << + " (CORBA::tk_union, sizeof (_oc_" << node->flatname () << + "), (unsigned char *) &_oc_" << node->flatname () << + ", CORBA::B_FALSE);" << be_nl; + *os << "CORBA::TypeCode_ptr " << node->tc_name () << " = &_tc__tc_" << + node->flatname () << ";\n\n"; + node->cli_stub_gen (I_TRUE); + } + return 0; +} + + +// ************************************************************************* +// be_visitor_discriminant_ch - visitor for discriminant in client header file +// ************************************************************************* + +be_visitor_union_discriminant_ch::be_visitor_union_discriminant_ch +(be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_union_discriminant_ch::~be_visitor_union_discriminant_ch (void) +{ +} + +int +be_visitor_union_discriminant_ch::visit_enum (be_enum *node) +{ + TAO_OutStream *os; // output stream + be_union *bu = + this->ctx_->be_node_as_union (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + os = this->ctx_->stream (); + + if (bt->node_type () != AST_Decl::NT_typedef // not a typedef + && bt->is_child (bu)) // bt is defined inside the union + { + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope + // is still the same + + // first generate the enum declaration + ctx.state (TAO_CodeGen::TAO_ENUM_CH); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_discriminant_ch::" + "visit_enum - " + "Bad visitor\n" + ), -1); + } + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_discriminant_ch::" + "visit_enum - " + "codegen failed\n" + ), -1); + } + delete visitor; + } + + os->indent (); + // the set method + *os << "void _d (" << bt->nested_type_name (bu) << ");" << be_nl; + // the get method + *os << bt->nested_type_name (bu) << " _d (void) const;\n\n"; + return 0; +} + +int +be_visitor_union_discriminant_ch::visit_predefined_type (be_predefined_type + *node) +{ + TAO_OutStream *os; // output stream + be_union *bu = + this->ctx_->be_node_as_union (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + os = this->ctx_->stream (); + + os->indent (); + // the set method + *os << "void _d (" << bt->nested_type_name (bu) << ");" << be_nl; + // the get method + *os << bt->nested_type_name (bu) << " _d (void) const;\n\n"; + return 0; +} + +int +be_visitor_union_discriminant_ch::visit_typedef (be_typedef *node) +{ + TAO_OutStream *os; // output stream + + os = this->ctx_->stream (); + this->ctx_->alias (node); // save the typedef node for use in code generation + // as we visit the base type + + // the node to be visited in the base primitve type that gets typedefed + be_type *bt = node->primitive_base_type (); + if (!bt || (bt->accept (this) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_discriminant_ch::" + "visit_typedef - " + "Bad primitive type\n" + ), -1); + } + + return 0; +} + +// ************************************************************************* +// be_visitor_discriminant_ci - visitor for discriminant in client inline file +// ************************************************************************* + +be_visitor_union_discriminant_ci::be_visitor_union_discriminant_ci +(be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_union_discriminant_ci::~be_visitor_union_discriminant_ci (void) +{ +} + +int +be_visitor_union_discriminant_ci::visit_enum (be_enum *node) +{ + TAO_OutStream *os; // output stream + be_union *bu = + this->ctx_->be_node_as_union (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + os = this->ctx_->stream (); + + os->indent (); + // the set method + *os << "// accessor to set the discriminant" << be_nl + << "ACE_INLINE void" << be_nl + << bu->name () << "::_d (" << bt->name () + << " discval)" << be_nl + << "{" << be_idt_nl + << "this->disc_ = discval;" << be_uidt_nl + << "}" << be_nl; + + // the get method + *os << "// accessor to get the discriminant" << be_nl + << "ACE_INLINE " << bt->name () << be_nl + << bu->name () << "::_d (void) const" << be_nl + << "{" << be_idt_nl + << "return this->disc_;" << be_uidt_nl + << "}\n\n"; + return 0; +} + +int +be_visitor_union_discriminant_ci::visit_predefined_type (be_predefined_type + *node) +{ + TAO_OutStream *os; // output stream + be_union *bu = + this->ctx_->be_node_as_union (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + os = this->ctx_->stream (); + + os->indent (); + // the set method + *os << "// accessor to set the discriminant" << be_nl + << "ACE_INLINE void" << be_nl + << bu->name () << "::_d (" << bt->name () + << " discval)" << be_nl + << "{" << be_idt_nl + << "this->disc_ = discval;" << be_uidt_nl + << "}" << be_nl; + + // the get method + *os << "// accessor to get the discriminant" << be_nl + << "ACE_INLINE " << bt->name () << be_nl + << bu->name () << "::_d (void) const" << be_nl + << "{" << be_idt_nl + << "return this->disc_;" << be_uidt_nl + << "}\n\n"; + return 0; +} + +int +be_visitor_union_discriminant_ci::visit_typedef (be_typedef *node) +{ + TAO_OutStream *os; // output stream + + os = this->ctx_->stream (); + this->ctx_->alias (node); // save the typedef node for use in code generation + // as we visit the base type + + // the node to be visited in the base primitve type that gets typedefed + be_type *bt = node->primitive_base_type (); + if (!bt || (bt->accept (this) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_discriminant_ci::" + "visit_typedef - " + "Bad primitive type\n" + ), -1); + } + + return 0; +} + +// ************************************************************************* +// be_visitor_discriminant_cs - visitor for discriminant in client stubs +// ************************************************************************* + +be_visitor_union_discriminant_cs::be_visitor_union_discriminant_cs +(be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_union_discriminant_cs::~be_visitor_union_discriminant_cs (void) +{ +} + +int +be_visitor_union_discriminant_cs::visit_enum (be_enum *node) +{ + TAO_OutStream *os; // output stream + be_union *bu = + this->ctx_->be_node_as_union (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + os = this->ctx_->stream (); + + if (bt->node_type () != AST_Decl::NT_typedef // not a typedef + && bt->is_child (bu)) // bt is defined inside the union + { + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope + // is still the same + + // generate the typecode for the enum + ctx.state (TAO_CodeGen::TAO_ENUM_CS); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_discriminant_cs::" + "visit_enum - " + "Bad visitor\n" + ), -1); + } + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_discriminant_cs::" + "visit_enum - " + "codegen failed\n" + ), -1); + } + delete visitor; + } + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch.cpp new file mode 100644 index 00000000000..cd4d79b7981 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_union_branch.cpp @@ -0,0 +1,2035 @@ +// +// $Id$ +// +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_union_branch.cpp +// +// = DESCRIPTION +// Concrete visitor for the base "BE_Union_Branch" node +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_union_branch.h" + +// ********************************************** +// visitor for union_branch in the client header file +// ********************************************** + +// constructor +be_visitor_union_branch_public_ch::be_visitor_union_branch_public_ch +(be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +// destructor +be_visitor_union_branch_public_ch::~be_visitor_union_branch_public_ch (void) +{ +} + +// visit the union_branch node +int +be_visitor_union_branch_public_ch::visit_union_branch (be_union_branch *node) +{ + TAO_OutStream *os; // output stream + be_type *bt; // union_branch's type + + os = this->ctx_->stream (); + // first generate the type information + bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ch::" + "visit_union_branch - " + "Bad union_branch type\n" + ), -1); + } + + this->ctx_->node (node); // save the node + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ch::" + "visit_union_branch - " + "codegen for union_branch type failed\n" + ), -1); + } + return 0; +} + +// =visit operations on all possible data types that a union_branch can be + +// visit array type +int +be_visitor_union_branch_public_ch::visit_array (be_array *node) +{ + TAO_OutStream *os; // output stream + be_decl *ub = this->ctx_->node (); // get union branch member + be_decl *bu = this->ctx_->scope (); // get the enclosing union node + be_type *bt; + + // check if we are visiting this via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ch::" + "visit_array - " + "bad context information\n" + ), -1); + } + + os = this->ctx_->stream (); + + if (bt->node_type () != AST_Decl::NT_typedef // not a typedef + && bt->is_child (bu)) // bt is defined inside the union + { + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope + // is still the same + + // first generate the enum declaration + ctx.state (TAO_CodeGen::TAO_ARRAY_CH); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ch::" + "visit_array - " + "Bad visitor\n" + ), -1); + } + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ch::" + "visit_array - " + "codegen failed\n" + ), -1); + } + delete visitor; + } + + // now use this enum as a "type" for the subsequent declarator + os->indent (); // start from current indentation + // the set method + *os << "void " << ub->local_name () << " (" + << bt->nested_type_name (bu) << ");// set" + << be_nl; + // the get method + *os << bt->nested_type_name (bu, "_slice *") << " " << ub->local_name () + << " (void) const; // get method\n\n"; + + return 0; +} + +// visit enum type +int +be_visitor_union_branch_public_ch::visit_enum (be_enum *node) +{ + TAO_OutStream *os; // output stream + be_decl *ub = this->ctx_->node (); // get union branch member + be_decl *bu = this->ctx_->scope (); // get the enclosing union node + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ch::" + "visit_enum - " + "bad context information\n" + ), -1); + } + + os = this->ctx_->stream (); + + if (bt->node_type () != AST_Decl::NT_typedef // not a typedef + && bt->is_child (bu)) // bt is defined inside the union + { + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope + // is still the same + + // first generate the enum declaration + ctx.state (TAO_CodeGen::TAO_ENUM_CH); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ch::" + "visit_enum - " + "Bad visitor\n" + ), -1); + } + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ch::" + "visit_enum - " + "codegen failed\n" + ), -1); + } + delete visitor; + } + + // now use this enum as a "type" for the subsequent declarator + os->indent (); // start from current indentation + // the set method + *os << "void " << ub->local_name () << " (" + << bt->nested_type_name (bu) << ");// set" + << be_nl; + // the get method + *os << bt->nested_type_name (bu) << " " << ub->local_name () + << " (void) const; // get method\n\n"; + + return 0; +} + +// visit interface type +int +be_visitor_union_branch_public_ch::visit_interface (be_interface *node) +{ + TAO_OutStream *os; // output stream + be_decl *ub = this->ctx_->node (); // get union branch + be_decl *bu = this->ctx_->scope (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ch::" + "visit_interface - " + "bad context information\n" + ), -1); + } + + os = this->ctx_->stream (); + + os->indent (); // start from current indentation + // set method + *os << "void " << ub->local_name () << " (" + << bt->nested_type_name (bu, "_ptr") + << ");// set" << be_nl; + // get method + *os << bt->nested_type_name (bu, "_ptr") << " " << ub->local_name () + << " (void) const; // get method\n\n"; + return 0; +} + +// visit interface forward type +int +be_visitor_union_branch_public_ch::visit_interface_fwd (be_interface_fwd *node) +{ + TAO_OutStream *os; // output stream + be_decl *ub = this->ctx_->node (); // get union branch + be_decl *bu = this->ctx_->scope (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ch::" + "visit_interface_fwd - " + "bad context information\n" + ), -1); + } + + os = this->ctx_->stream (); + + os->indent (); // start from current indentation + // set method + *os << "void " << ub->local_name () << " (" + << bt->nested_type_name (bu, "_ptr") + << ");// set" << be_nl; + // get method + *os << bt->nested_type_name (bu, "_ptr") << " " << ub->local_name () + << " (void) const; // get method\n\n"; + return 0; +} + +// visit predefined type +int +be_visitor_union_branch_public_ch::visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os; // output stream + be_decl *ub = this->ctx_->node (); // get union branch + be_decl *bu = this->ctx_->scope (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ch::" + "visit_predefined_type - " + "bad context information\n" + ), -1); + } + + os = this->ctx_->stream (); + + os->indent (); // start from current indentation + if (node->pt () == AST_PredefinedType::PT_pseudo) + { + // set method + *os << "void " << ub->local_name () << " (" + << bt->nested_type_name (bu, "_ptr") << ");// set" << be_nl; + // get method + *os << bt->nested_type_name (bu, "_ptr") << " " << ub->local_name () + << " (void) const; // get method\n\n"; + } + else + { + // set method + *os << "void " << ub->local_name () << " (" + << bt->nested_type_name (bu) << ");// set" << be_nl; + // get method + *os << bt->nested_type_name (bu) << " " << ub->local_name () + << " (void) const; // get method\n\n"; + } + return 0; +} + +// visit sequence type +int +be_visitor_union_branch_public_ch::visit_sequence (be_sequence *node) +{ + TAO_OutStream *os; // output stream + be_decl *ub = this->ctx_->node (); // get union branch + be_decl *bu = this->ctx_->scope (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ch::" + "visit_sequence - " + "bad context information\n" + ), -1); + } + + os = this->ctx_->stream (); + + if (bt->node_type () != AST_Decl::NT_typedef // not a typedef + && bt->is_child (bu)) // bt is defined inside the union + { + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope + // is still the same + + // first generate the sequence declaration + ctx.state (TAO_CodeGen::TAO_SEQUENCE_CH); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ch::" + "visit_sequence - " + "Bad visitor\n" + ), -1); + } + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ch::" + "visit_sequence - " + "codegen failed\n" + ), -1); + } + delete visitor; + } + os->indent (); + // set method + *os << "void " << ub->local_name () << " (const " + << bt->nested_type_name (bu) << " &);// set" << be_nl; + // read-only + *os << "const " << bt->nested_type_name (bu) << " &" + << ub->local_name () << " (void) const; // get method (read only)" + << be_nl; + // read/write + *os << bt->nested_type_name (bu) << " &" << ub->local_name () + << " (void); // get method (read/write only)\n\n"; + + return 0; +} + +// visit string type +int +be_visitor_union_branch_public_ch::visit_string (be_string *node) +{ + TAO_OutStream *os; // output stream + be_decl *ub = this->ctx_->node (); // get union branch + be_decl *bu = this->ctx_->scope (); // get the enclosing union backend + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ch::" + "visit_string - " + "bad context information\n" + ), -1); + } + + os = this->ctx_->stream (); + + os->indent (); + // three methods to set the string value + *os << "void " << ub->local_name () << " (char *); // set" << be_nl; + *os << "void " << ub->local_name () << " (const char *); // set" + << be_nl; + *os << "void " << ub->local_name () << " (const CORBA::String_var&); // set" + << be_nl; + //get method + *os << "const char *" << ub->local_name () + << " (void) const; // get method\n\n"; + return 0; +} + +// visit structure type +int +be_visitor_union_branch_public_ch::visit_structure (be_structure *node) +{ + TAO_OutStream *os; // output stream + be_decl *ub = this->ctx_->node (); // get union branch + be_decl *bu = this->ctx_->scope (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ch::" + "visit_structure - " + "bad context information\n" + ), -1); + } + + os = this->ctx_->stream (); + + if (bt->node_type () != AST_Decl::NT_typedef // not a typedef + && bt->is_child (bu)) // bt is defined inside the union + { + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope + // is still the same + + // first generate the sequence declaration + ctx.state (TAO_CodeGen::TAO_STRUCT_CH); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ch::" + "visit_structure - " + "Bad visitor\n" + ), -1); + } + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ch::" + "visit_structure - " + "codegen failed\n" + ), -1); + } + delete visitor; + } + os->indent (); + // set method + *os << "void " << ub->local_name () << " (const " + << bt->nested_type_name (bu) << " &);// set" << be_nl + // read-only + << "const " << bt->nested_type_name (bu) << " &" + << ub->local_name () << " (void) const; // get method (read only)" + << be_nl + // read/write + << bt->nested_type_name (bu) << " &" << ub->local_name () + << " (void); // get method (read/write only)\n\n"; + + return 0; +} + +// visit typedefed type +int +be_visitor_union_branch_public_ch::visit_typedef (be_typedef *node) +{ + TAO_OutStream *os; // output stream + + os = this->ctx_->stream (); + os->indent (); // start from current indentation level + this->ctx_->alias (node); // save the node for use in code generation and + // indicate that the union_branch of the union_branch node + // is a typedefed quantity + + // make a decision based on the primitive base type + be_type *bt = node->primitive_base_type (); + if (!bt || (bt->accept (this) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_spec_ch::" + "visit_typedef - " + "Bad primitive type\n" + ), -1); + } + return 0; +} + +// visit union type +int +be_visitor_union_branch_public_ch::visit_union (be_union *node) +{ + TAO_OutStream *os; // output stream + be_decl *ub = this->ctx_->node (); // get union branch + be_decl *bu = this->ctx_->scope (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ch::" + "visit_union - " + "bad context information\n" + ), -1); + } + + os = this->ctx_->stream (); + + if (bt->node_type () != AST_Decl::NT_typedef // not a typedef + && bt->is_child (bu)) // bt is defined inside the union + { + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope + // is still the same + + // first generate the sequence declaration + ctx.state (TAO_CodeGen::TAO_STRUCT_CH); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ch::" + "visit_union - " + "Bad visitor\n" + ), -1); + } + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ch::" + "visit_union - " + "codegen failed\n" + ), -1); + } + delete visitor; + } + os->indent (); + // set method + *os << "void " << ub->local_name () << " (const " + << bt->nested_type_name (bu) << " &);// set" << be_nl + // read-only + << "const " << bt->nested_type_name (bu) << " &" + << ub->local_name () << " (void) const; // get method (read only)" + << be_nl + // read/write + << bt->nested_type_name (bu) << " &" << ub->local_name () + << " (void); // get method (read/write only)\n\n"; + + return 0; +} + +// ********************************************** +// visitor for union_branch in the client header generating the private information +// ********************************************** + +// constructor +be_visitor_union_branch_private_ch::be_visitor_union_branch_private_ch (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +// destructor +be_visitor_union_branch_private_ch::~be_visitor_union_branch_private_ch (void) +{ +} + +// visit the union_branch node +int +be_visitor_union_branch_private_ch::visit_union_branch (be_union_branch *node) +{ + TAO_OutStream *os; + be_type *bt; // union_branch's type + + os = this->ctx_->stream (); + // first generate the type information + bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_cs::" + "visit_union_branch - " + "Bad union_branch type\n" + ), -1); + } + + this->ctx_->node (node); // save the node + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_cs::" + "visit_union_branch - " + "codegen for union_branch type failed\n" + ), -1); + } + return 0; +} + +// =visit operations on all possible data types that a union_branch can be + +int +be_visitor_union_branch_private_ch::visit_array (be_array *node) +{ + TAO_OutStream *os; // output stream + be_decl *ub = this->ctx_->node (); // get union branch + be_decl *bu = this->ctx_->scope (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_private_ch::" + "visit_array - " + "bad context information\n" + ), -1); + } + + os = this->ctx_->stream (); + + os->indent (); + *os << bt->nested_type_name (bu, "_slice") << " *" << ub->local_name () + << "_;\n"; + return 0; +} + +int +be_visitor_union_branch_private_ch::visit_enum (be_enum *node) +{ + TAO_OutStream *os; // output stream + be_decl *ub = this->ctx_->node (); // get union branch + be_decl *bu = this->ctx_->scope (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_private_ch::" + "visit_enum - " + "bad context information\n" + ), -1); + } + + os = this->ctx_->stream (); + + os->indent (); // start from current indentation + *os << bt->nested_type_name (bu) << " " << ub->local_name () << "_;\n"; + return 0; +} + +int +be_visitor_union_branch_private_ch::visit_interface (be_interface *node) +{ + TAO_OutStream *os; // output stream + be_decl *ub = this->ctx_->node (); // get union branch + be_decl *bu = this->ctx_->scope (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_private_ch::" + "visit_interface - " + "bad context information\n" + ), -1); + } + + os = this->ctx_->stream (); + + os->indent (); // start from current indentation + // C++ does not allow an object declaration inside a union. Hence we + // must have a pointer. This changes some of the methods + *os << bt->nested_type_name (bu, "_var") << " *" << ub->local_name () << + "_;\n"; + return 0; +} + +int +be_visitor_union_branch_private_ch::visit_interface_fwd (be_interface_fwd *node) +{ + TAO_OutStream *os; // output stream + be_decl *ub = this->ctx_->node (); // get union branch + be_decl *bu = this->ctx_->scope (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_private_ch::" + "visit_interface_fwd - " + "bad context information\n" + ), -1); + } + + os = this->ctx_->stream (); + + os->indent (); // start from current indentation + // C++ does not allow an object declaration inside a union. Hence we + // must have a pointer. This changes some of the methods + *os << bt->nested_type_name (bu, "_var") << " *" << ub->local_name () << + "_;\n"; + return 0; +} + +int +be_visitor_union_branch_private_ch::visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os; // output stream + be_decl *ub = this->ctx_->node (); // get union branch + be_decl *bu = this->ctx_->scope (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_private_ch::" + "visit_predefined_type - " + "bad context information\n" + ), -1); + } + + os = this->ctx_->stream (); + + if (node->pt () == AST_PredefinedType::PT_pseudo) + { + // Cannot have an object inside of a union + os->indent (); // start from current indentation + *os << bt->nested_type_name (bu, "_var") << " *" << ub->local_name () << + "_;\n"; + } + else + { + os->indent (); // start from current indentation + *os << bt->nested_type_name (bu) << " " << ub->local_name () << + "_;\n"; + } + return 0; +} + +int +be_visitor_union_branch_private_ch::visit_sequence (be_sequence *node) +{ + TAO_OutStream *os; // output stream + be_decl *ub = this->ctx_->node (); // get union branch + be_decl *bu = this->ctx_->scope (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_private_ch::" + "visit_sequence - " + "bad context information\n" + ), -1); + } + + os = this->ctx_->stream (); + + os->indent (); + // C++ doesn't allow object instances inside unions, so we need a + // pointer + *os << bt->nested_type_name (bu) << " *" << ub->local_name () << "_;\n"; + return 0; +} + +int +be_visitor_union_branch_private_ch::visit_string (be_string *node) +{ + TAO_OutStream *os; // output stream + be_decl *ub = this->ctx_->node (); // get union branch + be_decl *bu = this->ctx_->scope (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_private_ch::" + "visit_string - " + "bad context information\n" + ), -1); + } + + os = this->ctx_->stream (); + + *os << "CORBA::String_var *" << ub->local_name () << "_;\n"; + return 0; +} + +int +be_visitor_union_branch_private_ch::visit_structure (be_structure *node) +{ + TAO_OutStream *os; // output stream + be_decl *ub = this->ctx_->node (); // get union branch + be_decl *bu = this->ctx_->scope (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_private_ch::" + "visit_structure - " + "bad context information\n" + ), -1); + } + + os = this->ctx_->stream (); + + os->indent (); + *os << bt->nested_type_name (bu) << " " << ub->local_name () << "_;\n"; + return 0; +} + +int +be_visitor_union_branch_private_ch::visit_typedef (be_typedef *node) +{ + TAO_OutStream *os; // output stream + + os = this->ctx_->stream (); + this->ctx_->alias (node); // save the typedef node for use in code generation + // as we visit the base type + + // the node to be visited in the base primitve type that gets typedefed + be_type *bt = node->primitive_base_type (); + if (!bt || (bt->accept (this) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_private_ch::" + "visit_typedef - " + "Bad primitive type\n" + ), -1); + } + + return 0; +} + +int +be_visitor_union_branch_private_ch::visit_union (be_union *node) +{ + TAO_OutStream *os; // output stream + be_decl *ub = this->ctx_->node (); // get union branch + be_decl *bu = this->ctx_->scope (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_private_ch::" + "visit_union - " + "bad context information\n" + ), -1); + } + + os = this->ctx_->stream (); + + os->indent (); + // C++ doesn't allow object instances inside unions, so we need a + // pointer + *os << bt->nested_type_name (bu) << " *" << ub->local_name () << "_;\n"; + return 0; +} + +// ***************************************************** +// visitor for union_branch in the client inline file +// ***************************************************** + +// constructor +be_visitor_union_branch_public_ci::be_visitor_union_branch_public_ci (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +// destructor +be_visitor_union_branch_public_ci::~be_visitor_union_branch_public_ci (void) +{ +} + +// visit the union_branch node +int +be_visitor_union_branch_public_ci::visit_union_branch (be_union_branch *node) +{ + TAO_OutStream *os; + be_type *bt; // union_branch's type + + os = this->ctx_->stream (); + // first generate the type information + bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_cs::" + "visit_union_branch - " + "Bad union_branch type\n" + ), -1); + } + + this->ctx_->node (node); // save the node + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_cs::" + "visit_union_branch - " + "codegen for union_branch type failed\n" + ), -1); + } + return 0; +} + +// =visit operations on all possible data types that a union_branch can be + +int +be_visitor_union_branch_public_ci::visit_array (be_array *node) +{ + TAO_OutStream *os; // output stream + be_union_branch *ub = + this->ctx_->be_node_as_union_branch (); // get union branch + be_union *bu = + this->ctx_->be_scope_as_union (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ci::" + "visit_enum - " + "bad context information\n" + ), -1); + } + os = this->ctx_->stream (); + + if (bt->node_type () != AST_Decl::NT_typedef // not a typedef + && bt->is_child (bu)) // bt is defined inside the union + { + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope + // is still the same + + // first generate the enum declaration + ctx.state (TAO_CodeGen::TAO_ARRAY_CI); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ci::" + "visit_array - " + "Bad visitor\n" + ), -1); + } + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ci::" + "visit_array - " + "codegen failed\n" + ), -1); + } + delete visitor; + } + + // set method + os->indent (); // start from current indentation + *os << "// accessor to set the member" << be_nl + << "ACE_INLINE void" << be_nl + << bu->name () << "::" << ub->local_name () << " (" << bt->name () + << " val)// set" << be_nl + << "{\n"; + os->incr_indent (); + // set the discriminant to the appropriate label + if (ub->label ()->label_kind () == AST_UnionLabel::UL_label) + { + // valid label + *os << "// set the discriminant val" << be_nl; + // check if the case label is a symbol or a literal + if (ub->label ()->label_val ()->ec () == AST_Expression::EC_symbol) + { + *os << "this->disc_ = " << ub->label ()->label_val ()->n () + << ";" << be_nl; + } + else + { + *os << "this->disc_ = " << ub->label ()->label_val () << ";" << + be_nl; + } + *os << "// set the value" << be_nl + << "this->" << ub->local_name () << "_ = val;\n"; + } + else + { + // default label + // XXXASG - TODO + } + os->decr_indent (); + *os << "}" << be_nl; + + // get method + *os << "// retrieve the member" << be_nl + << "ACE_INLINE " << bt->name () << "_slice *" << be_nl + << bu->name () << "::" << ub->local_name () << " (void) const" << be_nl + << "{\n"; + os->incr_indent (); + *os << "return this->" << ub->local_name () << "_;\n"; + os->decr_indent (); + *os << "}\n\n"; + return 0; +} + +int +be_visitor_union_branch_public_ci::visit_enum (be_enum *node) +{ + TAO_OutStream *os; // output stream + be_union_branch *ub = + this->ctx_->be_node_as_union_branch (); // get union branch + be_union *bu = + this->ctx_->be_scope_as_union (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ci::" + "visit_enum - " + "bad context information\n" + ), -1); + } + os = this->ctx_->stream (); + + // set method + os->indent (); // start from current indentation + *os << "// accessor to set the member" << be_nl + << "ACE_INLINE void" << be_nl + << bu->name () << "::" << ub->local_name () << " (" << bt->name () + << " val)// set" << be_nl + << "{\n"; + os->incr_indent (); + // set the discriminant to the appropriate label + if (ub->label ()->label_kind () == AST_UnionLabel::UL_label) + { + // valid label + *os << "// set the discriminant val" << be_nl; + // check if the case label is a symbol or a literal + if (ub->label ()->label_val ()->ec () == AST_Expression::EC_symbol) + { + *os << "this->disc_ = " << ub->label ()->label_val ()->n () + << ";" << be_nl; + } + else + { + *os << "this->disc_ = " << ub->label ()->label_val () << ";" << + be_nl; + } + *os << "// set the value" << be_nl + << "this->" << ub->local_name () << "_ = val;\n"; + } + else + { + // default label + // XXXASG - TODO + } + os->decr_indent (); + *os << "}" << be_nl; + + // get method + *os << "// retrieve the member" << be_nl + << "ACE_INLINE " << bt->name () << be_nl + << bu->name () << "::" << ub->local_name () << " (void) const" << be_nl + << "{\n"; + os->incr_indent (); + *os << "return this->" << ub->local_name () << "_;\n"; + os->decr_indent (); + *os << "}\n\n"; + return 0; +} + +int +be_visitor_union_branch_public_ci::visit_interface (be_interface *node) +{ + TAO_OutStream *os; // output stream + be_union_branch *ub = + this->ctx_->be_node_as_union_branch (); // get union branch + be_union *bu = + this->ctx_->be_scope_as_union (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ci::" + "visit_interface - " + "bad context information\n" + ), -1); + } + os = this->ctx_->stream (); + + // set method + os->indent (); // start from current indentation + *os << "// accessor to set the member" << be_nl + << "ACE_INLINE void" << be_nl + << bu->name () << "::" << ub->local_name () << " (" << bt->name () + << "_ptr val)// set" << be_nl + << "{\n"; + os->incr_indent (); + // set the discriminant to the appropriate label + if (ub->label ()->label_kind () == AST_UnionLabel::UL_label) + { + // valid label + *os << "// set the discriminant val" << be_nl; + // check if the case label is a symbol or a literal + if (ub->label ()->label_val ()->ec () == AST_Expression::EC_symbol) + { + *os << "this->disc_ = " << ub->label ()->label_val ()->n () + << ";" << be_nl; + } + else + { + *os << "this->disc_ = " << ub->label ()->label_val () << ";" << + be_nl; + } + *os << "// set the value" << be_nl + << "this->" << ub->local_name () << "_ = val;\n"; + } + else + { + // default label + // XXXASG - TODO + } + os->decr_indent (); + *os << "}" << be_nl; + + // get method + *os << "// retrieve the member" << be_nl + << "ACE_INLINE " << bt->name () << "_ptr " << be_nl + << bu->name () << "::" << ub->local_name () << " (void) const" << be_nl + << "{\n"; + os->incr_indent (); + *os << "return this->" << ub->local_name () << "_;\n"; + os->decr_indent (); + *os << "}\n\n"; + return 0; +} + +int +be_visitor_union_branch_public_ci::visit_interface_fwd (be_interface_fwd *node) +{ + TAO_OutStream *os; // output stream + be_union_branch *ub = + this->ctx_->be_node_as_union_branch (); // get union branch + be_union *bu = + this->ctx_->be_scope_as_union (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ci::" + "visit_interface_fwd - " + "bad context information\n" + ), -1); + } + os = this->ctx_->stream (); + + // set method + os->indent (); // start from current indentation + *os << "// accessor to set the member" << be_nl + << "ACE_INLINE void" << be_nl + << bu->name () << "::" << ub->local_name () << " (" << bt->name () + << "_ptr val)// set" << be_nl + << "{\n"; + os->incr_indent (); + // set the discriminant to the appropriate label + if (ub->label ()->label_kind () == AST_UnionLabel::UL_label) + { + // valid label + *os << "// set the discriminant val" << be_nl; + // check if the case label is a symbol or a literal + if (ub->label ()->label_val ()->ec () == AST_Expression::EC_symbol) + { + *os << "this->disc_ = " << ub->label ()->label_val ()->n () + << ";" << be_nl; + } + else + { + *os << "this->disc_ = " << ub->label ()->label_val () << ";" << + be_nl; + } + *os << "// set the value" << be_nl + << "this->" << ub->local_name () << "_ = val;\n"; + } + else + { + // default label + // XXXASG - TODO + } + os->decr_indent (); + *os << "}" << be_nl; + + // get method + *os << "// retrieve the member" << be_nl + << "ACE_INLINE " << bt->name () << "_ptr " << be_nl + << bu->name () << "::" << ub->local_name () << " (void) const" << be_nl + << "{\n"; + os->incr_indent (); + *os << "return this->" << ub->local_name () << "_;\n"; + os->decr_indent (); + *os << "}\n\n"; + return 0; +} + +int +be_visitor_union_branch_public_ci::visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os; // output stream + be_union_branch *ub = + this->ctx_->be_node_as_union_branch (); // get union branch + be_union *bu = + this->ctx_->be_scope_as_union (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ci::" + "visit_interface - " + "bad context information\n" + ), -1); + } + os = this->ctx_->stream (); + + // set method + os->indent (); // start from current indentation + *os << "// accessor to set the member" << be_nl + << "ACE_INLINE void" << be_nl + << bu->name () << "::" << ub->local_name () << " (" << bt->name (); + if (node->pt () == AST_PredefinedType::PT_pseudo) + *os << "_ptr"; + *os << " val)// set" << be_nl + << "{\n"; + os->incr_indent (); + // set the discriminant to the appropriate label + if (ub->label ()->label_kind () == AST_UnionLabel::UL_label) + { + // valid label + *os << "// set the discriminant val" << be_nl; + // check if the case label is a symbol or a literal + if (ub->label ()->label_val ()->ec () == AST_Expression::EC_symbol) + { + *os << "this->disc_ = " << ub->label ()->label_val ()->n () + << ";" << be_nl; + } + else + { + *os << "this->disc_ = " << ub->label ()->label_val () << ";" << + be_nl; + } + *os << "// set the value" << be_nl + << "this->" << ub->local_name () << "_ = val;\n"; + } + else + { + // default label + // XXXASG - TODO + } + os->decr_indent (); + *os << "}" << be_nl; + + // get method + *os << "// retrieve the member" << be_nl + << "ACE_INLINE " << bt->name (); + if (node->pt () == AST_PredefinedType::PT_pseudo) + *os << "_ptr"; + *os << be_nl; + *os << bu->name () << "::" << ub->local_name () << " (void) const" << be_nl + << "{\n"; + os->incr_indent (); + *os << "return this->" << ub->local_name () << "_;\n"; + os->decr_indent (); + *os << "}\n\n"; + return 0; +} + +int +be_visitor_union_branch_public_ci::visit_sequence (be_sequence *node) +{ + return 0; +} + +int +be_visitor_union_branch_public_ci::visit_string (be_string *node) +{ + TAO_OutStream *os; // output stream + be_union_branch *ub = + this->ctx_->be_node_as_union_branch (); // get union branch + be_union *bu = + this->ctx_->be_scope_as_union (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ci::" + "visit_string - " + "bad context information\n" + ), -1); + } + os = this->ctx_->stream (); + + // three methods to set the string value + + // (1) set method from char* + os->indent (); // start from current indentation + *os << "// accessor to set the member" << be_nl + << "ACE_INLINE void" << be_nl + << bu->name () << "::" << ub->local_name () << " (char *val)" + << be_nl + << "{" << be_idt_nl; + // set the discriminant to the appropriate label + if (ub->label ()->label_kind () == AST_UnionLabel::UL_label) + { + // valid label + *os << "// set the discriminant val" << be_nl; + // check if the case label is a symbol or a literal + if (ub->label ()->label_val ()->ec () == AST_Expression::EC_symbol) + { + *os << "this->disc_ = " << ub->label ()->label_val ()->n () + << ";" << be_nl; + } + else + { + *os << "this->disc_ = " << ub->label ()->label_val () << ";" << + be_nl; + } + *os << "// set the value" << be_nl + << "if (!this->" << ub->local_name () << "_) // does not exist" + << be_nl + << "\tthis->" << ub->local_name () + << "_ = new CORBA::String_var (val);" << be_nl + << "else" << be_nl + << "\t*this->" << ub->local_name () << "_ = val;"; + } + else + { + // default label + // XXXASG - TODO + } + *os << be_uidt_nl << "}" << be_nl; + + // (2) set method from const char * + *os << "// accessor to set the member" << be_nl + << "ACE_INLINE void" << be_nl + << bu->name () << "::" << ub->local_name () + << " (const char *val)" << be_nl + << "{\n"; + os->incr_indent (); + // set the discriminant to the appropriate label + if (ub->label ()->label_kind () == AST_UnionLabel::UL_label) + { + // valid label + *os << "// set the discriminant val" << be_nl; + // check if the case label is a symbol or a literal + if (ub->label ()->label_val ()->ec () == AST_Expression::EC_symbol) + { + *os << "this->disc_ = " << ub->label ()->label_val ()->n () + << ";" << be_nl; + } + else + { + *os << "this->disc_ = " << ub->label ()->label_val () << ";" << + be_nl; + } + *os << "// set the value" << be_nl + << "if (!this->" << ub->local_name () << "_) // does not exist" + << be_nl + << "\tthis->" << ub->local_name () + << "_ = new CORBA::String_var (val);" << be_nl + << "else" << be_nl + << "\t*this->" << ub->local_name () << "_ = val;" << be_uidt_nl; + } + else + { + // default label + // XXXASG - TODO + } + + *os << "}" << be_nl; + + // (3) set from const String_var& + *os << "// accessor to set the member" << be_nl + << "ACE_INLINE void" << be_nl + << bu->name () << "::" << ub->local_name () + << " (const CORBA::String_var &val)" << be_nl + << "{" << be_idt_nl; + // set the discriminant to the appropriate label + if (ub->label ()->label_kind () == AST_UnionLabel::UL_label) + { + // valid label + *os << "// set the discriminant val" << be_nl; + // check if the case label is a symbol or a literal + if (ub->label ()->label_val ()->ec () == AST_Expression::EC_symbol) + { + *os << "this->disc_ = " << ub->label ()->label_val ()->n () + << ";" << be_nl; + } + else + { + *os << "this->disc_ = " << ub->label ()->label_val () << ";" << + be_nl; + } + *os << "// set the value" << be_nl + << "if (!this->" << ub->local_name () << "_) // does not exist" + << be_nl + << "\tthis->" << ub->local_name () + << "_ = new CORBA::String_var (val);" << be_nl + << "else" << be_nl + << "\t*this->" << ub->local_name () << "_ = val;"; + } + else + { + // default label + // XXXASG - TODO + } + *os << be_uidt_nl << "}" << be_nl; + + // get method + *os << "ACE_INLINE const char *" << be_nl + << bu->name () << "::" << ub->local_name () + << " (void) const // get method" << be_nl + << "{" << be_idt_nl + << "return *this->" << ub->local_name () << "_;" << be_uidt_nl + << "}\n\n"; + return 0; +} + +int +be_visitor_union_branch_public_ci::visit_structure (be_structure *node) +{ + TAO_OutStream *os; // output stream + be_union_branch *ub = + this->ctx_->be_node_as_union_branch (); // get union branch + be_union *bu = + this->ctx_->be_scope_as_union (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ci::" + "visit_structure - " + "bad context information\n" + ), -1); + } + os = this->ctx_->stream (); + + if (bt->node_type () != AST_Decl::NT_typedef // not a typedef + && bt->is_child (bu)) // bt is defined inside the union + { + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope + // is still the same + + // first generate the enum declaration + ctx.state (TAO_CodeGen::TAO_STRUCT_CI); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ci::" + "visit_structure - " + "Bad visitor\n" + ), -1); + } + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ci::" + "visit_structure - " + "codegen failed\n" + ), -1); + } + delete visitor; + } + + // (1) set from a const + *os << "// accessor to set the member" << be_nl + << "ACE_INLINE void" << be_nl + << bu->name () << "::" << ub->local_name () + << " (const " << bt->name () << " &val)" << be_nl + << "{" << be_idt_nl; + + // set the discriminant to the appropriate label + if (ub->label ()->label_kind () == AST_UnionLabel::UL_label) + { + // valid label + *os << "// set the discriminant val" << be_nl; + // check if the case label is a symbol or a literal + if (ub->label ()->label_val ()->ec () == AST_Expression::EC_symbol) + { + *os << "this->disc_ = " << ub->label ()->label_val ()->n () + << ";" << be_nl; + } + else + { + *os << "this->disc_ = " << ub->label ()->label_val () << ";" + << be_nl; + } + *os << "// set the value" << be_nl + << "this->" << ub->local_name () << "_ = val;" << be_uidt_nl; + } + else + { + // default label + // XXXASG - TODO + } + *os << "}" << be_nl; + + // readonly get method + *os << "// readonly get method " << be_nl + << "ACE_INLINE const " << bt->name () << " &" << be_nl + << bu->name () << "::" << ub->local_name () << " (void) const" << be_nl + << "{" << be_idt_nl + << "return this->" << ub->local_name () << "_;" << be_uidt_nl + << "}" << be_nl; + + // read/write get method + *os << "// read/write get method " << be_nl + << "ACE_INLINE " << bt->name () << " &" << be_nl + << bu->name () << "::" << ub->local_name () << " (void)" << be_nl + << "{" << be_idt_nl + << "return this->" << ub->local_name () << "_;" << be_uidt_nl + << "}\n\n"; + + return 0; +} + +int +be_visitor_union_branch_public_ci::visit_typedef (be_typedef *node) +{ + TAO_OutStream *os; // output stream + + os = this->ctx_->stream (); + this->ctx_->alias (node); // save the typedef node for use in code generation + // as we visit the base type + + // the node to be visited in the base primitve type that gets typedefed + be_type *bt = node->primitive_base_type (); + if (!bt || (bt->accept (this) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ci::" + "visit_typedef - " + "Bad primitive type\n" + ), -1); + } + + return 0; +} + +int +be_visitor_union_branch_public_ci::visit_union (be_union *node) +{ + TAO_OutStream *os; // output stream + be_union_branch *ub = + this->ctx_->be_node_as_union_branch (); // get union branch + be_union *bu = + this->ctx_->be_scope_as_union (); // get the enclosing union backend + be_type *bt; + + // check if we are visiting this node via a visit to a typedef node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (!ub || !bu) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ci::" + "visit_union - " + "bad context information\n" + ), -1); + } + os = this->ctx_->stream (); + + if (bt->node_type () != AST_Decl::NT_typedef // not a typedef + && bt->is_child (bu)) // bt is defined inside the union + { + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope + // is still the same + + // first generate the enum declaration + ctx.state (TAO_CodeGen::TAO_UNION_CI); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ci::" + "visit_union - " + "Bad visitor\n" + ), -1); + } + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_ci::" + "visit_union - " + "codegen failed\n" + ), -1); + } + delete visitor; + } + + // (1) set from a const + *os << "// accessor to set the member" << be_nl + << "ACE_INLINE void" << be_nl + << bu->name () << "::" << ub->local_name () + << " (const " << bt->name () << " &val)" << be_nl + << "{" << be_idt_nl; + os->incr_indent (); // set the discriminant to the appropriate label + if (ub->label ()->label_kind () == AST_UnionLabel::UL_label) + { + // valid label + *os << "// set the discriminant val" << be_nl; + // check if the case label is a symbol or a literal + if (ub->label ()->label_val ()->ec () == AST_Expression::EC_symbol) + { + *os << "this->disc_ = " << ub->label ()->label_val ()->n () + << ";" << be_nl; + } + else + { + *os << "this->disc_ = " << ub->label ()->label_val () << ";" << + be_nl; + } + *os << "// set the value" << be_nl + << "*this->" << ub->local_name () << "_ = val;" << be_uidt_nl; + } + else + { + // default label + // XXXASG - TODO + } + *os << "}" << be_nl; + + // readonly get method + *os << "// readonly get method " << be_nl + << "ACE_INLINE const " << bt->name () << " &" << be_nl + << bu->name () << "::" << ub->local_name () << " (void) const" << be_nl + << "{" << be_idt_nl + << "return *this->" << ub->local_name () << "_;" << be_uidt_nl + << "}" << be_nl; + + // read/write get method + *os << "// read/write get method " << be_nl + << "ACE_INLINE " << bt->name () << " &" << be_nl + << bu->name () << "::" << ub->local_name () << " (void)" << be_nl + << "{" << be_idt_nl + << "return *this->" << ub->local_name () << "_;" << be_uidt_nl + << "}\n\n"; + + return 0; +} + +// ********************************************** +// visitor for union_branch in the client stubs file +// ********************************************** + +// constructor +be_visitor_union_branch_public_cs::be_visitor_union_branch_public_cs (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +// destructor +be_visitor_union_branch_public_cs::~be_visitor_union_branch_public_cs (void) +{ +} + +// visit the union_branch node +int +be_visitor_union_branch_public_cs::visit_union_branch (be_union_branch *node) +{ + TAO_OutStream *os; // output stream + + be_type *bt; // union_branch's type + + os = this->ctx_->stream (); + // first generate the type information + bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_cs::" + "visit_union_branch - " + "Bad union_branch type\n" + ), -1); + } + + this->ctx_->node (node); // save the node + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_cs::" + "visit_union_branch - " + "codegen for union_branch type failed\n" + ), -1); + } + return 0; +} + +// visit array type +int +be_visitor_union_branch_public_cs::visit_array (be_array *node) +{ + return 0; +} + +// visit enum type +int +be_visitor_union_branch_public_cs::visit_enum (be_enum *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // generate the typcode for enums + ctx.state (TAO_CodeGen::TAO_ENUM_CS); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_cs::" + "visit_enum - " + "Bad visitor\n" + ), -1); + } + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_cs::" + "visit_enum - " + "codegen failed\n" + ), -1); + } + delete visitor; + return 0; +} + +// visit sequence type +int +be_visitor_union_branch_public_cs::visit_sequence (be_sequence *node) +{ + return 0; +} + +// visit string type +int +be_visitor_union_branch_public_cs::visit_string (be_string *node) +{ + return 0; +} + +// visit structure type +int +be_visitor_union_branch_public_cs::visit_structure (be_structure *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // generate the inline code for structs + ctx.state (TAO_CodeGen::TAO_STRUCT_CS); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_cs::" + "visit_struct - " + "Bad visitor\n" + ), -1); + } + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_cs::" + "visit_struct - " + "codegen failed\n" + ), -1); + } + delete visitor; + return 0; +} + +// visit union type +int +be_visitor_union_branch_public_cs::visit_union (be_union *node) +{ + // instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting + be_visitor_context ctx (*this->ctx_); + ctx.node (node); // set the node to be the node being visited. The scope is + // still the same + + // generate the inline code for union + ctx.state (TAO_CodeGen::TAO_UNION_CS); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_cs::" + "visit_union - " + "Bad visitor\n" + ), -1); + } + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_branch_public_cs::" + "visit_union - " + "codegen failed\n" + ), -1); + } + delete visitor; + return 0; +} + + +// ********************************************** +// visitor for union_branch in the client stubs file generating the code for +// the copy ctor and assignment operator +// ********************************************** + +// constructor +be_visitor_union_branch_public_assign_cs::be_visitor_union_branch_public_assign_cs +(be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +// destructor +be_visitor_union_branch_public_assign_cs::~be_visitor_union_branch_public_assign_cs +(void) +{ +} + +// visit the union_branch node +int +be_visitor_union_branch_public_assign_cs::visit_union_branch (be_union_branch *node) +{ + TAO_OutStream *os; // output stream + be_union_branch *ub = + this->ctx_->be_node_as_union_branch (); // get union branch + be_union *bu = + this->ctx_->be_scope_as_union (); // get the enclosing union backend + + os = this->ctx_->stream (); + + // This visitor is used when we are generating the copy ctor and + // assignment operator for the union. + // Individual assignment of the members takes place inside a case + // statement because the type of member assigned is based on the value + // of the discriminant + os->indent (); + if (ub->label ()->label_val ()->ec () == AST_Expression::EC_symbol) + { + *os << "case " << ub->label ()->label_val ()->n () << ":" << be_idt_nl; + } + else + { + *os << "case " << ub->label ()->label_val () << ":" << be_idt_nl; + } + + *os << "this->" << ub->local_name () << "_ = u." << ub->local_name () + << "_;" << be_nl + << "break;\n"; + os->decr_indent (0); + + return 0; +} diff --git a/TAO/TAO_IDL/be_include/be.h b/TAO/TAO_IDL/be_include/be.h index 8ff23997fd6..3dafbfec175 100644 --- a/TAO/TAO_IDL/be_include/be.h +++ b/TAO/TAO_IDL/be_include/be.h @@ -119,5 +119,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "be_factory.h" // factory #include "be_visitor.h" // abstract visitor +#include "be_visitor_context.h" // visitor context #endif // _BE_BE_HH diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h index 018fe2c8f0f..f4fcddd3959 100644 --- a/TAO/TAO_IDL/be_include/be_codegen.h +++ b/TAO/TAO_IDL/be_include/be_codegen.h @@ -1,3 +1,4 @@ +// $Id$ /* -*- c++ -*- */ // ============================================================================ // @@ -22,6 +23,7 @@ // maximum length of static buffers used to store names class TAO_Visitor_Factory; +class be_visitor_context; class TAO_CodeGen { @@ -44,21 +46,112 @@ public: // initial state TAO_INITIAL, - // emitting code for root - TAO_ROOT_CH, - TAO_ROOT_CI, - TAO_ROOT_CS, - TAO_ROOT_SH, - TAO_ROOT_SI, - TAO_ROOT_SS, + // rest of the state in alphabetical order of the types - // emitting code for the module - TAO_MODULE_CH, - TAO_MODULE_CI, - TAO_MODULE_CS, - TAO_MODULE_SH, - TAO_MODULE_SI, - TAO_MODULE_SS, + // emitting code for arguments of an operation. No distinction between + // headers, inlines, stubs. + TAO_ARGUMENT_CH, // in client header + TAO_ARGUMENT_CI, // in client inline + TAO_ARGUMENT_CS, // in client stubs + TAO_ARGUMENT_SH, // in server header + TAO_ARGUMENT_SI, // in server inline + TAO_ARGUMENT_SS, // in server skeleton + TAO_ARGUMENT_ARGLIST_CH, // argument in op signature of + // ... client header + TAO_ARGUMENT_ARGLIST_OTHERS, // ... in other cases + TAO_ARGUMENT_PRE_DOCALL_CS, // preprocessing of argument + // variable before passing to + // do_call (in stub) + TAO_ARGUMENT_DOCALL_CS, // passing argument variable to do_call + TAO_ARGUMENT_POST_DOCALL_CS, // postprocessing of argument + // variable after do_call + TAO_ARGUMENT_VARDECL_SS, // declaration of argument + // variable in skeleton (server) + TAO_ARGUMENT_MARSHAL_SS, // passing argument node to the + TAO_ARGUMENT_DEMARSHAL_SS, // demarshal and marshal operations + TAO_ARGUMENT_PRE_UPCALL_SS, // preprocessing of argument + // variable before upcall + TAO_ARGUMENT_UPCALL_SS, // passing argument variable to upcall + TAO_ARGUMENT_POST_UPCALL_SS, // postprocessing of argument + // variable after upcall + + // emitting code for attributes. + TAO_ATTRIBUTE_CH, // in client header + TAO_ATTRIBUTE_CS, // in client stubs + TAO_ATTRIBUTE_SH, // in server header + TAO_ATTRIBUTE_SS, // in server skeletons + TAO_ATTRIBUTE_COLLOCATED_SH, // in server header for collocated + TAO_ATTRIBUTE_COLLOCATED_SS, // in server skeletons for + // collocated + + TAO_ATTRIBUTE_RETVAL_DECL_SS, + TAO_ATTRIBUTE_RETVAL_ASSIGN_SS, + TAO_ATTRIBUTE_RETURN_TYPE_CH, + TAO_ATTRIBUTE_INPARAM_TYPE_CH, + TAO_ATTRIBUTE_RETURN_TYPE_CS, + TAO_ATTRIBUTE_RETVAL_DECL_CS, + TAO_ATTRIBUTE_RETVAL_EXCEPTION_CS, + TAO_ATTRIBUTE_RETVAL_RETURN_CS, + TAO_ATTRIBUTE_INPARAM_TYPE_CS, + TAO_ATTRIBUTE_PRE_DOCALL_CS, + TAO_ATTRIBUTE_DOCALL_CS, + TAO_ATTRIBUTE_POST_DOCALL_CS, + TAO_ATTRIBUTE_RETURN_TYPE_SH, + TAO_ATTRIBUTE_INPARAM_TYPE_SH, + TAO_ATTRIBUTE_RESULT_SS, + TAO_ATTRIBUTE_INPARAM_TYPE_SS, + TAO_ATTRIBUTE_PRE_UPCALL_SS, + TAO_ATTRIBUTE_UPCALL_SS, + TAO_ATTRIBUTE_POST_UPCALL_SS, + + // emitting code for array defn + TAO_ARRAY_CH, + TAO_ARRAY_CI, + TAO_ARRAY_CS, + + TAO_ARRAY_DEFN_CH, + TAO_ARRAY_DEFN_CI, + TAO_ARRAY_DEFN_CS, + TAO_ARRAY_DEFN_SH, + TAO_ARRAY_DEFN_SI, + TAO_ARRAY_DEFN_SS, + + // emitting code for rest of the array decl + TAO_ARRAY_OTHER_CH, + TAO_ARRAY_OTHER_CI, + TAO_ARRAY_OTHER_CS, + TAO_ARRAY_OTHER_SH, + TAO_ARRAY_OTHER_SI, + TAO_ARRAY_OTHER_SS, + + // emitting code for the constants + TAO_CONSTANT_CH, // in client header + TAO_CONSTANT_CI, // XXXASG rm? + TAO_CONSTANT_CS, // in client stub + + // emitting code for enums + TAO_ENUM_CH, // in client header + TAO_ENUM_CI, // XXXASG rm? + TAO_ENUM_CS, // in client stubs + TAO_ENUM_SH, // XXXASG rm? all 3 + TAO_ENUM_SI, + TAO_ENUM_SS, + + // emitting code for exceptions + TAO_EXCEPTION_CH, + TAO_EXCEPTION_CTOR_CH, + TAO_EXCEPTION_CI, + TAO_EXCEPTION_CS, + TAO_EXCEPTION_CTOR_CS, + TAO_EXCEPTION_CTOR_ASSIGN_CS, + TAO_EXCEPTION_SH, + TAO_EXCEPTION_SI, + TAO_EXCEPTION_SS, + + // emitting fields i.e., struct members + TAO_FIELD_CH, + TAO_FIELD_CI, + TAO_FIELD_CS, // emitting code for the interface TAO_INTERFACE_CH, @@ -67,14 +160,84 @@ public: TAO_INTERFACE_SH, TAO_INTERFACE_SI, TAO_INTERFACE_SS, + TAO_INTERFACE_COLLOCATED_SH, + TAO_INTERFACE_COLLOCATED_SS, - // emitting code for the constants - TAO_CONSTANT_CH, - TAO_CONSTANT_CI, - TAO_CONSTANT_CS, - TAO_CONSTANT_SH, - TAO_CONSTANT_SI, - TAO_CONSTANT_SS, + // emitting code for the interface forward declaration + TAO_INTERFACE_FWD_CH, + TAO_INTERFACE_FWD_CI, + + // emitting code for the module + TAO_MODULE_CH, + TAO_MODULE_CI, + TAO_MODULE_CS, + TAO_MODULE_SH, + TAO_MODULE_SI, + TAO_MODULE_SS, + + // emitting code for an operation. + TAO_OPERATION_CH, // in client header + TAO_OPERATION_CI, // XXXASG rm? + TAO_OPERATION_CS, // in client stubs + TAO_OPERATION_SH, // in server header + TAO_OPERATION_SI, // XXXASG rm? + TAO_OPERATION_SS, // in server skeletons + TAO_OPERATION_COLLOCATED_SH, // in collocated server header + TAO_OPERATION_COLLOCATED_SS, // in collocated server skel + TAO_OPERATION_RETTYPE_CH, // return type in client header op + // signature + TAO_OPERATION_RETTYPE_OTHERS, // ... in other cases + TAO_OPERATION_RETURN_TYPE_CS, // + TAO_OPERATION_ARGLIST_CH, // parameter list in op signature + // ... for client header + TAO_OPERATION_ARGLIST_SH, // ... for server header + TAO_OPERATION_ARGLIST_COLLOCATED_SH, // ... for collocated server + TAO_OPERATION_ARGLIST_OTHERS, // ... for all other cases + TAO_OPERATION_RETVAL_DECL_CS, // return value variable declaration + TAO_OPERATION_RETVAL_EXCEPTION_CS, // return value on exception (error) + TAO_OPERATION_RETVAL_PRE_DOCALL_CS, // preprocessing for return value + // before sending over the wire + TAO_OPERATION_ARG_PRE_DOCALL_CS, // preprocessing of arguments + // before do_call + TAO_OPERATION_RETVAL_DOCALL_CS, // passing the return type + // variable to do_call + TAO_OPERATION_ARG_DOCALL_CS, // passing argument variable to do_call + TAO_OPERATION_RETVAL_POST_DOCALL_CS, // processing of return type + // after do_call + TAO_OPERATION_ARG_POST_DOCALL_CS, // processing of arg after do_call + TAO_OPERATION_RETVAL_RETURN_CS, // returning the return type variable + TAO_OPERATION_RETVAL_DECL_SS, // return type decl in skeleton + TAO_OPERATION_ARG_DECL_SS, // argument decl in skeleton + TAO_OPERATION_RETVAL_DEMARSHAL_SS, // passing return type variable + TAO_OPERATION_ARG_DEMARSHAL_SS, // and argument variables to the + TAO_OPERATION_RETVAL_MARSHAL_SS, // marshal and demarshal operations + TAO_OPERATION_ARG_MARSHAL_SS, + TAO_OPERATION_RETVAL_ASSIGN_SS, // assigning to return type + // variable + TAO_OPERATION_ARG_PRE_UPCALL_SS, // pre upcall processing + TAO_OPERATION_RETVAL_UPCALL_SS, // passing return type var and argument + TAO_OPERATION_ARG_UPCALL_SS, // variables to upcall + TAO_OPERATION_RETVAL_POST_UPCALL_SS, // post upcall processing for + TAO_OPERATION_ARG_POST_UPCALL_SS, // return and argument variables + TAO_OPERATION_RESULT_SS, // XXXASG rm? + + // for predefined type + TAO_PREDEFINED_TYPE_CH, + TAO_PREDEFINED_TYPE_CI, + TAO_PREDEFINED_TYPE_CS, + + // emitting code for root + TAO_ROOT_CH, + TAO_ROOT_CI, + TAO_ROOT_CS, + TAO_ROOT_SH, + TAO_ROOT_SI, + TAO_ROOT_SS, + + // emitting sequences + TAO_SEQUENCE_CH, + TAO_SEQUENCE_CI, + TAO_SEQUENCE_CS, // emitting code for sequence base type TAO_SEQUENCE_BASE_CH, @@ -97,6 +260,37 @@ public: TAO_SEQELEM_RETTYPE_CI, TAO_SEQELEM_RETTYPE_CS, + // for sequence buffer types + TAO_SEQUENCE_BUFFER_TYPE_CH, + TAO_SEQUENCE_BUFFER_TYPE_CI, + TAO_SEQUENCE_BUFFER_TYPE_CS, + + // emitting code for strings + TAO_STRING_CH, + TAO_STRING_CI, + TAO_STRING_CS, + TAO_STRING_SH, + TAO_STRING_SI, + TAO_STRING_SS, + + // emitting code for struct and its members + TAO_STRUCT_CH, + TAO_STRUCT_CI, + TAO_STRUCT_CS, + + // emitting code for typedefs + TAO_TYPEDEF_CH, + TAO_TYPEDEF_CI, + TAO_TYPEDEF_CS, + TAO_TYPEDEF_SH, + TAO_TYPEDEF_SI, + TAO_TYPEDEF_SS, + + // emitting code for unions + TAO_UNION_CH, + TAO_UNION_CI, + TAO_UNION_CS, + // emitting code for the discriminant TAO_UNION_DISCTYPEDEFN_CH, TAO_UNION_DISCTYPEDEFN_CI, @@ -122,114 +316,9 @@ public: TAO_UNION_PRIVATE_SI, TAO_UNION_PRIVATE_SS, - // emitting code for struct and its members - TAO_STRUCT_CH, - TAO_STRUCT_CI, - TAO_STRUCT_CS, - TAO_STRUCT_SH, - TAO_STRUCT_SI, - TAO_STRUCT_SS, - - // emitting code for exceptions - TAO_EXCEPTION_CH, - TAO_EXCEPTION_CTOR_CH, - TAO_EXCEPTION_CI, - TAO_EXCEPTION_CS, - TAO_EXCEPTION_CTOR_CS, - TAO_EXCEPTION_CTOR_ASSIGN_CS, - TAO_EXCEPTION_SH, - TAO_EXCEPTION_SI, - TAO_EXCEPTION_SS, - - // emitting code for enums - TAO_ENUM_CH, - TAO_ENUM_CI, - TAO_ENUM_CS, - TAO_ENUM_SH, - TAO_ENUM_SI, - TAO_ENUM_SS, - - // emitting code for array defn - TAO_ARRAY_DEFN_CH, - TAO_ARRAY_DEFN_CI, - TAO_ARRAY_DEFN_CS, - TAO_ARRAY_DEFN_SH, - TAO_ARRAY_DEFN_SI, - TAO_ARRAY_DEFN_SS, - - // emitting code for rest of the array decl - TAO_ARRAY_OTHER_CH, - TAO_ARRAY_OTHER_CI, - TAO_ARRAY_OTHER_CS, - TAO_ARRAY_OTHER_SH, - TAO_ARRAY_OTHER_SI, - TAO_ARRAY_OTHER_SS, - - // emitting code for strings - TAO_STRING_CH, - TAO_STRING_CI, - TAO_STRING_CS, - TAO_STRING_SH, - TAO_STRING_SI, - TAO_STRING_SS, - - // emitting code for an operation. - TAO_OPERATION_CH, - TAO_OPERATION_CI, - TAO_OPERATION_RETURN_TYPE_CS, - TAO_OPERATION_RETVAL_DECL_CS, - TAO_OPERATION_RETVAL_EXCEPTION_CS, - TAO_OPERATION_RETVAL_RETURN_CS, - TAO_OPERATION_SH, - TAO_OPERATION_SI, - TAO_OPERATION_RETVAL_DECL_SS, - TAO_OPERATION_RETVAL_ASSIGN_SS, - TAO_OPERATION_RESULT_SS, - - // emitting code for arguments of an operation. No distinction between - // headers, inclines, stubs. - TAO_ARGUMENT_CH, - TAO_ARGUMENT_CI, - TAO_ARGUMENT_CS, - TAO_ARGUMENT_DOCALL_CS, - TAO_ARGUMENT_PRE_DOCALL_CS, - TAO_ARGUMENT_POST_DOCALL_CS, - TAO_ARGUMENT_SH, - TAO_ARGUMENT_SI, - TAO_ARGUMENT_SS, - TAO_ARGUMENT_VARDECL_SS, - TAO_ARGUMENT_UPCALL_SS, - TAO_ARGUMENT_PRE_UPCALL_SS, - TAO_ARGUMENT_POST_UPCALL_SS, - - // emitting code for attributes - TAO_ATTRIBUTE_RETURN_TYPE_CH, - TAO_ATTRIBUTE_INPARAM_TYPE_CH, - TAO_ATTRIBUTE_RETURN_TYPE_CS, - TAO_ATTRIBUTE_RETVAL_DECL_CS, - TAO_ATTRIBUTE_RETVAL_EXCEPTION_CS, - TAO_ATTRIBUTE_RETVAL_RETURN_CS, - TAO_ATTRIBUTE_INPARAM_TYPE_CS, - TAO_ATTRIBUTE_PRE_DOCALL_CS, - TAO_ATTRIBUTE_DOCALL_CS, - TAO_ATTRIBUTE_POST_DOCALL_CS, - TAO_ATTRIBUTE_RETURN_TYPE_SH, - TAO_ATTRIBUTE_INPARAM_TYPE_SH, - TAO_ATTRIBUTE_RETVAL_DECL_SS, - TAO_ATTRIBUTE_RETVAL_ASSIGN_SS, - TAO_ATTRIBUTE_RESULT_SS, - TAO_ATTRIBUTE_INPARAM_TYPE_SS, - TAO_ATTRIBUTE_PRE_UPCALL_SS, - TAO_ATTRIBUTE_UPCALL_SS, - TAO_ATTRIBUTE_POST_UPCALL_SS, + // Always must be last + TAO_UNKNOWN - // emitting code for typedefs - TAO_TYPEDEF_CH, - TAO_TYPEDEF_CI, - TAO_TYPEDEF_CS, - TAO_TYPEDEF_SH, - TAO_TYPEDEF_SI, - TAO_TYPEDEF_SS }; TAO_CodeGen (void); @@ -238,8 +327,8 @@ public: ~TAO_CodeGen (void); // destructor - be_visitor *make_visitor (CG_STATE); - // Factory that makes the right visitor based on the state. This + be_visitor *make_visitor (be_visitor_context *); + // Factory that makes the right visitor based on the contex. This // delegates the task to its factory data member be_state *make_state (void); @@ -362,5 +451,6 @@ private: typedef ACE_Singleton<TAO_CodeGen, ACE_SYNCH_RECURSIVE_MUTEX> TAO_CODEGEN; // Singleton instance of the BE code generator +extern TAO_CodeGen *tao_cg; // code generator instance which is used everywhere #endif // if !defined diff --git a/TAO/TAO_IDL/be_include/be_constant.h b/TAO/TAO_IDL/be_include/be_constant.h index a5139d8eed9..e11271450b1 100644 --- a/TAO/TAO_IDL/be_include/be_constant.h +++ b/TAO/TAO_IDL/be_include/be_constant.h @@ -56,6 +56,10 @@ public: virtual int gen_server_inline (void); // Generates the server-side inlines for the constant + // = helper + char *exprtype_to_string (void); + // returns the appropriate type + // Visiting virtual int accept (be_visitor *visitor); @@ -63,9 +67,6 @@ public: DEF_NARROW_METHODS2 (be_constant, AST_Constant, be_decl); DEF_NARROW_FROM_DECL (be_constant); -private: - char *exprtype_to_string (void); - // returns the appropriate type }; #endif // if !defined diff --git a/TAO/TAO_IDL/be_include/be_decl.h b/TAO/TAO_IDL/be_include/be_decl.h index f6b8f8f9578..2a37587f419 100644 --- a/TAO/TAO_IDL/be_include/be_decl.h +++ b/TAO/TAO_IDL/be_include/be_decl.h @@ -103,6 +103,25 @@ public: // Visiting virtual int accept (be_visitor *visitor); + // boolean methods to test if code was already generated + idl_bool cli_hdr_gen (void); + idl_bool cli_stub_gen (void); + idl_bool cli_inline_gen (void); + idl_bool srv_hdr_gen (void); + idl_bool srv_skel_gen (void); + idl_bool srv_inline_gen (void); + + // set the flag indicating that code generation is done + void cli_hdr_gen (idl_bool); + void cli_stub_gen (idl_bool); + void cli_inline_gen (idl_bool); + void srv_hdr_gen (idl_bool); + void srv_skel_gen (idl_bool); + void srv_inline_gen (idl_bool); + + idl_bool is_child (be_decl *node); + // am I a direct child of node? + // Narrowing DEF_NARROW_METHODS1 (be_decl, AST_Decl); DEF_NARROW_FROM_DECL (be_decl); diff --git a/TAO/TAO_IDL/be_include/be_factory.h b/TAO/TAO_IDL/be_include/be_factory.h index 9ad3b3cbed2..9ed9a18f0de 100644 --- a/TAO/TAO_IDL/be_include/be_factory.h +++ b/TAO/TAO_IDL/be_include/be_factory.h @@ -32,7 +32,7 @@ public: virtual ~TAO_Visitor_Factory (void); // destructor - virtual be_visitor *make_visitor (TAO_CodeGen::CG_STATE) = 0; + virtual be_visitor *make_visitor (be_visitor_context *) = 0; // create the right visitor }; diff --git a/TAO/TAO_IDL/be_include/be_helper.h b/TAO/TAO_IDL/be_include/be_helper.h index 37bf67d7ca7..e456e7394b3 100644 --- a/TAO/TAO_IDL/be_include/be_helper.h +++ b/TAO/TAO_IDL/be_include/be_helper.h @@ -14,6 +14,8 @@ // = AUTHOR // Aniruddha Gokhale // +// Improvements by Carlos O'Ryan +// // ============================================================================ #if !defined (TAO_BE_OUTSTRM_H) @@ -47,7 +49,7 @@ struct TAO_UNINDENT // Operates like a manipulator, decreasing the indentation level. // // = DESCRIPTION - // Increase the indentation level, if the "do_now" parameter is + // Decrease the indentation level, if the "do_now" parameter is // not zero then the <indent> method is called on the stream. // TAO_UNINDENT (int do_now = 0); diff --git a/TAO/TAO_IDL/be_include/be_interface.h b/TAO/TAO_IDL/be_include/be_interface.h index e8b58e4f468..d3da948c261 100644 --- a/TAO/TAO_IDL/be_include/be_interface.h +++ b/TAO/TAO_IDL/be_include/be_interface.h @@ -153,7 +153,6 @@ public: TAO_OutStream *os); // helper method passed to the template method -private: void compute_fullskelname (void); // compute the fully scoped skel class name diff --git a/TAO/TAO_IDL/be_include/be_interpretive.h b/TAO/TAO_IDL/be_include/be_interpretive.h index e8136e5108d..e6312b8d2cd 100644 --- a/TAO/TAO_IDL/be_include/be_interpretive.h +++ b/TAO/TAO_IDL/be_include/be_interpretive.h @@ -34,7 +34,7 @@ public: virtual ~TAO_Interpretive_Visitor_Factory (void); // destructor - virtual be_visitor *make_visitor (TAO_CodeGen::CG_STATE); + virtual be_visitor *make_visitor (be_visitor_context *); // create the right visitor }; diff --git a/TAO/TAO_IDL/be_include/be_operation.h b/TAO/TAO_IDL/be_include/be_operation.h index 56dd57b42d6..bf22269394e 100644 --- a/TAO/TAO_IDL/be_include/be_operation.h +++ b/TAO/TAO_IDL/be_include/be_operation.h @@ -20,6 +20,8 @@ #if !defined (BE_OPERATION_H) #define BE_OPERATION_H +class be_argument; + /* * BE_Operation */ @@ -63,6 +65,9 @@ public: // This is important because in that case no code should be // generated for the stubs. + be_argument *add_argument_to_scope (be_argument *arg); + // add an argument to the scope + // Visiting virtual int accept (be_visitor *visitor); diff --git a/TAO/TAO_IDL/be_include/be_sequence.h b/TAO/TAO_IDL/be_include/be_sequence.h index eeec67624c3..ce5cb519f89 100644 --- a/TAO/TAO_IDL/be_include/be_sequence.h +++ b/TAO/TAO_IDL/be_include/be_sequence.h @@ -24,6 +24,8 @@ * BE_Sequence */ +class be_typedef; + // A sequence in OMG IDL does not define a scoping construct just as a struct // or union or an interface do. However, in the C++ mapping, a sequence becomes // a class. If the base type of a sequence is another anonymous sequence, then @@ -50,7 +52,7 @@ public: be_sequence (AST_Expression *v, AST_Type *bt); // constructor - virtual int create_name (void); + virtual int create_name (be_typedef *node=0); // create a name for ourselves. If we are typedefed, then we get the name of // the typedef node, else we generate a name for ourselves diff --git a/TAO/TAO_IDL/be_include/be_type.h b/TAO/TAO_IDL/be_include/be_type.h index 8b572b19245..9d3949f28e5 100644 --- a/TAO/TAO_IDL/be_include/be_type.h +++ b/TAO/TAO_IDL/be_include/be_type.h @@ -76,7 +76,7 @@ public: UTL_ScopedName *tc_name (void); // return the typecode name - virtual char *nested_type_name (be_decl *d, char *suffix = 0); + virtual const char *nested_type_name (be_decl *d, const char *suffix = 0); // type name of a node used when generating declarations virtual int write_as_return (TAO_OutStream *stream, diff --git a/TAO/TAO_IDL/be_include/be_union.h b/TAO/TAO_IDL/be_include/be_union.h index 93555e10b0d..8d9729a74cf 100644 --- a/TAO/TAO_IDL/be_include/be_union.h +++ b/TAO/TAO_IDL/be_include/be_union.h @@ -96,6 +96,10 @@ public: DEF_NARROW_FROM_DECL(be_union); DEF_NARROW_FROM_SCOPE(be_union); +protected: + virtual int compute_size_type (void); + // compute the size type if it is unknown + private: //=helper diff --git a/TAO/TAO_IDL/be_include/be_union_branch.h b/TAO/TAO_IDL/be_include/be_union_branch.h index cc63f776d94..75393231e57 100644 --- a/TAO/TAO_IDL/be_include/be_union_branch.h +++ b/TAO/TAO_IDL/be_include/be_union_branch.h @@ -2,7 +2,7 @@ // // = LIBRARY // TAO IDL -// +// // = FILENAME // be_union_branch.h // @@ -12,9 +12,9 @@ // // = AUTHOR // Copyright 1994-1995 by Sun Microsystems, Inc. -// and +// and // Aniruddha Gokhale -// +// // ============================================================================ #if !defined (BE_UNION_BRANCH_H) @@ -65,6 +65,10 @@ public: // Narrowing DEF_NARROW_METHODS2 (be_union_branch, AST_UnionBranch, be_decl); DEF_NARROW_FROM_DECL (be_union_branch); +protected: + virtual int compute_size_type (void); + // compute the size type if it is unknown + }; #endif diff --git a/TAO/TAO_IDL/be_include/be_visitor.h b/TAO/TAO_IDL/be_include/be_visitor.h index 5bc503430f9..9c6c05e1632 100644 --- a/TAO/TAO_IDL/be_include/be_visitor.h +++ b/TAO/TAO_IDL/be_include/be_visitor.h @@ -12,8 +12,8 @@ // be_visitor.h // // = DESCRIPTION -// Extension of class AST_Interface that provides additional means for C++ -// mapping of an interface. +// The abstract visitor class. The concrete classes are responsible for code +// generation. // // = AUTHOR // Copyright 1994-1995 by Sun Microsystems, Inc. @@ -52,6 +52,7 @@ class be_typedef; class be_root; class be_native; +class be_visitor_context; class TAO_OutStream; class be_visitor @@ -69,54 +70,88 @@ class be_visitor public: virtual ~be_visitor (void); - virtual int visit_decl (be_decl *node); + virtual visit_decl (be_decl *d); + // visit a decl node + virtual int visit_scope (be_scope *node); + // visit the scope + virtual int visit_type (be_type *node); + // visit the type + virtual int visit_predefined_type (be_predefined_type *node); + // visit the predefined type + virtual int visit_module (be_module *node); + // visit module + virtual int visit_interface (be_interface *node); + // visit interface + virtual int visit_interface_fwd (be_interface_fwd *node); + // visit interface_fwd + virtual int visit_structure (be_structure *node); + // visit a structure + virtual int visit_exception (be_exception *node); + // visit exception + virtual int visit_expression (be_expression *node); + // visit expression + virtual int visit_enum (be_enum *node); + // visit an enum + virtual int visit_operation (be_operation *node); + // visit an operation + virtual int visit_field (be_field *node); + // visit a field + virtual int visit_argument (be_argument *node); + // visit argument + virtual int visit_attribute (be_attribute *node); + // visit an attribute + virtual int visit_union (be_union *node); + // visit union + virtual int visit_union_branch (be_union_branch *node); + // visit union branch + virtual int visit_union_label (be_union_label *node); + // visit union label + virtual int visit_constant (be_constant *node); + // visit a constant + virtual int visit_enum_val (be_enum_val *node); + // visit enum val + virtual int visit_array (be_array *node); + // visit an array + virtual int visit_sequence (be_sequence *node); - virtual int visit_string (be_string *node); - virtual int visit_typedef (be_typedef *node); - virtual int visit_root (be_root *node); - virtual int visit_native (be_native *node); + // visit a sequence - virtual void be_node (be_decl *); - // save a node + virtual int visit_string (be_string *node); + // visit a string - virtual be_decl *be_node (void); - // return the saved node + virtual int visit_typedef (be_typedef *node); + // visit a typedef - virtual TAO_OutStream &stream (void); - // return reference to stream + virtual int visit_root (be_root *node); + // visit a root - virtual void stream (TAO_OutStream *); - // set the underlying stream + virtual int visit_native (be_native *node); + // visit a native protected: be_visitor (void); // constructor is protected - be_decl *node_; - // saved node - - TAO_OutStream *os_; - // output stream }; #endif // TAO_BE_VISITOR_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_args.h b/TAO/TAO_IDL/be_include/be_visitor_args.h index 6f2b7e8a4b3..9dd4bc8d6bb 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_args.h +++ b/TAO/TAO_IDL/be_include/be_visitor_args.h @@ -2,14 +2,63 @@ // $Id$ // +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_args.h +// +// = DESCRIPTION +// Visitors for generation of code for Arguments +// +// = AUTHOR +// Aniruddha Gokhale and Carlos O' Ryan +// +// ============================================================================ + #ifndef _BE_VISITOR_ARGS_H #define _BE_VISITOR_ARGS_H -#include "be_visitor.h" +#include "be_visitor_decl.h" + +class be_visitor_args : public be_visitor_decl +{ + // + // = TITLE + // Generates the code for arguments output. + // + // = DESCRIPTION + // At several stages in the code generation a node of type + // "be_operation" is visited, and the code for its arguments must + // be generated. + // Sometimes the argument declarations must be generated (such as + // in the class declaration), other the arguments names (such as + // in method invocations). + // This class implements some common functionality required across all + // argument visitors + // +public: + be_visitor_args (be_visitor_context *ctx); + // constructor + + virtual ~be_visitor_args (void); + // destructor -class TAO_OutStream; + //= helper + virtual const char *type_name (be_type *type, const char *suffix=0); + // helper that produces either a nested name for header files or full name + // for others + + virtual AST_Argument::Direction direction (void); + // return the direction of the argument node + + virtual int visit_argument (be_argument *node); + // must be overridden by derived classes +}; -class be_visitor_args_decl : public be_visitor +class be_visitor_args_arglist : public be_visitor_args { // // = TITLE @@ -26,46 +75,441 @@ class be_visitor_args_decl : public be_visitor // it outputs both the arguments and their types. // public: - be_visitor_args_decl (TAO_OutStream *stream); - virtual ~be_visitor_args_decl (void); + be_visitor_args_arglist (be_visitor_context *ctx); + // constructor + + virtual ~be_visitor_args_arglist (void); + // destructor - virtual int visit_operation (be_operation *node); virtual int visit_argument (be_argument *node); + // visit the argument node + + // =visit all the nodes that can be the types for the argument + + virtual int visit_array (be_array *node); + // visit array type + + virtual int visit_enum (be_enum *node); + // visit the enum node + + virtual int visit_interface (be_interface *node); + // visit interface + + virtual int visit_interface_fwd (be_interface_fwd *node); + // visit interface forward + + virtual int visit_native (be_native *node); + // visit native node + virtual int visit_predefined_type (be_predefined_type *node); + // visit predefined type + + virtual int visit_sequence (be_sequence *node); + // visit sequence type + + virtual int visit_string (be_string *node); + // visit string type + + virtual int visit_structure (be_structure *node); + // visit structure type + + virtual int visit_union (be_union *node); + // visit union type + + virtual int visit_typedef (be_typedef *node); + // visit the typedef type + +}; + +// ************************************************************ +// class be_visitor_args_pre_docall_cs +// ************************************************************ +class be_visitor_args_pre_docall_cs : public be_visitor_args +{ + // + // = TITLE + // be_visitor_args_docall_cs + // + // = DESCRIPTION + // Code to be generated when making the do_call + // +public: + be_visitor_args_pre_docall_cs (be_visitor_context *ctx); + // constructor + + virtual ~be_visitor_args_pre_docall_cs (void); + // destructor + + virtual int visit_argument (be_argument *node); + // visit the argument node + + // =visit all the nodes that can be the types for the argument + + virtual int visit_array (be_array *node); + // visit array type + + virtual int visit_interface (be_interface *node); + // visit interface + + virtual int visit_interface_fwd (be_interface_fwd *node); + // visit interface forward + + virtual int visit_predefined_type (be_predefined_type *node); + // visit predefined type + + virtual int visit_sequence (be_sequence *node); + // visit sequence type + + virtual int visit_string (be_string *node); + // visit string type + + virtual int visit_structure (be_structure *node); + // visit structure type + + virtual int visit_union (be_union *node); + // visit union type + + virtual int visit_typedef (be_typedef *node); + // visit the typedef type + +}; + +// ************************************************************ +// class be_visitor_args_docall_cs +// ************************************************************ +class be_visitor_args_docall_cs : public be_visitor_args +{ + // + // = TITLE + // be_visitor_args_docall_cs + // + // = DESCRIPTION + // Code to be generated when making the do_call + // +public: + be_visitor_args_docall_cs (be_visitor_context *ctx); + // constructor + + virtual ~be_visitor_args_docall_cs (void); + // destructor + + virtual int visit_argument (be_argument *node); + // visit the argument node + + // =visit all the nodes that can be the types for the argument + + virtual int visit_array (be_array *node); + // visit array type + + virtual int visit_enum (be_enum *node); + // visit the enum node + + virtual int visit_interface (be_interface *node); + // visit interface + + virtual int visit_interface_fwd (be_interface_fwd *node); + // visit interface forward + + virtual int visit_predefined_type (be_predefined_type *node); + // visit predefined type + + virtual int visit_sequence (be_sequence *node); + // visit sequence type + + virtual int visit_string (be_string *node); + // visit string type + + virtual int visit_structure (be_structure *node); + // visit structure type + + virtual int visit_union (be_union *node); + // visit union type + + virtual int visit_typedef (be_typedef *node); + // visit the typedef type + +}; + +// ************************************************************ +// class be_visitor_args_post_docall_cs +// ************************************************************ +class be_visitor_args_post_docall_cs : public be_visitor_args +{ + // + // = TITLE + // be_visitor_args_post_docall_cs + // + // = DESCRIPTION + // Code to be generated after the do_call is done + // +public: + be_visitor_args_post_docall_cs (be_visitor_context *ctx); + // constructor + + virtual ~be_visitor_args_post_docall_cs (void); + // destructor + + virtual int visit_argument (be_argument *node); + // visit the argument node + + // =visit all the nodes that can be the types for the argument + + virtual int visit_interface (be_interface *node); + // visit interface + + virtual int visit_interface_fwd (be_interface_fwd *node); + // visit interface forward + + virtual int visit_typedef (be_typedef *node); + // visit the typedef type +}; + +// ************************************************************ +// class be_visitor_args_vardecl_ss +// ************************************************************ +class be_visitor_args_vardecl_ss : public be_visitor_args +{ + // + // = TITLE + // be_visitor_args_vardecl_ss + // + // = DESCRIPTION + // Visitor for variable declaration for argument + // +public: + be_visitor_args_vardecl_ss (be_visitor_context *ctx); + // constructor + + virtual ~be_visitor_args_vardecl_ss (void); + // destructor + + virtual int visit_argument (be_argument *node); + // visit the argument node + + // =visit all the nodes that can be the types for the argument + + virtual int visit_array (be_array *node); + // visit array type + + virtual int visit_enum (be_enum *node); + // visit the enum node + virtual int visit_interface (be_interface *node); + // visit interface + virtual int visit_interface_fwd (be_interface_fwd *node); + // visit interface forward + + virtual int visit_predefined_type (be_predefined_type *node); + // visit predefined type + + virtual int visit_sequence (be_sequence *node); + // visit sequence type + + virtual int visit_string (be_string *node); + // visit string type + virtual int visit_structure (be_structure *node); + // visit structure type + + virtual int visit_union (be_union *node); + // visit union type + + virtual int visit_typedef (be_typedef *node); + // visit the typedef type + +}; + +// ************************************************************ +// class be_visitor_args_pre_upcall_ss +// ************************************************************ +class be_visitor_args_pre_upcall_ss : public be_visitor_args +{ + // + // = TITLE + // be_visitor_args_upcall_ss + // + // = DESCRIPTION + // Visitor for passing argument to the upcall + // +public: + be_visitor_args_pre_upcall_ss (be_visitor_context *ctx); + // constructor + + virtual ~be_visitor_args_pre_upcall_ss (void); + // destructor + + virtual int visit_argument (be_argument *node); + // visit the argument node + + // =visit all the nodes that can be the types for the argument + + virtual int visit_array (be_array *node); + // visit array type + virtual int visit_enum (be_enum *node); + // visit the enum node + + virtual int visit_interface (be_interface *node); + // visit interface + + virtual int visit_interface_fwd (be_interface_fwd *node); + // visit interface forward + + virtual int visit_predefined_type (be_predefined_type *node); + // visit predefined type + + virtual int visit_sequence (be_sequence *node); + // visit sequence type + + virtual int visit_string (be_string *node); + // visit string type + + virtual int visit_structure (be_structure *node); + // visit structure type + virtual int visit_union (be_union *node); + // visit union type + + virtual int visit_typedef (be_typedef *node); + // visit the typedef type + +}; + +// ************************************************************ +// class be_visitor_args_upcall_ss +// ************************************************************ +class be_visitor_args_upcall_ss : public be_visitor_args +{ + // + // = TITLE + // be_visitor_args_upcall_ss + // + // = DESCRIPTION + // Visitor for passing argument to the upcall + // +public: + be_visitor_args_upcall_ss (be_visitor_context *ctx); + // constructor + + virtual ~be_visitor_args_upcall_ss (void); + // destructor + + virtual int visit_argument (be_argument *node); + // visit the argument node + +}; + +// ************************************************************ +// class be_visitor_args_marshal_ss +// ************************************************************ +class be_visitor_args_marshal_ss : public be_visitor_args +{ + // + // = TITLE + // be_visitor_args_marshal_ss + // + // = DESCRIPTION + // Visitor for passing argument to the marshaling/demarshaling routine + // +public: + be_visitor_args_marshal_ss (be_visitor_context *ctx); + // constructor + + virtual ~be_visitor_args_marshal_ss (void); + // destructor + + virtual int visit_argument (be_argument *node); + // visit the argument node + + // =visit all the nodes that can be the types for the argument + virtual int visit_array (be_array *node); + // visit array type + + virtual int visit_enum (be_enum *node); + // visit the enum node + + virtual int visit_interface (be_interface *node); + // visit interface + + virtual int visit_interface_fwd (be_interface_fwd *node); + // visit interface forward + + virtual int visit_predefined_type (be_predefined_type *node); + // visit predefined type + virtual int visit_sequence (be_sequence *node); + // visit sequence type + virtual int visit_string (be_string *node); + // visit string type + + virtual int visit_structure (be_structure *node); + // visit structure type + + virtual int visit_union (be_union *node); + // visit union type + virtual int visit_typedef (be_typedef *node); - virtual int visit_native (be_native *node); + // visit the typedef type - void argument_direction (int direction); - void current_type_name (UTL_ScopedName* name); +}; -private: - TAO_OutStream& stream (void) const; +// ************************************************************ +// class be_visitor_args_post_upcall_ss +// ************************************************************ +class be_visitor_args_post_upcall_ss : public be_visitor_args +{ + // + // = TITLE + // be_visitor_args_post_upcall_ss + // + // = DESCRIPTION + // Visitor for post processing after upcall + // +public: + be_visitor_args_post_upcall_ss (be_visitor_context *ctx); + // constructor + + virtual ~be_visitor_args_post_upcall_ss (void); + // destructor - // Several types have the same or very similar mappings, for - // instance: structures, unions and sequences, this routines - // abstract those mappings. - int dump_interface (void) const; - int dump_structure (void) const; + virtual int visit_argument (be_argument *node); + // visit the argument node + + // =visit all the nodes that can be the types for the argument -private: - TAO_OutStream *stream_; + virtual int visit_array (be_array *node); + // visit array type - int argument_direction_; - // The current argument direction. + virtual int visit_enum (be_enum *node); + // visit the enum node + + virtual int visit_interface (be_interface *node); + // visit interface + + virtual int visit_interface_fwd (be_interface_fwd *node); + // visit interface forward + + virtual int visit_predefined_type (be_predefined_type *node); + // visit predefined type + + virtual int visit_sequence (be_sequence *node); + // visit sequence type + + virtual int visit_string (be_string *node); + // visit string type + + virtual int visit_structure (be_structure *node); + // visit structure type + + virtual int visit_union (be_union *node); + // visit union type + + virtual int visit_typedef (be_typedef *node); + // visit the typedef type - UTL_ScopedName* current_type_name_; - // The scoped name for the current argument type name. - // We cannot use just node->name() because we could be using an - // aliased name (through typedefs) in which case the real name must - // be used. }; #endif // _BE_VISITOR_ARGS_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_attribute.h b/TAO/TAO_IDL/be_include/be_visitor_attribute.h new file mode 100644 index 00000000000..6db40e2a693 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_attribute.h @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_attribute.h +// +// = DESCRIPTION +// Concrete visitor for the Attribute class +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (TAO_BE_VISITOR_ATTRIBUTE_H) +#define TAO_BE_VISITOR_ATTRIBUTE_H + +#include "be_visitor.h" +#include "be_visitor_scope.h" + +// ************************************************************ +// Attribute visitor +// ************************************************************ + +class be_visitor_attribute : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_attribute + // + // = DESCRIPTION + // This is a concrete visitor to generate code for attributes. We have one + // class for mapping into the client and server. + // + // +public: + be_visitor_attribute (be_visitor_context *ctx); + // constructor + + ~be_visitor_attribute (void); + // destructor + + virtual int visit_attribute (be_attribute *node); + // visit attribute. We provide code for this method in the derived class + +}; + + +#endif diff --git a/TAO/TAO_IDL/be_include/be_visitor_constant.h b/TAO/TAO_IDL/be_include/be_visitor_constant.h new file mode 100644 index 00000000000..2f2902f844d --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_constant.h @@ -0,0 +1,72 @@ +/* -*- C++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_constant.h +// +// = DESCRIPTION +// Concrete visitor for the constant class +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (TAO_BE_VISITOR_CONSTANT_H) +#define TAO_BE_VISITOR_CONSTANT_H + +#include "be_visitor.h" +#include "be_visitor_scope.h" + +class be_visitor_constant_ch : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_constant_ch + // + // = DESCRIPTION + // This is the visitor for constant for the header file + // + // +public: + be_visitor_constant_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_constant_ch (void); + // destructor + + virtual int visit_constant (be_constant *node); + // visit constant. + +}; + +class be_visitor_constant_cs : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_constant_cs + // + // = DESCRIPTION + // This is the visitor for constant for the impl file + // + // +public: + be_visitor_constant_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_constant_cs (void); + // destructor + + virtual int visit_constant (be_constant *node); + // visit constant + +}; + +#endif // TAO_BE_VISITOR_CONSTANT_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_context.h b/TAO/TAO_IDL/be_include/be_visitor_context.h new file mode 100644 index 00000000000..760e3713f07 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_context.h @@ -0,0 +1,217 @@ +// +// $Id$ +// + +/* -*- C++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_context.h +// +// = DESCRIPTION +// This class serves to provide all the necessary context information to the +// visitor as it generates code. This may include the scope inside which the +// code is generated, the output file that is being used, and others. This +// context information will be passed to the abstract/concrete visitor +// factory which in turn will use it to construct the right visitor. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (TAO_BE_VISITOR_CONTEXT_H) +#define TAO_BE_VISITOR_CONTEXT_H + +class be_visitor_context +{ +public: + be_visitor_context (void); + // default constructor + + be_visitor_context (const be_visitor_context &ctx); + // default constructor + + ~be_visitor_context (void); + // destructor + + be_visitor_context &operator= (const be_visitor_context &ctx); + // assignment operator + + // =helpers + + void stream (TAO_OutStream *os); + // set the output stream + + TAO_OutStream *stream (void); + // get the stream + + void scope (be_decl *scope); + // set the scope + + be_decl *scope (void); + // get the scope in which code will be generated + + void node (be_decl *node); + // current node being visited + + be_decl *node (void); + // node being visited + + void state (TAO_CodeGen::CG_STATE); + // code generation state + + TAO_CodeGen::CG_STATE state (void); + // return the code generation state + + void alias (be_typedef *node); + // set the alias node (if any) + + be_typedef *alias (void); + // return the aliased node (if any) + + void tdef (be_typedef *node); + // set the typedef node (if any) + + be_typedef *tdef (void); + // return the typedef node (if any) + + void attribute (be_attribute *attr); + // set the attribute node if any + + be_attribute *attribute (void); + // get the attribute node + + void comma (idl_bool); + // scope supoorts generation of comma after each element + + idl_bool comma (void); + // are we supposed to generate a comma? + + // = helpers + + // visitors may need the actual type of the node stored in this context. We + // could have kept separate nodes but that would have increased the size of + // the context class by a large extent. So we will rely on the + // "narrow_from_decl" approach + + // two types of helpers are provided here. One of them returns the node as + // the desired actual type. The other returns the scope as the desired type. + + be_argument *be_node_as_argument (void); + // return the node as argument if possible + + be_array *be_node_as_array (void); + // return the node as array if possible + + be_attribute *be_node_as_attribute (void); + // return the node as attribute if possible + + be_constant *be_node_as_constant (void); + // return the node as constant if possible + + be_enum *be_node_as_enum (void); + // return the node as enum if possible + + be_enum_val *be_node_as_enum_val (void); + // return the node as enum_val if possible + + be_exception *be_node_as_exception (void); + // return the node as exception if possible + + be_field *be_node_as_field (void); + // return the node as field if possible + + be_interface *be_node_as_interface (void); + // return the node as interface if possible + + be_interface_fwd *be_node_as_interface_fwd (void); + // return the node as interface_fwd if possible + + be_module *be_node_as_module (void); + // return the node as module if possible + + be_operation *be_node_as_operation (void); + // return the node as operation if possible + + be_predefined_type *be_node_as_predefined_type (void); + // return the node as predefined_type if possible + + be_root *be_node_as_root (void); + // return the node as root if possible + + be_sequence *be_node_as_sequence (void); + // return the node as sequence if possible + + be_string *be_node_as_string (void); + // return the node as string if possible + + be_structure *be_node_as_structure (void); + // return the node as structure if possible + + be_typedef *be_node_as_typedef (void); + // return the node as typedef if possible + + be_union *be_node_as_union (void); + // return the node as union if possible + + be_union_branch *be_node_as_union_branch (void); + // return the node as union_branch if possible + + // for scope + + be_enum *be_scope_as_enum (void); + // return the scope as enum if possible + + be_exception *be_scope_as_exception (void); + // return the scope as exception if possible + + be_interface *be_scope_as_interface (void); + // return the scope as interface if possible + + be_module *be_scope_as_module (void); + // return the scope as module if possible + + be_operation *be_scope_as_operation (void); + // return the scope as operation if possible + + be_root *be_scope_as_root (void); + // return the scope as root if possible + + be_structure *be_scope_as_structure (void); + // return the scope as structure if possible + + be_union *be_scope_as_union (void); + // return the scope as union if possible + +private: + TAO_CodeGen::CG_STATE state_; + // code generation state + + TAO_OutStream *os_; + // current output stream + + be_decl *scope_; + // current scope in which code is generated + + be_decl *node_; + // current node + + be_typedef *alias_; + // aliased node used as a scoped name to define IDL types. + + be_typedef *tdef_; + // typedef node + + be_attribute *attr_; + // attribute node stored here while generating its code + + idl_bool comma_; + // whether scope should generate a comma after every element +}; + + +#endif /* BE_VISITOR_CONTEXT_H */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_decl.h b/TAO/TAO_IDL/be_include/be_visitor_decl.h new file mode 100644 index 00000000000..4c8f575cacd --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_decl.h @@ -0,0 +1,52 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_decl.h +// +// = DESCRIPTION +// Concrete visitor for the base "BE_Decl" node +// +// = AUTHOR +// Aniruddha Gokhale and Carlos O'Ryan +// +// ============================================================================ + +#if !defined (TAO_BE_VISITOR_DECL_H) +#define TAO_BE_VISITOR_DECL_H + +#include "be_visitor.h" + +class be_visitor_decl : public be_visitor +{ + // + // = TITLE + // be_visitor_decl + // + // = DESCRIPTION + // This is a concrete visitor for the be_decl node. Its only purpose is to + // maintain state information for the derived visitor + // +public: + be_visitor_decl (be_visitor_context *ctx); + // constructor + + ~be_visitor_decl (void); + // destructor + +protected: + // using a protected mechanism will allow derived visitors to access this + // information + + be_visitor_context *ctx_; + // any context information required by the visitor +}; + + +#endif // TAO_BE_VISITOR_DECL_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_enum.h b/TAO/TAO_IDL/be_include/be_visitor_enum.h new file mode 100644 index 00000000000..59a6aff8ab6 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_enum.h @@ -0,0 +1,81 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_enum.h +// +// = DESCRIPTION +// Concrete visitor for the enum class +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (TAO_BE_VISITOR_ENUM_H) +#define TAO_BE_VISITOR_ENUM_H + +#include "be_visitor.h" +#include "be_visitor_scope.h" + +class be_visitor_enum_ch : public be_visitor_scope +{ + // + // = TITLE + // be_visitor_enum_ch + // + // = DESCRIPTION + // This is the base visitor for enum for the header file + // + // +public: + be_visitor_enum_ch (be_visitor_context *ctx); + // conenumor + + ~be_visitor_enum_ch (void); + // deenumor + + virtual int visit_enum (be_enum *node); + // visit enum. + + // =visit operations on syntactically valid elements in our scope + + virtual int visit_enum_val (be_enum_val *node); + // visit enum_val + + // = helper + + virtual int post_process (void); + // generate a comma after each element is processed +}; + +class be_visitor_enum_cs : public be_visitor_scope +{ + // + // = TITLE + // be_visitor_enum_cs + // + // = DESCRIPTION + // This is the visitor for enum for the impl file + // + // +public: + be_visitor_enum_cs (be_visitor_context *ctx); + // conenumor + + ~be_visitor_enum_cs (void); + // deenumor + + virtual int visit_enum (be_enum *node); + // visit enum and generate the typecode + +}; + +#endif // TAO_BE_VISITOR_ENUM_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_field.h b/TAO/TAO_IDL/be_include/be_visitor_field.h new file mode 100644 index 00000000000..51a1eaad415 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_field.h @@ -0,0 +1,159 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_field.h +// +// = DESCRIPTION +// Concrete visitor for the base "BE_Field" node +// +// = AUTHOR +// Aniruddha Gokhale and Carlos O'Ryan +// +// ============================================================================ + +#if !defined (TAO_BE_VISITOR_FIELD_H) +#define TAO_BE_VISITOR_FIELD_H + +#include "be_visitor_decl.h" + +class be_visitor_field_ch : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_field_ch + // + // = DESCRIPTION + // This is a concrete visitor for the be_field node for the client header. + // +public: + be_visitor_field_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_field_ch (void); + // destructor + + virtual int visit_field (be_field *node); + // visit the field node + + // =visit operations on all possible data types that a field can be + + virtual int visit_array (be_array *node); + // visit array type + + virtual int visit_enum (be_enum *node); + // visit enum type + + virtual int visit_interface (be_interface *node); + // visit interface type + + virtual int visit_interface_fwd (be_interface_fwd *node); + // visit interface forward type + + virtual int visit_predefined_type (be_predefined_type *node); + // visit predefined type + + virtual int visit_sequence (be_sequence *node); + // visit sequence type + + virtual int visit_string (be_string *node); + // visit string type + + virtual int visit_structure (be_structure *node); + // visit structure type + + virtual int visit_typedef (be_typedef *node); + // visit typedefed type + + virtual int visit_union (be_union *node); + // visit union type + +}; + +class be_visitor_field_ci : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_field_ci + // + // = DESCRIPTION + // This is a concrete visitor for the be_field node for the client inline + // file + // +public: + be_visitor_field_ci (be_visitor_context *ctx); + // constructor + + ~be_visitor_field_ci (void); + // destructor + + virtual int visit_field (be_field *node); + // visit the field node + + // =visit operations on all possible data types that a field can be and for + // which inline code must be generated + + virtual int visit_array (be_array *node); + // visit array type + + virtual int visit_sequence (be_sequence *node); + // visit sequence type + + virtual int visit_structure (be_structure *node); + // visit structure type + + virtual int visit_typedef (be_typedef *node); + // visit typedefed type + + virtual int visit_union (be_union *node); + // visit union type + +}; + +class be_visitor_field_cs : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_field_cs + // + // = DESCRIPTION + // This is a concrete visitor for the be_field node for the client stubs + // file + // +public: + be_visitor_field_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_field_cs (void); + // destructor + + virtual int visit_field (be_field *node); + // visit the field node + + // =visit operations on all possible data types that a field can be and impl + // code must be generated + + virtual int visit_array (be_array *node); + // visit array type + + virtual int visit_enum (be_enum *node); + // visit enum type + + virtual int visit_structure (be_structure *node); + // visit structure type + + virtual int visit_typedef (be_typedef *node); + // visit typedefed type + + virtual int visit_union (be_union *node); + // visit union type + +}; + +#endif // TAO_BE_VISITOR_FIELD_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface.h b/TAO/TAO_IDL/be_include/be_visitor_interface.h index dce8faf3a61..c649c3a5fc2 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_interface.h +++ b/TAO/TAO_IDL/be_include/be_visitor_interface.h @@ -1,16 +1,33 @@ -// + // $Id$ // +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_interface.h +// +// = DESCRIPTION +// Concrete visitor for the Interface class +// +// = AUTHOR +// Carlos O'Ryan and Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (TAO_BE_VISITOR_INTERFACE_H) +#define TAO_BE_VISITOR_INTERFACE_H -#ifndef _BE_VISITOR_INTERFACE_H -#define _BE_VISITOR_INTERFACE_H +#include "be_visitor_scope.h" -#include "be_visitor.h" // = DESCRIPTION // Interface code generation is complex, the client stubs require // two different class and the server also require other two. -// Only onw of them includes whatever nested typedefs, exceptions +// Only one of them includes whatever nested typedefs, exceptions // and or structures are defined in the interface. // To break this complexity a different visitor is used for each // case. @@ -24,36 +41,217 @@ // methods. // -class be_visitor_collocated_sh : public be_visitor +class be_visitor_interface : public be_visitor_scope { + // // = TITLE - // Generate the "collocated" class declaration. + // be_visitor_interface + // + // = DESCRIPTION + // This is a concrete visitor for interface that abstracts all common tasks + // public: - be_visitor_collocated_sh (void); - virtual ~be_visitor_collocated_sh (void); + be_visitor_interface (be_visitor_context *ctx); + // constructor + + ~be_visitor_interface (void); + // destructor virtual int visit_interface (be_interface *node); - virtual int visit_operation (be_operation *node); + // visit the interface node + + // =visit methods on all elements syntactically valid in a Interface scope + virtual int visit_attribute (be_attribute *node); + // visit attribute + + virtual int visit_constant (be_constant *node); + // visit a constant + + virtual int visit_enum (be_enum *node); + // visit an enum + + virtual int visit_exception (be_exception *node); + // visit an exception + + virtual int visit_operation (be_operation *node); + // visit operation + + virtual int visit_structure (be_structure *node); + // visit a structure + + virtual int visit_union (be_union *node); + // visit a union + + virtual int visit_typedef (be_typedef *node); + // visit the typedef node + +}; + +// we need derived interface visitors for the client and server header files. For +// the others, they use the default interface visitor + +class be_visitor_interface_ch : public be_visitor_interface +{ + // + // = TITLE + // be_visitor_interface_ch + // + // = DESCRIPTION + // This is a concrete visitor to generate the client header for interface + // + // +public: + be_visitor_interface_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_interface_ch (void); + // destructor + + virtual int visit_interface (be_interface *node); + // set the right context and make a visitor + +}; + +class be_visitor_interface_ci : public be_visitor_interface +{ + // + // = TITLE + // be_visitor_interface_ci + // + // = DESCRIPTION + // This is a concrete visitor to generate the client inline for interface + // + // +public: + be_visitor_interface_ci (be_visitor_context *ctx); + // constructor + + ~be_visitor_interface_ci (void); + // destructor + + virtual int visit_interface (be_interface *node); + // set the right context and make a visitor + +}; + +class be_visitor_interface_cs : public be_visitor_interface +{ + // + // = TITLE + // be_visitor_interface_cs + // + // = DESCRIPTION + // This is a concrete visitor to generate the client stubs for interface + // + // +public: + be_visitor_interface_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_interface_cs (void); + // destructor + + virtual int visit_interface (be_interface *node); + // set the right context and make a visitor +}; + +class be_visitor_interface_sh : public be_visitor_interface +{ + // + // = TITLE + // be_visitor_interface_sh + // + // = DESCRIPTION + // This is a concrete visitor to generate the server header for interface + // + // +public: + be_visitor_interface_sh (be_visitor_context *ctx); + // constructor + + ~be_visitor_interface_sh (void); + // destructor + + virtual int visit_interface (be_interface *node); + // set the right context and make a visitor +}; + +class be_visitor_interface_si : public be_visitor_interface +{ + // + // = TITLE + // be_visitor_interface_si + // + // = DESCRIPTION + // This is a concrete visitor to generate the server inline for interface + // + // +public: + be_visitor_interface_si (be_visitor_context *ctx); + // constructor + + ~be_visitor_interface_si (void); + // destructor + + virtual int visit_interface (be_interface *node); + // set the right context and make a visitor }; -class be_visitor_collocated_ss : public be_visitor +class be_visitor_interface_ss : public be_visitor_interface +{ + // + // = TITLE + // be_visitor_interface_ss + // + // = DESCRIPTION + // This is a concrete visitor to generate the server skeletons for interface + // + // +public: + be_visitor_interface_ss (be_visitor_context *ctx); + // constructor + + ~be_visitor_interface_ss (void); + // destructor + + virtual int visit_interface (be_interface *node); + // set the right context and make a visitor +}; + +class be_visitor_interface_collocated_sh : public be_visitor_interface { // = TITLE // Generate the "collocated" class declaration. public: - be_visitor_collocated_ss (void); - virtual ~be_visitor_collocated_ss (void); + be_visitor_interface_collocated_sh (be_visitor_context *ctx); + // constructor + + virtual ~be_visitor_interface_collocated_sh (void); + // destructor virtual int visit_interface (be_interface *node); - virtual int visit_operation (be_operation *node); - virtual int visit_argument (be_argument *node); - virtual int visit_attribute (be_attribute *node); + // visit an interface + +}; + +class be_visitor_interface_collocated_ss : public be_visitor_interface +{ + // = TITLE + // Generate the "collocated" class declaration. + +public: + be_visitor_interface_collocated_ss (be_visitor_context *ctx); + // constructor + + virtual ~be_visitor_interface_collocated_ss (void); + // destructor + + virtual int visit_interface (be_interface *node); + // visit interface -private: - be_interface* current_interface_; }; #endif // _BE_VISITOR_INTERFACE_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface_fwd.h b/TAO/TAO_IDL/be_include/be_visitor_interface_fwd.h new file mode 100644 index 00000000000..b24a9942e39 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_interface_fwd.h @@ -0,0 +1,72 @@ +/* -*- C++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_interface_fwd.h +// +// = DESCRIPTION +// Concrete visitor for the interface_fwd class +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (TAO_BE_VISITOR_INTERFACE_FWD_H) +#define TAO_BE_VISITOR_INTERFACE_FWD_H + +#include "be_visitor.h" +#include "be_visitor_scope.h" + +class be_visitor_interface_fwd_ch : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_interface_fwd_ch + // + // = DESCRIPTION + // This is the visitor for interface_fwd for the header file + // + // +public: + be_visitor_interface_fwd_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_interface_fwd_ch (void); + // destructor + + virtual int visit_interface_fwd (be_interface_fwd *node); + // visit interface_fwd. + +}; + +class be_visitor_interface_fwd_ci : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_interface_fwd_ci + // + // = DESCRIPTION + // This is the visitor for interface_fwd for the inline file + // + // +public: + be_visitor_interface_fwd_ci (be_visitor_context *ctx); + // constructor + + ~be_visitor_interface_fwd_ci (void); + // destructor + + virtual int visit_interface_fwd (be_interface_fwd *node); + // visit interface_fwd + +}; + +#endif // TAO_BE_VISITOR_INTERFACE_FWD_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_module.h b/TAO/TAO_IDL/be_include/be_visitor_module.h new file mode 100644 index 00000000000..0a1f64a4496 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_module.h @@ -0,0 +1,124 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_module.h +// +// = DESCRIPTION +// Concrete visitor for the Module class +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (TAO_BE_VISITOR_MODULE_H) +#define TAO_BE_VISITOR_MODULE_H + +#include "be_visitor.h" +#include "be_visitor_scope.h" + +class be_visitor_module : public be_visitor_scope +{ + // + // = TITLE + // be_visitor_module + // + // = DESCRIPTION + // This is a concrete visitor for module that abstracts all common tasks + // + +public: + be_visitor_module (be_visitor_context *ctx); + // constructor + + ~be_visitor_module (void); + // destructor + + // =visit methods on all elements syntactically valid in a Module scope + + virtual int visit_constant (be_constant *node); + // visit a constant + + virtual int visit_enum (be_enum *node); + // visit an enum + + virtual int visit_exception (be_exception *node); + // visit an exception + + virtual int visit_interface (be_interface *node); + // visit an interface + + virtual int visit_interface_fwd (be_interface_fwd *node); + // visit an interface + + virtual int visit_module (be_module *node); + // visit a module + + virtual int visit_structure (be_structure *node); + // visit a structure + + virtual int visit_union (be_union *node); + // visit a union + + virtual int visit_typedef (be_typedef *node); + // visit the typedef node + +}; + +// we need derived module visitors for the client and server header files. For +// the others, they use the default module visitor + +class be_visitor_module_ch : public be_visitor_module +{ + // + // = TITLE + // be_visitor_module_ch + // + // = DESCRIPTION + // This is a concrete visitor to generate the client header for module + // + // +public: + be_visitor_module_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_module_ch (void); + // destructor + + virtual int visit_module (be_module *node); + // visit module. We provide code for this method in the derived class + +}; + +class be_visitor_module_sh : public be_visitor_module +{ + // + // = TITLE + // be_visitor_module_sh + // + // = DESCRIPTION + // This is a concrete visitor to generate the server header for module + // + // +public: + be_visitor_module_sh (be_visitor_context *ctx); + // constructor + + ~be_visitor_module_sh (void); + // destructor + + virtual int visit_module (be_module *node); + // visit module. We provide code for this method in the derived class + +}; + + +#endif // TAO_BE_VISITOR_MODULE_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation.h b/TAO/TAO_IDL/be_include/be_visitor_operation.h new file mode 100644 index 00000000000..33dec049cff --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation.h @@ -0,0 +1,762 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_operation.h +// +// = DESCRIPTION +// Concrete visitor for the Operation class +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (TAO_BE_VISITOR_OPERATION_H) +#define TAO_BE_VISITOR_OPERATION_H + +#include "be_visitor.h" +#include "be_visitor_scope.h" + +// ************************************************************ +// Operation visitor for client header +// ************************************************************ + +class be_visitor_operation_ch : public be_visitor_scope +{ + // + // = TITLE + // be_visitor_operation_ch + // + // = DESCRIPTION + // This is a concrete visitor to generate the client header for operation + // + // +public: + be_visitor_operation_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_operation_ch (void); + // destructor + + virtual int visit_operation (be_operation *node); + // visit operation. We provide code for this method in the derived class + +}; + +// ************************************************************ +// Operation visitor for client stubs +// ************************************************************ + +class be_visitor_operation_cs : public be_visitor_scope +{ + // + // = TITLE + // be_visitor_operation_cs + // + // = DESCRIPTION + // This is a concrete visitor to generate the client stubs for operation + // + // +public: + be_visitor_operation_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_operation_cs (void); + // destructor + + virtual int visit_operation (be_operation *node); + // visit operation. + + virtual int visit_argument (be_argument *node); + // visit argument to generate ParamData entries + + virtual int post_process (void); + // stuff to output after every member of the scope is handled +}; + +// ************************************************************ +// Operation visitor for server header +// ************************************************************ + +class be_visitor_operation_sh : public be_visitor_scope +{ + // + // = TITLE + // be_visitor_operation_sh + // + // = DESCRIPTION + // This is a concrete visitor to generate the server header for operation + // + // +public: + be_visitor_operation_sh (be_visitor_context *ctx); + // constructor + + ~be_visitor_operation_sh (void); + // destructor + + virtual int visit_operation (be_operation *node); + // visit operation. We provide code for this method in the derived class + +}; + +// ************************************************************ +// Operation visitor for server skeletons +// ************************************************************ + +class be_visitor_operation_ss : public be_visitor_scope +{ + // + // = TITLE + // be_visitor_operation_ss + // + // = DESCRIPTION + // This is a concrete visitor to generate the server skeletons for operation + // + // +public: + be_visitor_operation_ss (be_visitor_context *ctx); + // constructor + + ~be_visitor_operation_ss (void); + // destructor + + virtual int visit_operation (be_operation *node); + // visit operation. We provide code for this method in the derived class + + virtual int visit_argument (be_argument *node); + // visit argument to generate ParamData entries + + virtual int post_process (void); + // stuff to output after every member of the scope is handled +}; + +// ************************************************************ +// Operation visitor for server header in the collocated class +// ************************************************************ + +class be_visitor_operation_collocated_sh : public be_visitor_scope +{ + // + // = TITLE + // be_visitor_operation_collocated_sh + // + // = DESCRIPTION + // This is a concrete visitor to generate the server header for operation + // in the collocated class + // + // +public: + be_visitor_operation_collocated_sh (be_visitor_context *ctx); + // constructor + + ~be_visitor_operation_collocated_sh (void); + // destructor + + virtual int visit_operation (be_operation *node); + // visit operation node. + +}; + +// ***************************************************************** +// Operation visitor for server skeletons for the collocated class +// ***************************************************************** + +class be_visitor_operation_collocated_ss : public be_visitor_scope +{ + // + // = TITLE + // be_visitor_operation_ss + // + // = DESCRIPTION + // This is a concrete visitor to generate the server skeletons for + // operation in the collocated class + // + // +public: + be_visitor_operation_collocated_ss (be_visitor_context *ctx); + // constructor + + ~be_visitor_operation_collocated_ss (void); + // destructor + + virtual int visit_operation (be_operation *node); + // visit operation node. + +}; + +// *********************************************************************** +// Operation visitor for return types in the signature of the operation +// *********************************************************************** + +class be_visitor_operation_rettype : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_operation_ch + // + // = DESCRIPTION + // This is a visitor to generate operation return types + // + // +public: + be_visitor_operation_rettype (be_visitor_context *ctx); + // constructor + + ~be_visitor_operation_rettype (void); + // destructor + + int visit_array (be_array *node); + // visit an array node + + int visit_enum (be_enum *node); + // visit an enum node + + int visit_interface (be_interface *node); + // visit an interface node + + int visit_interface_fwd (be_interface_fwd *node); + // visit an interface node + + int visit_native (be_native *node); + // visit native type + + int visit_predefined_type (be_predefined_type *node); + // visit a predefined type node + + int visit_sequence (be_sequence *node); + // visit a sequence node + + int visit_string (be_string *node); + // visit a sequence node + + int visit_structure (be_structure *node); + // visit a structure node + + int visit_typedef (be_typedef *node); + // visit a typedef node + + int visit_union (be_union *node); + // visit a union node + +}; + +// ****************************************************************************** +// Operation visitor for argument list - generates parameters in the signature +// ****************************************************************************** + +class be_visitor_operation_arglist : public be_visitor_scope +{ + // + // = TITLE + // be_visitor_operaion_arglist + // + // = DESCRIPTION + // This is a visitor to generate operation argument list + // + // +public: + be_visitor_operation_arglist (be_visitor_context *ctx); + // constructor + + ~be_visitor_operation_arglist (void); + // destructor + + int visit_operation (be_operation *node); + // visit the operation + + int visit_argument (be_argument *node); + // visit each argument + +}; + +// ************************************************************ +// Operation visitor for return type variable declaration +// ************************************************************ + +class be_visitor_operation_rettype_vardecl_cs :public be_visitor_decl +{ + // + // = TITLE + // be_visitor_operation_rettype_vardecl_cs + // + // = DESCRIPTION + // This is a visitor to generate a variable declaration ofr an operation + // return type + // +public: + be_visitor_operation_rettype_vardecl_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_operation_rettype_vardecl_cs (void); + // destructor + + int visit_array (be_array *node); + // visit an array node + + int visit_enum (be_enum *node); + // visit an enum node + + int visit_interface (be_interface *node); + // visit an interface node + + int visit_interface_fwd (be_interface_fwd *node); + // visit an interface node + + int visit_predefined_type (be_predefined_type *node); + // visit a predefined type node + + int visit_sequence (be_sequence *node); + // visit a sequence node + + int visit_string (be_string *node); + // visit a sequence node + + int visit_structure (be_structure *node); + // visit a structure node + + int visit_typedef (be_typedef *node); + // visit a typedef node + + int visit_union (be_union *node); + // visit a union node + +}; + +// ************************************************************ +// Operation visitor for preprocessing before do_call is invoked +// ************************************************************ + +class be_visitor_operation_rettype_pre_docall_cs :public be_visitor_decl +{ + // + // = TITLE + // be_visitor_operation_rettype_pre_docall_cs + // + // = DESCRIPTION + // This is a visitor to generate any pre processing before the do_call is + // made + // +public: + be_visitor_operation_rettype_pre_docall_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_operation_rettype_pre_docall_cs (void); + // destructor + + int visit_array (be_array *node); + // visit an array node + + int visit_interface (be_interface *node); + // visit an interface node + + int visit_interface_fwd (be_interface_fwd *node); + // visit an interface node + + int visit_predefined_type (be_predefined_type *node); + // visit a predefined type node + + int visit_sequence (be_sequence *node); + // visit a sequence node + + int visit_structure (be_structure *node); + // visit a structure node + + int visit_typedef (be_typedef *node); + // visit a typedef node + + int visit_union (be_union *node); + // visit a union node + +}; + +// ************************************************************ +// Operation visitor for passing return variable to do_call +// ************************************************************ + +class be_visitor_operation_rettype_docall_cs :public be_visitor_decl +{ + // + // = TITLE + // be_visitor_operation_rettype_docall_cs + // + // = DESCRIPTION + // This is a visitor to generate a variable declaration ofr an operation + // return type + // +public: + be_visitor_operation_rettype_docall_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_operation_rettype_docall_cs (void); + // destructor + + int visit_array (be_array *node); + // visit an array node + + int visit_enum (be_enum *node); + // visit an enum node + + int visit_interface (be_interface *node); + // visit an interface node + + int visit_interface_fwd (be_interface_fwd *node); + // visit an interface node + + int visit_predefined_type (be_predefined_type *node); + // visit a predefined type node + + int visit_sequence (be_sequence *node); + // visit a sequence node + + int visit_string (be_string *node); + // visit a sequence node + + int visit_structure (be_structure *node); + // visit a structure node + + int visit_typedef (be_typedef *node); + // visit a typedef node + + int visit_union (be_union *node); + // visit a union node + +}; + +// ************************************************************ +// Operation visitor for postprocessing after do_call is invoked +// ************************************************************ + +class be_visitor_operation_rettype_post_docall_cs :public be_visitor_decl +{ + // + // = TITLE + // be_visitor_operation_rettype_psot_docall_cs + // + // = DESCRIPTION + // This is a visitor to generate any post processing after the do_call is + // made + // +public: + be_visitor_operation_rettype_post_docall_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_operation_rettype_post_docall_cs (void); + // destructor + + int visit_interface (be_interface *node); + // visit an interface node + + int visit_interface_fwd (be_interface_fwd *node); + // visit an interface node +}; + +// ************************************************************ +// Operation visitor for returning the return val +// ************************************************************ + +class be_visitor_operation_rettype_return_cs :public be_visitor_decl +{ + // + // = TITLE + // be_visitor_operation_rettype_return_cs + // + // = DESCRIPTION + // This is a visitor to generate a variable declaration ofr an operation + // return type + // +public: + be_visitor_operation_rettype_return_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_operation_rettype_return_cs (void); + // destructor + + int visit_array (be_array *node); + // visit an array node + + int visit_enum (be_enum *node); + // visit an enum node + + int visit_interface (be_interface *node); + // visit an interface node + + int visit_interface_fwd (be_interface_fwd *node); + // visit an interface node + + int visit_predefined_type (be_predefined_type *node); + // visit a predefined type node + + int visit_sequence (be_sequence *node); + // visit a sequence node + + int visit_string (be_string *node); + // visit a sequence node + + int visit_structure (be_structure *node); + // visit a structure node + + int visit_typedef (be_typedef *node); + // visit a typedef node + + int visit_union (be_union *node); + // visit a union node + +}; + +// ************************************************************ +// generic operation visitor for docall, upcall, pre/post +// ************************************************************ + +class be_visitor_operation_argument : public be_visitor_scope +{ + // + // = TITLE + // be_visitor_operation_argument + // + // = DESCRIPTION + // This is a visitor to generate a variable declaration ofr an operation + // return type + // +public: + be_visitor_operation_argument (be_visitor_context *ctx); + // constructor + + ~be_visitor_operation_argument (void); + // destructor + + int post_process (void); + // stuff to o/p after each element of the scope is handled + + int visit_operation (be_operation *node); + // visit the operation + + int visit_argument (be_argument *node); + // visit argument + +}; + +// ************************************************************ +// Operation visitor for return type variable declaration in the server +// skeleton +// ************************************************************ + +class be_visitor_operation_rettype_vardecl_ss :public be_visitor_decl +{ + // + // = TITLE + // be_visitor_operation_rettype_vardecl_ss + // + // = DESCRIPTION + // This is a visitor to generate a variable declaration ofr an operation + // return type in the server skeleton + // +public: + be_visitor_operation_rettype_vardecl_ss (be_visitor_context *ctx); + // constructor + + ~be_visitor_operation_rettype_vardecl_ss (void); + // destructor + + int visit_array (be_array *node); + // visit an array node + + int visit_enum (be_enum *node); + // visit an enum node + + int visit_interface (be_interface *node); + // visit an interface node + + int visit_interface_fwd (be_interface_fwd *node); + // visit an interface node + + int visit_predefined_type (be_predefined_type *node); + // visit a predefined type node + + int visit_sequence (be_sequence *node); + // visit a sequence node + + int visit_string (be_string *node); + // visit a sequence node + + int visit_structure (be_structure *node); + // visit a structure node + + int visit_typedef (be_typedef *node); + // visit a typedef node + + int visit_union (be_union *node); + // visit a union node + +}; + +// *********************************************************************** +// Operation visitor for passing return type to the marshal/demarshal routine +// inside the server skeleton +// *********************************************************************** + +class be_visitor_operation_rettype_marshal_ss : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_operation_rettype_marshal_ss + // + // = DESCRIPTION + // This is a visitor to pass return type to the marshal/demarshal routines + // + // +public: + be_visitor_operation_rettype_marshal_ss (be_visitor_context *ctx); + // constructor + + ~be_visitor_operation_rettype_marshal_ss (void); + // destructor + + int visit_array (be_array *node); + // visit an array node + + int visit_enum (be_enum *node); + // visit an enum node + + int visit_interface (be_interface *node); + // visit an interface node + + int visit_interface_fwd (be_interface_fwd *node); + // visit an interface node + + int visit_predefined_type (be_predefined_type *node); + // visit a predefined type node + + int visit_sequence (be_sequence *node); + // visit a sequence node + + int visit_string (be_string *node); + // visit a sequence node + + int visit_structure (be_structure *node); + // visit a structure node + + int visit_typedef (be_typedef *node); + // visit a typedef node + + int visit_union (be_union *node); + // visit a union node + +}; + +// *********************************************************************** +// Operation visitor for assignment to return types in an upcall +// *********************************************************************** + +class be_visitor_operation_rettype_assign_ss : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_operation_ch + // + // = DESCRIPTION + // This is a visitor to generate code that assigns to the return type + // variable in the upcall + // + // +public: + be_visitor_operation_rettype_assign_ss (be_visitor_context *ctx); + // constructor + + ~be_visitor_operation_rettype_assign_ss (void); + // destructor + + int visit_array (be_array *node); + // visit an array node + + int visit_enum (be_enum *node); + // visit an enum node + + int visit_interface (be_interface *node); + // visit an interface node + + int visit_interface_fwd (be_interface_fwd *node); + // visit an interface node + + int visit_predefined_type (be_predefined_type *node); + // visit a predefined type node + + int visit_sequence (be_sequence *node); + // visit a sequence node + + int visit_string (be_string *node); + // visit a sequence node + + int visit_structure (be_structure *node); + // visit a structure node + + int visit_typedef (be_typedef *node); + // visit a typedef node + + int visit_union (be_union *node); + // visit a union node + +}; + +// *********************************************************************** +// Operation visitor for post upcall processing of return types +// *********************************************************************** + +class be_visitor_operation_rettype_post_upcall_ss : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_operation_rettype_post_upcall_ss + // + // = DESCRIPTION + // This is a visitor for post processing after an upcall + // + // +public: + be_visitor_operation_rettype_post_upcall_ss (be_visitor_context *ctx); + // constructor + + ~be_visitor_operation_rettype_post_upcall_ss (void); + // destructor + + int visit_array (be_array *node); + // visit an array node + + int visit_enum (be_enum *node); + // visit an enum node + + int visit_interface (be_interface *node); + // visit an interface node + + int visit_interface_fwd (be_interface_fwd *node); + // visit an interface node + + int visit_predefined_type (be_predefined_type *node); + // visit a predefined type node + + int visit_sequence (be_sequence *node); + // visit a sequence node + + int visit_string (be_string *node); + // visit a sequence node + + int visit_structure (be_structure *node); + // visit a structure node + + int visit_typedef (be_typedef *node); + // visit a typedef node + + int visit_union (be_union *node); + // visit a union node + +}; + +#endif // TAO_BE_VISITOR_OPERATION_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_root.h b/TAO/TAO_IDL/be_include/be_visitor_root.h index 1f936a731f5..7d0f4f6a704 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root.h @@ -3,153 +3,208 @@ // $Id$ // +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_root.h +// +// = DESCRIPTION +// Concrete visitor for the Root class +// +// = AUTHOR +// Aniruddha Gokhale and Carlos O'Ryan +// +// ============================================================================ + #if !defined (TAO_BE_VISITOR_ROOT_H) #define TAO_BE_VISITOR_ROOT_H #include "be_visitor.h" +#include "be_visitor_scope.h" -class be_visitor_root_ch : public be_visitor +class be_visitor_root : public be_visitor_scope { // // = TITLE - // Main visitor for the generation of the client header file. + // be_visitor_root // // = DESCRIPTION - // This is a concrete visitor to generate the client header. - // - // = NOTE - // The current implementation only works for sequences. + // This is a concrete visitor for root that abstracts all common tasks // + public: - be_visitor_root_ch (void); - ~be_visitor_root_ch (void); + be_visitor_root (be_visitor_context *ctx); + // constructor + + ~be_visitor_root (void); + // destructor virtual int visit_root (be_root *node); // visit root - virtual int visit_sequence (be_sequence *node); -}; + // =visit methods on all elements syntactically valid in a Root scope + + virtual int visit_constant (be_constant *node); + // visit a constant + + virtual int visit_enum (be_enum *node); + // visit an enum + + virtual int visit_exception (be_exception *node); + // visit an exception + + virtual int visit_interface (be_interface *node); + // visit an interface -typedef ACE_Singleton <be_visitor_root_ch, ACE_SYNCH_RECURSIVE_MUTEX> TAO_BE_VISITOR_ROOT_CH; + virtual int visit_interface_fwd (be_interface_fwd *node); + // visit an interface -class be_visitor_root_cs : public be_visitor + virtual int visit_module (be_module *node); + // visit a module + + virtual int visit_structure (be_structure *node); + // visit a structure + + virtual int visit_union (be_union *node); + // visit a union + + virtual int visit_typedef (be_typedef *node); + // visit the typedef node + + // =helper. This is used by derived clases to set the right context + + virtual int init (void); + // will be overridden by derived classes that set the appropriate context +}; + +class be_visitor_root_ch : public be_visitor_root { // // = TITLE - // Main visitor for the generation of the client header file. + // be_visitor_root_ch // // = DESCRIPTION - // This is a concrete visitor to generate the client stub. + // This is a concrete visitor to generate the client header for root // - // = NOTE - // The current implementation only works for sequences. // public: - be_visitor_root_cs (void); - ~be_visitor_root_cs (void); + be_visitor_root_ch (be_visitor_context *ctx); + // constructor - virtual int visit_root (be_root *node); - // visit root + ~be_visitor_root_ch (void); + // destructor - virtual int visit_sequence (be_sequence *node); + virtual int init (void); + // set the right context and make a visitor }; -typedef ACE_Singleton <be_visitor_root_cs, ACE_SYNCH_RECURSIVE_MUTEX> TAO_BE_VISITOR_ROOT_CS; - -class be_visitor_root_ci : public be_visitor +class be_visitor_root_ci : public be_visitor_root { // // = TITLE - // Main visitor for the generation of the client inline file. + // be_visitor_root_ci // // = DESCRIPTION - // This is a concrete visitor to generate the client inline. + // This is a concrete visitor to generate the client inline for root // - // = NOTE - // The current implementation only works for sequences. // public: - be_visitor_root_ci (void); - ~be_visitor_root_ci (void); + be_visitor_root_ci (be_visitor_context *ctx); + // constructor - virtual int visit_root (be_root *node); - // visit root + ~be_visitor_root_ci (void); + // destructor - virtual int visit_sequence (be_sequence *node); + virtual int init (void); + // set the right context and make a visitor }; -typedef ACE_Singleton <be_visitor_root_ci, ACE_SYNCH_RECURSIVE_MUTEX> TAO_BE_VISITOR_ROOT_CI; - -class be_visitor_root_sh : public be_visitor +class be_visitor_root_cs : public be_visitor_root { // // = TITLE - // Main visitor for the generation of the server header file + // be_visitor_root_cs // // = DESCRIPTION - // This is a concrete visitor to generate the server header + // This is a concrete visitor to generate the client stubs for root // - // = NOTE - // The current implementation only works for sequences. // public: - be_visitor_root_sh (void); - ~be_visitor_root_sh (void); + be_visitor_root_cs (be_visitor_context *ctx); + // constructor - virtual int visit_root (be_root *node); - // visit root + ~be_visitor_root_cs (void); + // destructor - virtual int visit_sequence (be_sequence *node); + virtual int init (void); + // set the right context and make a visitor }; -typedef ACE_Singleton <be_visitor_root_sh, ACE_SYNCH_RECURSIVE_MUTEX> TAO_BE_VISITOR_ROOT_SH; - -class be_visitor_root_si : public be_visitor +class be_visitor_root_sh : public be_visitor_root { // // = TITLE - // Main visitor for the generation of the server inline file. + // be_visitor_root_sh // // = DESCRIPTION - // This is a concrete visitor to generate the server inline. + // This is a concrete visitor to generate the server header for root // - // = NOTE - // The current implementation only works for sequences. // public: - be_visitor_root_si (void); - ~be_visitor_root_si (void); + be_visitor_root_sh (be_visitor_context *ctx); + // constructor - virtual int visit_root (be_root *node); - // visit root + ~be_visitor_root_sh (void); + // destructor - virtual int visit_sequence (be_sequence *node); + virtual int init (void); + // set the right context and make a visitor }; -typedef ACE_Singleton <be_visitor_root_si, ACE_SYNCH_RECURSIVE_MUTEX> TAO_BE_VISITOR_ROOT_SI; +class be_visitor_root_si : public be_visitor_root +{ + // + // = TITLE + // be_visitor_root_si + // + // = DESCRIPTION + // This is a concrete visitor to generate the server inline for root + // + // +public: + be_visitor_root_si (be_visitor_context *ctx); + // constructor + + ~be_visitor_root_si (void); + // destructor + + virtual int init (void); + // set the right context and make a visitor +}; -class be_visitor_root_ss : public be_visitor +class be_visitor_root_ss : public be_visitor_root { // // = TITLE - // Main visitor for the generation of the server skeletons file. + // be_visitor_root_ss // // = DESCRIPTION - // This is a concrete visitor to generate the server skeletons + // This is a concrete visitor to generate the server skeletons for root // - // = NOTE - // The current implementation only works for sequences. // public: - be_visitor_root_ss (void); - ~be_visitor_root_ss (void); + be_visitor_root_ss (be_visitor_context *ctx); + // constructor - virtual int visit_root (be_root *node); - // visit root + ~be_visitor_root_ss (void); + // destructor - virtual int visit_sequence (be_sequence *node); + virtual int init (void); + // set the right context and make a visitor }; -typedef ACE_Singleton <be_visitor_root_ss, ACE_SYNCH_RECURSIVE_MUTEX> TAO_BE_VISITOR_ROOT_SS; #endif // TAO_BE_VISITOR_ROOT_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_scope.h b/TAO/TAO_IDL/be_include/be_visitor_scope.h new file mode 100644 index 00000000000..07796a9b0e2 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_scope.h @@ -0,0 +1,53 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_scope.h +// +// = DESCRIPTION +// Concrete visitor for the base "BE_Scope" node +// +// = AUTHOR +// Aniruddha Gokhale and Carlos O'Ryan +// +// ============================================================================ + +#if !defined (TAO_BE_VISITOR_SCOPE_H) +#define TAO_BE_VISITOR_SCOPE_H + +#include "be_visitor.h" +#include "be_visitor_decl.h" + +class be_visitor_scope : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_scope + // + // = DESCRIPTION + // This is a concrete visitor for the be_scope node. Its only purpose is to + // iterate over the elements of the scope + // +public: + be_visitor_scope (be_visitor_context *ctx); + // constructor + + ~be_visitor_scope (void); + // destructor + + int visit_scope (be_scope *node); + // visit scope + + virtual int post_process (void); + // do any processing after every element except the last one of the scope is + // processed +}; + + +#endif // TAO_BE_VISITOR_SCOPE_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence.h b/TAO/TAO_IDL/be_include/be_visitor_sequence.h index d4be4a936d3..ff78daa3a2d 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_sequence.h +++ b/TAO/TAO_IDL/be_include/be_visitor_sequence.h @@ -6,9 +6,9 @@ #if !defined (TAO_BE_VISITOR_SEQUENCE_H) #define TAO_BE_VISITOR_SEQUENCE_H -#include "be_visitor.h" +#include "be_visitor_decl.h" -class be_visitor_sequence_ch : public be_visitor +class be_visitor_sequence_ch : public be_visitor_decl { // // = TITLE @@ -19,7 +19,7 @@ class be_visitor_sequence_ch : public be_visitor // sequences // public: - be_visitor_sequence_ch (void); + be_visitor_sequence_ch (be_visitor_context *ctx); // constructor ~be_visitor_sequence_ch (void); @@ -27,16 +27,77 @@ public: virtual int visit_sequence (be_sequence *node); // visit sequence node + + virtual int gen_base_sequence_class (be_sequence *node); + // generate the base sequence class + + virtual int gen_var_defn (be_sequence *node); + // generate the var defn + + virtual int gen_out_defn (be_sequence *node); + // generate the out defn }; -typedef ACE_Singleton <be_visitor_sequence_ch, ACE_SYNCH_RECURSIVE_MUTEX> -TAO_BE_VISITOR_SEQUENCE_CH; +class be_visitor_sequence_ci : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_sequence_ci + // + // = DESCRIPTION + // This is a concrete visitor to generate the client inline for + // sequences. The only purpose is to generate the implementation for the + // _var and _out classes + // +public: + be_visitor_sequence_ci (be_visitor_context *ctx); + // constructor + + ~be_visitor_sequence_ci (void); + // destructor + + virtual int visit_sequence (be_sequence *node); + // visit sequence node + + virtual int gen_var_impl (be_sequence *node); + // generate the var impl -class be_visitor_sequence_base_ch : public be_visitor + virtual int gen_out_impl (be_sequence *node); + // generate the out impl +}; + +class be_visitor_sequence_cs : public be_visitor_decl { // // = TITLE - // be_visitor_sequence_base_ch + // be_visitor_sequence_cs + // + // = DESCRIPTION + // This is a concrete visitor to generate the client stubs for + // sequences + // +public: + be_visitor_sequence_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_sequence_cs (void); + // destructor + + virtual int visit_sequence (be_sequence *node); + // visit sequence node + + virtual int gen_base_sequence_class (be_sequence *node); + // generate the base sequence class + +}; + +// =helper visitors to generate the base type and element type + +class be_visitor_sequence_base : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_sequence_base // // = DESCRIPTION // This is a concrete visitor to generate the template parameters @@ -45,18 +106,15 @@ class be_visitor_sequence_base_ch : public be_visitor // = BUGS // The class name is misleading, eventually this class could be // used to generate code in other files, not only the client - // header. + // header. // The visitor factory should provide a factory method that builds // this class on the fly. // public: - be_visitor_sequence_base_ch (TAO_OutStream *stream, - be_decl *sequence_scope, - be_type *base_type); - // Constructor, set the stream to write to, the scope where the - // sequence is defined and the base type for the sequence. + be_visitor_sequence_base (be_visitor_context *ctx); + // Constructor - ~be_visitor_sequence_base_ch (void); + ~be_visitor_sequence_base (void); // destructor // = Visitor methods. @@ -72,21 +130,47 @@ public: virtual int visit_typedef (be_typedef *node); protected: - be_decl *seq_scope (void); - // scope node of the saved sequence node + int visit_node (be_type *); + // helper that does the common job + +}; + +class be_visitor_sequence_buffer_type : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_sequence_buffer_type + // + // = DESCRIPTION + // This is a concrete visitor to generate the buffer type + // for a TAO_*_Sequence instantiation. + // +public: + be_visitor_sequence_buffer_type (be_visitor_context *ctx); + // Constructor + ~be_visitor_sequence_buffer_type (void); + // destructor + + // = Visitor methods. + virtual int visit_predefined_type (be_predefined_type *node); + virtual int visit_interface (be_interface *node); + virtual int visit_interface_fwd (be_interface_fwd *node); + virtual int visit_structure (be_structure *node); + virtual int visit_enum (be_enum *node); + virtual int visit_union (be_union *node); + virtual int visit_array (be_array *node); + virtual int visit_string (be_string *node); + virtual int visit_sequence (be_sequence *node); + virtual int visit_typedef (be_typedef *node); + +protected: int visit_node (be_type *); // helper that does the common job -private: - be_type* current_type_; - // The scoped name for the current argument type name. - // We cannot use just node->name() because we could be using an - // aliased name (through typedefs) in which case the real name must - // be used. }; -class be_visitor_sequence_elemtype : public be_visitor +class be_visitor_sequence_elemtype : public be_visitor_decl { // // = TITLE @@ -100,11 +184,8 @@ class be_visitor_sequence_elemtype : public be_visitor // This class may eventually go away when the _var and _out classes are // generated using templates public: - be_visitor_sequence_elemtype (TAO_OutStream *stream, - be_decl *sequence_scope, - be_type *base_type); - // Constructor, set the stream to write to, the scope where the - // sequence is defined and the base type for the sequence. + be_visitor_sequence_elemtype (be_visitor_context *ctx); + // Constructor ~be_visitor_sequence_elemtype (void); // destructor @@ -122,17 +203,9 @@ public: virtual int visit_string (be_string *node); protected: - be_decl *seq_scope (void); - // scope node of the saved sequence node - int visit_node (be_type *); // helper that does the common job - be_type* current_type_; - // The scoped name for the current argument type name. - // We cannot use just node->name() because we could be using an - // aliased name (through typedefs) in which case the real name must - // be used. }; #endif /* TAO_BE_VISITOR_SEQUENCE_H */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure.h b/TAO/TAO_IDL/be_include/be_visitor_structure.h new file mode 100644 index 00000000000..5c643d48c23 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_structure.h @@ -0,0 +1,121 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_structure.h +// +// = DESCRIPTION +// Concrete visitor for the Structure class +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (TAO_BE_VISITOR_STRUCTURE_H) +#define TAO_BE_VISITOR_STRUCTURE_H + +#include "be_visitor.h" +#include "be_visitor_scope.h" + +class be_visitor_structure : public be_visitor_scope +{ + // + // = TITLE + // be_visitor_structure + // + // = DESCRIPTION + // This is the base visitor for structure + // + // +public: + be_visitor_structure (be_visitor_context *ctx); + // constructureor + + ~be_visitor_structure (void); + // destructureor + + virtual int visit_structure (be_structure *node); + // visit structure. We provide code for this method in the derived class + + // =visit operations on syntactically valid elements in our scope + + virtual int visit_field (be_field *node); + // visit field +}; + +class be_visitor_structure_ch : public be_visitor_structure +{ + // + // = TITLE + // be_visitor_structure_ch + // + // = DESCRIPTION + // This is a concrete visitor to generate the client header for structure + // + // +public: + be_visitor_structure_ch (be_visitor_context *ctx); + // constructureor + + ~be_visitor_structure_ch (void); + // destructureor + + virtual int visit_structure (be_structure *node); + // visit structure. We provide code for this method in the derived class + +}; + +class be_visitor_structure_ci : public be_visitor_structure +{ + // + // = TITLE + // be_visitor_structure_ci + // + // = DESCRIPTION + // This is a concrete visitor to generate the client inline for structure + // + // +public: + be_visitor_structure_ci (be_visitor_context *ctx); + // constructureor + + ~be_visitor_structure_ci (void); + // destructureor + + virtual int visit_structure (be_structure *node); + // visit structure. We provide code for this method in the derived class + +}; + +class be_visitor_structure_cs : public be_visitor_structure +{ + // + // = TITLE + // be_visitor_structure_cs + // + // = DESCRIPTION + // This is a concrete visitor to generate the client stubs for structure + // + // +public: + be_visitor_structure_cs (be_visitor_context *ctx); + // constructureor + + ~be_visitor_structure_cs (void); + // destructureor + + virtual int visit_structure (be_structure *node); + // visit structure. We provide code for this method in the derived class + +}; + + +#endif // TAO_BE_VISITOR_STRUCTURE_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef.h b/TAO/TAO_IDL/be_include/be_visitor_typedef.h new file mode 100644 index 00000000000..270f2aae6a0 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_typedef.h @@ -0,0 +1,182 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_typedef.h +// +// = DESCRIPTION +// Concrete visitor for the Typedef class +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (TAO_BE_VISITOR_TYPEDEF_H) +#define TAO_BE_VISITOR_TYPEDEF_H + +#include "be_visitor.h" +#include "be_visitor_scope.h" + +class be_visitor_typedef : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_typedef + // + // = DESCRIPTION + // This is a concrete visitor for typedef that abstracts all common tasks + // + +public: + be_visitor_typedef (be_visitor_context *ctx); + // constructor + + ~be_visitor_typedef (void); + // destructor + + virtual int visit_typedef (be_typedef *node); + // must be overridden + + // =visit methods on all elements syntactically valid as types that can be + // typedefed. + + virtual int visit_array (be_array *node); + // visit a array + + virtual int visit_enum (be_enum *node); + // visit an enum + + virtual int visit_predefined_type (be_predefined_type *node); + // visit predefined type node + + virtual int visit_string (be_string *node); + // visit a typedef + + virtual int visit_sequence (be_sequence *node); + // visit a sequence + + virtual int visit_structure (be_structure *node); + // visit a structure + + virtual int visit_union (be_union *node); + // visit a union + +}; + +// we need derived typedef visitors for the client files. + +class be_visitor_typedef_ch : public be_visitor_typedef +{ + // + // = TITLE + // be_visitor_typedef_ch + // + // = DESCRIPTION + // This is a concrete visitor to generate the client header for typedef + // + // +public: + be_visitor_typedef_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_typedef_ch (void); + // destructor + + virtual int visit_typedef (be_typedef *node); + // visit typedef. We provide code for this method in the derived class + + // =visit methods on all elements syntactically valid as types that can be + // typedefed. + + virtual int visit_array (be_array *node); + // visit a array + + virtual int visit_enum (be_enum *node); + // visit an enum + + virtual int visit_predefined_type (be_predefined_type *node); + // visit predefined type node + + virtual int visit_string (be_string *node); + // visit a typedef + + virtual int visit_sequence (be_sequence *node); + // visit a sequence + + virtual int visit_structure (be_structure *node); + // visit a structure + + virtual int visit_union (be_union *node); + // visit a union + +}; + +class be_visitor_typedef_ci : public be_visitor_typedef +{ + // + // = TITLE + // be_visitor_typedef_sh + // + // = DESCRIPTION + // This is a concrete visitor to generate the server header for typedef + // + // +public: + be_visitor_typedef_ci (be_visitor_context *ctx); + // constructor + + ~be_visitor_typedef_ci (void); + // destructor + + virtual int visit_typedef (be_typedef *node); + // visit typedef. We provide code for this method in the derived class + + // =visit methods on all elements syntactically valid as types that can be + // typedefed. + + virtual int visit_array (be_array *node); + // visit a array + + virtual int visit_sequence (be_sequence *node); + // visit a sequence + + virtual int visit_structure (be_structure *node); + // visit a structure + + virtual int visit_union (be_union *node); + // visit a union + +}; + +class be_visitor_typedef_cs : public be_visitor_typedef +{ + // + // = TITLE + // be_visitor_typedef_cs + // + // = DESCRIPTION + // This is a concrete visitor to generate the server header for typedef + // + // +public: + be_visitor_typedef_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_typedef_cs (void); + // destructor + + virtual int visit_typedef (be_typedef *node); + // visit typedef. We provide code for this method in the derived class + +}; + + +#endif // TAO_BE_VISITOR_TYPEDEF_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_union.h b/TAO/TAO_IDL/be_include/be_visitor_union.h new file mode 100644 index 00000000000..5ed4437fa2c --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_union.h @@ -0,0 +1,200 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_union.h +// +// = DESCRIPTION +// Concrete visitor for the Union class +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (TAO_BE_VISITOR_UNION_H) +#define TAO_BE_VISITOR_UNION_H + +#include "be_visitor.h" +#include "be_visitor_scope.h" + +class be_visitor_union : public be_visitor_scope +{ + // + // = TITLE + // be_visitor_union + // + // = DESCRIPTION + // This is the base visitor for union + // + // +public: + be_visitor_union (be_visitor_context *ctx); + // constructor + + ~be_visitor_union (void); + // destructor + + virtual int visit_union (be_union *node); + // visit union. We provide code for this method in the derived class + + // =visit operations on syntactically valid elements in our scope + + virtual int visit_union_branch (be_union_branch *node); + // visit union_branch +}; + +class be_visitor_union_ch : public be_visitor_union +{ + // + // = TITLE + // be_visitor_union_ch + // + // = DESCRIPTION + // This is a concrete visitor to generate the client header for union + // + // +public: + be_visitor_union_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_union_ch (void); + // destructor + + virtual int visit_union (be_union *node); + // visit union. We provide code for this method in the derived class + +}; + +class be_visitor_union_ci : public be_visitor_union +{ + // + // = TITLE + // be_visitor_union_ci + // + // = DESCRIPTION + // This is a concrete visitor to generate the client inline for union + // + // +public: + be_visitor_union_ci (be_visitor_context *ctx); + // constructor + + ~be_visitor_union_ci (void); + // destructor + + virtual int visit_union (be_union *node); + // visit union. We provide code for this method in the derived class + +}; + +class be_visitor_union_cs : public be_visitor_union +{ + // + // = TITLE + // be_visitor_union_cs + // + // = DESCRIPTION + // This is a concrete visitor to generate the client stubs for union + // + // +public: + be_visitor_union_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_union_cs (void); + // destructor + + virtual int visit_union (be_union *node); + // visit union. We provide code for this method in the derived class + +}; + +class be_visitor_union_discriminant_ch : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_union_discriminant_ch + // + // = DESCRIPTION + // This is a concrete visitor to generate the client header for union + // discriminant + // + // +public: + be_visitor_union_discriminant_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_union_discriminant_ch (void); + // destructor + + virtual int visit_enum (be_enum *node); + // visit an enum + + virtual int visit_predefined_type (be_predefined_type *node); + // visit a predefined type + + virtual int visit_typedef (be_typedef *node); + // visit a typedef node +}; + +class be_visitor_union_discriminant_ci : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_union_discriminant_ci + // + // = DESCRIPTION + // This is a concrete visitor to generate the client inline for union + // discriminant + // + // +public: + be_visitor_union_discriminant_ci (be_visitor_context *ctx); + // constructor + + ~be_visitor_union_discriminant_ci (void); + // destructor + + virtual int visit_enum (be_enum *node); + // visit an enum + + virtual int visit_predefined_type (be_predefined_type *node); + // visit a predefined type + + virtual int visit_typedef (be_typedef *node); + // visit a typedef node +}; + +class be_visitor_union_discriminant_cs : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_union_discriminant_cs + // + // = DESCRIPTION + // This is a concrete visitor to generate the client stubs for union + // discriminant + // + // +public: + be_visitor_union_discriminant_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_union_discriminant_cs (void); + // destructor + + virtual int visit_enum (be_enum *node); + // visit an enum. Required to generate the typecode for an enum definition + // appearing side the union + +}; + +#endif // TAO_BE_VISITOR_UNION_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch.h new file mode 100644 index 00000000000..780099165eb --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch.h @@ -0,0 +1,254 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_union_branch.h +// +// = DESCRIPTION +// Concrete visitor for the base "BE_Union_Branch" node +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (TAO_BE_VISITOR_UNION_BRANCH_H) +#define TAO_BE_VISITOR_UNION_BRANCH_H + +#include "be_visitor_decl.h" + +class be_visitor_union_branch_public_ch : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_union_branch_public_ch + // + // = DESCRIPTION + // This is a concrete visitor for the be_union_branch node for the client + // header. This generates the code for the public section of the "union" + // class + // +public: + be_visitor_union_branch_public_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_union_branch_public_ch (void); + // destructor + + virtual int visit_union_branch (be_union_branch *node); + // visit the union_branch node + + // =visit operations on all possible data types that a union_branch can be + + virtual int visit_array (be_array *node); + // visit array type + + virtual int visit_enum (be_enum *node); + // visit enum type + + virtual int visit_interface (be_interface *node); + // visit interface type + + virtual int visit_interface_fwd (be_interface_fwd *node); + // visit interface forward type + + virtual int visit_predefined_type (be_predefined_type *node); + // visit predefined type + + virtual int visit_sequence (be_sequence *node); + // visit sequence type + + virtual int visit_string (be_string *node); + // visit string type + + virtual int visit_structure (be_structure *node); + // visit structure type + + virtual int visit_typedef (be_typedef *node); + // visit typedefed type + + virtual int visit_union (be_union *node); + // visit union type + +}; + +class be_visitor_union_branch_private_ch : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_union_branch_private_ch + // + // = DESCRIPTION + // This is a concrete visitor for the be_union_branch node for the client + // header. This generates the code for the private section of the "union" + // class + // +public: + be_visitor_union_branch_private_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_union_branch_private_ch (void); + // destructor + + virtual int visit_union_branch (be_union_branch *node); + // visit the union_branch node + + // =visit operations on all possible data types that a union_branch can be + + virtual int visit_array (be_array *node); + // visit array type + + virtual int visit_enum (be_enum *node); + // visit enum type + + virtual int visit_interface (be_interface *node); + // visit interface type + + virtual int visit_interface_fwd (be_interface_fwd *node); + // visit interface forward type + + virtual int visit_predefined_type (be_predefined_type *node); + // visit predefined type + + virtual int visit_sequence (be_sequence *node); + // visit sequence type + + virtual int visit_string (be_string *node); + // visit string type + + virtual int visit_structure (be_structure *node); + // visit structure type + + virtual int visit_typedef (be_typedef *node); + // visit typedefed type + + virtual int visit_union (be_union *node); + // visit union type + +}; + +class be_visitor_union_branch_public_ci : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_union_branch_public_ci + // + // = DESCRIPTION + // This visitor is used to generate the accessors for the members of the + // union + // +public: + be_visitor_union_branch_public_ci (be_visitor_context *ctx); + // constructor + + ~be_visitor_union_branch_public_ci (void); + // destructor + + virtual int visit_union_branch (be_union_branch *node); + // visit the union_branch node + + // =visit operations on all possible data types that a union_branch can be + + virtual int visit_array (be_array *node); + // visit array type + + virtual int visit_enum (be_enum *node); + // visit enum type + + virtual int visit_interface (be_interface *node); + // visit interface type + + virtual int visit_interface_fwd (be_interface_fwd *node); + // visit interface forward type + + virtual int visit_predefined_type (be_predefined_type *node); + // visit predefined type + + virtual int visit_sequence (be_sequence *node); + // visit sequence type + + virtual int visit_string (be_string *node); + // visit string type + + virtual int visit_structure (be_structure *node); + // visit structure type + + virtual int visit_typedef (be_typedef *node); + // visit typedefed type + + virtual int visit_union (be_union *node); + // visit union type + +}; + +class be_visitor_union_branch_public_cs : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_union_branch_public_cs + // + // = DESCRIPTION + // This visitor is used to generate implementation such as typecodes for + // constructed types + // +public: + be_visitor_union_branch_public_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_union_branch_public_cs (void); + // destructor + + virtual int visit_union_branch (be_union_branch *node); + // visit the union_branch node + + // =visit operations on all possible data types that a union_branch can be + + virtual int visit_array (be_array *node); + // visit array type + + virtual int visit_enum (be_enum *node); + // visit enum type + + virtual int visit_sequence (be_sequence *node); + // visit sequence type + + virtual int visit_string (be_string *node); + // visit string type + + virtual int visit_structure (be_structure *node); + // visit structure type + + virtual int visit_union (be_union *node); + // visit union type + +}; + +class be_visitor_union_branch_public_assign_cs : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_union_branch_public_assign_cs + // + // = DESCRIPTION + // This is used to generate the body of the assignment operator and the + // copy constructor of the union class + // +public: + be_visitor_union_branch_public_assign_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_union_branch_public_assign_cs (void); + // destructor + + virtual int visit_union_branch (be_union_branch *node); + // visit the union_branch node + +}; + +#endif // TAO_BE_VISITOR_UNION_BRANCH_H diff --git a/TAO/tao/corba.h b/TAO/tao/corba.h index e675792f976..d106cb6ce3d 100644 --- a/TAO/tao/corba.h +++ b/TAO/tao/corba.h @@ -162,6 +162,7 @@ extern TAO_Export int operator== (const TAO_ObjectKey &l, #include "tao/giop.i" #include "tao/iioporb.i" #include "tao/iiopobj.i" +#include "tao/svrrqst.i" //#include "tao/managed_types.i" # if defined (do_undef_on_ACE_INLINE) diff --git a/TAO/tao/decode.cpp b/TAO/tao/decode.cpp index f3d68f736d5..45f4d696cbf 100644 --- a/TAO/tao/decode.cpp +++ b/TAO/tao/decode.cpp @@ -975,11 +975,14 @@ TAO_Marshal_String::decode (CORBA::TypeCode_ptr, str = (*(char **) data) = CORBA::string_alloc (len - 1); // only allocate the string *after* the length was validated. +#if 0 while (continue_decoding != CORBA::B_FALSE && len-- != 0) { continue_decoding = stream->get_char (*(CORBA::Char *) str); str++; } +#endif + continue_decoding = stream->get_string (str, len); } if (continue_decoding == CORBA::B_TRUE) return CORBA::TypeCode::TRAVERSE_CONTINUE; diff --git a/TAO/tao/encode.cpp b/TAO/tao/encode.cpp index 1f32d6d806c..cc3b488b8ba 100644 --- a/TAO/tao/encode.cpp +++ b/TAO/tao/encode.cpp @@ -718,7 +718,7 @@ TAO_Marshal_String::encode (CORBA::TypeCode_ptr tc, { // Encode the string, followed by a NUL character. - +#if 0 for (continue_encoding = stream->put_ulong (len + 1); // length + // 1 for // the NULL @@ -728,7 +728,11 @@ TAO_Marshal_String::encode (CORBA::TypeCode_ptr tc, continue; // put a NULL terminating character stream->put_char (0); - return CORBA::TypeCode::TRAVERSE_CONTINUE; +#endif + if (stream->put_string (str, len)) + return CORBA::TypeCode::TRAVERSE_CONTINUE; + else + return CORBA::TypeCode::TRAVERSE_STOP; } else return CORBA::TypeCode::TRAVERSE_STOP; diff --git a/TAO/tao/giop.h b/TAO/tao/giop.h index 708502a1ceb..fc199565770 100644 --- a/TAO/tao/giop.h +++ b/TAO/tao/giop.h @@ -4,7 +4,7 @@ // // = LIBRARY // TAO -// +// // = FILENAME // giop.h // @@ -26,9 +26,9 @@ // GIOP code is reentrant. // // = AUTHOR -// Copyright 1994-1995 by Sun Microsystems Inc., +// Copyright 1994-1995 by Sun Microsystems Inc., // Chris Cleeland <cleeland@cs.wustl.edu> -// +// // ============================================================================ #if !defined (TAO_GIOP_H) @@ -43,7 +43,7 @@ // Email to tag-request@omg.org to allocate tags. typedef CORBA::ULong TAO_IOP_Profile_ID; -enum +enum { TAO_IOP_TAG_INTERNET_IOP = 0, // IIOP TAO_IOP_TAG_MULTIPLE_COMPONENTS = 1, // DCE-CIOP @@ -52,16 +52,16 @@ enum TAO_IOP_TAG_ONC_IOP = 0x4f4e4300 // ONC IOP }; -struct TAO_IOP_Tagged_Profile +struct TAO_IOP_Tagged_Profile // One per protocol. -{ +{ TAO_IOP_Profile_ID tag; TAO_opaque profile_data; }; typedef TAO_Unbounded_Sequence<TAO_IOP_Tagged_Profile> TAO_IOP_Tagged_Profile_Sequence; -struct TAO_IOP_IOR +struct TAO_IOP_IOR // = TITLE // InteroperableObjectReference // @@ -82,7 +82,7 @@ struct TAO_IOP_IOR typedef CORBA::ULong TAO_IOP_ComponentId; -enum +enum // = DESCRIPTION // These are all defined by DCE-CIOP in OMG TC document 95-3-10. { @@ -94,7 +94,7 @@ enum TAO_IOP_TAG_LOCATION_POLICY = 12 // octet/enum }; -struct TAO_IOP_TaggedComponent +struct TAO_IOP_TaggedComponent // = DESCRIPTION // One way to represent multicomponent profiles, e.g. as done by the // DCE-CIOP protocol. One of these gets encapsulated in @@ -118,15 +118,15 @@ struct TAO_Version CORBA::Octet minor; }; -enum - // = DESCRIPTION +enum + // = DESCRIPTION // GIOP protocol version 1.0 information. -{ +{ MY_MAJOR = 1, - MY_MINOR = 0 + MY_MINOR = 0 }; -enum TAO_GIOP_MsgType +enum TAO_GIOP_MsgType // = DESCRIPTION // All GIOP messages include a header and message type. { @@ -142,7 +142,7 @@ enum TAO_GIOP_MsgType TAO_GIOP_MessageError = 6 // by both }; -struct TAO_GIOP_MessageHeader +struct TAO_GIOP_MessageHeader { CORBA::Char magic [4]; // "GIOP" TAO_Version giop_version; @@ -168,11 +168,11 @@ enum TAO_GIOP_TransactionService = 0 // More service IDs may be defined by OMG. - + // This is where our RIOP service ID will be defined... }; - -struct TAO_GIOP_ServiceContext + +struct TAO_GIOP_ServiceContext { TAO_GIOP_ServiceID context_id; TAO_opaque context_data; @@ -184,7 +184,7 @@ extern CORBA::TypeCode TC_ServiceContextList; // = Request, Reply headers -class TAO_Export TAO_GIOP_RequestHeader +class TAO_Export TAO_GIOP_RequestHeader // = TITLE // This class embodies the header of a GIOP request. // @@ -194,23 +194,23 @@ class TAO_Export TAO_GIOP_RequestHeader public: TAO_GIOP_RequestHeader (void); // Constructor. - + CORBA::Boolean init (CDR &msg, CORBA::Environment& env); // Initialize the header from the values found in <msg>. - + //private: TAO_GIOP_ServiceContextList service_info; // The service context for the request (CORBA Reference?) - + CORBA::ULong request_id; // Unique identifier for a request - + CORBA::Boolean response_expected; // true if this request requires a response - + TAO_opaque object_key; // The object key of the destination object. - + CORBA::String operation; // Name of the operation being performed @@ -218,69 +218,69 @@ public: // Identifies the requester }; -enum TAO_GIOP_ReplyStatusType +enum TAO_GIOP_ReplyStatusType { - TAO_GIOP_NO_EXCEPTION, + TAO_GIOP_NO_EXCEPTION, // Request completed successfully - TAO_GIOP_USER_EXCEPTION, + TAO_GIOP_USER_EXCEPTION, // Request terminated with user exception - TAO_GIOP_SYSTEM_EXCEPTION, + TAO_GIOP_SYSTEM_EXCEPTION, // Request terminated with system exception - TAO_GIOP_LOCATION_FORWARD + TAO_GIOP_LOCATION_FORWARD // @@ More info }; -struct TAO_GIOP_ReplyHeader +struct TAO_GIOP_ReplyHeader { - TAO_GIOP_ServiceContextList service_info; - // Information + TAO_GIOP_ServiceContextList service_info; + // Information - CORBA::ULong request_id; + CORBA::ULong request_id; // Unique identifier of the request for which this is a reply - TAO_GIOP_ReplyStatusType reply_status; + TAO_GIOP_ReplyStatusType reply_status; // Status of the reply (see above enum) }; -struct TAO_GIOP_CancelRequestHeader +struct TAO_GIOP_CancelRequestHeader // = DESCRIPTION // Cancellation -- applies both to Requests and LocateRequests. { - CORBA::ULong request_id; + CORBA::ULong request_id; // Unique identifier of the request being cancelled }; -struct TAO_GIOP_LocateRequestHeader +struct TAO_GIOP_LocateRequestHeader // = DESCRIPTION // Location service support { TAO_GIOP_LocateRequestHeader (void); // Constructor - + CORBA::Boolean init (CDR &msg, CORBA::Environment& env); // Initialize the header from the values found in <msg>. - + CORBA::ULong request_id; TAO_opaque object_key; }; -enum TAO_GIOP_LocateStatusType +enum TAO_GIOP_LocateStatusType { TAO_GIOP_UNKNOWN_OBJECT, TAO_GIOP_OBJECT_HERE, TAO_GIOP_OBJECT_FORWARD }; -struct TAO_GIOP_LocateReplyHeader +struct TAO_GIOP_LocateReplyHeader { CORBA::ULong request_id; TAO_GIOP_LocateStatusType locate_status; }; -class TAO_Export TAO_GIOP_Invocation +class TAO_Export TAO_GIOP_Invocation // = TITLE // Invocation: Sends a Request, optionally reads associated Reply. // Uses transport info passed in, doesn't locate anything. @@ -299,7 +299,7 @@ public: // <start> goes beyond initialising data structures, and makes // calls that may fail -- and thus throw exceptions. - void put_param (CORBA::TypeCode_ptr tc, + void put_param (CORBA::TypeCode_ptr tc, void *value, CORBA::Environment &env); @@ -311,6 +311,9 @@ public: CORBA::Environment &env); // No CORBA::Context support (deprecated). + CDR &stream (void); + // return the underlying stream + private: IIOP_Object *data_; // The object on which this invocation is going. @@ -326,7 +329,7 @@ private: u_char buffer [CDR::DEFAULT_BUFSIZE]; // Buffer used for CDR stream. - + CDR stream_; // Stream into which the request is placed. @@ -334,7 +337,6 @@ private: // The handler for the client's connection. }; - class TAO_Export TAO_GIOP // = TITLE // A namespace for GIOP-related operations. @@ -343,7 +345,7 @@ class TAO_Export TAO_GIOP // Only put static methods within this scope. { ACE_CLASS_IS_NAMESPACE (TAO_GIOP); - + public: // = Close a connection, first sending GIOP::CloseConnection static void close_connection (TAO_Client_Connection_Handler *&handle, @@ -352,16 +354,16 @@ public: static CORBA::Boolean start_message (TAO_GIOP_MsgType t, CDR &msg); // Build the header for a message of type <t> into stream <msg>. - + static CORBA::Boolean send_request (TAO_SVC_HANDLER *handler, CDR &stream); // Send message, returns TRUE if success, else FALSE. static TAO_GIOP_MsgType recv_request (TAO_SVC_HANDLER *&handler, - CDR &msg, + CDR &msg, CORBA::Environment &env); // Reads message, returns message type from header. - + static void make_error (CDR &msg, ...); // Construct a message containing an error so that it can be sent as // a response to a request. diff --git a/TAO/tao/giop.i b/TAO/tao/giop.i index 351f97e1b74..65c9b022704 100644 --- a/TAO/tao/giop.i +++ b/TAO/tao/giop.i @@ -4,14 +4,14 @@ ACE_INLINE TAO_GIOP_LocateRequestHeader::TAO_GIOP_LocateRequestHeader (void) : request_id (0) {} - + ACE_INLINE TAO_GIOP_RequestHeader::TAO_GIOP_RequestHeader (void) : request_id (0), response_expected (CORBA::B_FALSE) {} -ACE_INLINE void +ACE_INLINE void TAO_GIOP_Invocation::get_value (CORBA::TypeCode_ptr tc, void *value, CORBA::Environment &env) @@ -19,10 +19,16 @@ TAO_GIOP_Invocation::get_value (CORBA::TypeCode_ptr tc, (void) this->stream_.decode (tc, value, 0, env); } -ACE_INLINE void -TAO_GIOP_Invocation::put_param (CORBA::TypeCode_ptr tc, - void *value, +ACE_INLINE void +TAO_GIOP_Invocation::put_param (CORBA::TypeCode_ptr tc, + void *value, CORBA::Environment &env) { (void) this->stream_.encode (tc, value, 0, env); } + +ACE_INLINE CDR & +TAO_GIOP_Invocation::stream (void) +{ + return this->stream_; +} diff --git a/TAO/tao/sequence_T.cpp b/TAO/tao/sequence_T.cpp index 48c31b8884a..f081a73ddeb 100644 --- a/TAO/tao/sequence_T.cpp +++ b/TAO/tao/sequence_T.cpp @@ -554,8 +554,8 @@ TAO_Bounded_String_Sequence<MAX>::operator= this->buffer_ = TAO_Bounded_String_Sequence<T>::allocbuf (rhs.maximum_); } - TAO_Bounded_Base_Sequence::operator= (rhs); - + TAO_Bounded_Base_Sequence::operator= (rhs); + char* *tmp1 = ACE_reinterpret_cast(char* *,this->buffer_); char* *tmp2 = ACE_reinterpret_cast(char* *,seq.buffer_); for (CORBA::ULong i=0; i < seq.length_; i++) diff --git a/TAO/tao/svrrqst.cpp b/TAO/tao/svrrqst.cpp index d49e025c1cd..66fbbd008a2 100644 --- a/TAO/tao/svrrqst.cpp +++ b/TAO/tao/svrrqst.cpp @@ -14,10 +14,14 @@ DEFINE_GUID (IID_IIOP_ServerRequest, DEFINE_GUID (IID_CORBA_ServerRequest, 0x4b48d881, 0xf7f0, 0x11ce, 0x95, 0x98, 0x0, 0x0, 0xc0, 0x7c, 0xa8, 0x98); -IIOP_ServerRequest::IIOP_ServerRequest (CDR *msg, +IIOP_ServerRequest::IIOP_ServerRequest (CDR *req, + CDR *resp, + CORBA::ULong reqid, CORBA::ORB_ptr the_orb, TAO_POA *the_poa) - : incoming_ (msg), + : incoming_ (req), + outgoing_ (resp), + reqid_ (reqid), params_ (0), retval_ (0), exception_ (0), @@ -220,3 +224,172 @@ IIOP_ServerRequest::oa (void) { return poa_; } + +// Extension +void +IIOP_ServerRequest::demarshal (CORBA::Environment &env, // exception reporting + const TAO_Call_Data_Skel *info, // call description + ...) // ... any parameters +{ + // first find out the size of the list to be created. info->count keeps track + // of the table size. If "roundtrip" is true => one entry is for RETURN type + // which does not go into the NVList + CORBA::ULong list_size = info->is_roundtrip ? (info->param_count - 1) + : info->param_count; + CORBA::NVList_ptr nvlist; + + // create an NVList of the appropriate size + this->orb ()->create_list (list_size, nvlist); + + // Now, put all "in" and "inout" parameters into the NVList + CORBA::ULong i; + + // setup the variable argument list + const TAO_Param_Data_Skel *pdp; + va_list param_vector; + va_start (param_vector, info); + + for (i = 0, pdp = info->params; + i < info->param_count; + i++, pdp++) + { + void *ptr = va_arg (param_vector, void *); + + if ((pdp->mode == CORBA::ARG_IN) + || (pdp->mode == CORBA::ARG_INOUT)) + { + // populate the NVList + (void) nvlist->add_item (0, pdp->mode, env) + ->value ()->replace (pdp->tc, ptr, pdp->own, env); + } + else if (pdp->mode == CORBA::ARG_OUT) + { + (void) nvlist->add_item (0, pdp->mode, env); + // don't add any value + } + } + va_end (param_vector); + + // now demarshal the parameters using a call to params + this->params (nvlist, env); // nvlist is now owned by us +} + +// Extension +void +IIOP_ServerRequest::marshal (CORBA::Environment &env, // exception reporting + const TAO_Call_Data_Skel *info, // call description + ...) // ... any parameters +{ + // Now, put all "in" and "inout" parameters into the NVList + CORBA::ULong i, j; + + // setup the variable argument list + const TAO_Param_Data_Skel *pdp; + va_list param_vector; + va_start (param_vector, info); + + j = 0; + for (i = 0, pdp = info->params; + i < info->param_count; + i++, pdp++) + { + void *ptr = va_arg (param_vector, void *); + + if (pdp->mode == 0) // return type + { + this->retval_ = new CORBA::Any (pdp->tc, ptr, pdp->own); + continue; + } + + if (pdp->mode == CORBA::ARG_OUT) + { + (void) this->params_->item (j, env)->value () + ->replace (pdp->tc, ptr, pdp->own, env); + // don't add any value + } + j++; + } + va_end (param_vector); + + + // setup a Reply message + this->init_reply (env); + + // Normal reply. + if (!env.exception ()) + { + // ... then send any return value ... + if (this->retval_) + { + CORBA::TypeCode_ptr tc = this->retval_->type (); + const void *value = this->retval_->value (); + if (value) + (void) this->outgoing_->encode (tc, value, 0, env); + } + + // ... Followed by "inout" and "out" parameters, left to right + for (u_int i = 0; + i < this->params_->count (); + i++) + { + CORBA::NamedValue_ptr nv = this->params_->item (i, env); + CORBA::Any_ptr any; + + if (!(nv->flags () & (CORBA::ARG_INOUT|CORBA::ARG_OUT))) + continue; + + any = nv->value (); + CORBA::TypeCode_ptr tc = any->type (); + const void *value = any->value (); + (void) this->outgoing_->encode (tc, value, 0, env); + } + } +} + +void +IIOP_ServerRequest::init_reply (CORBA::Environment &env) +{ + // construct a REPLY header + TAO_GIOP::start_message (TAO_GIOP_Reply, *this->outgoing_); + TAO_GIOP_ServiceContextList resp_ctx; + resp_ctx.length (0); + this->outgoing_->encode (&TC_ServiceContextList, &resp_ctx, 0, env); + this->outgoing_->put_ulong (this->reqid_); + + // Standard exceptions only. + if (env.exception () != 0) + { + CORBA::Environment env2; + CORBA::Exception *x = env.exception (); + CORBA::TypeCode_ptr except_tc = x->type (); + + this->outgoing_->put_ulong (TAO_GIOP_SYSTEM_EXCEPTION); + (void) this->outgoing_->encode (except_tc, x, 0, env2); + } + + // Any exception at all. + else if (this->exception_) + { + CORBA::Exception *x; + CORBA::TypeCode_ptr except_tc; + + x = (CORBA::Exception *) this->exception_->value (); + except_tc = this->exception_->type (); + + // Finish the GIOP Reply header, then marshal the exception. + // + // XXX x->type () someday ... + if (this->ex_type_ == CORBA::SYSTEM_EXCEPTION) + this->outgoing_->put_ulong (TAO_GIOP_SYSTEM_EXCEPTION); + else + this->outgoing_->put_ulong (TAO_GIOP_USER_EXCEPTION); + + (void) this->outgoing_->encode (except_tc, x, 0, env); + } + else + { // Normal reply + + // First finish the GIOP header ... + this->outgoing_->put_ulong (TAO_GIOP_NO_EXCEPTION); + } +} diff --git a/TAO/tao/svrrqst.h b/TAO/tao/svrrqst.h index 454b3038c3f..af7afa3e7c2 100644 --- a/TAO/tao/svrrqst.h +++ b/TAO/tao/svrrqst.h @@ -4,12 +4,12 @@ // // = LIBRARY // TAO -// +// // = FILENAME // svrrqst.h // // = DESCRIPTION -// +// // Header file for Win32 C/C++/COM interface to CORBA's Dynamic // Server Skeleton Interface's "Server Request" type. // @@ -18,7 +18,7 @@ // // = VERSION // $Id$ -// +// // ============================================================================ #if !defined (TAO_SVRRQST_H) @@ -26,6 +26,71 @@ class TAO_POA; +struct TAO_Param_Data_Skel + // = TITLE + // Description of a single parameter. + // + // = DESCRIPTION + // + // If value_size is nonzero for OUT, INOUT, or RETURN parameters, + // it's (a) an indicator that the ORB returns a pointer-to-value + // for this parameter, and also (b) is the size of the top-level + // of the value that's returned (e.g. ignoring nested sequence + // buffers). That is, it moves CPU cycles from runtime -- some + // calls to tc->size() -- to compile time where they're + // cheap/free. + // + // It _must_ only be set for cases where the ORB allocates the + // return value, which must then be ORB::free()d ... e.g. where + // the value is a pointer to data such as a struct, sequence, or + // union. (The CORBA C++ mapping doesn't require that for all + // "out" structs; only those of "variable size".) If this value + // is nonzero, the value passed to do_call() must be the address + // of a pointer. + +{ + CORBA::TypeCode_ptr tc; + // Type of param. + + CORBA::ULong mode; + // Its mode. + + CORBA::Boolean own; + // whether we own it or not +}; + +struct TAO_Call_Data_Skel + // = TITLE + // Descriptions of operations, as used by the stub interpreter. + // Only interpretive marshaling/unmarshaling is used, and the + // stubs don't know what particular on-the-wire protocol is being + // used. + // + // = DESCRIPTION + // When using C++ exceptions, many C++ compilers will require the + // use of compiled code throw the exception. As binary standards + // for exception throwing evolve, it may become practical to + // interpretively throw exceptions. +{ + const char *opname; + // Operation name. + + CORBA::Boolean is_roundtrip; + // !oneway + + // When constructing tables of parameters, put them in the same + // order they appear in the IDL spec: return value, then parameters + // left to right. Other orders may produce illegal IIOP protocol + // messages. + + CORBA::ULong param_count; + // # parameters. + + const TAO_Param_Data_Skel *params; + // Their descriptions. + +}; + class TAO_Export CORBA_ServerRequest : public TAO_IUnknown // = TITLE // XXX this is currently in an intermediate state; this is not @@ -71,6 +136,22 @@ public: virtual CORBA::String op_name (void) = 0; virtual TAO_POA *oa (void) = 0; virtual CORBA::ORB_ptr orb (void) = 0; + + // Extensions + virtual void demarshal (CORBA::Environment &env, + const TAO_Call_Data_Skel *info, + ...) = 0; + virtual void marshal (CORBA::Environment &env, + const TAO_Call_Data_Skel *info, + ...) = 0; + virtual void init_reply (CORBA::Environment &env) = 0; + // start a Reply message + + virtual CDR &incoming (void) = 0; + // retrieve the incoming stream + + virtual CDR &outgoing (void) = 0; + // retrieve the outgoing stream }; class TAO_Export IIOP_ServerRequest : public CORBA_ServerRequest @@ -80,7 +161,9 @@ class TAO_Export IIOP_ServerRequest : public CORBA_ServerRequest public: // Constructor, destructor - IIOP_ServerRequest (CDR *msg, + IIOP_ServerRequest (CDR *req, + CDR *resp, + CORBA::ULong reqid, CORBA::ORB_ptr the_orb, TAO_POA *the_poa); @@ -112,9 +195,26 @@ public: TAO_HRESULT QueryInterface (REFIID riid, void **ppv); + virtual void demarshal (CORBA::Environment &env, + const TAO_Call_Data_Skel *info, + ...); + virtual void marshal (CORBA::Environment &env, + const TAO_Call_Data_Skel *info, + ...); + virtual void init_reply (CORBA::Environment &env); + // start a Reply message + + virtual CDR &incoming (void); + // retrieve the incoming stream + + virtual CDR &outgoing (void); + // retrieve the outgoing stream + // private: CORBA::String opname_; // Operation name. CDR *incoming_; // Incoming stream. + CDR *outgoing_; // Outgoing stream. + CORBA::ULong reqid_; // request ID CORBA::NVList_ptr params_; // Incoming parameters. CORBA::Any_ptr retval_; // Return value. CORBA::Any_ptr exception_; // Any exception which might be raised. diff --git a/TAO/tao/svrrqst.i b/TAO/tao/svrrqst.i index 8b137891791..fe56464b028 100644 --- a/TAO/tao/svrrqst.i +++ b/TAO/tao/svrrqst.i @@ -1 +1,11 @@ +ACE_INLINE CDR & +IIOP_ServerRequest::incoming (void) +{ + return *this->incoming_; +} +ACE_INLINE CDR & +IIOP_ServerRequest::outgoing (void) +{ + return *this->outgoing_; +} diff --git a/TAO/tests/Param_Test/param_test.idl b/TAO/tests/Param_Test/param_test.idl index 57f186cb577..bd6887e6711 100644 --- a/TAO/tests/Param_Test/param_test.idl +++ b/TAO/tests/Param_Test/param_test.idl @@ -62,7 +62,6 @@ interface Param_Test out Fixed_Struct s3); // sequences and typedefs - typedef sequence<string> StrSeq1; typedef sequence<string> StrSeq; StrSeq test_strseq (in StrSeq s1, inout StrSeq s2, @@ -103,6 +102,18 @@ interface Param_Test Coffee make_coffee (); // make a Coffee object Coffee test_objref (in Coffee o1, inout Coffee o2, out Coffee o3); + // Any + // any test_any (in any a1, inout any a2, out any a3); + + // test simple objects + // Object test_object (in Object o1, inout Object o2, out Object o3); + + // test typecodes + // TypeCode test_typecode (in TypeCode t1, inout TypeCode t2, out TypeCode t3); + + // sequence of typecodes + // typedef sequence<TypeCode> TypeCodeSeq; + // TypeCodeSeq test_tcseq (in TypeCodeSeq t1, inout TypeCodeSeq t2, out TypeCodeSeq t3); /* long test_long (in long l1, inout long l2, |