diff options
Diffstat (limited to 'TAO')
280 files changed, 33208 insertions, 24418 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c index dd8b32658c2..5e9790050b9 100644 --- a/TAO/ChangeLog-98c +++ b/TAO/ChangeLog-98c @@ -1,3 +1,276 @@ +Wed Jun 17 22:03:42 1998 Aniruddha Gokhale <gokhale@mambo.cs.wustl.edu> + + * TAO_IDL: Massive restructuring of directories for be_include and + the "be" directories. Since each individual file was getting too big + with a large number of visitors, we have now subdivided them and + grouped them under individual subdirectories. + + The original header files (e.g., be_include/be_visitor_interface.h), + now only include their subdivided header files. This way the rest of + the code does not need to "#include" every individual file. They + still deal with the higher level include files only. This avoids + any modification of existing code. + + The new directory structure for the be_include directory and the + newly added files are shown below: + + + be_visitor_argument/arglist.h + be_visitor_argument/argument.h + be_visitor_argument/docall_cs.h + be_visitor_argument/marshal_ss.h + be_visitor_argument/post_docall_cs.h + be_visitor_argument/post_marshal_ss.h + be_visitor_argument/post_upcall_ss.h + be_visitor_argument/pre_docall_cs.h + be_visitor_argument/pre_upcall_ss.h + be_visitor_argument/upcall_ss.h + be_visitor_argument/vardecl_ss.h + be_visitor_array/any_op_ch.h + be_visitor_array/any_op_cs.h + be_visitor_array/array.h + be_visitor_array/array_ch.h + be_visitor_array/array_ci.h + be_visitor_array/array_cs.h + be_visitor_attribute/attribute.h + be_visitor_constant/constant_ch.h + be_visitor_constant/constant_cs.h + be_visitor_enum/any_op_ch.h + be_visitor_enum/any_op_cs.h + be_visitor_enum/enum_ch.h + be_visitor_enum/enum_cs.h + be_visitor_exception/any_op_ch.h + be_visitor_exception/any_op_cs.h + be_visitor_exception/ctor.h + be_visitor_exception/ctor_assign.h + be_visitor_exception/exception.h + be_visitor_exception/exception_ch.h + be_visitor_exception/exception_ci.h + be_visitor_exception/exception_cs.h + be_visitor_exception/exception_ctor.h + be_visitor_field/field_ch.h + be_visitor_field/field_ci.h + be_visitor_field/field_cs.h + be_visitor_interface/any_op_ch.h + be_visitor_interface/any_op_cs.h + be_visitor_interface/collocated_sh.h + be_visitor_interface/collocated_ss.h + be_visitor_interface/interface.h + be_visitor_interface/interface_ch.h + be_visitor_interface/interface_ci.h + be_visitor_interface/interface_cs.h + be_visitor_interface/interface_sh.h + be_visitor_interface/interface_si.h + be_visitor_interface/interface_ss.h + be_visitor_interface/tie_sh.h + be_visitor_interface/tie_si.h + be_visitor_interface_fwd/interface_fwd_ch.h + be_visitor_interface_fwd/interface_fwd_ci.h + be_visitor_module/any_op.h + be_visitor_module/module.h + be_visitor_module/module_ch.h + be_visitor_module/module_sh.h + be_visitor_operation/arglist.h + be_visitor_operation/argument.h + be_visitor_operation/collocated_sh.h + be_visitor_operation/collocated_ss.h + be_visitor_operation/exceptlist_cs.h + be_visitor_operation/operation_ch.h + be_visitor_operation/operation_cs.h + be_visitor_operation/operation_sh.h + be_visitor_operation/operation_ss.h + be_visitor_operation/rettype.h + be_visitor_operation/rettype_assign_ss.h + be_visitor_operation/rettype_docall_cs.h + be_visitor_operation/rettype_marshal_ss.h + be_visitor_operation/rettype_post_docall_cs.h + be_visitor_operation/rettype_post_upcall_ss.h + be_visitor_operation/rettype_pre_docall_cs.h + be_visitor_operation/rettype_return_cs.h + be_visitor_operation/rettype_vardecl_cs.h + be_visitor_operation/rettype_vardecl_ss.h + be_visitor_operation/tie_sh.h + be_visitor_operation/tie_si.h + be_visitor_root/any_op.h + be_visitor_root/root.h + be_visitor_root/root_ch.h + be_visitor_root/root_ci.h + be_visitor_root/root_cs.h + be_visitor_root/root_sh.h + be_visitor_root/root_si.h + be_visitor_root/root_ss.h + be_visitor_sequence/any_op_ch.h + be_visitor_sequence/any_op_cs.h + be_visitor_sequence/buffer_type.h + be_visitor_sequence/elemtype.h + be_visitor_sequence/sequence_base.h + be_visitor_sequence/sequence_ch.h + be_visitor_sequence/sequence_ci.h + be_visitor_sequence/sequence_cs.h + be_visitor_structure/any_op_ch.h + be_visitor_structure/any_op_cs.h + be_visitor_structure/structure.h + be_visitor_structure/structure_ch.h + be_visitor_structure/structure_ci.h + be_visitor_structure/structure_cs.h + be_visitor_typecode/typecode_decl.h + be_visitor_typecode/typecode_defn.h + be_visitor_typedef/any_op_ch.h + be_visitor_typedef/any_op_cs.h + be_visitor_typedef/typedef.h + be_visitor_typedef/typedef_ch.h + be_visitor_typedef/typedef_ci.h + be_visitor_typedef/typedef_cs.h + be_visitor_union/any_op_ch.h + be_visitor_union/any_op_cs.h + be_visitor_union/discriminant_ch.h + be_visitor_union/discriminant_ci.h + be_visitor_union/discriminant_cs.h + be_visitor_union/union.h + be_visitor_union/union_ch.h + be_visitor_union/union_ci.h + be_visitor_union/union_cs.h + be_visitor_union_branch/private_ch.h + be_visitor_union_branch/public_assign_cs.h + be_visitor_union_branch/public_ch.h + be_visitor_union_branch/public_ci.h + be_visitor_union_branch/public_cs.h + + The same logic of breaking up individual files and grouping them + under individual subdirectories is used for the be_visitor_*.cpp + files. Each individual file "#include"s their individual + subfiles. This way, we do not have to modify the Makefile to + compile individual file. In addition, the Makefile would have + required each individual subdirectory in its VPATH. Furthermore, + it does not compile files with the same name in different + directories. The new structure is shown below. + + be_visitor_argument/arglist.cpp + be_visitor_argument/argument.cpp + be_visitor_argument/docall_cs.cpp + be_visitor_argument/marshal_ss.cpp + be_visitor_argument/post_docall_cs.cpp + be_visitor_argument/post_marshal_ss.cpp + be_visitor_argument/post_upcall_ss.cpp + be_visitor_argument/pre_docall_cs.cpp + be_visitor_argument/pre_upcall_ss.cpp + be_visitor_argument/upcall_ss.cpp + be_visitor_argument/vardecl_ss.cpp + be_visitor_array/any_op_ch.cpp + be_visitor_array/any_op_cs.cpp + be_visitor_array/array.cpp + be_visitor_array/array_ch.cpp + be_visitor_array/array_ci.cpp + be_visitor_array/array_cs.cpp + be_visitor_attribute/attribute.cpp + be_visitor_constant/constant_ch.cpp + be_visitor_constant/constant_cs.cpp + be_visitor_enum/any_op_ch.cpp + be_visitor_enum/any_op_cs.cpp + be_visitor_enum/enum_ch.cpp + be_visitor_enum/enum_cs.cpp + be_visitor_exception/any_op_ch.cpp + be_visitor_exception/any_op_cs.cpp + be_visitor_exception/ctor_assign.cpp + be_visitor_exception/exception.cpp + be_visitor_exception/exception_ch.cpp + be_visitor_exception/exception_ci.cpp + be_visitor_exception/exception_cs.cpp + be_visitor_exception/exception_ctor.cpp + be_visitor_field/field_ch.cpp + be_visitor_field/field_ci.cpp + be_visitor_field/field_cs.cpp + be_visitor_interface/any_op_ch.cpp + be_visitor_interface/any_op_cs.cpp + be_visitor_interface/collocated_sh.cpp + be_visitor_interface/collocated_ss.cpp + be_visitor_interface/interface.cpp + be_visitor_interface/interface_ch.cpp + be_visitor_interface/interface_ci.cpp + be_visitor_interface/interface_cs.cpp + be_visitor_interface/interface_sh.cpp + be_visitor_interface/interface_si.cpp + be_visitor_interface/interface_ss.cpp + be_visitor_interface/tie_sh.cpp + be_visitor_interface/tie_si.cpp + be_visitor_interface_fwd/interface_fwd_ch.cpp + be_visitor_interface_fwd/interface_fwd_ci.cpp + be_visitor_module/any_op.cpp + be_visitor_module/module.cpp + be_visitor_module/module_ch.cpp + be_visitor_module/module_sh.cpp + be_visitor_operation/arglist.cpp + be_visitor_operation/argument.cpp + be_visitor_operation/collocated_sh.cpp + be_visitor_operation/collocated_ss.cpp + be_visitor_operation/exceptlist_cs.cpp + be_visitor_operation/operation_ch.cpp + be_visitor_operation/operation_cs.cpp + be_visitor_operation/operation_sh.cpp + be_visitor_operation/operation_ss.cpp + be_visitor_operation/rettype.cpp + be_visitor_operation/rettype_assign_ss.cpp + be_visitor_operation/rettype_docall_cs.cpp + be_visitor_operation/rettype_marshal_ss.cpp + be_visitor_operation/rettype_post_docall_cs.cpp + be_visitor_operation/rettype_post_upcall_ss.cpp + be_visitor_operation/rettype_pre_docall_cs.cpp + be_visitor_operation/rettype_return_cs.cpp + be_visitor_operation/rettype_vardecl_cs.cpp + be_visitor_operation/rettype_vardecl_ss.cpp + be_visitor_operation/tie_sh.cpp + be_visitor_operation/tie_si.cpp + be_visitor_root/any_op.cpp + be_visitor_root/root.cpp + be_visitor_root/root_ch.cpp + be_visitor_root/root_ci.cpp + be_visitor_root/root_cs.cpp + be_visitor_root/root_sh.cpp + be_visitor_root/root_si.cpp + be_visitor_root/root_ss.cpp + be_visitor_sequence/any_op_ch.cpp + be_visitor_sequence/any_op_cs.cpp + be_visitor_sequence/buffer_type.cpp + be_visitor_sequence/elemtype.cpp + be_visitor_sequence/sequence_base.cpp + be_visitor_sequence/sequence_ch.cpp + be_visitor_sequence/sequence_ci.cpp + be_visitor_sequence/sequence_cs.cpp + be_visitor_structure/any_op_ch.cpp + be_visitor_structure/any_op_cs.cpp + be_visitor_structure/structure.cpp + be_visitor_structure/structure_ch.cpp + be_visitor_structure/structure_ci.cpp + be_visitor_structure/structure_cs.cpp + be_visitor_typecode/typecode_decl.cpp + be_visitor_typecode/typecode_defn.cpp + be_visitor_typedef/any_op_ch.cpp + be_visitor_typedef/any_op_cs.cpp + be_visitor_typedef/typedef.cpp + be_visitor_typedef/typedef_ch.cpp + be_visitor_typedef/typedef_ci.cpp + be_visitor_typedef/typedef_cs.cpp + be_visitor_union/any_op_ch.cpp + be_visitor_union/any_op_cs.cpp + be_visitor_union/discriminant_ch.cpp + be_visitor_union/discriminant_ci.cpp + be_visitor_union/discriminant_cs.cpp + be_visitor_union/union.cpp + be_visitor_union/union_ch.cpp + be_visitor_union/union_ci.cpp + be_visitor_union/union_cs.cpp + be_visitor_union_branch/private_ch.cpp + be_visitor_union_branch/public_assign_cs.cpp + be_visitor_union_branch/public_ch.cpp + be_visitor_union_branch/public_ci.cpp + be_visitor_union_branch/public_cs.cpp + + * TAO_IDL/be_include + TAO_IDL/be + + Renamed be_visitor_args.{h, cpp} to be_visitor_argument.{h, cpp} + to reflect the correct name used by the AST node. + Wed Jun 17 23:29:06 1998 Carlos O'Ryan <coryan@cs.wustl.edu> * orbsvcs/orbsvcs/Event/Event_Channel.h: diff --git a/TAO/TAO_IDL/Makefile b/TAO/TAO_IDL/Makefile index c72673475c5..807331a0a2e 100644 --- a/TAO/TAO_IDL/Makefile +++ b/TAO/TAO_IDL/Makefile @@ -109,7 +109,7 @@ FILES = tao_idl \ be/be_decl \ be/be_scope \ be/be_visitor \ - be/be_visitor_args \ + be/be_visitor_argument \ be/be_visitor_array \ be/be_visitor_attribute \ be/be_visitor_constant \ @@ -220,6 +220,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -256,6 +257,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -292,6 +294,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -328,6 +331,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -364,6 +368,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -409,27 +414,11 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Process.h \ $(ACE_ROOT)/ace/SString.h \ $(ACE_ROOT)/ace/SString.i \ - $(ACE_ROOT)/ace/Malloc.h \ - $(ACE_ROOT)/ace/Malloc.i \ - $(ACE_ROOT)/ace/Malloc_T.h \ - $(ACE_ROOT)/ace/Free_List.h \ - $(ACE_ROOT)/ace/Free_List.i \ - $(ACE_ROOT)/ace/Malloc_T.i \ - $(ACE_ROOT)/ace/Memory_Pool.h \ - $(ACE_ROOT)/ace/Signal.h \ - $(ACE_ROOT)/ace/Containers.h \ - $(ACE_ROOT)/ace/Containers.i \ - $(ACE_ROOT)/ace/Signal.i \ - $(ACE_ROOT)/ace/Object_Manager.h \ - $(ACE_ROOT)/ace/Object_Manager.i \ - $(ACE_ROOT)/ace/Managed_Object.h \ - $(ACE_ROOT)/ace/Managed_Object.i \ - $(ACE_ROOT)/ace/Mem_Map.h \ - $(ACE_ROOT)/ace/Mem_Map.i \ - $(ACE_ROOT)/ace/Memory_Pool.i \ + $(ACE_ROOT)/ace/Malloc_Base.h \ $(ACE_ROOT)/ace/Process.i \ $(ACE_ROOT)/ace/Process_Manager.i .obj/drv_link.o .obj/drv_link.so .shobj/drv_link.o .shobj/drv_link.so: driver/drv_link.cpp include/idl.h \ @@ -437,6 +426,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -473,6 +463,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -518,36 +509,22 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Process.h \ $(ACE_ROOT)/ace/SString.h \ $(ACE_ROOT)/ace/SString.i \ - $(ACE_ROOT)/ace/Malloc.h \ - $(ACE_ROOT)/ace/Malloc.i \ - $(ACE_ROOT)/ace/Malloc_T.h \ - $(ACE_ROOT)/ace/Free_List.h \ - $(ACE_ROOT)/ace/Free_List.i \ - $(ACE_ROOT)/ace/Malloc_T.i \ - $(ACE_ROOT)/ace/Memory_Pool.h \ - $(ACE_ROOT)/ace/Signal.h \ - $(ACE_ROOT)/ace/Containers.h \ - $(ACE_ROOT)/ace/Containers.i \ - $(ACE_ROOT)/ace/Signal.i \ - $(ACE_ROOT)/ace/Object_Manager.h \ - $(ACE_ROOT)/ace/Object_Manager.i \ - $(ACE_ROOT)/ace/Managed_Object.h \ - $(ACE_ROOT)/ace/Managed_Object.i \ - $(ACE_ROOT)/ace/Mem_Map.h \ - $(ACE_ROOT)/ace/Mem_Map.i \ - $(ACE_ROOT)/ace/Memory_Pool.i \ + $(ACE_ROOT)/ace/Malloc_Base.h \ $(ACE_ROOT)/ace/Process.i \ $(ACE_ROOT)/ace/Process_Manager.i \ $(ACE_ROOT)/ace/Env_Value_T.h \ - $(ACE_ROOT)/ace/Env_Value_T.i + $(ACE_ROOT)/ace/Env_Value_T.i \ + $(ACE_ROOT)/ace/Env_Value_T.cpp .obj/fe_declarator.o .obj/fe_declarator.so .shobj/fe_declarator.o .shobj/fe_declarator.so: fe/fe_declarator.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/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -585,6 +562,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -622,6 +600,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -659,6 +638,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -696,6 +676,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -733,6 +714,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -769,6 +751,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -807,6 +790,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -842,6 +826,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -877,6 +862,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -912,6 +898,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -947,6 +934,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -982,6 +970,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1017,6 +1006,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1052,6 +1042,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1087,6 +1078,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1122,6 +1114,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1157,6 +1150,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1192,6 +1186,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1227,6 +1222,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1262,6 +1258,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1297,6 +1294,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1332,6 +1330,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1367,6 +1366,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1402,6 +1402,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1437,6 +1438,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1472,6 +1474,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1507,6 +1510,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1542,6 +1546,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1577,6 +1582,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1612,6 +1618,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1647,6 +1654,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1682,6 +1690,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1717,6 +1726,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1752,6 +1762,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1787,6 +1798,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1822,6 +1834,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1857,6 +1870,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1892,6 +1906,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1927,6 +1942,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1962,6 +1978,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1997,6 +2014,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -2032,6 +2050,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -2067,6 +2086,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -2102,6 +2122,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -2137,6 +2158,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -2172,6 +2194,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -2207,6 +2230,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -2242,6 +2266,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -2277,6 +2302,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -2312,6 +2338,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -2347,6 +2374,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -2382,6 +2410,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -2417,6 +2446,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -2462,9 +2492,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -2485,6 +2538,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -2530,9 +2584,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -2553,6 +2630,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -2598,9 +2676,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -2621,6 +2722,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -2666,9 +2768,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -2689,6 +2814,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -2734,9 +2860,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -2757,6 +2906,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -2802,9 +2952,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -2825,6 +2998,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -2870,9 +3044,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -2893,6 +3090,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -2938,9 +3136,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -2961,6 +3182,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -3006,9 +3228,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -3029,6 +3274,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -3060,7 +3306,20 @@ realclean.old: 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_scope.h \ - be_include/be_visitor.h be_include/be_visitor_decl.h be_include/be.h \ + be_include/be_visitor.h be_include/be_visitor_decl.h \ + be_include/be_visitor_interface/interface.h \ + be_include/be_visitor_interface/interface_ch.h \ + be_include/be_visitor_interface/interface_ci.h \ + be_include/be_visitor_interface/interface_cs.h \ + be_include/be_visitor_interface/interface_sh.h \ + be_include/be_visitor_interface/interface_si.h \ + be_include/be_visitor_interface/interface_ss.h \ + be_include/be_visitor_interface/collocated_sh.h \ + be_include/be_visitor_interface/collocated_ss.h \ + be_include/be_visitor_interface/any_op_ch.h \ + be_include/be_visitor_interface/any_op_cs.h \ + be_include/be_visitor_interface/tie_sh.h \ + be_include/be_visitor_interface/tie_si.h be_include/be.h \ $(ACE_ROOT)/ace/Singleton.h \ $(ACE_ROOT)/ace/Synch.h \ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ @@ -3075,9 +3334,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -3097,6 +3379,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -3142,9 +3425,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -3165,6 +3471,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -3210,9 +3517,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -3233,6 +3563,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -3278,9 +3609,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -3301,6 +3655,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -3346,9 +3701,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -3369,6 +3747,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -3414,9 +3793,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -3437,6 +3839,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -3482,9 +3885,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -3505,6 +3931,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -3550,9 +3977,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -3568,12 +4018,21 @@ realclean.old: be_include/be_helper.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_sequence.h \ - be_include/be_visitor_decl.h + be_include/be_visitor_decl.h \ + be_include/be_visitor_sequence/sequence_ch.h \ + be_include/be_visitor_sequence/sequence_ci.h \ + be_include/be_visitor_sequence/sequence_cs.h \ + be_include/be_visitor_sequence/sequence_base.h \ + be_include/be_visitor_sequence/buffer_type.h \ + be_include/be_visitor_sequence/elemtype.h \ + be_include/be_visitor_sequence/any_op_ch.h \ + be_include/be_visitor_sequence/any_op_cs.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 \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -3619,9 +4078,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -3642,6 +4124,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -3687,9 +4170,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -3710,6 +4216,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -3755,9 +4262,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -3778,6 +4308,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -3823,9 +4354,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -3846,6 +4400,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -3891,9 +4446,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -3914,6 +4492,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -3959,9 +4538,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -3982,6 +4584,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -4027,9 +4630,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -4050,6 +4676,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -4095,9 +4722,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -4118,6 +4768,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -4163,9 +4814,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -4186,6 +4860,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -4231,9 +4906,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -4254,6 +4952,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -4299,9 +4998,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -4322,6 +5044,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -4367,9 +5090,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -4390,6 +5136,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -4435,9 +5182,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -4458,6 +5228,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -4503,9 +5274,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -4526,6 +5320,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -4571,9 +5366,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -4594,6 +5412,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -4639,9 +5458,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -4662,6 +5504,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -4707,9 +5550,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -4730,6 +5596,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -4772,9 +5639,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -4790,11 +5680,12 @@ realclean.old: be_include/be_helper.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 \ +.obj/be_visitor_argument.o .obj/be_visitor_argument.so .shobj/be_visitor_argument.o .shobj/be_visitor_argument.so: be/be_visitor_argument.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/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -4837,9 +5728,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -4854,13 +5768,137 @@ 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_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 + be_include/be_visitor_context.h be_include/be_visitor_argument.h \ + be_include/be_visitor_decl.h \ + be_include/be_visitor_argument/argument.h \ + be_include/be_visitor_argument/arglist.h \ + be_include/be_visitor_argument/pre_docall_cs.h \ + be_include/be_visitor_argument/docall_cs.h \ + be_include/be_visitor_argument/post_docall_cs.h \ + be_include/be_visitor_argument/vardecl_ss.h \ + be_include/be_visitor_argument/pre_upcall_ss.h \ + be_include/be_visitor_argument/upcall_ss.h \ + be_include/be_visitor_argument/post_upcall_ss.h \ + be_include/be_visitor_argument/marshal_ss.h \ + be_include/be_visitor_argument/post_marshal_ss.h \ + be/be_visitor_argument/arglist.cpp \ + be/be_visitor_argument/argument.cpp \ + be/be_visitor_argument/docall_cs.cpp \ + be/be_visitor_argument/marshal_ss.cpp \ + be/be_visitor_argument/post_docall_cs.cpp \ + be/be_visitor_argument/post_marshal_ss.cpp \ + be/be_visitor_argument/post_upcall_ss.cpp \ + be/be_visitor_argument/pre_docall_cs.cpp \ + be/be_visitor_argument/pre_upcall_ss.cpp \ + be/be_visitor_argument/upcall_ss.cpp \ + be/be_visitor_argument/vardecl_ss.cpp +.obj/be_visitor_array.o .obj/be_visitor_array.so .shobj/be_visitor_array.o .shobj/be_visitor_array.so: be/be_visitor_array.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/config-g++-common.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/ACE.i \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.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/Synch_T.cpp \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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_codegen.h \ + be_include/be_factory.h be_include/be_visitor.h \ + be_include/be_visitor_context.h be_include/be_visitor_array.h \ + be_include/be_visitor_decl.h be_include/be_visitor_array/array.h \ + be_include/be_visitor_array/array_ch.h \ + be_include/be_visitor_array/array_ci.h \ + be_include/be_visitor_array/array_cs.h \ + be_include/be_visitor_array/any_op_ch.h \ + be_include/be_visitor_array/any_op_cs.h \ + be/be_visitor_array/any_op_ch.cpp be/be_visitor_array/any_op_cs.cpp \ + be/be_visitor_array/array.cpp be/be_visitor_array/array_ch.cpp \ + be/be_visitor_array/array_ci.cpp be/be_visitor_array/array_cs.cpp .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 \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -4906,9 +5944,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -4924,12 +5985,15 @@ realclean.old: be_include/be_helper.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_attribute.h \ - be_include/be_visitor_scope.h be_include/be_visitor_decl.h + be_include/be_visitor_scope.h be_include/be_visitor_decl.h \ + be_include/be_visitor_attribute/attribute.h \ + be/be_visitor_attribute/attribute.cpp .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 \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -4975,9 +6039,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -4993,12 +6080,17 @@ realclean.old: be_include/be_helper.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 + be_include/be_visitor_scope.h be_include/be_visitor_decl.h \ + be_include/be_visitor_constant/constant_ch.h \ + be_include/be_visitor_constant/constant_cs.h \ + be/be_visitor_constant/constant_ch.cpp \ + be/be_visitor_constant/constant_cs.cpp .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 \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -5044,9 +6136,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -5067,6 +6182,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -5112,9 +6228,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -5135,6 +6274,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -5180,9 +6320,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -5198,12 +6361,19 @@ realclean.old: be_include/be_helper.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 + be_include/be_visitor_scope.h be_include/be_visitor_decl.h \ + be_include/be_visitor_enum/enum_ch.h \ + be_include/be_visitor_enum/enum_cs.h \ + be_include/be_visitor_enum/any_op_ch.h \ + be_include/be_visitor_enum/any_op_cs.h \ + be/be_visitor_enum/any_op_ch.cpp be/be_visitor_enum/any_op_cs.cpp \ + be/be_visitor_enum/enum_ch.cpp be/be_visitor_enum/enum_cs.cpp .obj/be_visitor_exception.o .obj/be_visitor_exception.so .shobj/be_visitor_exception.o .shobj/be_visitor_exception.so: be/be_visitor_exception.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/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -5249,9 +6419,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -5267,12 +6460,29 @@ realclean.old: be_include/be_helper.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_exception.h \ - be_include/be_visitor_scope.h be_include/be_visitor_decl.h + be_include/be_visitor_scope.h be_include/be_visitor_decl.h \ + be_include/be_visitor_exception/exception.h \ + be_include/be_visitor_exception/exception_ch.h \ + be_include/be_visitor_exception/exception_ci.h \ + be_include/be_visitor_exception/exception_cs.h \ + be_include/be_visitor_exception/ctor.h \ + be_include/be_visitor_exception/ctor_assign.h \ + be_include/be_visitor_exception/any_op_ch.h \ + be_include/be_visitor_exception/any_op_cs.h \ + be/be_visitor_exception/any_op_ch.cpp \ + be/be_visitor_exception/any_op_cs.cpp \ + be/be_visitor_exception/ctor_assign.cpp \ + be/be_visitor_exception/exception.cpp \ + be/be_visitor_exception/exception_ch.cpp \ + be/be_visitor_exception/exception_ci.cpp \ + be/be_visitor_exception/exception_cs.cpp \ + be/be_visitor_exception/exception_ctor.cpp .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 \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -5318,9 +6528,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -5336,12 +6569,17 @@ realclean.old: be_include/be_helper.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 + be_include/be_visitor_decl.h be_include/be_visitor_field/field_ch.h \ + be_include/be_visitor_field/field_ci.h \ + be_include/be_visitor_field/field_cs.h \ + be/be_visitor_field/field_ch.cpp be/be_visitor_field/field_ci.cpp \ + be/be_visitor_field/field_cs.cpp .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 \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -5387,9 +6625,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -5405,12 +6666,38 @@ realclean.old: be_include/be_helper.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.h \ - be_include/be_visitor_scope.h be_include/be_visitor_decl.h + be_include/be_visitor_scope.h be_include/be_visitor_decl.h \ + be_include/be_visitor_interface/interface.h \ + be_include/be_visitor_interface/interface_ch.h \ + be_include/be_visitor_interface/interface_ci.h \ + be_include/be_visitor_interface/interface_cs.h \ + be_include/be_visitor_interface/interface_sh.h \ + be_include/be_visitor_interface/interface_si.h \ + be_include/be_visitor_interface/interface_ss.h \ + be_include/be_visitor_interface/collocated_sh.h \ + be_include/be_visitor_interface/collocated_ss.h \ + be_include/be_visitor_interface/any_op_ch.h \ + be_include/be_visitor_interface/any_op_cs.h \ + be_include/be_visitor_interface/tie_sh.h \ + be_include/be_visitor_interface/tie_si.h \ + be/be_visitor_interface/any_op_ch.cpp \ + be/be_visitor_interface/any_op_cs.cpp \ + be/be_visitor_interface/collocated_sh.cpp \ + be/be_visitor_interface/collocated_ss.cpp \ + be/be_visitor_interface/interface.cpp \ + be/be_visitor_interface/interface_ch.cpp \ + be/be_visitor_interface/interface_ci.cpp \ + be/be_visitor_interface/interface_cs.cpp \ + be/be_visitor_interface/interface_sh.cpp \ + be/be_visitor_interface/interface_si.cpp \ + be/be_visitor_interface/interface_ss.cpp \ + be/be_visitor_interface/tie_sh.cpp be/be_visitor_interface/tie_si.cpp .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/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -5456,9 +6743,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -5474,12 +6784,17 @@ realclean.old: be_include/be_helper.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 + be_include/be_visitor_scope.h be_include/be_visitor_decl.h \ + be_include/be_visitor_interface_fwd/interface_fwd_ch.h \ + be_include/be_visitor_interface_fwd/interface_fwd_ci.h \ + be/be_visitor_interface_fwd/interface_fwd_ch.cpp \ + be/be_visitor_interface_fwd/interface_fwd_ci.cpp .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 \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -5525,9 +6840,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -5543,12 +6881,19 @@ realclean.old: be_include/be_helper.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 + be_include/be_visitor_scope.h be_include/be_visitor_decl.h \ + be_include/be_visitor_module/module.h \ + be_include/be_visitor_module/module_ch.h \ + be_include/be_visitor_module/module_sh.h \ + be_include/be_visitor_module/any_op.h be/be_visitor_module/any_op.cpp \ + be/be_visitor_module/module.cpp be/be_visitor_module/module_ch.cpp \ + be/be_visitor_module/module_sh.cpp .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/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -5594,9 +6939,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -5612,12 +6980,54 @@ realclean.old: be_include/be_helper.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 + be_include/be_visitor_scope.h be_include/be_visitor_decl.h \ + be_include/be_visitor_operation/operation_ch.h \ + be_include/be_visitor_operation/operation_cs.h \ + be_include/be_visitor_operation/operation_sh.h \ + be_include/be_visitor_operation/operation_ss.h \ + be_include/be_visitor_operation/tie_sh.h \ + be_include/be_visitor_operation/tie_si.h \ + be_include/be_visitor_operation/collocated_sh.h \ + be_include/be_visitor_operation/collocated_ss.h \ + be_include/be_visitor_operation/arglist.h \ + be_include/be_visitor_operation/rettype.h \ + be_include/be_visitor_operation/rettype_vardecl_cs.h \ + be_include/be_visitor_operation/rettype_pre_docall_cs.h \ + be_include/be_visitor_operation/rettype_docall_cs.h \ + be_include/be_visitor_operation/rettype_post_docall_cs.h \ + be_include/be_visitor_operation/rettype_return_cs.h \ + be_include/be_visitor_operation/exceptlist_cs.h \ + be_include/be_visitor_operation/argument.h \ + be_include/be_visitor_operation/rettype_vardecl_ss.h \ + be_include/be_visitor_operation/rettype_assign_ss.h \ + be_include/be_visitor_operation/rettype_post_upcall_ss.h \ + be_include/be_visitor_operation/rettype_marshal_ss.h \ + be/be_visitor_operation/arglist.cpp \ + be/be_visitor_operation/argument.cpp \ + be/be_visitor_operation/collocated_sh.cpp \ + be/be_visitor_operation/collocated_ss.cpp \ + be/be_visitor_operation/exceptlist_cs.cpp \ + be/be_visitor_operation/operation_ch.cpp \ + be/be_visitor_operation/operation_cs.cpp \ + be/be_visitor_operation/operation_sh.cpp \ + be/be_visitor_operation/operation_ss.cpp \ + be/be_visitor_operation/rettype.cpp \ + be/be_visitor_operation/rettype_assign_ss.cpp \ + be/be_visitor_operation/rettype_docall_cs.cpp \ + be/be_visitor_operation/rettype_marshal_ss.cpp \ + be/be_visitor_operation/rettype_post_docall_cs.cpp \ + be/be_visitor_operation/rettype_post_upcall_ss.cpp \ + be/be_visitor_operation/rettype_pre_docall_cs.cpp \ + be/be_visitor_operation/rettype_return_cs.cpp \ + be/be_visitor_operation/rettype_vardecl_cs.cpp \ + be/be_visitor_operation/rettype_vardecl_ss.cpp \ + be/be_visitor_operation/tie_sh.cpp be/be_visitor_operation/tie_si.cpp .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 \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -5663,9 +7073,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -5681,12 +7114,25 @@ realclean.old: be_include/be_helper.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_root.h \ - be_include/be_visitor_scope.h be_include/be_visitor_decl.h + be_include/be_visitor_scope.h be_include/be_visitor_decl.h \ + be_include/be_visitor_root/root.h \ + be_include/be_visitor_root/root_ch.h \ + be_include/be_visitor_root/root_ci.h \ + be_include/be_visitor_root/root_cs.h \ + be_include/be_visitor_root/root_sh.h \ + be_include/be_visitor_root/root_si.h \ + be_include/be_visitor_root/root_ss.h \ + be_include/be_visitor_root/any_op.h be/be_visitor_root/any_op.cpp \ + be/be_visitor_root/root.cpp be/be_visitor_root/root_ch.cpp \ + be/be_visitor_root/root_ci.cpp be/be_visitor_root/root_cs.cpp \ + be/be_visitor_root/root_sh.cpp be/be_visitor_root/root_si.cpp \ + be/be_visitor_root/root_ss.cpp .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/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -5732,9 +7178,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -5756,6 +7225,7 @@ realclean.old: $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -5801,9 +7271,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -5819,12 +7312,29 @@ realclean.old: be_include/be_helper.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_sequence.h \ - be_include/be_visitor_decl.h + be_include/be_visitor_decl.h \ + be_include/be_visitor_sequence/sequence_ch.h \ + be_include/be_visitor_sequence/sequence_ci.h \ + be_include/be_visitor_sequence/sequence_cs.h \ + be_include/be_visitor_sequence/sequence_base.h \ + be_include/be_visitor_sequence/buffer_type.h \ + be_include/be_visitor_sequence/elemtype.h \ + be_include/be_visitor_sequence/any_op_ch.h \ + be_include/be_visitor_sequence/any_op_cs.h \ + be/be_visitor_sequence/any_op_ch.cpp \ + be/be_visitor_sequence/any_op_cs.cpp \ + be/be_visitor_sequence/buffer_type.cpp \ + be/be_visitor_sequence/elemtype.cpp \ + be/be_visitor_sequence/sequence_base.cpp \ + be/be_visitor_sequence/sequence_ch.cpp \ + be/be_visitor_sequence/sequence_ci.cpp \ + be/be_visitor_sequence/sequence_cs.cpp .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/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -5870,9 +7380,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -5888,12 +7421,25 @@ realclean.old: be_include/be_helper.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 + be_include/be_visitor_scope.h be_include/be_visitor_decl.h \ + be_include/be_visitor_structure/structure.h \ + be_include/be_visitor_structure/structure_ch.h \ + be_include/be_visitor_structure/structure_ci.h \ + be_include/be_visitor_structure/structure_cs.h \ + be_include/be_visitor_structure/any_op_ch.h \ + be_include/be_visitor_structure/any_op_cs.h \ + be/be_visitor_structure/any_op_ch.cpp \ + be/be_visitor_structure/any_op_cs.cpp \ + be/be_visitor_structure/structure.cpp \ + be/be_visitor_structure/structure_ch.cpp \ + be/be_visitor_structure/structure_ci.cpp \ + be/be_visitor_structure/structure_cs.cpp .obj/be_visitor_typecode.o .obj/be_visitor_typecode.so .shobj/be_visitor_typecode.o .shobj/be_visitor_typecode.so: be/be_visitor_typecode.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/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -5939,9 +7485,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -5957,12 +7526,17 @@ realclean.old: be_include/be_helper.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_typecode.h \ - be_include/be_visitor_decl.h + be_include/be_visitor_decl.h \ + be_include/be_visitor_typecode/typecode_decl.h \ + be_include/be_visitor_typecode/typecode_defn.h \ + be/be_visitor_typecode/typecode_decl.cpp \ + be/be_visitor_typecode/typecode_defn.cpp .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/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -6008,9 +7582,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -6026,12 +7623,24 @@ realclean.old: be_include/be_helper.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 + be_include/be_visitor_scope.h be_include/be_visitor_decl.h \ + be_include/be_visitor_typedef/typedef.h \ + be_include/be_visitor_typedef/typedef_ch.h \ + be_include/be_visitor_typedef/typedef_ci.h \ + be_include/be_visitor_typedef/typedef_cs.h \ + be_include/be_visitor_typedef/any_op_ch.h \ + be_include/be_visitor_typedef/any_op_cs.h \ + be/be_visitor_typedef/any_op_ch.cpp \ + be/be_visitor_typedef/any_op_cs.cpp be/be_visitor_typedef/typedef.cpp \ + be/be_visitor_typedef/typedef_ch.cpp \ + be/be_visitor_typedef/typedef_ci.cpp \ + be/be_visitor_typedef/typedef_cs.cpp .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/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -6077,9 +7686,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -6095,12 +7727,28 @@ realclean.old: be_include/be_helper.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 + be_include/be_visitor_scope.h be_include/be_visitor_decl.h \ + be_include/be_visitor_union/union.h \ + be_include/be_visitor_union/union_ch.h \ + be_include/be_visitor_union/union_ci.h \ + be_include/be_visitor_union/union_cs.h \ + be_include/be_visitor_union/discriminant_ch.h \ + be_include/be_visitor_union/discriminant_ci.h \ + be_include/be_visitor_union/discriminant_cs.h \ + be_include/be_visitor_union/any_op_ch.h \ + be_include/be_visitor_union/any_op_cs.h \ + be/be_visitor_union/any_op_ch.cpp be/be_visitor_union/any_op_cs.cpp \ + be/be_visitor_union/discriminant_ch.cpp \ + be/be_visitor_union/discriminant_ci.cpp \ + be/be_visitor_union/discriminant_cs.cpp be/be_visitor_union/union.cpp \ + be/be_visitor_union/union_ch.cpp be/be_visitor_union/union_ci.cpp \ + be/be_visitor_union/union_cs.cpp .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/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -6146,9 +7794,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -6164,12 +7835,23 @@ realclean.old: be_include/be_helper.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 + be_include/be_visitor_decl.h \ + be_include/be_visitor_union_branch/public_ch.h \ + be_include/be_visitor_union_branch/public_ci.h \ + be_include/be_visitor_union_branch/public_cs.h \ + be_include/be_visitor_union_branch/public_assign_cs.h \ + be_include/be_visitor_union_branch/private_ch.h \ + be/be_visitor_union_branch/private_ch.cpp \ + be/be_visitor_union_branch/public_assign_cs.cpp \ + be/be_visitor_union_branch/public_ch.cpp \ + be/be_visitor_union_branch/public_ci.cpp \ + be/be_visitor_union_branch/public_cs.cpp .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 \ $(ACE_ROOT)/ace/inc_user_config.h \ $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/config-g++-common.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -6215,9 +7897,32 @@ realclean.old: $(ACE_ROOT)/ace/Thread.h \ $(ACE_ROOT)/ace/Thread.i \ $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ $(ACE_ROOT)/ace/Containers.h \ $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.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 \ @@ -6233,15 +7938,135 @@ realclean.old: be_include/be_helper.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_interpretive.h \ - be_include/be_visitor_args.h be_include/be_visitor_decl.h \ + be_include/be_visitor_argument.h be_include/be_visitor_decl.h \ + be_include/be_visitor_argument/argument.h \ + be_include/be_visitor_argument/arglist.h \ + be_include/be_visitor_argument/pre_docall_cs.h \ + be_include/be_visitor_argument/docall_cs.h \ + be_include/be_visitor_argument/post_docall_cs.h \ + be_include/be_visitor_argument/vardecl_ss.h \ + be_include/be_visitor_argument/pre_upcall_ss.h \ + be_include/be_visitor_argument/upcall_ss.h \ + be_include/be_visitor_argument/post_upcall_ss.h \ + be_include/be_visitor_argument/marshal_ss.h \ + be_include/be_visitor_argument/post_marshal_ss.h \ + be_include/be_visitor_array.h be_include/be_visitor_array/array.h \ + be_include/be_visitor_array/array_ch.h \ + be_include/be_visitor_array/array_ci.h \ + be_include/be_visitor_array/array_cs.h \ + be_include/be_visitor_array/any_op_ch.h \ + be_include/be_visitor_array/any_op_cs.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_exception.h be_include/be_visitor_field.h \ + be_include/be_visitor_attribute/attribute.h \ + be_include/be_visitor_constant.h \ + be_include/be_visitor_constant/constant_ch.h \ + be_include/be_visitor_constant/constant_cs.h \ + be_include/be_visitor_enum.h be_include/be_visitor_enum/enum_ch.h \ + be_include/be_visitor_enum/enum_cs.h \ + be_include/be_visitor_enum/any_op_ch.h \ + be_include/be_visitor_enum/any_op_cs.h \ + be_include/be_visitor_exception.h \ + be_include/be_visitor_exception/exception.h \ + be_include/be_visitor_exception/exception_ch.h \ + be_include/be_visitor_exception/exception_ci.h \ + be_include/be_visitor_exception/exception_cs.h \ + be_include/be_visitor_exception/ctor.h \ + be_include/be_visitor_exception/ctor_assign.h \ + be_include/be_visitor_exception/any_op_ch.h \ + be_include/be_visitor_exception/any_op_cs.h \ + be_include/be_visitor_field.h be_include/be_visitor_field/field_ch.h \ + be_include/be_visitor_field/field_ci.h \ + be_include/be_visitor_field/field_cs.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_typecode.h be_include/be_visitor_typedef.h \ - be_include/be_visitor_union.h be_include/be_visitor_union_branch.h + be_include/be_visitor_interface/interface.h \ + be_include/be_visitor_interface/interface_ch.h \ + be_include/be_visitor_interface/interface_ci.h \ + be_include/be_visitor_interface/interface_cs.h \ + be_include/be_visitor_interface/interface_sh.h \ + be_include/be_visitor_interface/interface_si.h \ + be_include/be_visitor_interface/interface_ss.h \ + be_include/be_visitor_interface/collocated_sh.h \ + be_include/be_visitor_interface/collocated_ss.h \ + be_include/be_visitor_interface/any_op_ch.h \ + be_include/be_visitor_interface/any_op_cs.h \ + be_include/be_visitor_interface/tie_sh.h \ + be_include/be_visitor_interface/tie_si.h \ + be_include/be_visitor_interface_fwd.h \ + be_include/be_visitor_interface_fwd/interface_fwd_ch.h \ + be_include/be_visitor_interface_fwd/interface_fwd_ci.h \ + be_include/be_visitor_module.h be_include/be_visitor_module/module.h \ + be_include/be_visitor_module/module_ch.h \ + be_include/be_visitor_module/module_sh.h \ + be_include/be_visitor_module/any_op.h \ + be_include/be_visitor_operation.h \ + be_include/be_visitor_operation/operation_ch.h \ + be_include/be_visitor_operation/operation_cs.h \ + be_include/be_visitor_operation/operation_sh.h \ + be_include/be_visitor_operation/operation_ss.h \ + be_include/be_visitor_operation/tie_sh.h \ + be_include/be_visitor_operation/tie_si.h \ + be_include/be_visitor_operation/collocated_sh.h \ + be_include/be_visitor_operation/collocated_ss.h \ + be_include/be_visitor_operation/arglist.h \ + be_include/be_visitor_operation/rettype.h \ + be_include/be_visitor_operation/rettype_vardecl_cs.h \ + be_include/be_visitor_operation/rettype_pre_docall_cs.h \ + be_include/be_visitor_operation/rettype_docall_cs.h \ + be_include/be_visitor_operation/rettype_post_docall_cs.h \ + be_include/be_visitor_operation/rettype_return_cs.h \ + be_include/be_visitor_operation/exceptlist_cs.h \ + be_include/be_visitor_operation/argument.h \ + be_include/be_visitor_operation/rettype_vardecl_ss.h \ + be_include/be_visitor_operation/rettype_assign_ss.h \ + be_include/be_visitor_operation/rettype_post_upcall_ss.h \ + be_include/be_visitor_operation/rettype_marshal_ss.h \ + be_include/be_visitor_root.h be_include/be_visitor_root/root.h \ + be_include/be_visitor_root/root_ch.h \ + be_include/be_visitor_root/root_ci.h \ + be_include/be_visitor_root/root_cs.h \ + be_include/be_visitor_root/root_sh.h \ + be_include/be_visitor_root/root_si.h \ + be_include/be_visitor_root/root_ss.h \ + be_include/be_visitor_root/any_op.h be_include/be_visitor_sequence.h \ + be_include/be_visitor_sequence/sequence_ch.h \ + be_include/be_visitor_sequence/sequence_ci.h \ + be_include/be_visitor_sequence/sequence_cs.h \ + be_include/be_visitor_sequence/sequence_base.h \ + be_include/be_visitor_sequence/buffer_type.h \ + be_include/be_visitor_sequence/elemtype.h \ + be_include/be_visitor_sequence/any_op_ch.h \ + be_include/be_visitor_sequence/any_op_cs.h \ + be_include/be_visitor_structure.h \ + be_include/be_visitor_structure/structure.h \ + be_include/be_visitor_structure/structure_ch.h \ + be_include/be_visitor_structure/structure_ci.h \ + be_include/be_visitor_structure/structure_cs.h \ + be_include/be_visitor_structure/any_op_ch.h \ + be_include/be_visitor_structure/any_op_cs.h \ + be_include/be_visitor_typecode.h \ + be_include/be_visitor_typecode/typecode_decl.h \ + be_include/be_visitor_typecode/typecode_defn.h \ + be_include/be_visitor_typedef.h \ + be_include/be_visitor_typedef/typedef.h \ + be_include/be_visitor_typedef/typedef_ch.h \ + be_include/be_visitor_typedef/typedef_ci.h \ + be_include/be_visitor_typedef/typedef_cs.h \ + be_include/be_visitor_typedef/any_op_ch.h \ + be_include/be_visitor_typedef/any_op_cs.h \ + be_include/be_visitor_union.h be_include/be_visitor_union/union.h \ + be_include/be_visitor_union/union_ch.h \ + be_include/be_visitor_union/union_ci.h \ + be_include/be_visitor_union/union_cs.h \ + be_include/be_visitor_union/discriminant_ch.h \ + be_include/be_visitor_union/discriminant_ci.h \ + be_include/be_visitor_union/discriminant_cs.h \ + be_include/be_visitor_union/any_op_ch.h \ + be_include/be_visitor_union/any_op_cs.h \ + be_include/be_visitor_union_branch.h \ + be_include/be_visitor_union_branch/public_ch.h \ + be_include/be_visitor_union_branch/public_ci.h \ + be_include/be_visitor_union_branch/public_cs.h \ + be_include/be_visitor_union_branch/public_assign_cs.h \ + be_include/be_visitor_union_branch/private_ch.h # IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/TAO_IDL/be/be_interpretive.cpp b/TAO/TAO_IDL/be/be_interpretive.cpp index 4cfa72d80b5..f592f2128b5 100644 --- a/TAO/TAO_IDL/be/be_interpretive.cpp +++ b/TAO/TAO_IDL/be/be_interpretive.cpp @@ -25,7 +25,7 @@ // individual visitors included only here #include "be_interpretive.h" -#include "be_visitor_args.h" +#include "be_visitor_argument.h" #include "be_visitor_array.h" #include "be_visitor_attribute.h" #include "be_visitor_constant.h" diff --git a/TAO/TAO_IDL/be/be_visitor_args.cpp b/TAO/TAO_IDL/be/be_visitor_args.cpp deleted file mode 100644 index 55abdb3057e..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_args.cpp +++ /dev/null @@ -1,2805 +0,0 @@ -// -// $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::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; -} - -// 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; -} - -// helper that returns the direction type of the argument -AST_Argument::Direction -be_visitor_args::direction (void) -{ - // 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 (); -} - -// ************************************************************ -// 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) -{ -} - -be_visitor_args_arglist::~be_visitor_args_arglist (void) -{ -} - -int be_visitor_args_arglist::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_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 - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_arglist::" - "visit_argument - " - "cannot accept visitor\n"), - -1); - } - - *os << " " << node->local_name () << ",\n"; - return 0; -} - -int be_visitor_args_arglist::visit_array (be_array *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output 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_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; -} - -int be_visitor_args_arglist::visit_interface_fwd (be_interface_fwd *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; -} - -int be_visitor_args_arglist::visit_native (be_native *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) << " &"; - break; - } - return 0; -} - -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->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; - } // 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: - *os << this->type_name (node, "_ptr"); - break; - case AST_Argument::dir_INOUT: - *os << this->type_name (node, "_ptr") << " &"; - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; - } // end switch direction - } // end else if - else // simple predefined types - { - 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; - } // end switch direction - } // end of else - - return 0; -} - -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 *) -{ - 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_arglist::visit_structure (be_structure *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_union (be_union *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_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_arglist::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -// ************************************************************************* -// 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::void_return_type (void) -{ - // is the operation return type void? - be_argument *arg = this->ctx_->be_node_as_argument (); - ACE_ASSERT (arg != 0); - be_operation *op = be_operation::narrow_from_scope (arg->defined_in ()); - ACE_ASSERT (arg != 0); - - be_type *bt = be_type::narrow_from_decl (op->return_type ()); - if (bt->node_type () == AST_Decl::NT_pre_defined - && (be_predefined_type::narrow_from_decl (bt)->pt () - == AST_PredefinedType::PT_void)) - return 1; - else - return 0; -} - -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"; - if (!this->void_return_type ()) - { - *os << "ACE_NEW_RETURN (_tao_base_" << arg->local_name () - << ", " << bt->name () << "_slice, _tao_retval);\n"; - } - else - { - *os << "ACE_NEW (_tao_base_" << arg->local_name () - << ", " << bt->name () << "_slice);\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_static_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; - if (!this->void_return_type ()) - { - *os << "ACE_NEW_RETURN (_tao_base_" << arg->local_name () - << ", CORBA::Any, _tao_retval);\n"; - } - else - { - *os << "ACE_NEW (_tao_base_" << arg->local_name () - << ", CORBA::Any);\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; - if (!this->void_return_type ()) - { - *os << "ACE_NEW_RETURN (_tao_base_" << arg->local_name () - << ", " << bt->name () << ", _tao_retval);\n"; - } - else - { - *os << "ACE_NEW (_tao_base_" << arg->local_name () - << ", " << bt->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; - if (!this->void_return_type ()) - { - *os << "ACE_NEW_RETURN (_tao_base_" << arg->local_name () - << ", " << bt->name () << ", _tao_retval);\n"; - } - else - { - *os << "ACE_NEW (_tao_base_" << arg->local_name () - << ", " << bt->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; - if (!this->void_return_type ()) - { - *os << "ACE_NEW_RETURN (_tao_base_" << arg->local_name () - << ", " << bt->name () << ", _tao_retval);\n"; - } - else - { - *os << "ACE_NEW (_tao_base_" << arg->local_name () - << ", " << bt->name () << ");\n"; - } - break; - default: - break; - } - } - return 0; -} - -int -be_visitor_args_pre_docall_cs::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_pre_docall_cs::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -// **************************************************************************** -// visitor for argument passing to do_static_call. The do_static_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_static_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_static_call. This is done in the "pre_do_static_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); - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_docall_cs::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -// ************************************************************************* -// 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); - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_post_docall_cs::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -// ************************************************************************ -// 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 () << "_var _tao_var_" - << arg->local_name () << ";" << be_nl; - *os << bt->name () << " *&_tao_ptr_" << arg->local_name () - << " = _tao_var_" << arg->local_name () << ".out ();" << 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 () << "_var " << arg->local_name () << ";" << be_nl; - *os << "CORBA::Object_var _tao_base_var_" << arg->local_name () - << ";" << be_nl; - *os << "CORBA::Object_ptr &_tao_base_ptr_" << arg->local_name () - << " = _tao_base_var_" << arg->local_name () << ".out ();\n"; - break; - case AST_Argument::dir_OUT: - os->indent (); - *os << bt->name () << "_var _tao_var_" - << arg->local_name () << ";" << be_nl; - *os << "CORBA::Object_ptr _tao_base_ptr_" - << arg->local_name () << ";" << be_nl; - *os << bt->name () << "_out " << arg->local_name () - << " (_tao_var_" << arg->local_name () << ".out ());\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 () << "_var " << arg->local_name () << ";" << be_nl; - *os << "CORBA::Object_var _tao_base_var_" << arg->local_name () - << ";" << be_nl; - *os << "CORBA::Object_ptr &_tao_base_ptr_" << arg->local_name () - << " = _tao_base_var_" << arg->local_name () << ".out ();\n"; - break; - case AST_Argument::dir_OUT: - os->indent (); - *os << bt->name () << "_var _tao_var_" - << arg->local_name () << ";" << be_nl; - *os << "CORBA::Object_ptr _tao_base_ptr_" - << arg->local_name () << ";" << be_nl; - *os << bt->name () << "_out " << arg->local_name () - << " (_tao_var_" << arg->local_name () << ".out ());\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 () << "_var _tao_var_" - << arg->local_name () << ";" << be_nl; - *os << bt->name () << "_ptr &_tao_ptr_" << arg->local_name () - << " = _tao_var_" << arg->local_name () << ".out ();" << 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 () << "_var " << arg->local_name () - << ";" << be_nl; - *os << bt->name () << "_ptr &_tao_ptr_" << arg->local_name () - << " = " << arg->local_name () << ".out ();\n"; - break; - case AST_Argument::dir_OUT: - os->indent (); - *os << bt->name () << "_var _tao_var_" - << arg->local_name () << ";" << be_nl; - *os << bt->name () << "_ptr _tao_ptr_" << arg->local_name () - << ";" << be_nl; - *os << bt->name () << "_out " << arg->local_name () - << " (_tao_var_" << arg->local_name () << ".out ());" << be_nl; - 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 () << "_var _tao_var_" - << arg->local_name () << ";" << be_nl; - *os << bt->name () << " *&_tao_ptr_" << arg->local_name () - << " = _tao_var_" << arg->local_name () << ".out ();" << 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: - os->indent (); - *os << "CORBA::String_var _tao_var_" - << arg->local_name () << ";" << be_nl; - *os << "char *&_tao_ptr_" << arg->local_name () << " = _tao_var_" - << arg->local_name () << ".out ();" << be_nl; - *os << "CORBA::String_out " << arg->local_name () - << " (_tao_ptr_" << arg->local_name () << ");\n"; - break; - } - return 0; -} - -int be_visitor_args_vardecl_ss::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; - - 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 () << "_var _tao_var_" - << arg->local_name () << ";" << be_nl; - *os << bt->name () << " *&_tao_ptr_" << arg->local_name () - << " = _tao_var_" << arg->local_name () << ".out ();" << 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_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; - - 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 () << "_var _tao_var_" - << arg->local_name () << ";" << be_nl; - *os << bt->name () << " *&_tao_ptr_" << arg->local_name () - << " = _tao_var_" << arg->local_name () << ".out ();" << 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); - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_vardecl_ss::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -// ************************************************************************ -// 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: - os->indent (); - *os << arg->local_name (); - break; - case AST_Argument::dir_OUT: - os->indent (); - *os << "_tao_var_" << arg->local_name () << ".ptr ()"; - break; - } - return 0; -} - -int be_visitor_args_marshal_ss::visit_enum (be_enum *) -{ - 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: - 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: - case AST_Argument::dir_OUT: - os->indent (); - *os << "&_tao_base_ptr_" << arg->local_name (); - break; - } - return 0; -} - -int be_visitor_args_marshal_ss::visit_interface_fwd (be_interface_fwd *) -{ - 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: - case AST_Argument::dir_OUT: - os->indent (); - *os << "&_tao_base_ptr_" << arg->local_name (); - break; - } - return 0; -} - -int be_visitor_args_marshal_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 - - // 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: - 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: - 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: - 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); - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_marshal_ss::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -// ************************************************************************ -// 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_var_" << arg->local_name () - << ".in (), _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_var_" << arg->local_name () - << ".in (), _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 ()) - { - 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: - break; - } - return 0; -} - -int be_visitor_args_pre_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_pre_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_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); - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_pre_upcall_ss::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -// ************************************************************************ -// 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 - - // retrieve the type - be_type *bt = be_type::narrow_from_decl (node->field_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_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_upcall_ss::" - "visit_argument - " - "cannot accept visitor\n"), - -1); - } - - return 0; -} - -int be_visitor_args_upcall_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 - - os->indent (); - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name (); - break; - } - return 0; -} - -int be_visitor_args_upcall_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 - - os->indent (); - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name (); - break; - } - return 0; -} - -int be_visitor_args_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 - os->indent (); - switch (this->direction ()) - { - case AST_Argument::dir_IN: - if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); - else - *os << arg->local_name () << ".in ()"; - break; - case AST_Argument::dir_INOUT: - if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); - else - *os << arg->local_name () << ".inout ()"; - break; - case AST_Argument::dir_OUT: - *os << arg->local_name (); - break; - } - return 0; -} - -int be_visitor_args_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 - os->indent (); - switch (this->direction ()) - { - case AST_Argument::dir_IN: - if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); - else - *os << arg->local_name () << ".in ()"; - break; - case AST_Argument::dir_INOUT: - if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); - else - *os << arg->local_name () << ".inout ()"; - break; - case AST_Argument::dir_OUT: - *os << arg->local_name (); - break; - } - return 0; -} - -int be_visitor_args_upcall_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 - - 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: - case AST_Argument::dir_OUT: - *os << 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: - if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); - else - *os << arg->local_name () << ".in ()"; - break; - case AST_Argument::dir_INOUT: - if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); - else - *os << arg->local_name () << ".inout ()"; - break; - case AST_Argument::dir_OUT: - *os << 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 << arg->local_name (); - break; - } // end switch direction - } // end of else - - return 0; -} - -int be_visitor_args_upcall_ss::visit_sequence (be_sequence *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the 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 << arg->local_name (); - break; - } - return 0; -} - -int be_visitor_args_upcall_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 - - os->indent (); - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name (); - break; - } - return 0; -} - -int be_visitor_args_upcall_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 - - os->indent (); - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name (); - break; - } - return 0; -} - -int be_visitor_args_upcall_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 - - os->indent (); - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name (); - break; - } - return 0; -} - -int be_visitor_args_upcall_ss::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_upcall_ss::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - 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) -{ - 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_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: - break; - case AST_Argument::dir_INOUT: // inout - os->indent (); - *os << "_tao_base_ptr_" << arg->local_name () - << " = " << arg->local_name () << ".in ();\n"; - break; - case AST_Argument::dir_OUT: - os->indent (); - *os << "_tao_base_ptr_" << arg->local_name () << " = _tao_var_" - << arg->local_name () << ".in ();\n"; - 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 - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: // inout - os->indent (); - *os << "_tao_base_ptr_" << arg->local_name () << " = " - << arg->local_name () << ".in ();\n"; - break; - case AST_Argument::dir_OUT: - os->indent (); - *os << "_tao_base_ptr_" << arg->local_name () << " = _tao_var_" - << arg->local_name () << ".in ();\n"; - 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); - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_post_upcall_ss::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -// ************************************************************************ -// visitor for doing any post-processing after the marshaling is done -// ************************************************************************ - -be_visitor_args_post_marshal_ss::be_visitor_args_post_marshal_ss (be_visitor_context *ctx) - : be_visitor_args (ctx) -{ -} - -be_visitor_args_post_marshal_ss::~be_visitor_args_post_marshal_ss (void) -{ -} - -int be_visitor_args_post_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_post_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_post_marshal_ss::" - "visit_argument - " - "cannot accept visitor\n"), - -1); - } - - return 0; -} - -int be_visitor_args_post_marshal_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_marshal_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_post_marshal_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 - case AST_Argument::dir_OUT: - break; - } - return 0; -} - -int be_visitor_args_post_marshal_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 - case AST_Argument::dir_OUT: - break; - } - return 0; -} - -int be_visitor_args_post_marshal_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_marshal_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_marshal_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_marshal_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_marshal_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_marshal_ss::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_post_marshal_ss::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp new file mode 100644 index 00000000000..6e4b7d94f2c --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp @@ -0,0 +1,311 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// arglist.cpp +// +// = DESCRIPTION +// Visitor that generates the parameters in an Operation signature +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "be.h" +#include "be_visitor_argument.h" + +// ************************************************************ +// 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) +{ +} + +be_visitor_args_arglist::~be_visitor_args_arglist (void) +{ +} + +int be_visitor_args_arglist::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_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 + + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_arglist::" + "visit_argument - " + "cannot accept visitor\n"), + -1); + } + + *os << " " << node->local_name () << ",\n"; + return 0; +} + +int be_visitor_args_arglist::visit_array (be_array *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output 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_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; +} + +int be_visitor_args_arglist::visit_interface_fwd (be_interface_fwd *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; +} + +int be_visitor_args_arglist::visit_native (be_native *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) << " &"; + break; + } + return 0; +} + +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->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; + } // 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: + *os << this->type_name (node, "_ptr"); + break; + case AST_Argument::dir_INOUT: + *os << this->type_name (node, "_ptr") << " &"; + break; + case AST_Argument::dir_OUT: + *os << this->type_name (node, "_out"); + break; + } // end switch direction + } // end else if + else // simple predefined types + { + 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; + } // end switch direction + } // end of else + + return 0; +} + +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 *) +{ + 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_arglist::visit_structure (be_structure *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_union (be_union *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_typedef (be_typedef *node) +{ + this->ctx_->alias (node); + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_arglist::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_argument/argument.cpp b/TAO/TAO_IDL/be/be_visitor_argument/argument.cpp new file mode 100644 index 00000000000..319f739469a --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_argument/argument.cpp @@ -0,0 +1,83 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// argument.cpp +// +// = DESCRIPTION +// generic visitor for Argument node +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "be.h" +#include "be_visitor_argument.h" + +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; +} + +// 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; +} + +// helper that returns the direction type of the argument +AST_Argument::Direction +be_visitor_args::direction (void) +{ + // 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 (); +} diff --git a/TAO/TAO_IDL/be/be_visitor_argument/docall_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/docall_cs.cpp new file mode 100644 index 00000000000..ef5d0b8b70c --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_argument/docall_cs.cpp @@ -0,0 +1,305 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// docall_cs.cpp +// +// = DESCRIPTION +// Visitor generating the code that passes arguments to the do_static_call +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "be.h" +#include "be_visitor_argument.h" + +// **************************************************************************** +// visitor for argument passing to do_static_call. The do_static_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_static_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_static_call. This is done in the "pre_do_static_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); + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_docall_cs::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_argument/marshal_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/marshal_ss.cpp new file mode 100644 index 00000000000..3aa07cd6329 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_argument/marshal_ss.cpp @@ -0,0 +1,295 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// marshal_ss.cpp +// +// = DESCRIPTION +// Visitor that generates code that passes the argument variable to the +// marshal operations. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "be.h" +#include "be_visitor_argument.h" + +// ************************************************************************ +// 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: + os->indent (); + *os << arg->local_name (); + break; + case AST_Argument::dir_OUT: + os->indent (); + *os << "_tao_var_" << arg->local_name () << ".ptr ()"; + break; + } + return 0; +} + +int be_visitor_args_marshal_ss::visit_enum (be_enum *) +{ + 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: + 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: + case AST_Argument::dir_OUT: + os->indent (); + *os << "&_tao_base_ptr_" << arg->local_name (); + break; + } + return 0; +} + +int be_visitor_args_marshal_ss::visit_interface_fwd (be_interface_fwd *) +{ + 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: + case AST_Argument::dir_OUT: + os->indent (); + *os << "&_tao_base_ptr_" << arg->local_name (); + break; + } + return 0; +} + +int be_visitor_args_marshal_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 + + // 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: + 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: + 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: + 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); + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_marshal_ss::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_argument/post_docall_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/post_docall_cs.cpp new file mode 100644 index 00000000000..554cfafa9b6 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_argument/post_docall_cs.cpp @@ -0,0 +1,140 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// post_docall_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for post-processing of arguments following a +// do_static_call +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "be.h" +#include "be_visitor_argument.h" + +// ************************************************************************* +// 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); + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_post_docall_cs::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_argument/post_marshal_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/post_marshal_ss.cpp new file mode 100644 index 00000000000..939baacd4b2 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_argument/post_marshal_ss.cpp @@ -0,0 +1,256 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// post_marshal_ss.cpp +// +// = DESCRIPTION +// Visitor generating code that does post-processing of arguments following +// any marshaling. This involves any cleanup. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "be.h" +#include "be_visitor_argument.h" + +// ************************************************************************ +// visitor for doing any post-processing after the marshaling is done +// ************************************************************************ + +be_visitor_args_post_marshal_ss::be_visitor_args_post_marshal_ss (be_visitor_context *ctx) + : be_visitor_args (ctx) +{ +} + +be_visitor_args_post_marshal_ss::~be_visitor_args_post_marshal_ss (void) +{ +} + +int be_visitor_args_post_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_post_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_post_marshal_ss::" + "visit_argument - " + "cannot accept visitor\n"), + -1); + } + + return 0; +} + +int be_visitor_args_post_marshal_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_marshal_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_post_marshal_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 + case AST_Argument::dir_OUT: + break; + } + return 0; +} + +int be_visitor_args_post_marshal_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 + case AST_Argument::dir_OUT: + break; + } + return 0; +} + +int be_visitor_args_post_marshal_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_marshal_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_marshal_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_marshal_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_marshal_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_marshal_ss::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_post_marshal_ss::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_argument/post_upcall_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/post_upcall_ss.cpp new file mode 100644 index 00000000000..4c520ca6c60 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_argument/post_upcall_ss.cpp @@ -0,0 +1,270 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// post_upcall_ss.cpp +// +// = DESCRIPTION +// Visitor generating code to do post-processing of arguments following an +// upcall. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "be.h" +#include "be_visitor_argument.h" + +// ************************************************************************ +// 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) +{ + 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_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: + break; + case AST_Argument::dir_INOUT: // inout + os->indent (); + *os << "_tao_base_ptr_" << arg->local_name () + << " = " << arg->local_name () << ".in ();\n"; + break; + case AST_Argument::dir_OUT: + os->indent (); + *os << "_tao_base_ptr_" << arg->local_name () << " = _tao_var_" + << arg->local_name () << ".in ();\n"; + 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 + be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument + // node + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: // inout + os->indent (); + *os << "_tao_base_ptr_" << arg->local_name () << " = " + << arg->local_name () << ".in ();\n"; + break; + case AST_Argument::dir_OUT: + os->indent (); + *os << "_tao_base_ptr_" << arg->local_name () << " = _tao_var_" + << arg->local_name () << ".in ();\n"; + 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); + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_post_upcall_ss::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_argument/pre_docall_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/pre_docall_cs.cpp new file mode 100644 index 00000000000..098bd5ae403 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_argument/pre_docall_cs.cpp @@ -0,0 +1,389 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// pre_docall_cs.cpp +// +// = DESCRIPTION +// Visitor that generates code (if any) for pre-processing prior to call to +// do_static_call in the client stub +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "be.h" +#include "be_visitor_argument.h" + +// ************************************************************************* +// 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::void_return_type (void) +{ + // is the operation return type void? + be_argument *arg = this->ctx_->be_node_as_argument (); + ACE_ASSERT (arg != 0); + be_operation *op = be_operation::narrow_from_scope (arg->defined_in ()); + ACE_ASSERT (arg != 0); + + be_type *bt = be_type::narrow_from_decl (op->return_type ()); + if (bt->node_type () == AST_Decl::NT_pre_defined + && (be_predefined_type::narrow_from_decl (bt)->pt () + == AST_PredefinedType::PT_void)) + return 1; + else + return 0; +} + +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 ();" << be_nl; + if (!this->void_return_type ()) + { + *os << "ACE_ALLOCATOR_RETURN (_tao_base_" << arg->local_name () + << ", " << bt->name () << "_alloc (), _tao_retval);\n"; + } + else + { + *os << "ACE_ALLOCATOR (_tao_base_" << arg->local_name () + << ", " << bt->name () << "_alloc ());\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_static_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; + if (!this->void_return_type ()) + { + *os << "ACE_NEW_RETURN (_tao_base_" << arg->local_name () + << ", CORBA::Any, _tao_retval);\n"; + } + else + { + *os << "ACE_NEW (_tao_base_" << arg->local_name () + << ", CORBA::Any);\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; + if (!this->void_return_type ()) + { + *os << "ACE_NEW_RETURN (_tao_base_" << arg->local_name () + << ", " << bt->name () << ", _tao_retval);\n"; + } + else + { + *os << "ACE_NEW (_tao_base_" << arg->local_name () + << ", " << bt->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; + if (!this->void_return_type ()) + { + *os << "ACE_NEW_RETURN (_tao_base_" << arg->local_name () + << ", " << bt->name () << ", _tao_retval);\n"; + } + else + { + *os << "ACE_NEW (_tao_base_" << arg->local_name () + << ", " << bt->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; + if (!this->void_return_type ()) + { + *os << "ACE_NEW_RETURN (_tao_base_" << arg->local_name () + << ", " << bt->name () << ", _tao_retval);\n"; + } + else + { + *os << "ACE_NEW (_tao_base_" << arg->local_name () + << ", " << bt->name () << ");\n"; + } + break; + default: + break; + } + } + return 0; +} + +int +be_visitor_args_pre_docall_cs::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_pre_docall_cs::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_argument/pre_upcall_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/pre_upcall_ss.cpp new file mode 100644 index 00000000000..ddd0e822105 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_argument/pre_upcall_ss.cpp @@ -0,0 +1,266 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// pre_upcall_ss.cpp +// +// = DESCRIPTION +// Visitor that generates any pre-processing of arguments prior to making +// the upcall (in the skeleton). +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "be.h" +#include "be_visitor_argument.h" + +// ************************************************************************ +// 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_var_" << arg->local_name () + << ".in (), _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_var_" << arg->local_name () + << ".in (), _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 ()) + { + 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: + break; + } + return 0; +} + +int be_visitor_args_pre_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_pre_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_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); + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_pre_upcall_ss::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_argument/upcall_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/upcall_ss.cpp new file mode 100644 index 00000000000..43f27735449 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_argument/upcall_ss.cpp @@ -0,0 +1,306 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// upcall_ss.cpp +// +// = DESCRIPTION +// Visitor that generates code that passes argument variables to the +// upcall. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "be.h" +#include "be_visitor_argument.h" + +// ************************************************************************ +// 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 + + // retrieve the type + be_type *bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_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_upcall_ss::" + "visit_argument - " + "cannot accept visitor\n"), + -1); + } + + return 0; +} + +int be_visitor_args_upcall_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 + + os->indent (); + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + *os << arg->local_name (); + break; + } + return 0; +} + +int be_visitor_args_upcall_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 + + os->indent (); + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + *os << arg->local_name (); + break; + } + return 0; +} + +int be_visitor_args_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 + os->indent (); + switch (this->direction ()) + { + case AST_Argument::dir_IN: + if (this->ctx_->state () + == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) + *os << arg->local_name (); + else + *os << arg->local_name () << ".in ()"; + break; + case AST_Argument::dir_INOUT: + if (this->ctx_->state () + == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) + *os << arg->local_name (); + else + *os << arg->local_name () << ".inout ()"; + break; + case AST_Argument::dir_OUT: + *os << arg->local_name (); + break; + } + return 0; +} + +int be_visitor_args_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 + os->indent (); + switch (this->direction ()) + { + case AST_Argument::dir_IN: + if (this->ctx_->state () + == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) + *os << arg->local_name (); + else + *os << arg->local_name () << ".in ()"; + break; + case AST_Argument::dir_INOUT: + if (this->ctx_->state () + == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) + *os << arg->local_name (); + else + *os << arg->local_name () << ".inout ()"; + break; + case AST_Argument::dir_OUT: + *os << arg->local_name (); + break; + } + return 0; +} + +int be_visitor_args_upcall_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 + + 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: + case AST_Argument::dir_OUT: + *os << 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: + if (this->ctx_->state () + == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) + *os << arg->local_name (); + else + *os << arg->local_name () << ".in ()"; + break; + case AST_Argument::dir_INOUT: + if (this->ctx_->state () + == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) + *os << arg->local_name (); + else + *os << arg->local_name () << ".inout ()"; + break; + case AST_Argument::dir_OUT: + *os << 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 << arg->local_name (); + break; + } // end switch direction + } // end of else + + return 0; +} + +int be_visitor_args_upcall_ss::visit_sequence (be_sequence *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get the 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 << arg->local_name (); + break; + } + return 0; +} + +int be_visitor_args_upcall_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 + + os->indent (); + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + *os << arg->local_name (); + break; + } + return 0; +} + +int be_visitor_args_upcall_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 + + os->indent (); + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + *os << arg->local_name (); + break; + } + return 0; +} + +int be_visitor_args_upcall_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 + + os->indent (); + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + *os << arg->local_name (); + break; + } + return 0; +} + +int be_visitor_args_upcall_ss::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_upcall_ss::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_argument/vardecl_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/vardecl_ss.cpp new file mode 100644 index 00000000000..caa464a531f --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_argument/vardecl_ss.cpp @@ -0,0 +1,422 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// vardecl_ss.cpp +// +// = DESCRIPTION +// Visitor that generates the variable declaration in the skeleton +// corresponding to the Argument node +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "be.h" +#include "be_visitor_argument.h" + +// ************************************************************************ +// 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 () << "_var _tao_hivar_" + << arg->local_name () << ";" << be_nl; + *os << bt->name () << " *&_tao_ptr_" << arg->local_name () + << " = _tao_var_" << arg->local_name () << ".out ();" << 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 () << "_var " << arg->local_name () << ";" << be_nl; + *os << "CORBA::Object_var _tao_base_var_" << arg->local_name () + << ";" << be_nl; + *os << "CORBA::Object_ptr &_tao_base_ptr_" << arg->local_name () + << " = _tao_base_var_" << arg->local_name () << ".out ();\n"; + break; + case AST_Argument::dir_OUT: + os->indent (); + *os << bt->name () << "_var _tao_var_" + << arg->local_name () << ";" << be_nl; + *os << "CORBA::Object_ptr _tao_base_ptr_" + << arg->local_name () << ";" << be_nl; + *os << bt->name () << "_out " << arg->local_name () + << " (_tao_var_" << arg->local_name () << ".out ());\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 () << "_var " << arg->local_name () << ";" << be_nl; + *os << "CORBA::Object_var _tao_base_var_" << arg->local_name () + << ";" << be_nl; + *os << "CORBA::Object_ptr &_tao_base_ptr_" << arg->local_name () + << " = _tao_base_var_" << arg->local_name () << ".out ();\n"; + break; + case AST_Argument::dir_OUT: + os->indent (); + *os << bt->name () << "_var _tao_var_" + << arg->local_name () << ";" << be_nl; + *os << "CORBA::Object_ptr _tao_base_ptr_" + << arg->local_name () << ";" << be_nl; + *os << bt->name () << "_out " << arg->local_name () + << " (_tao_var_" << arg->local_name () << ".out ());\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 () << "_var _tao_var_" + << arg->local_name () << ";" << be_nl; + *os << bt->name () << "_ptr &_tao_ptr_" << arg->local_name () + << " = _tao_var_" << arg->local_name () << ".out ();" << 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 () << "_var " << arg->local_name () + << ";" << be_nl; + *os << bt->name () << "_ptr &_tao_ptr_" << arg->local_name () + << " = " << arg->local_name () << ".out ();\n"; + break; + case AST_Argument::dir_OUT: + os->indent (); + *os << bt->name () << "_var _tao_var_" + << arg->local_name () << ";" << be_nl; + *os << bt->name () << "_ptr _tao_ptr_" << arg->local_name () + << ";" << be_nl; + *os << bt->name () << "_out " << arg->local_name () + << " (_tao_var_" << arg->local_name () << ".out ());" << be_nl; + 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 () << "_var _tao_var_" + << arg->local_name () << ";" << be_nl; + *os << bt->name () << " *&_tao_ptr_" << arg->local_name () + << " = _tao_var_" << arg->local_name () << ".out ();" << 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: + os->indent (); + *os << "CORBA::String_var _tao_var_" + << arg->local_name () << ";" << be_nl; + *os << "char *&_tao_ptr_" << arg->local_name () << " = _tao_var_" + << arg->local_name () << ".out ();" << be_nl; + *os << "CORBA::String_out " << arg->local_name () + << " (_tao_ptr_" << arg->local_name () << ");\n"; + break; + } + return 0; +} + +int be_visitor_args_vardecl_ss::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; + + 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 () << "_var _tao_var_" + << arg->local_name () << ";" << be_nl; + *os << bt->name () << " *&_tao_ptr_" << arg->local_name () + << " = _tao_var_" << arg->local_name () << ".out ();" << 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_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; + + 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 () << "_var _tao_var_" + << arg->local_name () << ";" << be_nl; + *os << bt->name () << " *&_tao_ptr_" << arg->local_name () + << " = _tao_var_" << arg->local_name () << ".out ();" << 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); + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_vardecl_ss::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_array.cpp b/TAO/TAO_IDL/be/be_visitor_array.cpp index 0f92cd40b52..ef8594af845 100644 --- a/TAO/TAO_IDL/be/be_visitor_array.cpp +++ b/TAO/TAO_IDL/be/be_visitor_array.cpp @@ -24,514 +24,10 @@ #include "be_visitor_array.h" -// ************************************************************************ -// visitor for array declaration in client header -// ************************************************************************ - -be_visitor_array_ch::be_visitor_array_ch (be_visitor_context *ctx) - : be_visitor_decl (ctx) -{ -} - -be_visitor_array_ch::~be_visitor_array_ch (void) -{ -} - -int be_visitor_array_ch::visit_array (be_array *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_type *bt; // base type - be_decl *scope = this->ctx_->scope (); // scope in which it is used - - // nothing to do if we are imported or code is already generated - if (node->imported () || (node->cli_hdr_gen ())) - return 0; - - this->ctx_->node (node); // save the array node - - // retrieve the type - bt = be_type::narrow_from_decl (node->base_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_array_ch::" - "visit_array - " - "Bad base type\n"), - -1); - } - - // generate the ifdefined macro - os->gen_ifdef_macro (node->flatname ()); - - os->indent (); - if (this->ctx_->tdef ()) - { - // this is a typedef to an array node - *os << "typedef " << bt->nested_type_name (scope) << " " - << node->local_name (); - if (node->gen_dimensions (os) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_array_ch::" - "visit_array - " - "gen dimensions failed\n"), - -1); - } - *os << ";" << be_nl; - *os << "typedef " << bt->nested_type_name (scope) << " " - << node->local_name () << "_slice"; - if (node->gen_dimensions (os, 1) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_array_ch::" - "visit_array - " - "gen slice dimensions failed\n"), - -1); - } - *os << ";" << be_nl; - } - else - { - } - // typedef the _var, _out, and _forany types - if (node->gen_var_defn () == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_array_ch::" - "visit_argument - " - "var_defn failed\n"), - -1); - } - if (node->gen_out_defn () == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_array_ch::" - "visit_argument - " - "out_defn failed\n"), - -1); - } - if (node->gen_forany_defn () == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_array_ch::" - "visit_argument - " - "forany_defn failed\n"), - -1); - } - // the _alloc, _dup, copy, and free methods. If the node is nested, the - // methods become static - *os << "static " << node->nested_type_name (scope, "_slice") << " *" - << node->nested_type_name (scope, "_alloc") << " (void);" << be_nl; - *os << "static " << node->nested_type_name (scope, "_slice") << " *" - << node->nested_type_name (scope, "_dup") << " (const " - << node->nested_type_name (scope, "_slice") << " *_tao_slice);" << be_nl; - *os << "static void " << node->nested_type_name (scope, "_copy") << " (" - << node->nested_type_name (scope, "_slice") << " *_tao_to, const " - << node->nested_type_name (scope, "_slice") << " *_tao_from);" << be_nl; - *os << "static void " << node->nested_type_name (scope, "_free") << " (" - << node->nested_type_name (scope, "_slice") << " *_tao_slice);" << be_nl; - - // is this a typedefined array? if so, then let the typedef deal with - // generation of the typecode - if (!this->ctx_->tdef ()) - { - // by using a visitor to declare and define the TypeCode, we have the - // added advantage to conditionally not generate any code. This will be - // based on the command line options. This is still TO-DO - be_visitor_context ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL); - be_visitor *visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_array_ch::" - "visit_array - " - "TypeCode declaration failed\n" - ), -1); - } - delete visitor; - } - - // generate the endif macro - os->gen_endif (); - - node->cli_hdr_gen (1); - return 0; -} - -// ************************************************************************ -// visitor for array declaration in client inline -// ************************************************************************ - -be_visitor_array_ci::be_visitor_array_ci (be_visitor_context *ctx) - : be_visitor_decl (ctx) -{ -} - -be_visitor_array_ci::~be_visitor_array_ci (void) -{ -} - -int be_visitor_array_ci::visit_array (be_array *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_type *bt; // base type - be_decl *scope = this->ctx_->scope (); // scope in which it is used - - // nothing to do if we are imported or code is already generated - if (node->imported () || (node->cli_inline_gen ())) - return 0; - - this->ctx_->node (node); // save the array node - - // retrieve the type - bt = be_type::narrow_from_decl (node->base_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_array_ci::" - "visit_array - " - "Bad base type\n"), - -1); - } - - // alloc method - os->indent (); // start from current indentation - *os << "ACE_INLINE " << node->name () << "_slice *" << be_nl; - *os << node->name () << "_alloc (void)" << be_nl; - *os << "{" << be_idt_nl; - *os << "return new " << bt->name (); - if (node->gen_dimensions (os) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_array::" - "gen_client_inline - " - "dimensions codegen failed\n"), - -1); - } - - *os << ";" << be_uidt_nl; - *os << "}\n\n"; - - // free method - os->indent (); - *os << "ACE_INLINE void" << be_nl - << node->name () << "_free (" << node->name () - << "_slice *_tao_slice)" << be_nl; - *os << "{" << be_idt_nl; - *os << "delete [] _tao_slice;" << be_uidt_nl; - *os << "}\n\n"; - - // generate code for the _var, _out, and _forany types - if (node->gen_var_impl () == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_array_ci::" - "visit_array - " - "var_defn failed\n"), - -1); - } - if (node->gen_out_impl () == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_array_ci::" - "visit_array - " - "out_defn failed\n"), - -1); - } - if (node->gen_forany_impl () == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_array_ci::" - "visit_array - " - "forany_defn failed\n"), - -1); - } - - // is this a typedefined array? if so, then let the typedef deal with - // generation of the typecode - if (!this->ctx_->tdef ()) - { - // by using a visitor to declare and define the TypeCode, we have the - // added advantage to conditionally not generate any code. This will be - // based on the command line options. This is still TO-DO - be_visitor_context ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN); - be_visitor *visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_array_cs::" - "visit_array - " - "TypeCode definition failed\n" - ), -1); - } - delete visitor; - } - - node->cli_inline_gen (1); - return 0; -} - -// ************************************************************************ -// visitor for array declaration in client stubs -// ************************************************************************ - -be_visitor_array_cs::be_visitor_array_cs (be_visitor_context *ctx) - : be_visitor_decl (ctx) -{ -} - -be_visitor_array_cs::~be_visitor_array_cs (void) -{ -} - -int be_visitor_array_cs::visit_array (be_array *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_type *bt; // base type - be_decl *scope = this->ctx_->scope (); // scope in which it is used - unsigned long i; - - // nothing to do if we are imported or code is already generated - if (node->imported () || (node->cli_stub_gen ())) - return 0; - - this->ctx_->node (node); // save the array node - - // retrieve the type - bt = be_type::narrow_from_decl (node->base_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_array_ci::" - "visit_array - " - "Bad base type\n"), - -1); - } - - // dup method - os->indent (); - *os << node->name () << "_slice *" << be_nl - << node->name () << "_dup (const " << node->name () - << "_slice *_tao_src_array)" << be_nl; - *os << "{" << be_idt_nl; - *os << node->name () << "_slice *_tao_dup_array = " << node->name () - << "_alloc ();" << be_nl; - *os << "if (!_tao_dup_array) return (" << node->name () - << "_slice *)0;" << be_nl; - *os << node->name () << "_copy (_tao_dup_array, _tao_src_array);" << be_nl; - *os << "return _tao_dup_array;" << be_uidt_nl; - *os << "}\n\n"; - - // copy method - *os << "void " << be_nl; - *os << node->name () << "_copy (" << node->name () << "_slice * _tao_to, " - << "const " << node->name () << "_slice *_tao_from)" << be_nl; - *os << "{" << be_idt_nl; - *os << "// copy each individual elements" << be_nl; - - // generate nested loops for as many dimensions as there are - for (i = 0; i < node->n_dims (); i++) - { - // retrieve the ith dimension value - AST_Expression *expr = node->dims ()[i]; - // dimension value - if ((expr == NULL) || ((expr != NULL) && (expr->ev () == NULL))) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_array_cs::" - "visit_array - " - "bad array dimension\n"), - -1); - } - if (expr->ev ()->et == AST_Expression::EV_ulong) - { - // generate a loop for each dimension - *os << "for (CORBA::ULong i" << i << " = 0; i" << i << " < " - << expr->ev ()->u.ulval << "; i" << i << "++)" << be_idt_nl; - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_array_cs::" - "visit_array - " - "bad array dimension value\n"), - -1); - } - } - - // now generate code such that every element of the array gets assigned - // inside the innermost level of the nested loops generated above - be_array *primitive_type = 0; - if (bt->node_type () == AST_Decl::NT_typedef) - { - // base type of the array node is a typedef. We need to make sure that - // this typedef is not to another array type. If it is, then we cannot - // assign an array to another. We will have to invoke the underlying - // array type's copy method for every array dimension. - be_typedef *tdef = be_typedef::narrow_from_decl (bt); - // check if the base type of the typedef node is an Array node - primitive_type = be_array::narrow_from_decl (tdef->base_type ()); - } - if (primitive_type) - { - // the base type is not a typedef to a possibly another array type. In - // such a case, assign each element. - - *os << "// call the underlying _copy" << be_nl; - *os << bt->name () << "_copy (_tao_to"; - for (i = 0; i < node->n_dims (); i++) - { - *os << "[i" << i << "]"; - } - *os << ", "; - *os << "_tao_from"; // generate the rvalue - for (i = 0; i < node->n_dims (); i++) - { - *os << "[i" << i << "]"; - } - *os << ");"; - } - else - { - // the base type is not a typedef to a possibly another array type. In - // such a case, assign each element. - - *os << "_tao_to"; // generate the lvalue - for (i = 0; i < node->n_dims (); i++) - { - *os << "[i" << i << "]"; - } - *os << " = "; - *os << "_tao_from"; // generate the rvalue - for (i = 0; i < node->n_dims (); i++) - { - *os << "[i" << i << "]"; - } - *os << ";"; - } - for (i = 0; i < node->n_dims (); i++) - { - // decrement indentation as many times as the number of dimensions - *os << be_uidt; - } - *os << be_uidt_nl << "}\n\n"; - - node->cli_stub_gen (1); - - return 0; -} - -// *************************************************************************** -// Array visitor for generating Any operator declarations in the client header -// *************************************************************************** - -be_visitor_array_any_op_ch::be_visitor_array_any_op_ch -(be_visitor_context *ctx) - : be_visitor_decl (ctx) -{ -} - -be_visitor_array_any_op_ch::~be_visitor_array_any_op_ch (void) -{ -} - -int -be_visitor_array_any_op_ch::visit_array (be_array *node) -{ - if (node->cli_hdr_any_op_gen () || node->imported ()) - return 0; - - TAO_OutStream *os = tao_cg->client_header (); - - // generate the Any <<= and >>= operator declarations - os->indent (); - *os << "void " << idl_global->export_macro () - << " operator<<= (CORBA::Any &, const " << node->name () - << "_forany &);" << be_nl; - *os << "CORBA::Boolean " << idl_global->export_macro () - << " operator>>= (const CORBA::Any &, " - << node->name () << "_forany &);\n"; - - node->cli_hdr_any_op_gen (1); - return 0; -} - -// *************************************************************************** -// Array visitor for generating Any operator declarations in the client -// stubs file -// *************************************************************************** - -be_visitor_array_any_op_cs::be_visitor_array_any_op_cs -(be_visitor_context *ctx) - : be_visitor_decl (ctx) -{ -} - -be_visitor_array_any_op_cs::~be_visitor_array_any_op_cs (void) -{ -} - -int -be_visitor_array_any_op_cs::visit_array (be_array *node) -{ - if (node->cli_stub_any_op_gen () || node->imported ()) - return 0; - - TAO_OutStream *os = tao_cg->client_stubs (); - - // generate the Any <<= and >>= operator declarations - // Any <<= and >>= operators - os->indent (); - *os << "void operator<<= (CORBA::Any &_tao_any, const " - << node->name () << "_forany &_tao_elem)" << be_nl - << "{" << be_idt_nl - << "CORBA::Environment _tao_env;" << be_nl - << "if (_tao_elem.nocopy ()) // no copy" << be_idt_nl - << "_tao_any.replace (" << node->tc_name () << ", " - << "_tao_elem.ptr (), 1, _tao_env); // consume it" << be_uidt_nl - << "else // copy" << be_idt_nl - << "_tao_any.replace (" << node->tc_name () << ", " << node->name () - << "_dup (_tao_elem.ptr ()), 1, _tao_env);" << be_uidt_nl - << be_uidt_nl << "}" << be_nl; - - *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, " - << node->name () << "_forany &_tao_elem)" << be_nl - << "{" << be_idt_nl - << "CORBA::Environment _tao_env;" << be_nl - << "if (!_tao_any.type ()->equal (" << node->tc_name () - << ", _tao_env)) return 0; // not equal" << be_nl - << "if (_tao_any.any_owns_data ())" << be_nl - << "{" << be_idt_nl - << node->name () << "_slice *&_tao_elem_ptr = _tao_elem.out ();" << be_nl - << "_tao_elem_ptr = " << node->name () << "_alloc ();" << be_nl - << "if (!_tao_elem_ptr) return 0;" << be_nl - << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());" - << be_nl - << "if (stream.decode (" << node->tc_name () - << ", _tao_elem_ptr, 0, _tao_env)" << be_nl - << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl - << "{" << be_idt_nl - << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), " - << "_tao_elem_ptr, 1, _tao_env);" - << be_nl - << " return 1;" << be_uidt_nl - << "}" << be_nl - << "else" << be_nl // decode failed - << "{" << be_idt_nl - << node->name () << "_free (_tao_elem_ptr);" << be_nl - << "return 0;" << be_uidt_nl - << "}" << be_uidt_nl - << "}" << be_nl - << "else" << be_nl // else Any does not own the data - << "{" << be_idt_nl - << "_tao_elem = (" << node->name () << "_slice *)_tao_any.value ();" - << be_nl - << "return 1;" << be_uidt_nl - << "}" << be_uidt_nl - << "}\n\n"; - - node->cli_stub_any_op_gen (1); - return 0; -} +// include all the individual files +#include "be_visitor_array/any_op_ch.cpp" +#include "be_visitor_array/any_op_cs.cpp" +#include "be_visitor_array/array.cpp" +#include "be_visitor_array/array_ch.cpp" +#include "be_visitor_array/array_ci.cpp" +#include "be_visitor_array/array_cs.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_array/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_array/any_op_ch.cpp new file mode 100644 index 00000000000..412fe6de16e --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_array/any_op_ch.cpp @@ -0,0 +1,61 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_ch.cpp +// +// = DESCRIPTION +// Visitor for code generation of Arrays for the Any operators in the client +// header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_array.h" + +// *************************************************************************** +// Array visitor for generating Any operator declarations in the client header +// *************************************************************************** + +be_visitor_array_any_op_ch::be_visitor_array_any_op_ch +(be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_array_any_op_ch::~be_visitor_array_any_op_ch (void) +{ +} + +int +be_visitor_array_any_op_ch::visit_array (be_array *node) +{ + if (node->cli_hdr_any_op_gen () || node->imported ()) + return 0; + + TAO_OutStream *os = tao_cg->client_header (); + + // generate the Any <<= and >>= operator declarations + os->indent (); + *os << "void " << idl_global->export_macro () + << " operator<<= (CORBA::Any &, const " << node->name () + << "_forany &);" << be_nl; + *os << "CORBA::Boolean " << idl_global->export_macro () + << " operator>>= (const CORBA::Any &, " + << node->name () << "_forany &);\n"; + + node->cli_hdr_any_op_gen (1); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_array/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_array/any_op_cs.cpp new file mode 100644 index 00000000000..2a9c2fb903b --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_array/any_op_cs.cpp @@ -0,0 +1,104 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_cs.cpp +// +// = DESCRIPTION +// Visitor for code generation of Arrays for the Any operators in the client +// stubs. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_array.h" + +// *************************************************************************** +// Array visitor for generating Any operator declarations in the client +// stubs file +// *************************************************************************** + +be_visitor_array_any_op_cs::be_visitor_array_any_op_cs +(be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_array_any_op_cs::~be_visitor_array_any_op_cs (void) +{ +} + +int +be_visitor_array_any_op_cs::visit_array (be_array *node) +{ + if (node->cli_stub_any_op_gen () || node->imported ()) + return 0; + + TAO_OutStream *os = tao_cg->client_stubs (); + + // generate the Any <<= and >>= operator declarations + // Any <<= and >>= operators + os->indent (); + *os << "void operator<<= (CORBA::Any &_tao_any, const " + << node->name () << "_forany &_tao_elem)" << be_nl + << "{" << be_idt_nl + << "CORBA::Environment _tao_env;" << be_nl + << "if (_tao_elem.nocopy ()) // no copy" << be_idt_nl + << "_tao_any.replace (" << node->tc_name () << ", " + << "_tao_elem.ptr (), 1, _tao_env); // consume it" << be_uidt_nl + << "else // copy" << be_idt_nl + << "_tao_any.replace (" << node->tc_name () << ", " << node->name () + << "_dup (_tao_elem.ptr ()), 1, _tao_env);" << be_uidt_nl + << be_uidt_nl << "}" << be_nl; + + *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, " + << node->name () << "_forany &_tao_elem)" << be_nl + << "{" << be_idt_nl + << "CORBA::Environment _tao_env;" << be_nl + << "if (!_tao_any.type ()->equal (" << node->tc_name () + << ", _tao_env)) return 0; // not equal" << be_nl + << "if (_tao_any.any_owns_data ())" << be_nl + << "{" << be_idt_nl + << node->name () << "_slice *&_tao_elem_ptr = _tao_elem.out ();" << be_nl + << "_tao_elem_ptr = " << node->name () << "_alloc ();" << be_nl + << "if (!_tao_elem_ptr) return 0;" << be_nl + << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());" + << be_nl + << "if (stream.decode (" << node->tc_name () + << ", _tao_elem_ptr, 0, _tao_env)" << be_nl + << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl + << "{" << be_idt_nl + << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), " + << "_tao_elem_ptr, 1, _tao_env);" + << be_nl + << " return 1;" << be_uidt_nl + << "}" << be_nl + << "else" << be_nl // decode failed + << "{" << be_idt_nl + << node->name () << "_free (_tao_elem_ptr);" << be_nl + << "return 0;" << be_uidt_nl + << "}" << be_uidt_nl + << "}" << be_nl + << "else" << be_nl // else Any does not own the data + << "{" << be_idt_nl + << "_tao_elem = (" << node->name () << "_slice *)_tao_any.value ();" + << be_nl + << "return 1;" << be_uidt_nl + << "}" << be_uidt_nl + << "}\n\n"; + + node->cli_stub_any_op_gen (1); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_array/array.cpp b/TAO/TAO_IDL/be/be_visitor_array/array.cpp new file mode 100644 index 00000000000..c8827264b95 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_array/array.cpp @@ -0,0 +1,148 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// array.cpp +// +// = DESCRIPTION +// Generic visitor for code generation for Arrays +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_array.h" + +// ************************************************************************ +// generic visitor for array declaration +// ************************************************************************ + +be_visitor_array::be_visitor_array (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_array::~be_visitor_array (void) +{ +} + +int be_visitor_array::visit_array (be_array *node) +{ + // must be overloaded by derived visitors + return -1; +} + +int +be_visitor_array::visit_enum (be_enum *node) +{ + return this->visit_node (node); +} + +int +be_visitor_array::visit_interface (be_interface *node) +{ + 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_ARRAY_CH) + *os << bt->nested_type_name (this->ctx_->scope (), "_var"); + else + *os << bt->name () << "_var"; + return 0; +} + +int +be_visitor_array::visit_interface_fwd (be_interface_fwd *node) +{ + 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_ARRAY_CH) + *os << bt->nested_type_name (this->ctx_->scope (), "_var"); + else + *os << bt->name () << "_var"; + return 0; +} + +int +be_visitor_array::visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + if (node->pt () == AST_PredefinedType::PT_pseudo) + *os << node->name () << "_var"; + else + *os << node->name (); + return 0; +} + +int +be_visitor_array::visit_sequence (be_sequence *node) +{ + return this->visit_node (node); +} + +int +be_visitor_array::visit_string (be_string *) +{ + TAO_OutStream *os = this->ctx_->stream (); + *os << "CORBA::String_var"; + return 0; +} + +int +be_visitor_array::visit_structure (be_structure *node) +{ + return this->visit_node (node); +} + +int +be_visitor_array::visit_union (be_union *node) +{ + return this->visit_node (node); +} + +int +be_visitor_array::visit_typedef (be_typedef *node) +{ + return this->visit_node (node); +} + +// helper +int +be_visitor_array::visit_node (be_type *node) +{ + 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_ARRAY_CH) + *os << bt->nested_type_name (this->ctx_->scope ()); + else + *os << bt->name (); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp b/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp new file mode 100644 index 00000000000..5e5ab9154c4 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp @@ -0,0 +1,177 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// array_ch.cpp +// +// = DESCRIPTION +// Visitor for Array code generation in client header +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_array.h" + +// ************************************************************************ +// visitor for array declaration in client header +// ************************************************************************ + +be_visitor_array_ch::be_visitor_array_ch (be_visitor_context *ctx) + : be_visitor_array (ctx) +{ +} + +be_visitor_array_ch::~be_visitor_array_ch (void) +{ +} + +int be_visitor_array_ch::visit_array (be_array *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_type *bt; // base type + be_decl *scope = this->ctx_->scope (); // scope in which it is used + + // nothing to do if we are imported or code is already generated + if (node->imported () || (node->cli_hdr_gen ())) + return 0; + + this->ctx_->node (node); // save the array node + + // retrieve the type + bt = be_type::narrow_from_decl (node->base_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_array_ch::" + "visit_array - " + "Bad base type\n"), + -1); + } + + // generate the ifdefined macro + os->gen_ifdef_macro (node->flatname ()); + + os->indent (); + if (this->ctx_->tdef ()) + { + // this is a typedef to an array node + *os << "typedef "; + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_array_ch::" + "visit_array - " + "base type decl failed\n"), + -1); + } + *os << " " << node->local_name (); + if (node->gen_dimensions (os) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_array_ch::" + "visit_array - " + "gen dimensions failed\n"), + -1); + } + *os << ";" << be_nl; + *os << "typedef "; + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_array_ch::" + "visit_array - " + "base type decl failed\n"), + -1); + } + *os << " " << node->local_name () << "_slice"; + if (node->gen_dimensions (os, 1) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_array_ch::" + "visit_array - " + "gen slice dimensions failed\n"), + -1); + } + *os << ";" << be_nl; + } + else + { + // anonymous array case - TO-DO + } + // typedef the _var, _out, and _forany types + if (node->gen_var_defn () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_array_ch::" + "visit_argument - " + "var_defn failed\n"), + -1); + } + if (node->gen_out_defn () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_array_ch::" + "visit_argument - " + "out_defn failed\n"), + -1); + } + if (node->gen_forany_defn () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_array_ch::" + "visit_argument - " + "forany_defn failed\n"), + -1); + } + // the _alloc, _dup, copy, and free methods. If the node is nested, the + // methods become static + *os << "static " << node->nested_type_name (scope, "_slice") << " *" + << node->nested_type_name (scope, "_alloc") << " (void);" << be_nl; + *os << "static " << node->nested_type_name (scope, "_slice") << " *" + << node->nested_type_name (scope, "_dup") << " (const " + << node->nested_type_name (scope, "_slice") << " *_tao_slice);" << be_nl; + *os << "static void " << node->nested_type_name (scope, "_copy") << " (" + << node->nested_type_name (scope, "_slice") << " *_tao_to, const " + << node->nested_type_name (scope, "_slice") << " *_tao_from);" << be_nl; + *os << "static void " << node->nested_type_name (scope, "_free") << " (" + << node->nested_type_name (scope, "_slice") << " *_tao_slice);" << be_nl; + + // is this a typedefined array? if so, then let the typedef deal with + // generation of the typecode + if (!this->ctx_->tdef ()) + { + // by using a visitor to declare and define the TypeCode, we have the + // added advantage to conditionally not generate any code. This will be + // based on the command line options. This is still TO-DO + be_visitor_context ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_array_ch::" + "visit_array - " + "TypeCode declaration failed\n" + ), -1); + } + delete visitor; + } + + // generate the endif macro + os->gen_endif (); + + node->cli_hdr_gen (1); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp b/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp new file mode 100644 index 00000000000..36bd3264cd4 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp @@ -0,0 +1,148 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// array_ci.cpp +// +// = DESCRIPTION +// Visitor generating code for Arrays in the client header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_array.h" + +// ************************************************************************ +// visitor for array declaration in client inline +// ************************************************************************ + +be_visitor_array_ci::be_visitor_array_ci (be_visitor_context *ctx) + : be_visitor_array (ctx) +{ +} + +be_visitor_array_ci::~be_visitor_array_ci (void) +{ +} + +int be_visitor_array_ci::visit_array (be_array *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_type *bt; // base type + be_decl *scope = this->ctx_->scope (); // scope in which it is used + + // nothing to do if we are imported or code is already generated + if (node->imported () || (node->cli_inline_gen ())) + return 0; + + this->ctx_->node (node); // save the array node + + // retrieve the type + bt = be_type::narrow_from_decl (node->base_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_array_ci::" + "visit_array - " + "Bad base type\n"), + -1); + } + + // alloc method + os->indent (); // start from current indentation + *os << "ACE_INLINE " << node->name () << "_slice *" << be_nl; + *os << node->name () << "_alloc (void)" << be_nl; + *os << "{" << be_idt_nl; + *os << "return new "; + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_array_ci::" + "visit_array - " + "base type decl failed\n"), + -1); + } + + if (node->gen_dimensions (os) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_array::" + "gen_client_inline - " + "dimensions codegen failed\n"), + -1); + } + + *os << ";" << be_uidt_nl; + *os << "}\n\n"; + + // free method + os->indent (); + *os << "ACE_INLINE void" << be_nl + << node->name () << "_free (" << node->name () + << "_slice *_tao_slice)" << be_nl; + *os << "{" << be_idt_nl; + *os << "delete [] _tao_slice;" << be_uidt_nl; + *os << "}\n\n"; + + // generate code for the _var, _out, and _forany types + if (node->gen_var_impl () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_array_ci::" + "visit_array - " + "var_defn failed\n"), + -1); + } + if (node->gen_out_impl () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_array_ci::" + "visit_array - " + "out_defn failed\n"), + -1); + } + if (node->gen_forany_impl () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_array_ci::" + "visit_array - " + "forany_defn failed\n"), + -1); + } + + // is this a typedefined array? if so, then let the typedef deal with + // generation of the typecode + if (!this->ctx_->tdef ()) + { + // by using a visitor to declare and define the TypeCode, we have the + // added advantage to conditionally not generate any code. This will be + // based on the command line options. This is still TO-DO + be_visitor_context ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_array_cs::" + "visit_array - " + "TypeCode definition failed\n" + ), -1); + } + delete visitor; + } + + node->cli_inline_gen (1); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_array/array_cs.cpp b/TAO/TAO_IDL/be/be_visitor_array/array_cs.cpp new file mode 100644 index 00000000000..34bb4eabeeb --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_array/array_cs.cpp @@ -0,0 +1,184 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// array_cs.cpp +// +// = DESCRIPTION +// Visitor for code generation of Arrays in the client stubs +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_array.h" + +// ************************************************************************ +// visitor for array declaration in client stubs +// ************************************************************************ + +be_visitor_array_cs::be_visitor_array_cs (be_visitor_context *ctx) + : be_visitor_array (ctx) +{ +} + +be_visitor_array_cs::~be_visitor_array_cs (void) +{ +} + +int be_visitor_array_cs::visit_array (be_array *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_type *bt; // base type + be_decl *scope = this->ctx_->scope (); // scope in which it is used + unsigned long i; + + // nothing to do if we are imported or code is already generated + if (node->imported () || (node->cli_stub_gen ())) + return 0; + + this->ctx_->node (node); // save the array node + + // retrieve the type + bt = be_type::narrow_from_decl (node->base_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_array_ci::" + "visit_array - " + "Bad base type\n"), + -1); + } + + // dup method + os->indent (); + *os << node->name () << "_slice *" << be_nl + << node->name () << "_dup (const " << node->name () + << "_slice *_tao_src_array)" << be_nl; + *os << "{" << be_idt_nl; + *os << node->name () << "_slice *_tao_dup_array = " << node->name () + << "_alloc ();" << be_nl; + *os << "if (!_tao_dup_array) return (" << node->name () + << "_slice *)0;" << be_nl; + *os << node->name () << "_copy (_tao_dup_array, _tao_src_array);" << be_nl; + *os << "return _tao_dup_array;" << be_uidt_nl; + *os << "}\n\n"; + + // copy method + *os << "void " << be_nl; + *os << node->name () << "_copy (" << node->name () << "_slice * _tao_to, " + << "const " << node->name () << "_slice *_tao_from)" << be_nl; + *os << "{" << be_idt_nl; + *os << "// copy each individual elements" << be_nl; + + // generate nested loops for as many dimensions as there are + for (i = 0; i < node->n_dims (); i++) + { + // retrieve the ith dimension value + AST_Expression *expr = node->dims ()[i]; + // dimension value + if ((expr == NULL) || ((expr != NULL) && (expr->ev () == NULL))) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_array_cs::" + "visit_array - " + "bad array dimension\n"), + -1); + } + if (expr->ev ()->et == AST_Expression::EV_ulong) + { + // generate a loop for each dimension + *os << "for (CORBA::ULong i" << i << " = 0; i" << i << " < " + << expr->ev ()->u.ulval << "; i" << i << "++)" << be_idt_nl; + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_array_cs::" + "visit_array - " + "bad array dimension value\n"), + -1); + } + } + + // now generate code such that every element of the array gets assigned + // inside the innermost level of the nested loops generated above + be_array *primitive_type = 0; + if (bt->node_type () == AST_Decl::NT_typedef) + { + // base type of the array node is a typedef. We need to make sure that + // this typedef is not to another array type. If it is, then we cannot + // assign an array to another. We will have to invoke the underlying + // array type's copy method for every array dimension. + be_typedef *tdef = be_typedef::narrow_from_decl (bt); + // check if the base type of the typedef node is an Array node + primitive_type = be_array::narrow_from_decl (tdef->base_type ()); + } + if (primitive_type) + { + // the base type is not a typedef to a possibly another array type. In + // such a case, assign each element. + + *os << "// call the underlying _copy" << be_nl; + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_array_cs::" + "visit_array - " + "base type decl failed\n"), + -1); + } + + *os << "_copy (_tao_to"; + for (i = 0; i < node->n_dims (); i++) + { + *os << "[i" << i << "]"; + } + *os << ", "; + *os << "_tao_from"; // generate the rvalue + for (i = 0; i < node->n_dims (); i++) + { + *os << "[i" << i << "]"; + } + *os << ");"; + } + else + { + // the base type is not a typedef to a possibly another array type. In + // such a case, assign each element. + + *os << "_tao_to"; // generate the lvalue + for (i = 0; i < node->n_dims (); i++) + { + *os << "[i" << i << "]"; + } + *os << " = "; + *os << "_tao_from"; // generate the rvalue + for (i = 0; i < node->n_dims (); i++) + { + *os << "[i" << i << "]"; + } + *os << ";"; + } + for (i = 0; i < node->n_dims (); i++) + { + // decrement indentation as many times as the number of dimensions + *os << be_uidt; + } + *os << be_uidt_nl << "}\n\n"; + + node->cli_stub_gen (1); + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_attribute.cpp b/TAO/TAO_IDL/be/be_visitor_attribute.cpp index ad677a8ed3f..de67d91bb47 100644 --- a/TAO/TAO_IDL/be/be_visitor_attribute.cpp +++ b/TAO/TAO_IDL/be/be_visitor_attribute.cpp @@ -24,165 +24,5 @@ #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; - case TAO_CodeGen::TAO_ATTRIBUTE_TIE_SH: - ctx.state (TAO_CodeGen::TAO_OPERATION_TIE_SH); - break; - case TAO_CodeGen::TAO_ATTRIBUTE_TIE_SI: - ctx.state (TAO_CodeGen::TAO_OPERATION_TIE_SI); - 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; -} +// include all the individual files +#include "be_visitor_attribute/attribute.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp new file mode 100644 index 00000000000..5a68ce7027c --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp @@ -0,0 +1,188 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// attribute.cpp +// +// = DESCRIPTION +// Visitor 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; + case TAO_CodeGen::TAO_ATTRIBUTE_TIE_SH: + ctx.state (TAO_CodeGen::TAO_OPERATION_TIE_SH); + break; + case TAO_CodeGen::TAO_ATTRIBUTE_TIE_SI: + ctx.state (TAO_CodeGen::TAO_OPERATION_TIE_SI); + 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 index 536ffe06e25..2ebf9283907 100644 --- a/TAO/TAO_IDL/be/be_visitor_constant.cpp +++ b/TAO/TAO_IDL/be/be_visitor_constant.cpp @@ -24,158 +24,7 @@ #include "be_visitor_constant.h" -// ******************************************************************** -// Visitor implementation for the Constant type -// This one for the client header file -// ******************************************************************** +// include all the individual files +#include "be_visitor_constant/constant_ch.cpp" +#include "be_visitor_constant/constant_cs.cpp" -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 () && !node->imported ()) - { - // 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 - // is our enclosing scope a module? We need this check because for - // platforms that support namespaces, the typecode must be declared - // extern - if (node->is_nested () && - (node->defined_in ()->scope_node_type () == AST_Decl::NT_module)) - *os << "TAO_NAMESPACE_STORAGE_CLASS "; - else - *os << "static "; - *os << "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_stub_gen () && !node->imported ()) - { - if (node->is_nested ()) - { - if (node->defined_in ()->scope_node_type () == AST_Decl::NT_module) - { - *os << "TAO_NAMESPACE_TYPE (const " - << node->exprtype_to_string () << ")" << be_nl; - be_module *module = be_module::narrow_from_scope (node->defined_in ()); - if (!module || (this->gen_nested_namespace_begin (module) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_constant_cs::visit_constant - " - "Error parsing nested name\n"), - -1); - } - *os << "TAO_NAMESPACE_DEFINE (const " - << node->exprtype_to_string () << ", " - << node->local_name () << ", " - << node->constant_value () << ")" << be_nl; - if (this->gen_nested_namespace_end (module) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_constant_cs::visit_constant - " - "Error parsing nested name\n"), - -1); - } - } - else - { - // 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; -} - -// the following needs to be done to deal with the most bizarre behavior of -// MSVC++ compiler -int -be_visitor_constant_cs::gen_nested_namespace_begin (be_module *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - UTL_IdListActiveIterator *i; - - i = new UTL_IdListActiveIterator (node->name ()); - while (!(i->is_done ())) - { - if (ACE_OS::strcmp (i->item ()->get_string (), "") != 0) - { - // leave the outermost root scope - *os << "TAO_NAMESPACE_BEGIN (" << i->item ()->get_string () - << ")" << be_nl; - } - i->next (); - } - delete i; - return 0; -} - -// the following needs to be done to deal with the most bizarre behavior of -// MSVC++ compiler -int -be_visitor_constant_cs::gen_nested_namespace_end (be_module *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - UTL_IdListActiveIterator *i; - - i = new UTL_IdListActiveIterator (node->name ()); - while (!(i->is_done ())) - { - if (ACE_OS::strcmp (i->item ()->get_string (), "") != 0) - { - // leave the outermost root scope - *os << "TAO_NAMESPACE_END" << be_nl; - } - i->next (); - } - delete i; - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_constant/constant_ch.cpp b/TAO/TAO_IDL/be/be_visitor_constant/constant_ch.cpp new file mode 100644 index 00000000000..73e7af87f9d --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_constant/constant_ch.cpp @@ -0,0 +1,73 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// constant_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for the Constant node in the client header. +// +// = 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 () && !node->imported ()) + { + // 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 + // is our enclosing scope a module? We need this check because for + // platforms that support namespaces, the typecode must be declared + // extern + if (node->is_nested () && + (node->defined_in ()->scope_node_type () == AST_Decl::NT_module)) + *os << "TAO_NAMESPACE_STORAGE_CLASS "; + else + *os << "static "; + *os << "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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp b/TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp new file mode 100644 index 00000000000..add132a9357 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp @@ -0,0 +1,133 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// constant_cs.cpp +// +// = DESCRIPTION +// Visitor for code generation of Constant code in the client stubs file. +// +// = 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 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_stub_gen () && !node->imported ()) + { + if (node->is_nested ()) + { + if (node->defined_in ()->scope_node_type () == AST_Decl::NT_module) + { + *os << "TAO_NAMESPACE_TYPE (const " + << node->exprtype_to_string () << ")" << be_nl; + be_module *module = be_module::narrow_from_scope (node->defined_in ()); + if (!module || (this->gen_nested_namespace_begin (module) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_constant_cs::visit_constant - " + "Error parsing nested name\n"), + -1); + } + *os << "TAO_NAMESPACE_DEFINE (const " + << node->exprtype_to_string () << ", " + << node->local_name () << ", " + << node->constant_value () << ")" << be_nl; + if (this->gen_nested_namespace_end (module) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_constant_cs::visit_constant - " + "Error parsing nested name\n"), + -1); + } + } + else + { + // 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; +} + +// the following needs to be done to deal with the most bizarre behavior of +// MSVC++ compiler +int +be_visitor_constant_cs::gen_nested_namespace_begin (be_module *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + UTL_IdListActiveIterator *i; + + i = new UTL_IdListActiveIterator (node->name ()); + while (!(i->is_done ())) + { + if (ACE_OS::strcmp (i->item ()->get_string (), "") != 0) + { + // leave the outermost root scope + *os << "TAO_NAMESPACE_BEGIN (" << i->item ()->get_string () + << ")" << be_nl; + } + i->next (); + } + delete i; + return 0; +} + +// the following needs to be done to deal with the most bizarre behavior of +// MSVC++ compiler +int +be_visitor_constant_cs::gen_nested_namespace_end (be_module *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + UTL_IdListActiveIterator *i; + + i = new UTL_IdListActiveIterator (node->name ()); + while (!(i->is_done ())) + { + if (ACE_OS::strcmp (i->item ()->get_string (), "") != 0) + { + // leave the outermost root scope + *os << "TAO_NAMESPACE_END" << be_nl; + } + i->next (); + } + delete i; + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_enum.cpp b/TAO/TAO_IDL/be/be_visitor_enum.cpp index 162475bfc2c..3a0ff49e7e9 100644 --- a/TAO/TAO_IDL/be/be_visitor_enum.cpp +++ b/TAO/TAO_IDL/be/be_visitor_enum.cpp @@ -24,218 +24,8 @@ #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 () && !node->imported ()) - { - 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->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"; - - // by using a visitor to declare and define the TypeCode, we have the - // added advantage to conditionally not generate any code. This will be - // based on the command line options. This is still TO-DO - be_visitor *visitor; - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_enum_ch::" - "visit_enum - " - "TypeCode declaration failed\n" - ), -1); - } - - 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_stub_gen () && !node->imported ()) - { - // by using a visitor to declare and define the TypeCode, we have the - // added advantage to conditionally not generate any code. This will be - // based on the command line options. This is still TO-DO - be_visitor *visitor; - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_enum_cs::" - "visit_enum - " - "TypeCode definition failed\n" - ), -1); - } - - node->cli_stub_gen (I_TRUE); - } - return 0; -} - -// *************************************************************************** -// Enum visitor for generating Any operator declarations in the client header -// *************************************************************************** - -be_visitor_enum_any_op_ch::be_visitor_enum_any_op_ch -(be_visitor_context *ctx) - : be_visitor_scope (ctx) -{ -} - -be_visitor_enum_any_op_ch::~be_visitor_enum_any_op_ch (void) -{ -} - -int -be_visitor_enum_any_op_ch::visit_enum (be_enum *node) -{ - if (node->cli_hdr_any_op_gen () || node->imported ()) - return 0; - - TAO_OutStream *os = tao_cg->client_header (); - - // generate the Any <<= and >>= operators - os->indent (); - *os << "void " << idl_global->export_macro () - << " operator<<= (CORBA::Any &, " << node->name () - << ");" << be_nl; - *os << "CORBA::Boolean " << idl_global->export_macro () - << " operator>>= (const CORBA::Any &, " - << node->name () << " &);\n"; - - node->cli_hdr_any_op_gen (1); - return 0; -} - -// *************************************************************************** -// Enum visitor for generating Any operator declarations in the client -// stubs file -// *************************************************************************** - -be_visitor_enum_any_op_cs::be_visitor_enum_any_op_cs -(be_visitor_context *ctx) - : be_visitor_scope (ctx) -{ -} - -be_visitor_enum_any_op_cs::~be_visitor_enum_any_op_cs (void) -{ -} - -int -be_visitor_enum_any_op_cs::visit_enum (be_enum *node) -{ - if (node->cli_stub_any_op_gen () || node->imported ()) - return 0; - - TAO_OutStream *os = tao_cg->client_stubs (); - - // generate the Any <<= and >>= operator declarations - // Any <<= and >>= operators - os->indent (); - *os << "void operator<<= (CORBA::Any &_tao_any, " - << node->name () << " _tao_elem)" << be_nl - << "{" << be_idt_nl - << "CORBA::Environment _tao_env;" << be_nl - << "_tao_any.replace (" << node->tc_name () << ", new " - << node->name () << "(_tao_elem), 1, _tao_env);" << be_uidt_nl - << "}" << be_nl; - - *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, " - << node->name () << " &_tao_elem)" << be_nl - << "{" << be_idt_nl - << "CORBA::Environment _tao_env;" << be_nl - << "if (!_tao_any.type ()->equal (" << node->tc_name () - << ", _tao_env)) return 0; // not equal" << be_nl - << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());" - << be_nl - << "if (stream.decode (" << node->tc_name () - << ", &_tao_elem, 0, _tao_env)" << be_nl - << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl - << " return 1;" << be_nl - << "else" << be_nl - << " return 0;" << be_uidt_nl - << "}\n\n"; - - node->cli_stub_any_op_gen (1); - return 0; -} +// include all the individual files +#include "be_visitor_enum/any_op_ch.cpp" +#include "be_visitor_enum/any_op_cs.cpp" +#include "be_visitor_enum/enum_ch.cpp" +#include "be_visitor_enum/enum_cs.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_enum/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_enum/any_op_ch.cpp new file mode 100644 index 00000000000..766e743dbf3 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_enum/any_op_ch.cpp @@ -0,0 +1,61 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for Enums for the Any operators +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_enum.h" + + +// *************************************************************************** +// Enum visitor for generating Any operator declarations in the client header +// *************************************************************************** + +be_visitor_enum_any_op_ch::be_visitor_enum_any_op_ch +(be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_enum_any_op_ch::~be_visitor_enum_any_op_ch (void) +{ +} + +int +be_visitor_enum_any_op_ch::visit_enum (be_enum *node) +{ + if (node->cli_hdr_any_op_gen () || node->imported ()) + return 0; + + TAO_OutStream *os = tao_cg->client_header (); + + // generate the Any <<= and >>= operators + os->indent (); + *os << "void " << idl_global->export_macro () + << " operator<<= (CORBA::Any &, " << node->name () + << ");" << be_nl; + *os << "CORBA::Boolean " << idl_global->export_macro () + << " operator>>= (const CORBA::Any &, " + << node->name () << " &);\n"; + + node->cli_hdr_any_op_gen (1); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_enum/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_enum/any_op_cs.cpp new file mode 100644 index 00000000000..e24522eef1a --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_enum/any_op_cs.cpp @@ -0,0 +1,79 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_cs.cpp +// +// = DESCRIPTION +// Visitors for generation of code for Enum for the Any operators +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_enum.h" + +// *************************************************************************** +// Enum visitor for generating Any operator declarations in the client +// stubs file +// *************************************************************************** + +be_visitor_enum_any_op_cs::be_visitor_enum_any_op_cs +(be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_enum_any_op_cs::~be_visitor_enum_any_op_cs (void) +{ +} + +int +be_visitor_enum_any_op_cs::visit_enum (be_enum *node) +{ + if (node->cli_stub_any_op_gen () || node->imported ()) + return 0; + + TAO_OutStream *os = tao_cg->client_stubs (); + + // generate the Any <<= and >>= operator declarations + // Any <<= and >>= operators + os->indent (); + *os << "void operator<<= (CORBA::Any &_tao_any, " + << node->name () << " _tao_elem)" << be_nl + << "{" << be_idt_nl + << "CORBA::Environment _tao_env;" << be_nl + << "_tao_any.replace (" << node->tc_name () << ", new " + << node->name () << "(_tao_elem), 1, _tao_env);" << be_uidt_nl + << "}" << be_nl; + + *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, " + << node->name () << " &_tao_elem)" << be_nl + << "{" << be_idt_nl + << "CORBA::Environment _tao_env;" << be_nl + << "if (!_tao_any.type ()->equal (" << node->tc_name () + << ", _tao_env)) return 0; // not equal" << be_nl + << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());" + << be_nl + << "if (stream.decode (" << node->tc_name () + << ", &_tao_elem, 0, _tao_env)" << be_nl + << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl + << " return 1;" << be_nl + << "else" << be_nl + << " return 0;" << be_uidt_nl + << "}\n\n"; + + node->cli_stub_any_op_gen (1); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp b/TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp new file mode 100644 index 00000000000..c902d4e7847 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp @@ -0,0 +1,109 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// enum_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for Enums in the client header +// +// = 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 () && !node->imported ()) + { + 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->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"; + + // by using a visitor to declare and define the TypeCode, we have the + // added advantage to conditionally not generate any code. This will be + // based on the command line options. This is still TO-DO + be_visitor *visitor; + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_enum_ch::" + "visit_enum - " + "TypeCode declaration failed\n" + ), -1); + } + + 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_enum/enum_cs.cpp b/TAO/TAO_IDL/be/be_visitor_enum/enum_cs.cpp new file mode 100644 index 00000000000..ad0d23b1755 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_enum/enum_cs.cpp @@ -0,0 +1,68 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// enum_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for Enums in the client stubs +// +// = 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 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_stub_gen () && !node->imported ()) + { + // by using a visitor to declare and define the TypeCode, we have the + // added advantage to conditionally not generate any code. This will be + // based on the command line options. This is still TO-DO + be_visitor *visitor; + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_enum_cs::" + "visit_enum - " + "TypeCode definition failed\n" + ), -1); + } + + 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 index 1ca3a73871d..a71cda41037 100644 --- a/TAO/TAO_IDL/be/be_visitor_exception.cpp +++ b/TAO/TAO_IDL/be/be_visitor_exception.cpp @@ -24,1155 +24,12 @@ #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_EXCEPTION_CH: - ctx.state (TAO_CodeGen::TAO_FIELD_CH); - break; - case TAO_CodeGen::TAO_EXCEPTION_CI: - ctx.state (TAO_CodeGen::TAO_FIELD_CI); - break; - case TAO_CodeGen::TAO_EXCEPTION_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 () && !node->imported ()) // not already generated and - // not imported - { - os = this->ctx_->stream (); - - os->gen_ifdef_macro (node->flatname (), "_ptr"); - - os->indent (); - *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 (); - - os->gen_ifdef_macro (node->flatname ()); - - os->indent (); - *os << "class " << idl_global->export_macro () - << " " << node->local_name () - << " : public CORBA::UserException" << be_nl; - *os << "{" << be_nl - << "public:\n"; - os->incr_indent (); - // constructors and destructor - *os << node->local_name () << " (void); // default ctor" << be_nl; - *os << node->local_name () << " (const " << node->local_name () - << " &); // copy ctor" << be_nl; - *os << "~" << node->local_name () << " (void); // dtor" << be_nl; - - // generate constructor that takes each member as a parameter. We need a - // new state. Such a constructor exists if we have members - if (node->member_count () > 0) - { - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_CH); - be_visitor *visitor = tao_cg->make_visitor (&ctx); - - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_exception::" - "visit_exception - " - "codegen for ctor failed\n"), -1); - } - delete visitor; - } - - os->indent (); - // assignment operator - *os << node->local_name () << " &operator= (const " - << node->local_name () << " &);" << be_nl; - // the static _narrow method - *os << "static " << node->local_name () - << " *_narrow (CORBA::Exception *);\n"; - - // 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); - } - - // generate the static *_alloc method - os->indent (); - // this is TAO extension - *os << "// the alloc method. This is TAO extension" << be_nl; - *os << "static CORBA::Exception *_alloc (void);" << be_uidt_nl; - *os << "}; // exception " << node->name () << be_nl; - - // by using a visitor to declare and define the TypeCode, we have the - // added advantage to conditionally not generate any code. This will be - // based on the command line options. This is still TO-DO - be_visitor *visitor; - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_exception_ch::" - "visit_exception - " - "TypeCode declaration failed\n" - ), -1); - } - - - os->gen_endif (); - - node->cli_hdr_gen (1); - - } - 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) -{ - TAO_OutStream *os = this->ctx_->stream (); // output stream - - if (!node->cli_inline_gen () && !node->imported ()) - { - os = this->ctx_->stream (); - os->indent (); - *os << "// *************************************************************" - << be_nl; - *os << "// Inline operations for exception " << node->name () << be_nl; - *os << "// *************************************************************\n\n"; - - // generate inline code required of any anonymous types of members - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_exception::" - "visit_exception -" - "code for inline 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 () && !node->imported ()) - { - os = this->ctx_->stream (); - - // default constructor - os->indent (); - *os << "// default constructor" << be_nl; - *os << node->name () << "::" << node->local_name () << " (void)" << be_nl; - *os << " : CORBA_UserException (" - << node->tc_name () << ")\n"; - *os << "{" << be_nl; - *os << "}\n\n"; - - // destructor - os->indent (); - *os << "// destructor - all members are of self managing types" << be_nl; - *os << node->name () << "::~" << node->local_name () << " (void)" << be_nl; - *os << "{" << be_nl; - *os << "}\n\n"; - - // copy constructor - os->indent (); - *os << "// copy constructor" << be_nl; - *os << node->name () << "::" << node->local_name () << " (const " << - node->name () << " &_tao_excp)" << be_nl; - *os << " :CORBA_UserException (" << - "_tao_excp._type ())" << be_nl; - *os << "{\n"; - os->incr_indent (); - // assign each individual member - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS); - be_visitor *visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_exception_cs::" - "visit_exception -" - "codegen for scope failed\n"), -1); - } - delete visitor; - os->decr_indent (); - *os << "}\n\n"; - - // assignment operator - os->indent (); - *os << "// assignment operator" << be_nl; - *os << node->name () << "&" << be_nl; - *os << node->name () << "::operator= (const " << - node->name () << " &_tao_excp)" << be_nl; - *os << "{\n"; - os->incr_indent (); - *os << "this->ACE_CORBA_1 (UserException)::operator= " << - "(_tao_excp._type ());\n"; - // assign each individual member - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_exception_cs::" - "visit_exception -" - "codegen for scope failed\n"), -1); - } - delete visitor; - os->indent (); - *os << "return *this;\n"; - os->decr_indent (); - *os << "}\n\n"; - - // constructor taking all members. It exists only if there are any - // members - if (node->member_count () > 0) - { - // generate the signature - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_CS); - visitor = tao_cg->make_visitor (&ctx); - - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_exception::" - "visit_exception - " - "codegen for ctor failed\n"), -1); - } - delete visitor; - - *os << " : CORBA_UserException " - << " (CORBA::TypeCode::_duplicate (" << node->tc_name () - << "))" << be_nl; - *os << "{\n"; - os->incr_indent (); - // assign each individual member. We need yet another state - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS); - ctx.exception (1); // indicate that the special ctor is being - // generated - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_exception_cs::" - "visit_exception -" - "codegen for scope failed\n"), -1); - } - delete visitor; - os->decr_indent (); - *os << "}\n\n"; - } - - // narrow method - os->indent (); - *os << "// narrow" << be_nl; - *os << node->name () << "_ptr " << be_nl; - *os << node->name () << "::_narrow (CORBA::Exception *exc)" << be_nl; - *os << "{\n"; - os->incr_indent (); - *os << "if (!ACE_OS::strcmp (\"" << node->repoID () << - "\", exc->_id ())) // same type" << be_nl; - *os << " return ACE_dynamic_cast (" << node->name () << "_ptr, exc);" << - be_nl; - *os << "else" << be_nl; - *os << " return 0;\n"; - os->decr_indent (); - *os << "}\n\n"; - - // generate the _alloc method - os->indent (); - *os << "// TAO extension - the _alloc method" << be_nl; - *os << "CORBA::Exception *" << node->name () - << "::_alloc (void)" << be_nl; - *os << "{" << be_idt_nl; - *os << "return new " << node->name () << ";" << be_uidt_nl; - *os << "}\n\n"; - - // by using a visitor to declare and define the TypeCode, we have the - // added advantage to conditionally not generate any code. This will be - // based on the command line options. This is still TO-DO - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_exception_cs::" - "visit_exception - " - "TypeCode definition failed\n" - ), -1); - } - - node->cli_stub_gen (I_TRUE); - } - - return 0; -} - -// ************************************************************************ -// code to generate the special ctor -// ************************************************************************ - -be_visitor_exception_ctor::be_visitor_exception_ctor -(be_visitor_context *ctx) - : be_visitor_scope (ctx) -{ -} - -be_visitor_exception_ctor::~be_visitor_exception_ctor (void) -{ -} - -int -be_visitor_exception_ctor::post_process (void) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - *os << ",\n"; - return 0; -} - -int be_visitor_exception_ctor::visit_exception (be_exception *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - this->ctx_->node (node); // save the argument node - - if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) - *os << node->local_name (); - else - *os << node->name () << "::" << node->local_name (); - *os << "(" << be_idt << "\n"; - - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_exception_ctor_assign::" - "visit_exception - " - "codegen for scope failed\n"), - -1); - } - - if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) - *os << be_uidt << ");\n\n"; - else - *os << be_uidt << ")\n\n"; - - return 0; -} - -int be_visitor_exception_ctor::visit_field (be_field *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - // retrieve the type - be_type *bt = be_type::narrow_from_decl (node->field_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_exception_ctor::" - "visit_exception - " - "Bad field type\n"), - -1); - } - - os->indent (); - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_exception_ctor::" - "visit_field - " - "cannot accept visitor\n"), - -1); - } - - *os << " _tao_" << node->local_name (); - return 0; -} - -int be_visitor_exception_ctor::visit_array (be_array *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - // set the right type; - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) - *os << "const " << bt->nested_type_name (this->ctx_->scope ()); - else - *os << "const " << bt->name (); - return 0; -} - -int be_visitor_exception_ctor::visit_enum (be_enum *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - // set the right type; - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) - *os << bt->nested_type_name (this->ctx_->scope ()); - else - *os << bt->name (); - return 0; -} - -int be_visitor_exception_ctor::visit_interface (be_interface *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - // set the right type; - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) - *os << "const " << bt->nested_type_name (this->ctx_->scope ()); - else - *os << "const " << bt->name (); - *os << "_ptr "; - return 0; -} - -int be_visitor_exception_ctor::visit_interface_fwd (be_interface_fwd *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - // set the right type; - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) - *os << "const " << bt->nested_type_name (this->ctx_->scope ()); - else - *os << "const " << bt->name (); - *os << "_ptr "; - return 0; -} - -int be_visitor_exception_ctor::visit_predefined_type (be_predefined_type *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - // set the right type; - 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) - { - if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) - *os << "const " << bt->nested_type_name (this->ctx_->scope ()); - else - *os << "const " << bt->name (); - *os << " &"; - return 0; - } // end of if - else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object - { - if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) - *os << "const " << bt->nested_type_name (this->ctx_->scope ()); - else - *os << "const " << bt->name (); - *os << "_ptr "; - } // end else if - else // simple predefined types - { - if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) - *os << bt->nested_type_name (this->ctx_->scope ()); - else - *os << bt->name (); - } // end of else - - return 0; -} - -int be_visitor_exception_ctor::visit_sequence (be_sequence *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - // set the right type; - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) - *os << "const " << bt->nested_type_name (this->ctx_->scope ()); - else - *os << "const " << bt->name (); - *os << " &"; - return 0; -} - -int be_visitor_exception_ctor::visit_string (be_string *) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - *os << "const char *"; - return 0; -} - -int be_visitor_exception_ctor::visit_structure (be_structure *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - // set the right type; - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) - *os << "const " << bt->nested_type_name (this->ctx_->scope ()); - else - *os << "const " << bt->name (); - *os << " &"; - return 0; -} - -int be_visitor_exception_ctor::visit_union (be_union *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - // set the right type; - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) - *os << "const " << bt->nested_type_name (this->ctx_->scope ()); - else - *os << "const " << bt->name (); - *os << " &"; - return 0; -} - -int be_visitor_exception_ctor::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_exception_ctor::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -// ************************************************************************ -// used for the body of the assignment operator and the copy constructor -// ************************************************************************ - -be_visitor_exception_ctor_assign::be_visitor_exception_ctor_assign (be_visitor_context *ctx) - : be_visitor_scope (ctx) -{ -} - -be_visitor_exception_ctor_assign::~be_visitor_exception_ctor_assign (void) -{ -} - -int be_visitor_exception_ctor_assign::visit_exception (be_exception *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - this->ctx_->node (node); // save the argument node - - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_exception_ctor_assign::" - "visit_exception - " - "codegen for scope failed\n"), - -1); - } - - return 0; -} - -int be_visitor_exception_ctor_assign::visit_field (be_field *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_exception_ctor_assign::" - "visit_field - " - "Bad field 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_exception_ctor_assign::" - "visit_field - " - "cannot accept visitor\n"), - -1); - } - - return 0; -} - -int be_visitor_exception_ctor_assign::visit_array (be_array *) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_decl *bd = this->ctx_->node (); - - os->indent (); - if (this->ctx_->exception ()) // special ctor - { - *os << "this->" << bd->local_name () << " = _tao_" << bd->local_name () - << ";\n"; - } - else - { - *os << "this->" << bd->local_name () << " = _tao_excp." << bd->local_name () - << ";\n"; - } - return 0; -} - -int be_visitor_exception_ctor_assign::visit_enum (be_enum *) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_decl *bd = this->ctx_->node (); - - os->indent (); - if (this->ctx_->exception ()) // special ctor - { - *os << "this->" << bd->local_name () << " = _tao_" << bd->local_name () - << ";\n"; - } - else - { - *os << "this->" << bd->local_name () << " = _tao_excp." << bd->local_name () - << ";\n"; - } - return 0; -} - -int be_visitor_exception_ctor_assign::visit_interface (be_interface *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_decl *bd = this->ctx_->node (); - - os->indent (); - if (this->ctx_->exception ()) // special ctor - { - *os << "this->" << bd->local_name () << " = " << node->name () - << "::_duplicate (_tao_" << bd->local_name () << ");\n"; - } - else - { - *os << "this->" << bd->local_name () << " = " << node->name () - << "::_duplicate (_tao_excp." << bd->local_name () << ".in ());\n"; - } - return 0; -} - -int be_visitor_exception_ctor_assign::visit_interface_fwd (be_interface_fwd *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_decl *bd = this->ctx_->node (); - - os->indent (); - if (this->ctx_->exception ()) // special ctor - { - *os << "this->" << bd->local_name () << " = " << node->name () - << "::_duplicate (_tao_" << bd->local_name () << ");\n"; - } - else - { - *os << "this->" << bd->local_name () << " = " << node->name () - << "::_duplicate (_tao_excp." << bd->local_name () << ".in ());\n"; - } - return 0; -} - -int be_visitor_exception_ctor_assign::visit_predefined_type (be_predefined_type *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_decl *bd = this->ctx_->node (); - - os->indent (); - // check if the type is an any - if (node->pt () == AST_PredefinedType::PT_any) - { - if (this->ctx_->exception ()) // special ctor - { - *os << "this->" << bd->local_name () << " = _tao_" - << bd->local_name () << ";\n"; - } - else - { - *os << "this->" << bd->local_name () << " = _tao_excp." - << bd->local_name () << ";\n"; - } - } // end of if - else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object - { - if (this->ctx_->exception ()) // special ctor - { - *os << "this->" << bd->local_name () << " = " - << node->name () << "::_duplicate (_tao_" - << bd->local_name () << ");\n"; - } - else - { - *os << "this->" << bd->local_name () << " = " - << node->name () << "::_duplicate (_tao_excp." - << bd->local_name () << ".in ());\n"; - } - } // end else if - else // simple predefined types - { - if (this->ctx_->exception ()) // special ctor - { - *os << "this->" << bd->local_name () << " = _tao_" - << bd->local_name () << ";\n"; - } - else - { - *os << "this->" << bd->local_name () << " = _tao_excp." - << bd->local_name () << ";\n"; - } - } // end of else - - return 0; -} - -int be_visitor_exception_ctor_assign::visit_sequence (be_sequence *) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_decl *bd = this->ctx_->node (); - - os->indent (); - if (this->ctx_->exception ()) // special ctor - { - *os << "this->" << bd->local_name () << " = _tao_" << bd->local_name () - << ";\n"; - } - else - { - *os << "this->" << bd->local_name () << " = _tao_excp." << bd->local_name () - << ";\n"; - } - return 0; -} - -int be_visitor_exception_ctor_assign::visit_string (be_string *) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_decl *bd = this->ctx_->node (); - - os->indent (); - if (this->ctx_->exception ()) // special ctor - { - *os << "this->" << bd->local_name () << " = CORBA::string_dup (_tao_" - << bd->local_name () << ");\n"; - } - else - { - *os << "this->" << bd->local_name () - << " = CORBA::string_dup (_tao_excp." << bd->local_name () - << ".in ());\n"; - } - return 0; -} - -int be_visitor_exception_ctor_assign::visit_structure (be_structure *) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_decl *bd = this->ctx_->node (); - - os->indent (); - if (this->ctx_->exception ()) // special ctor - { - *os << "this->" << bd->local_name () << " = _tao_" << bd->local_name () - << ";\n"; - } - else - { - *os << "this->" << bd->local_name () << " = _tao_excp." << bd->local_name () - << ";\n"; - } - return 0; -} - -int be_visitor_exception_ctor_assign::visit_union (be_union *) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_decl *bd = this->ctx_->node (); - - os->indent (); - if (this->ctx_->exception ()) // special ctor - { - *os << "this->" << bd->local_name () << " = _tao_" << bd->local_name () - << ";\n"; - } - else - { - *os << "this->" << bd->local_name () << " = _tao_excp." << bd->local_name () - << ";\n"; - } - return 0; -} - -int be_visitor_exception_ctor_assign::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_exception_ctor_assign::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -// *************************************************************************** -// Exception visitor for generating Any operator declarations in the client header -// *************************************************************************** - -be_visitor_exception_any_op_ch::be_visitor_exception_any_op_ch -(be_visitor_context *ctx) - : be_visitor_scope (ctx) -{ -} - -be_visitor_exception_any_op_ch::~be_visitor_exception_any_op_ch (void) -{ -} - -int -be_visitor_exception_any_op_ch::visit_exception (be_exception *node) -{ - if (node->cli_hdr_any_op_gen () || node->imported ()) - return 0; - - TAO_OutStream *os = tao_cg->client_header (); - - // generate the Any <<= and >>= operator declarations - os->indent (); - *os << "void " << idl_global->export_macro () - << " operator<<= (CORBA::Any &, const " << node->name () - << " &); // copying version" << be_nl; - *os << "void " << idl_global->export_macro () - << " operator<<= (CORBA::Any &, " << node->name () - << "*); // noncopying version" << be_nl; - *os << "CORBA::Boolean " << idl_global->export_macro () - << " operator>>= (const CORBA::Any &, " - << node->name () << " *&);\n"; - - - // all we have to do is to visit the scope and generate code - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_exception::visit_exception - " - "codegen for scope failed\n"), -1); - } - - node->cli_hdr_any_op_gen (1); - return 0; -} - -int -be_visitor_exception_any_op_ch::visit_field (be_field *node) -{ - be_type *bt; // field's type - - // 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_exception_any_op_ch::" - "visit_field - " - "Bad field type\n" - ), -1); - } - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_exception_any_op_ch::" - "visit_field - " - "codegen for field type failed\n" - ), -1); - } - return 0; -} - -// *************************************************************************** -// Exception visitor for generating Any operator declarations in the client -// stubs file -// *************************************************************************** - -be_visitor_exception_any_op_cs::be_visitor_exception_any_op_cs -(be_visitor_context *ctx) - : be_visitor_scope (ctx) -{ -} - -be_visitor_exception_any_op_cs::~be_visitor_exception_any_op_cs (void) -{ -} - -int -be_visitor_exception_any_op_cs::visit_exception (be_exception *node) -{ - if (node->cli_stub_any_op_gen () || node->imported ()) - return 0; - - TAO_OutStream *os = tao_cg->client_stubs (); - - // generate the Any <<= and >>= operator declarations - // Any <<= and >>= operators - os->indent (); - *os << "void operator<<= (CORBA::Any &_tao_any, const " - << node->name () << " &_tao_elem) // copying" << be_nl - << "{" << be_idt_nl - << "CORBA::Environment _tao_env;" << be_nl - << "_tao_any.replace (" << node->tc_name () << ", new " - << node->name () << "(_tao_elem), 1, _tao_env);" << be_uidt_nl - << "}" << be_nl; - - *os << "void operator<<= (CORBA::Any &_tao_any, " - << node->name () << " *_tao_elem) // non copying" << be_nl - << "{" << be_idt_nl - << "CORBA::Environment _tao_env;" << be_nl - << "_tao_any.replace (" << node->tc_name () << ", " - << "_tao_elem, 1, _tao_env); // consume it" << be_uidt_nl - << "}" << be_nl; - - *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, " - << node->name () << " *&_tao_elem)" << be_nl - << "{" << be_idt_nl - << "CORBA::Environment _tao_env;" << be_nl - << "if (!_tao_any.type ()->equal (" << node->tc_name () - << ", _tao_env)) return 0; // not equal" << be_nl - << "if (_tao_any.any_owns_data ())" << be_nl - << "{" << be_idt_nl - << "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);" - << be_nl - << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());" - << be_nl - << "if (stream.decode (" << node->tc_name () - << ", _tao_elem, 0, _tao_env)" << be_nl - << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl - << "{" << be_idt_nl - << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), " - << "_tao_elem, 1, _tao_env);" - << be_nl - << " return 1;" << be_uidt_nl - << "}" << be_nl - << "else" << be_nl // decode failed - << "{" << be_idt_nl - << "delete _tao_elem;" << be_nl - << "return 0;" << be_uidt_nl - << "}" << be_uidt_nl - << "}" << be_nl - << "else" << be_nl // else any does not own the data - << "{" << be_idt_nl - << "_tao_elem = (" << node->name () << " *)_tao_any.value ();" - << be_nl - << "return 1;" << be_uidt_nl - << "}" << be_uidt_nl - << "}\n\n"; - - - // all we have to do is to visit the scope and generate code - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_exception::visit_exception - " - "codegen for scope failed\n"), -1); - } - - node->cli_stub_any_op_gen (1); - return 0; -} - -int -be_visitor_exception_any_op_cs::visit_field (be_field *node) -{ - be_type *bt; // field's type - - // 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_exception_any_op_cs::" - "visit_field - " - "Bad field type\n" - ), -1); - } - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_exception_any_op_cs::" - "visit_field - " - "codegen for field type failed\n" - ), -1); - } - return 0; -} +// include all the individual files +#include "be_visitor_exception/any_op_ch.cpp" +#include "be_visitor_exception/any_op_cs.cpp" +#include "be_visitor_exception/ctor_assign.cpp" +#include "be_visitor_exception/exception.cpp" +#include "be_visitor_exception/exception_ch.cpp" +#include "be_visitor_exception/exception_ci.cpp" +#include "be_visitor_exception/exception_cs.cpp" +#include "be_visitor_exception/exception_ctor.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_exception/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_exception/any_op_ch.cpp new file mode 100644 index 00000000000..0c2ce3f484f --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_exception/any_op_ch.cpp @@ -0,0 +1,100 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for the Any operators for Exceptions +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_exception.h" + + +// *************************************************************************** +// Exception visitor for generating Any operator declarations in the client header +// *************************************************************************** + +be_visitor_exception_any_op_ch::be_visitor_exception_any_op_ch +(be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_exception_any_op_ch::~be_visitor_exception_any_op_ch (void) +{ +} + +int +be_visitor_exception_any_op_ch::visit_exception (be_exception *node) +{ + if (node->cli_hdr_any_op_gen () || node->imported ()) + return 0; + + TAO_OutStream *os = tao_cg->client_header (); + + // generate the Any <<= and >>= operator declarations + os->indent (); + *os << "void " << idl_global->export_macro () + << " operator<<= (CORBA::Any &, const " << node->name () + << " &); // copying version" << be_nl; + *os << "void " << idl_global->export_macro () + << " operator<<= (CORBA::Any &, " << node->name () + << "*); // noncopying version" << be_nl; + *os << "CORBA::Boolean " << idl_global->export_macro () + << " operator>>= (const CORBA::Any &, " + << node->name () << " *&);\n"; + + + // all we have to do is to visit the scope and generate code + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_exception::visit_exception - " + "codegen for scope failed\n"), -1); + } + + node->cli_hdr_any_op_gen (1); + return 0; +} + +int +be_visitor_exception_any_op_ch::visit_field (be_field *node) +{ + be_type *bt; // field's type + + // 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_exception_any_op_ch::" + "visit_field - " + "Bad field type\n" + ), -1); + } + + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_exception_any_op_ch::" + "visit_field - " + "codegen for field type failed\n" + ), -1); + } + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp new file mode 100644 index 00000000000..652f7c991d7 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp @@ -0,0 +1,143 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for the Any operators for Exceptions. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_exception.h" + + +// *************************************************************************** +// Exception visitor for generating Any operator declarations in the client +// stubs file +// *************************************************************************** + +be_visitor_exception_any_op_cs::be_visitor_exception_any_op_cs +(be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_exception_any_op_cs::~be_visitor_exception_any_op_cs (void) +{ +} + +int +be_visitor_exception_any_op_cs::visit_exception (be_exception *node) +{ + if (node->cli_stub_any_op_gen () || node->imported ()) + return 0; + + TAO_OutStream *os = tao_cg->client_stubs (); + + // generate the Any <<= and >>= operator declarations + // Any <<= and >>= operators + os->indent (); + *os << "void operator<<= (CORBA::Any &_tao_any, const " + << node->name () << " &_tao_elem) // copying" << be_nl + << "{" << be_idt_nl + << "CORBA::Environment _tao_env;" << be_nl + << "_tao_any.replace (" << node->tc_name () << ", new " + << node->name () << "(_tao_elem), 1, _tao_env);" << be_uidt_nl + << "}" << be_nl; + + *os << "void operator<<= (CORBA::Any &_tao_any, " + << node->name () << " *_tao_elem) // non copying" << be_nl + << "{" << be_idt_nl + << "CORBA::Environment _tao_env;" << be_nl + << "_tao_any.replace (" << node->tc_name () << ", " + << "_tao_elem, 1, _tao_env); // consume it" << be_uidt_nl + << "}" << be_nl; + + *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, " + << node->name () << " *&_tao_elem)" << be_nl + << "{" << be_idt_nl + << "CORBA::Environment _tao_env;" << be_nl + << "if (!_tao_any.type ()->equal (" << node->tc_name () + << ", _tao_env)) return 0; // not equal" << be_nl + << "if (_tao_any.any_owns_data ())" << be_nl + << "{" << be_idt_nl + << "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);" + << be_nl + << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());" + << be_nl + << "if (stream.decode (" << node->tc_name () + << ", _tao_elem, 0, _tao_env)" << be_nl + << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl + << "{" << be_idt_nl + << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), " + << "_tao_elem, 1, _tao_env);" + << be_nl + << " return 1;" << be_uidt_nl + << "}" << be_nl + << "else" << be_nl // decode failed + << "{" << be_idt_nl + << "delete _tao_elem;" << be_nl + << "return 0;" << be_uidt_nl + << "}" << be_uidt_nl + << "}" << be_nl + << "else" << be_nl // else any does not own the data + << "{" << be_idt_nl + << "_tao_elem = (" << node->name () << " *)_tao_any.value ();" + << be_nl + << "return 1;" << be_uidt_nl + << "}" << be_uidt_nl + << "}\n\n"; + + + // all we have to do is to visit the scope and generate code + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_exception::visit_exception - " + "codegen for scope failed\n"), -1); + } + + node->cli_stub_any_op_gen (1); + return 0; +} + +int +be_visitor_exception_any_op_cs::visit_field (be_field *node) +{ + be_type *bt; // field's type + + // 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_exception_any_op_cs::" + "visit_field - " + "Bad field type\n" + ), -1); + } + + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_exception_any_op_cs::" + "visit_field - " + "codegen for field type failed\n" + ), -1); + } + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_exception/ctor_assign.cpp b/TAO/TAO_IDL/be/be_visitor_exception/ctor_assign.cpp new file mode 100644 index 00000000000..664e15fbea1 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_exception/ctor_assign.cpp @@ -0,0 +1,308 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// ctor_assign.cpp +// +// = DESCRIPTION +// Visitor generating code for the special CTOR and assignment operator for +// Exceptions. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_exception.h" + + +// ************************************************************************ +// used for the body of the assignment operator and the copy constructor +// ************************************************************************ + +be_visitor_exception_ctor_assign::be_visitor_exception_ctor_assign (be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_exception_ctor_assign::~be_visitor_exception_ctor_assign (void) +{ +} + +int be_visitor_exception_ctor_assign::visit_exception (be_exception *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + this->ctx_->node (node); // save the argument node + + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_exception_ctor_assign::" + "visit_exception - " + "codegen for scope failed\n"), + -1); + } + + return 0; +} + +int be_visitor_exception_ctor_assign::visit_field (be_field *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_exception_ctor_assign::" + "visit_field - " + "Bad field 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_exception_ctor_assign::" + "visit_field - " + "cannot accept visitor\n"), + -1); + } + + return 0; +} + +int be_visitor_exception_ctor_assign::visit_array (be_array *) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_decl *bd = this->ctx_->node (); + + os->indent (); + if (this->ctx_->exception ()) // special ctor + { + *os << "this->" << bd->local_name () << " = _tao_" << bd->local_name () + << ";\n"; + } + else + { + *os << "this->" << bd->local_name () << " = _tao_excp." << bd->local_name () + << ";\n"; + } + return 0; +} + +int be_visitor_exception_ctor_assign::visit_enum (be_enum *) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_decl *bd = this->ctx_->node (); + + os->indent (); + if (this->ctx_->exception ()) // special ctor + { + *os << "this->" << bd->local_name () << " = _tao_" << bd->local_name () + << ";\n"; + } + else + { + *os << "this->" << bd->local_name () << " = _tao_excp." << bd->local_name () + << ";\n"; + } + return 0; +} + +int be_visitor_exception_ctor_assign::visit_interface (be_interface *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_decl *bd = this->ctx_->node (); + + os->indent (); + if (this->ctx_->exception ()) // special ctor + { + *os << "this->" << bd->local_name () << " = " << node->name () + << "::_duplicate (_tao_" << bd->local_name () << ");\n"; + } + else + { + *os << "this->" << bd->local_name () << " = " << node->name () + << "::_duplicate (_tao_excp." << bd->local_name () << ".in ());\n"; + } + return 0; +} + +int be_visitor_exception_ctor_assign::visit_interface_fwd (be_interface_fwd *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_decl *bd = this->ctx_->node (); + + os->indent (); + if (this->ctx_->exception ()) // special ctor + { + *os << "this->" << bd->local_name () << " = " << node->name () + << "::_duplicate (_tao_" << bd->local_name () << ");\n"; + } + else + { + *os << "this->" << bd->local_name () << " = " << node->name () + << "::_duplicate (_tao_excp." << bd->local_name () << ".in ());\n"; + } + return 0; +} + +int be_visitor_exception_ctor_assign::visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_decl *bd = this->ctx_->node (); + + os->indent (); + // check if the type is an any + if (node->pt () == AST_PredefinedType::PT_any) + { + if (this->ctx_->exception ()) // special ctor + { + *os << "this->" << bd->local_name () << " = _tao_" + << bd->local_name () << ";\n"; + } + else + { + *os << "this->" << bd->local_name () << " = _tao_excp." + << bd->local_name () << ";\n"; + } + } // end of if + else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object + { + if (this->ctx_->exception ()) // special ctor + { + *os << "this->" << bd->local_name () << " = " + << node->name () << "::_duplicate (_tao_" + << bd->local_name () << ");\n"; + } + else + { + *os << "this->" << bd->local_name () << " = " + << node->name () << "::_duplicate (_tao_excp." + << bd->local_name () << ".in ());\n"; + } + } // end else if + else // simple predefined types + { + if (this->ctx_->exception ()) // special ctor + { + *os << "this->" << bd->local_name () << " = _tao_" + << bd->local_name () << ";\n"; + } + else + { + *os << "this->" << bd->local_name () << " = _tao_excp." + << bd->local_name () << ";\n"; + } + } // end of else + + return 0; +} + +int be_visitor_exception_ctor_assign::visit_sequence (be_sequence *) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_decl *bd = this->ctx_->node (); + + os->indent (); + if (this->ctx_->exception ()) // special ctor + { + *os << "this->" << bd->local_name () << " = _tao_" << bd->local_name () + << ";\n"; + } + else + { + *os << "this->" << bd->local_name () << " = _tao_excp." << bd->local_name () + << ";\n"; + } + return 0; +} + +int be_visitor_exception_ctor_assign::visit_string (be_string *) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_decl *bd = this->ctx_->node (); + + os->indent (); + if (this->ctx_->exception ()) // special ctor + { + *os << "this->" << bd->local_name () << " = CORBA::string_dup (_tao_" + << bd->local_name () << ");\n"; + } + else + { + *os << "this->" << bd->local_name () + << " = CORBA::string_dup (_tao_excp." << bd->local_name () + << ".in ());\n"; + } + return 0; +} + +int be_visitor_exception_ctor_assign::visit_structure (be_structure *) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_decl *bd = this->ctx_->node (); + + os->indent (); + if (this->ctx_->exception ()) // special ctor + { + *os << "this->" << bd->local_name () << " = _tao_" << bd->local_name () + << ";\n"; + } + else + { + *os << "this->" << bd->local_name () << " = _tao_excp." << bd->local_name () + << ";\n"; + } + return 0; +} + +int be_visitor_exception_ctor_assign::visit_union (be_union *) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + be_decl *bd = this->ctx_->node (); + + os->indent (); + if (this->ctx_->exception ()) // special ctor + { + *os << "this->" << bd->local_name () << " = _tao_" << bd->local_name () + << ";\n"; + } + else + { + *os << "this->" << bd->local_name () << " = _tao_excp." << bd->local_name () + << ";\n"; + } + return 0; +} + +int be_visitor_exception_ctor_assign::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_exception_ctor_assign::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_exception/exception.cpp b/TAO/TAO_IDL/be/be_visitor_exception/exception.cpp new file mode 100644 index 00000000000..f0a0b46d072 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_exception/exception.cpp @@ -0,0 +1,100 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// .cpp +// +// = DESCRIPTION +// Generic visitor generating code for Exceptions. +// +// = 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_EXCEPTION_CH: + ctx.state (TAO_CodeGen::TAO_FIELD_CH); + break; + case TAO_CodeGen::TAO_EXCEPTION_CI: + ctx.state (TAO_CodeGen::TAO_FIELD_CI); + break; + case TAO_CodeGen::TAO_EXCEPTION_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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp b/TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp new file mode 100644 index 00000000000..97548360d12 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp @@ -0,0 +1,140 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// exception_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for Exception in the client header +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_exception.h" + + +// ****************************************************** +// 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 () && !node->imported ()) // not already generated and + // not imported + { + os = this->ctx_->stream (); + + os->gen_ifdef_macro (node->flatname (), "_ptr"); + + os->indent (); + *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 (); + + os->gen_ifdef_macro (node->flatname ()); + + os->indent (); + *os << "class " << idl_global->export_macro () + << " " << node->local_name () + << " : public CORBA::UserException" << be_nl; + *os << "{" << be_nl + << "public:\n"; + os->incr_indent (); + // constructors and destructor + *os << node->local_name () << " (void); // default ctor" << be_nl; + *os << node->local_name () << " (const " << node->local_name () + << " &); // copy ctor" << be_nl; + *os << "~" << node->local_name () << " (void); // dtor" << be_nl; + + // generate constructor that takes each member as a parameter. We need a + // new state. Such a constructor exists if we have members + if (node->member_count () > 0) + { + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_CH); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + + if (!visitor || (node->accept (visitor) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_exception::" + "visit_exception - " + "codegen for ctor failed\n"), -1); + } + delete visitor; + } + + os->indent (); + // assignment operator + *os << node->local_name () << " &operator= (const " + << node->local_name () << " &);" << be_nl; + // the static _narrow method + *os << "static " << node->local_name () + << " *_narrow (CORBA::Exception *);\n"; + + // 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); + } + + // generate the static *_alloc method + os->indent (); + // this is TAO extension + *os << "// the alloc method. This is TAO extension" << be_nl; + *os << "static CORBA::Exception *_alloc (void);" << be_uidt_nl; + *os << "}; // exception " << node->name () << be_nl; + + // by using a visitor to declare and define the TypeCode, we have the + // added advantage to conditionally not generate any code. This will be + // based on the command line options. This is still TO-DO + be_visitor *visitor; + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_exception_ch::" + "visit_exception - " + "TypeCode declaration failed\n" + ), -1); + } + + + os->gen_endif (); + + node->cli_hdr_gen (1); + + } + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_exception/exception_ci.cpp b/TAO/TAO_IDL/be/be_visitor_exception/exception_ci.cpp new file mode 100644 index 00000000000..19366da8a13 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_exception/exception_ci.cpp @@ -0,0 +1,67 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// exception_ci.cpp +// +// = DESCRIPTION +// Visitor generating code for Exception in the inline file. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_exception.h" + + +// ****************************************************** +// 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) +{ + TAO_OutStream *os = this->ctx_->stream (); // output stream + + if (!node->cli_inline_gen () && !node->imported ()) + { + os = this->ctx_->stream (); + os->indent (); + *os << "// *************************************************************" + << be_nl; + *os << "// Inline operations for exception " << node->name () << be_nl; + *os << "// *************************************************************\n\n"; + + // generate inline code required of any anonymous types of members + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_exception::" + "visit_exception -" + "code for inline failed\n"), -1); + } + + node->cli_inline_gen (I_TRUE); + } + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp b/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp new file mode 100644 index 00000000000..febb0f9329b --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp @@ -0,0 +1,204 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// exception_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for Exception in the stubs file +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_exception.h" + + +// *************************************************************************** +// 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 () && !node->imported ()) + { + os = this->ctx_->stream (); + + // default constructor + os->indent (); + *os << "// default constructor" << be_nl; + *os << node->name () << "::" << node->local_name () << " (void)" << be_nl; + *os << " : CORBA_UserException (" + << node->tc_name () << ")\n"; + *os << "{" << be_nl; + *os << "}\n\n"; + + // destructor + os->indent (); + *os << "// destructor - all members are of self managing types" << be_nl; + *os << node->name () << "::~" << node->local_name () << " (void)" << be_nl; + *os << "{" << be_nl; + *os << "}\n\n"; + + // copy constructor + os->indent (); + *os << "// copy constructor" << be_nl; + *os << node->name () << "::" << node->local_name () << " (const " << + node->name () << " &_tao_excp)" << be_nl; + *os << " :CORBA_UserException (" << + "_tao_excp._type ())" << be_nl; + *os << "{\n"; + os->incr_indent (); + // assign each individual member + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_exception_cs::" + "visit_exception -" + "codegen for scope failed\n"), -1); + } + delete visitor; + os->decr_indent (); + *os << "}\n\n"; + + // assignment operator + os->indent (); + *os << "// assignment operator" << be_nl; + *os << node->name () << "&" << be_nl; + *os << node->name () << "::operator= (const " << + node->name () << " &_tao_excp)" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "this->ACE_CORBA_1 (UserException)::operator= " << + "(_tao_excp._type ());\n"; + // assign each individual member + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_exception_cs::" + "visit_exception -" + "codegen for scope failed\n"), -1); + } + delete visitor; + os->indent (); + *os << "return *this;\n"; + os->decr_indent (); + *os << "}\n\n"; + + // constructor taking all members. It exists only if there are any + // members + if (node->member_count () > 0) + { + // generate the signature + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_CS); + visitor = tao_cg->make_visitor (&ctx); + + if (!visitor || (node->accept (visitor) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_exception::" + "visit_exception - " + "codegen for ctor failed\n"), -1); + } + delete visitor; + + *os << " : CORBA_UserException " + << " (CORBA::TypeCode::_duplicate (" << node->tc_name () + << "))" << be_nl; + *os << "{\n"; + os->incr_indent (); + // assign each individual member. We need yet another state + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS); + ctx.exception (1); // indicate that the special ctor is being + // generated + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_exception_cs::" + "visit_exception -" + "codegen for scope failed\n"), -1); + } + delete visitor; + os->decr_indent (); + *os << "}\n\n"; + } + + // narrow method + os->indent (); + *os << "// narrow" << be_nl; + *os << node->name () << "_ptr " << be_nl; + *os << node->name () << "::_narrow (CORBA::Exception *exc)" << be_nl; + *os << "{\n"; + os->incr_indent (); + *os << "if (!ACE_OS::strcmp (\"" << node->repoID () << + "\", exc->_id ())) // same type" << be_nl; + *os << " return ACE_dynamic_cast (" << node->name () << "_ptr, exc);" << + be_nl; + *os << "else" << be_nl; + *os << " return 0;\n"; + os->decr_indent (); + *os << "}\n\n"; + + // generate the _alloc method + os->indent (); + *os << "// TAO extension - the _alloc method" << be_nl; + *os << "CORBA::Exception *" << node->name () + << "::_alloc (void)" << be_nl; + *os << "{" << be_idt_nl; + *os << "return new " << node->name () << ";" << be_uidt_nl; + *os << "}\n\n"; + + // by using a visitor to declare and define the TypeCode, we have the + // added advantage to conditionally not generate any code. This will be + // based on the command line options. This is still TO-DO + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_exception_cs::" + "visit_exception - " + "TypeCode definition failed\n" + ), -1); + } + + node->cli_stub_gen (I_TRUE); + } + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_exception/exception_ctor.cpp b/TAO/TAO_IDL/be/be_visitor_exception/exception_ctor.cpp new file mode 100644 index 00000000000..6d026158f80 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_exception/exception_ctor.cpp @@ -0,0 +1,300 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// exception_ctor.cpp +// +// = DESCRIPTION +// Visitor generating code for the special constructor for Exceptions +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_exception.h" + + +// ************************************************************************ +// code to generate the special ctor +// ************************************************************************ + +be_visitor_exception_ctor::be_visitor_exception_ctor +(be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_exception_ctor::~be_visitor_exception_ctor (void) +{ +} + +int +be_visitor_exception_ctor::post_process (void) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + *os << ",\n"; + return 0; +} + +int be_visitor_exception_ctor::visit_exception (be_exception *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + this->ctx_->node (node); // save the argument node + + if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) + *os << node->local_name (); + else + *os << node->name () << "::" << node->local_name (); + *os << "(" << be_idt << "\n"; + + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_exception_ctor_assign::" + "visit_exception - " + "codegen for scope failed\n"), + -1); + } + + if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) + *os << be_uidt << ");\n\n"; + else + *os << be_uidt << ")\n\n"; + + return 0; +} + +int be_visitor_exception_ctor::visit_field (be_field *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + // retrieve the type + be_type *bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_exception_ctor::" + "visit_exception - " + "Bad field type\n"), + -1); + } + + os->indent (); + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_exception_ctor::" + "visit_field - " + "cannot accept visitor\n"), + -1); + } + + *os << " _tao_" << node->local_name (); + return 0; +} + +int be_visitor_exception_ctor::visit_array (be_array *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + // set the right type; + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) + *os << "const " << bt->nested_type_name (this->ctx_->scope ()); + else + *os << "const " << bt->name (); + return 0; +} + +int be_visitor_exception_ctor::visit_enum (be_enum *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + // set the right type; + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) + *os << bt->nested_type_name (this->ctx_->scope ()); + else + *os << bt->name (); + return 0; +} + +int be_visitor_exception_ctor::visit_interface (be_interface *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + // set the right type; + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) + *os << "const " << bt->nested_type_name (this->ctx_->scope ()); + else + *os << "const " << bt->name (); + *os << "_ptr "; + return 0; +} + +int be_visitor_exception_ctor::visit_interface_fwd (be_interface_fwd *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + // set the right type; + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) + *os << "const " << bt->nested_type_name (this->ctx_->scope ()); + else + *os << "const " << bt->name (); + *os << "_ptr "; + return 0; +} + +int be_visitor_exception_ctor::visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + // set the right type; + 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) + { + if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) + *os << "const " << bt->nested_type_name (this->ctx_->scope ()); + else + *os << "const " << bt->name (); + *os << " &"; + return 0; + } // end of if + else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object + { + if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) + *os << "const " << bt->nested_type_name (this->ctx_->scope ()); + else + *os << "const " << bt->name (); + *os << "_ptr "; + } // end else if + else // simple predefined types + { + if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) + *os << bt->nested_type_name (this->ctx_->scope ()); + else + *os << bt->name (); + } // end of else + + return 0; +} + +int be_visitor_exception_ctor::visit_sequence (be_sequence *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + // set the right type; + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) + *os << "const " << bt->nested_type_name (this->ctx_->scope ()); + else + *os << "const " << bt->name (); + *os << " &"; + return 0; +} + +int be_visitor_exception_ctor::visit_string (be_string *) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + *os << "const char *"; + return 0; +} + +int be_visitor_exception_ctor::visit_structure (be_structure *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + // set the right type; + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) + *os << "const " << bt->nested_type_name (this->ctx_->scope ()); + else + *os << "const " << bt->name (); + *os << " &"; + return 0; +} + +int be_visitor_exception_ctor::visit_union (be_union *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + // set the right type; + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH) + *os << "const " << bt->nested_type_name (this->ctx_->scope ()); + else + *os << "const " << bt->name (); + *os << " &"; + return 0; +} + +int be_visitor_exception_ctor::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_exception_ctor::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_field.cpp b/TAO/TAO_IDL/be/be_visitor_field.cpp index 1eaa5ee04d7..4728ac23d5a 100644 --- a/TAO/TAO_IDL/be/be_visitor_field.cpp +++ b/TAO/TAO_IDL/be/be_visitor_field.cpp @@ -23,762 +23,7 @@ #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) -{ - // TO-DO - 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 - // set the right type; - if (this->ctx_->alias ()) - { - *os << this->ctx_->alias ()->nested_type_name (this->ctx_->scope ()) - << "_var"; - } - else - *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) -{ - 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); - } - this->ctx_->alias (0); - 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); - } - - this->ctx_->alias (0); - 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; -} - -int -be_visitor_field_cs::visit_sequence (be_sequence *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_SEQUENCE_CS); - be_visitor *visitor = tao_cg->make_visitor (&ctx); - if (!visitor) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_field_cs::" - "visit_sequence - " - "Bad visitor\n" - ), -1); - } - if (node->accept (visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_field_cs::" - "visit_sequence - " - "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); - } - - this->ctx_->alias (0); - 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; -} +// include all the individual files +#include "be_visitor_field/field_ch.cpp" +#include "be_visitor_field/field_ci.cpp" +#include "be_visitor_field/field_cs.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp b/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp new file mode 100644 index 00000000000..402da5bfe6c --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp @@ -0,0 +1,396 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// field_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for Field node in the client header +// +// = 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) +{ + // TO-DO + 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 + // set the right type; + if (this->ctx_->alias ()) + { + *os << this->ctx_->alias ()->nested_type_name (this->ctx_->scope ()) + << "_var"; + } + else + *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) +{ + 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); + } + this->ctx_->alias (0); + 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_field/field_ci.cpp b/TAO/TAO_IDL/be/be_visitor_field/field_ci.cpp new file mode 100644 index 00000000000..b926d660594 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_field/field_ci.cpp @@ -0,0 +1,189 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// field_ci.cpp +// +// = DESCRIPTION +// Visitor generating code for Field in the client inline file +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_field.h" + + +// ********************************************** +// 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); + } + + this->ctx_->alias (0); + 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_field/field_cs.cpp b/TAO/TAO_IDL/be/be_visitor_field/field_cs.cpp new file mode 100644 index 00000000000..9c2a196e05f --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_field/field_cs.cpp @@ -0,0 +1,253 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// field_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for Field in the client stubs file. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_field.h" + + +// ********************************************** +// 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; +} + +int +be_visitor_field_cs::visit_sequence (be_sequence *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_SEQUENCE_CS); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_cs::" + "visit_sequence - " + "Bad visitor\n" + ), -1); + } + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_cs::" + "visit_sequence - " + "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); + } + + this->ctx_->alias (0); + 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 55a6535cc44..a067928f0ec 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface.cpp @@ -22,2161 +22,17 @@ #include "be_visitor_interface.h" -// ****************************************************** -// 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_TIE_SH: - ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_TIE_SH); - break; - case TAO_CodeGen::TAO_INTERFACE_TIE_SI: - ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_TIE_SI); - break; - case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH: - case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS: - 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_ANY_OP_CH: - case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS: - 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: - case TAO_CodeGen::TAO_INTERFACE_TIE_SH: - case TAO_CodeGen::TAO_INTERFACE_TIE_SI: - 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_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_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: - case TAO_CodeGen::TAO_INTERFACE_TIE_SH: - case TAO_CodeGen::TAO_INTERFACE_TIE_SI: - 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_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_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: - case TAO_CodeGen::TAO_INTERFACE_TIE_SH: - case TAO_CodeGen::TAO_INTERFACE_TIE_SI: - 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_TIE_SH: - ctx.state (TAO_CodeGen::TAO_OPERATION_TIE_SH); - break; - case TAO_CodeGen::TAO_INTERFACE_TIE_SI: - ctx.state (TAO_CodeGen::TAO_OPERATION_TIE_SI); - break; - case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH: - case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS: - 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_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_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: - case TAO_CodeGen::TAO_INTERFACE_TIE_SH: - case TAO_CodeGen::TAO_INTERFACE_TIE_SI: - 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_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_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: - case TAO_CodeGen::TAO_INTERFACE_TIE_SH: - case TAO_CodeGen::TAO_INTERFACE_TIE_SI: - 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_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_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: - case TAO_CodeGen::TAO_INTERFACE_TIE_SH: - case TAO_CodeGen::TAO_INTERFACE_TIE_SI: - 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 () && !node->imported ()) // not already generated and - // not imported - { - - 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 " << idl_global->export_macro () - << " " << 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 - // Generate code that uses the macro. This is required to deal with - // the MSVC++ insanity - *os << " : public virtual ACE_CORBA_1 (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, " << be_idt << be_idt_nl - << "CORBA::Environment &env" << be_uidt_nl - << ");" << be_uidt_nl - << "virtual const char* " - << "_interface_repository_id (void) const;" << be_uidt_nl; - - // generate the "protected" constructor so that users cannot instantiate - // us - *os << "protected:" << be_idt_nl - << node->local_name () << " (void); // default constructor" << be_nl - << node->local_name () - << " (STUB_Object *objref, " << be_idt << be_idt_nl - << "TAO_ServantBase *_tao_servant = 0, " << be_nl - << "CORBA::Boolean _tao_collocated = 0" << be_uidt_nl - << ");" << be_uidt_nl - << "virtual ~" << node->local_name () << " (void);" << be_uidt_nl; - - // 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 (); - - // by using a visitor to declare and define the TypeCode, we have the - // added advantage to conditionally not generate any code. This will be - // based on the command line options. This is still TO-DO - be_visitor *visitor; - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_ch::" - "visit_interface - " - "TypeCode declaration failed\n" - ), -1); - } - - - 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_interface_ci::~be_visitor_interface_ci (void) -{ -} - -int -be_visitor_interface_ci::visit_interface (be_interface *node) -{ - TAO_OutStream *os; // output stream - - if (node->cli_inline_gen () || node->imported ()) - return 0; - - 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 << " : 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 - - if (node->cli_stub_gen () || node->imported ()) - return 0; - - 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 ()" << be_idt << be_idt << be_idt_nl - << " || !obj->_servant()" << be_nl - << " || obj->_servant()->_downcast (\"" - << node->repoID () << "\") == 0" << be_uidt_nl - << ")" << be_uidt << be_uidt_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 *skel_name = node->full_skel_name (); - const char *coll_name = node->full_coll_name (); - assert (coll_name != 0); - - *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 << " return 1; // success using local knowledge\n"; - os->decr_indent (); - *os << "else" << be_nl; - *os << " return this->CORBA_Object::_is_a (value, env); // remote call\n"; - os->decr_indent (); - *os << "}\n\n"; - - os->indent (); - *os << "const char* " << node->name () - << "::_interface_repository_id (void) const" - << be_nl - << "{" << be_idt_nl - << "return \"" << node->repoID () << "\";" << be_uidt_nl - << "}\n\n"; - - // by using a visitor to declare and define the TypeCode, we have the - // added advantage to conditionally not generate any code. This will be - // based on the command line options. This is still TO-DO - be_visitor *visitor; - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_cs::" - "visit_interface - " - "TypeCode definition failed\n" - ), -1); - } - - - 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 - long i; // loop index - static char namebuf [NAMEBUFSIZE]; // holds the class name - - if (node->srv_hdr_gen () || node->imported ()) - return 0; - - 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 " << idl_global->export_macro () - << " " << 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); - } - - // generate the TIE class - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_INTERFACE_TIE_SH); - 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 TIE class failed\n"), - -1); - } - - *os << "\n"; - ctx.stream (tao_cg->server_template_header ()); - - 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 - - if (node->srv_inline_gen () || node->imported ()) - return 0; - - 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); - } - - // generate the TIE class - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_INTERFACE_TIE_SI); - ctx.stream (tao_cg->server_template_inline ()); - 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 TIE class 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 - - if (node->srv_skel_gen () || node->imported ()) - return 0; - - 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 &_tao_server_request, " << 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 << "static const TAO_Param_Data_Skel " << node->flatname () - << "_is_a_paramdata [] = " << be_nl; - *os << "{" << be_idt_nl; - *os << "{CORBA::_tc_boolean, 0, 0}," << be_nl; - *os << "{CORBA::_tc_string, CORBA::ARG_IN, 0}" << be_uidt_nl; - *os << "};" << be_nl; - *os << "static const TAO_Call_Data_Skel " << node->flatname () - << "_is_a_calldata = " << be_nl; - *os << "{\"_is_a\", 1, 2, " << node->flatname () << "_is_a_paramdata};" - << be_nl; - *os << "CORBA::Environment _tao_skel_environment;" << be_nl; - *os << node->full_skel_name () << "_ptr _tao_impl = (" - << node->full_skel_name () << "_ptr) _tao_object_reference;" - << be_nl; - *os << "CORBA::Boolean _tao_retval;" << be_nl; - *os << "char *_tao_value = 0;" << be_nl; - *os << "_tao_server_request.demarshal (" << be_idt_nl - << "_tao_environment, " << be_nl - << "&" << node->flatname () << "_is_a_calldata, " << be_nl - << "&_tao_retval, " << be_nl - << "&_tao_value" << be_uidt_nl - << ");" << be_nl; - *os << "if (_tao_environment.exception () != 0) return;" << be_nl; - *os << "_tao_retval = _tao_impl->_is_a (_tao_value, " - << "_tao_skel_environment);" << be_nl; - *os << "_tao_server_request.marshal (" << be_idt_nl - << "_tao_environment, " << be_nl - << "_tao_skel_environment," << be_nl - << "&" << node->flatname () << "_is_a_calldata, " << be_nl - << "&_tao_retval, " << be_nl - << "&_tao_value" << be_uidt_nl - << ");" << be_nl; - *os << "CORBA::string_free (_tao_value);" << be_uidt_nl; - *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 << "const char *opname = req.operation (); // 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 << " skel (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 << "," << 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 << "{" << be_nl; - *os << "public:\n"; - os->incr_indent (); - - *os << node->local_coll_name () << " (\n"; - - os->incr_indent (0); - os->incr_indent (); - - // 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. - *os << "POA_"; - } - - *os << node->local_name () << "_ptr " - << " servant," << be_nl; - - *os << "STUB_Object *stub\n"; - os->decr_indent (); - *os << ");\n"; - os->decr_indent (0); - - os->indent (); - if (!node->is_nested ()) - { - // The skeleton name is the outermost, we need to printout the - // POA_ prefix that goes with it. - *os << "POA_"; - } - *os << node->local_name () - << "_ptr _get_servant (void) const;" << 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_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); - } - - os->decr_indent (); - - *os << be_nl << "private:\n"; - os->incr_indent (); - if (!node->is_nested ()) - { - // The skeleton name is the outermost, we need to printout the - // POA_ prefix that goes with it. - *os << "POA_"; - } - *os << node->local_name () << "_ptr servant_;\n"; - os->decr_indent (); - *os << "};\n\n"; - - os->gen_endif (); - - return 0; -} - -// ************************************************************ -// be_visitor_interface_collacted_ss -// ************************************************************ - -be_visitor_interface_collocated_ss::be_visitor_interface_collocated_ss -(be_visitor_context *ctx) - : be_visitor_interface (ctx) -{ -} - -be_visitor_interface_collocated_ss::~be_visitor_interface_collocated_ss (void) -{ -} - -int be_visitor_interface_collocated_ss::visit_interface (be_interface *node) -{ - TAO_OutStream *os = tao_cg->server_skeletons (); - long i; - - this->ctx_->node (node); - - *os << node->full_coll_name () << "::" - << node->local_coll_name () << " (\n"; - - os->incr_indent (0); - os->incr_indent (); - *os << node->full_skel_name () << "_ptr " - << " servant," << be_nl; - - *os << "STUB_Object *stub\n"; - os->decr_indent (); - *os << ")\n"; - os->decr_indent (0); - - os->incr_indent (); - - if (node->is_nested ()) - { - be_decl* scope = - be_scope::narrow_from_scope (node->defined_in ())->decl (); - - *os << ": ACE_NESTED_CLASS (" - << scope->name () << "," - << node->local_name () - << ") ()," << be_nl; - } - else - { - *os << ": " << node->name () - << " ()," << be_nl; - } - - // @@ We should call the constructor for all base classes, since we - // are using multiple inheritance. - - if (node->traverse_inheritance_graph (be_interface::collocated_ctor_helper, os) - == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_interface_collocated_ss::" - "visit_interface - " - "codegen for base class ctor init failed\n"), - -1); - } - -#if 0 - if (node->n_inherits () > 0) - { - for (i = 0; i < node->n_inherits (); ++i) - { - be_interface* parent = - be_interface::narrow_from_decl (node->inherits()[i]); - if (parent->is_nested ()) - { - be_decl* scope = - be_scope::narrow_from_scope (parent->defined_in())->decl (); - - *os << " ACE_NESTED_CLASS (" - << "POA_" << scope->name () << "," - << parent->local_coll_name () - << ") (servant, stub)," << be_nl; - } - else - { - *os << " " << parent->full_coll_name () - << " (servant, stub)," << be_nl; - } - } - } -#endif - - *os << " CORBA_Object (stub, servant, CORBA::B_TRUE)," << be_nl - << " servant_ (servant)"; - - *os << "\n"; - os->decr_indent (); - *os << "{\n"; - *os << "}\n\n"; - - os->indent (); - *os << node->full_skel_name () << "_ptr " - << node->full_coll_name () << "::" - << "_get_servant (void) const\n" - << "{\n"; - os->incr_indent (); - *os << "return this->servant_;\n"; - os->decr_indent (); - *os << "}\n\n"; - - 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 - << ")" << be_uidt_nl - << "{" << be_idt_nl - << "return this->servant_->_is_a (" << be_idt << be_idt_nl - << "logical_type_id," << be_nl - << "_tao_environment" << be_uidt_nl - << ");" << 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); - } - - return 0; -} - -// *************************************************************************** -// Interface visitor for generating Any operator declarations in the client header -// *************************************************************************** - -be_visitor_interface_any_op_ch::be_visitor_interface_any_op_ch -(be_visitor_context *ctx) - : be_visitor_interface (ctx) -{ -} - -be_visitor_interface_any_op_ch::~be_visitor_interface_any_op_ch (void) -{ -} - -int -be_visitor_interface_any_op_ch::visit_interface (be_interface *node) -{ - if (node->cli_hdr_any_op_gen () || node->imported ()) - return 0; - - TAO_OutStream *os = tao_cg->client_header (); - - // generate the Any <<= and >>= operator declarations - os->indent (); - *os << "// Any operators for interface " << node->name () << be_nl; - *os << "void " << idl_global->export_macro () - << " operator<<= (CORBA::Any &, const " << node->name () - << " &); // copying version" << be_nl; - *os << "void " << idl_global->export_macro () - << " operator<<= (CORBA::Any &, " << node->name () - << "*); // noncopying version" << be_nl; - *os << "CORBA::Boolean " << idl_global->export_macro () - << " operator>>= (const CORBA::Any &, " - << node->name () << " *&);\n"; - - // all we have to do is to visit the scope and generate code - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface::visit_interface - " - "codegen for scope failed\n"), -1); - } - - node->cli_hdr_any_op_gen (1); - return 0; -} - -// *************************************************************************** -// Interface visitor for generating Any operator declarations in the client -// stubs file -// *************************************************************************** - -be_visitor_interface_any_op_cs::be_visitor_interface_any_op_cs -(be_visitor_context *ctx) - : be_visitor_interface (ctx) -{ -} - -be_visitor_interface_any_op_cs::~be_visitor_interface_any_op_cs (void) -{ -} - -int -be_visitor_interface_any_op_cs::visit_interface (be_interface *node) -{ - if (node->cli_stub_any_op_gen () || node->imported ()) - return 0; - - TAO_OutStream *os = tao_cg->client_stubs (); - - // generate the Any <<= and >>= operator declarations - // Any <<= and >>= operators - os->indent (); - *os << "void operator<<= (CORBA::Any &_tao_any, " - << node->name () << "_ptr _tao_elem) // copying" << be_nl - << "{" << be_idt_nl - << "CORBA::Environment _tao_env;" << be_nl - << "CORBA::Object_ptr *_tao_obj_ptr;" << be_nl - << "ACE_NEW (_tao_obj_ptr, CORBA::Object_ptr);" << be_nl - << "*_tao_obj_ptr = " << node->name () - << "::_duplicate (_tao_elem);" << be_nl - << "_tao_any.replace (" << node->tc_name () << ", " - << "_tao_obj_ptr, 1, _tao_env);" << be_uidt_nl - << "}" << be_nl; - - *os << "void operator<<= (CORBA::Any &_tao_any, " - << node->name () << "_ptr *_tao_elem) // non copying" << be_nl - << "{" << be_idt_nl - << "CORBA::Environment _tao_env;" << be_nl - << "_tao_any.replace (" << node->tc_name () << ", " - << "_tao_elem, 1, _tao_env); // consume it" << be_uidt_nl - << "}" << be_nl; - - *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, " - << node->name () << "_ptr &_tao_elem)" << be_nl - << "{" << be_idt_nl - << "CORBA::Environment _tao_env;" << be_nl - << "_tao_elem = " << node->name () << "::_nil ();" << be_nl - << "if (!_tao_any.type ()->equal (" << node->tc_name () - << ", _tao_env)) return 0; // not equal" << be_nl - << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());" - << be_nl - << "CORBA::Object_ptr *_tao_obj_ptr;" << be_nl - << "ACE_NEW_RETURN (_tao_obj_ptr, CORBA::Object_ptr, 0);" << be_nl - << "if (stream.decode (" << node->tc_name () - << ", _tao_obj_ptr, 0, _tao_env)" << be_nl - << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl - << "{" << be_idt_nl - << "_tao_elem = " << node->name () - << "::_narrow (*_tao_obj_ptr, _tao_env);" << be_nl - << "if (_tao_env.exception ()) return 0; // narrow failed" << be_nl - << "CORBA::release (*_tao_obj_ptr);" << be_nl - << "*_tao_obj_ptr = _tao_elem;" << be_nl - << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), " - << "_tao_obj_ptr, 1, _tao_env);" - << be_nl - << "if (_tao_env.exception ()) return 0; // narrow failed" << be_nl - << "return 1;" << be_uidt_nl - << "}" << be_nl - << "return 0; // failure" << be_uidt_nl - << "}\n\n"; - - - // all we have to do is to visit the scope and generate code - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface::visit_interface - " - "codegen for scope failed\n"), -1); - } - - node->cli_stub_any_op_gen (1); - return 0; -} - -// ************************************************************ -// Interface visitor for server header -// ************************************************************ - -be_visitor_interface_tie_sh::be_visitor_interface_tie_sh (be_visitor_context *ctx) - : be_visitor_interface (ctx) -{ -} - -be_visitor_interface_tie_sh::~be_visitor_interface_tie_sh (void) -{ -} - -int -be_visitor_interface_tie_sh::visit_interface (be_interface *node) -{ - TAO_OutStream *os; // output stream - static char namebuf [NAMEBUFSIZE]; // holds the class name - static char tiename [NAMEBUFSIZE]; // holds the tie name - - if (node->srv_hdr_gen () || node->imported ()) - return 0; - - ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE); - ACE_OS::memset (tiename, '\0', NAMEBUFSIZE); - - os = this->ctx_->stream (); - - // generate the skeleton class name which will be used to determine the TIE - // class name - - // 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 ()); - ACE_OS::sprintf (tiename, "POA_%s_tie", - node->local_name ()->get_string ()); - } - else - { - ACE_OS::sprintf (namebuf, "%s", node->local_name ()->get_string ()); - ACE_OS::sprintf (tiename, "%s_tie", - node->local_name ()->get_string ()); - } - - // now generate the class definition - os->indent (); // start with whatever indentation level we are at - - // Since templates nested inside of classes are broken on most C++ compilers, - // we generate code for this inside a conditional macro. The code is - // activated only if "namespaces" are supported on the platform - if (node->is_nested ()) - { - *os << "\n#if defined (ACE_HAS_USING_KEYWORD)" << be_nl; - } - - *os << "// TIE class: Refer to CORBA v2.2, Section 20.34.4" << be_nl; - *os << "template <class T>" << be_nl; - *os << "class " << idl_global->export_macro () - << " " << tiename << " : public " << namebuf << be_nl; - *os << "{" << be_nl - << "public:" << be_idt_nl - << tiename << " (T &t);" << be_nl - << "// the T& ctor" << be_nl - << tiename << " (T &t, PortableServer::POA_ptr poa);" << be_nl - << "// ctor taking a POA" << be_nl - << tiename << " (T *tp, CORBA::Boolean release=1);" << be_nl - << "// ctor taking pointer and an ownership flag" << be_nl - << tiename << " (T *tp, PortableServer::POA_ptr poa, " - << "CORBA::Boolean release=1);" << be_nl - << "// ctor with T*, ownership flag and a POA" << be_nl - << "~" << tiename << " (void);" << be_nl - << "// dtor" << be_nl << be_nl - << "// TIE specific functions" << be_nl - << "T *_tied_object (void);" << be_nl - << "// return the underlying object" << be_nl - << "void _tied_object (T &obj);" << be_nl - << "// set the underlying object" << be_nl - << "void _tied_object (T *obj, CORBA::Boolean release=1);" << be_nl - << "// set the underlying object and the ownership flag" << be_nl - << "CORBA::Boolean _is_owner (void);" << be_nl - << "// do we own it" << be_nl - << "void _is_owner (CORBA::Boolean b);" << be_nl - << "// set the ownership" << be_nl << be_nl - << "// overridden ServantBase operations" << be_nl - << "PortableServer::POA_ptr _default_POA (CORBA::Environment &env);\n"; - - // generate code for the operations in the scope - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_interface_tie_sh::" - "visit_interface - " - "codegen for scope failed\n"), - -1); - } - - *os << be_uidt << "private:" << be_idt_nl - << "T *ptr_;" << be_nl - << "PortableServer::POA_var poa_;" << be_nl - << "CORBA::Boolean rel_;" << be_nl << be_nl - << "// copy and assignment are not allowed" << be_nl - << tiename << " (const " << tiename << " &);" << be_nl - << "void operator= (const " << tiename << " &);" << be_uidt_nl - << "};\n\n"; - - if (node->is_nested ()) - { - *os << "#endif /* ACE_HAS_USING_KEYWORD */\n"; - } - - return 0; -} - -// ************************************************************************ -// Interface visitor for server inline -// ************************************************************************ - -be_visitor_interface_tie_si::be_visitor_interface_tie_si (be_visitor_context *ctx) - : be_visitor_interface (ctx) -{ -} - -be_visitor_interface_tie_si::~be_visitor_interface_tie_si (void) -{ -} - -int -be_visitor_interface_tie_si::visit_interface (be_interface *node) -{ - TAO_OutStream *os; // output stream - static char fulltiename [NAMEBUFSIZE]; // holds the class name - static char localtiename [NAMEBUFSIZE]; // holds the tie name - - if (node->srv_inline_gen () || node->imported ()) - return 0; - - ACE_OS::memset (fulltiename, '\0', NAMEBUFSIZE); - ACE_OS::memset (localtiename, '\0', NAMEBUFSIZE); - - os = this->ctx_->stream (); - - // generate the skeleton class name which will be used to determine the TIE - // class name - - // we are outermost - ACE_OS::sprintf (fulltiename, "%s_tie", node->full_skel_name ()); - if (!node->is_nested ()) - { - ACE_OS::sprintf (localtiename, "POA_%s_tie", - node->local_name ()->get_string ()); - } - else - { - ACE_OS::sprintf (localtiename, "%s_tie", - node->local_name ()->get_string ()); - } - - if (node->is_nested ()) - { - *os << "\n#if defined (ACE_HAS_USING_KEYWORD)\n"; - } - - os->indent (); // start with whatever indentation level we are at - - *os << "template <class T> ACE_INLINE" << be_nl - << fulltiename << "<T>::" << localtiename << " (T &t)" << be_nl - << "\t: ptr_ (&t)," << be_nl - << "\t poa_ (PortableServer::POA::_nil ())," << be_nl - << "\t rel_ (0)" << be_nl - << "{}" << be_nl << be_nl; - - *os << "template <class T> ACE_INLINE" << be_nl - << fulltiename << "<T>::" << localtiename - << " (T &t, PortableServer::POA_ptr poa)" << be_nl - << "\t: ptr_ (&t)," << be_nl - << "\t poa_ (PortableServer::POA::_duplicate (poa))," << be_nl - << "\t rel_ (0)" << be_nl - << "{}" << be_nl << be_nl; - - *os << "template <class T> ACE_INLINE" << be_nl - << fulltiename << "<T>::" << localtiename - << " (T *tp, CORBA::Boolean release)" << be_nl - << "\t: ptr_ (tp)," << be_nl - << "\t poa_ (PortableServer::POA::_nil ())," << be_nl - << "\t rel_ (release)" << be_nl - << "{}" << be_nl << be_nl; - - *os << "template <class T> ACE_INLINE" << be_nl - << fulltiename << "<T>::" << localtiename - << " (T *tp, PortableServer::POA_ptr poa, CORBA::Boolean release)" - << be_nl - << "\t: ptr_ (tp)," << be_nl - << "\t poa_ (PortableServer::POA::_duplicate (poa))," << be_nl - << "\t rel_ (release)" << be_nl - << "{}" << be_nl << be_nl; - - *os << "template <class T> ACE_INLINE" << be_nl - << fulltiename << "<T>::~" << localtiename << " (void)" << be_nl - << "{" << be_idt_nl - << "CORBA::release (this->poa_);" << be_nl - << "if (this->rel_) delete this->ptr_;" << be_uidt_nl - << "}" << be_nl << be_nl; - - *os << "template <class T> ACE_INLINE T *" << be_nl - << fulltiename << "<T>::_tied_object (void)" << be_nl - << "{" << be_idt_nl - << "return this->ptr_;" << be_uidt_nl - << "}" << be_nl << be_nl; - - *os << "template <class T> ACE_INLINE void" << be_nl - << fulltiename << "<T>::_tied_object (T &obj)" << be_nl - << "{" << be_idt_nl - << "if (this->rel_) delete this->ptr_;" << be_nl - << "this->ptr_ = &obj;" << be_nl - << "this->rel_ = 0;" << be_uidt_nl - << "}" << be_nl << be_nl; - - *os << "template <class T> ACE_INLINE void" << be_nl - << fulltiename << "<T>::_tied_object (T *obj, " - << "CORBA::Boolean release)" << be_nl - << "{" << be_idt_nl - << "if (this->rel_) delete this->ptr_;" << be_nl - << "this->ptr_ = obj;" << be_nl - << "this->rel_ = release;" << be_uidt_nl - << "}" << be_nl << be_nl; - - *os << "template <class T> ACE_INLINE CORBA::Boolean" << be_nl - << fulltiename << "<T>::_is_owner (void)" << be_nl - << "{" << be_idt_nl - << "return this->rel_;" << be_uidt_nl - << "}" << be_nl << be_nl; - - *os << "template <class T> ACE_INLINE void" << be_nl - << fulltiename << "<T>::_is_owner (CORBA::Boolean b)" << be_nl - << "{" << be_idt_nl - << "this->rel_ = b;" << be_uidt_nl - << "}" << be_nl << be_nl; - - *os << "template <class T> ACE_INLINE " - << "PortableServer::POA_ptr" << be_nl - << fulltiename << "<T>::_default_POA (CORBA::Environment &env)" << be_nl - << "{" << be_idt_nl - << "if (!CORBA::is_nil (this->poa_.in ()))" << be_idt_nl - << "return PortableServer::POA::_duplicate (this->poa_.in ());" - << be_uidt_nl - << "else" << be_nl - << "{" << be_idt_nl - << "TAO_POA *poa = TAO_ORB_Core_instance ()->root_poa ();" << be_nl - << "PortableServer::POA_var result = poa->_this (env);" << be_nl - << "if (env.exception () != 0)" << be_idt_nl - << "return PortableServer::POA::_nil ();" << be_uidt_nl - << "else" << be_idt_nl - << "return result._retn ();" << be_uidt << be_uidt_nl - << "}" << be_uidt - << "}\n\n"; - - // generate code for the operations in the scope - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_interface_tie_si::" - "visit_interface - " - "codegen for scope failed\n"), - -1); - } - - if (node->is_nested ()) - { - *os << "#endif /* ACE_HAS_USING_KEYWORD */\n"; - } - - return 0; -} +// include all the individual files +#include "be_visitor_interface/any_op_ch.cpp" +#include "be_visitor_interface/any_op_cs.cpp" +#include "be_visitor_interface/collocated_sh.cpp" +#include "be_visitor_interface/collocated_ss.cpp" +#include "be_visitor_interface/interface.cpp" +#include "be_visitor_interface/interface_ch.cpp" +#include "be_visitor_interface/interface_ci.cpp" +#include "be_visitor_interface/interface_cs.cpp" +#include "be_visitor_interface/interface_sh.cpp" +#include "be_visitor_interface/interface_si.cpp" +#include "be_visitor_interface/interface_ss.cpp" +#include "be_visitor_interface/tie_sh.cpp" +#include "be_visitor_interface/tie_si.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_interface/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/any_op_ch.cpp new file mode 100644 index 00000000000..1c699cec8a5 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_interface/any_op_ch.cpp @@ -0,0 +1,74 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for Any operators for an Interface in the client +// header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_interface.h" + + +// *************************************************************************** +// Interface visitor for generating Any operator declarations in the client header +// *************************************************************************** + +be_visitor_interface_any_op_ch::be_visitor_interface_any_op_ch +(be_visitor_context *ctx) + : be_visitor_interface (ctx) +{ +} + +be_visitor_interface_any_op_ch::~be_visitor_interface_any_op_ch (void) +{ +} + +int +be_visitor_interface_any_op_ch::visit_interface (be_interface *node) +{ + if (node->cli_hdr_any_op_gen () || node->imported ()) + return 0; + + TAO_OutStream *os = tao_cg->client_header (); + + // generate the Any <<= and >>= operator declarations + os->indent (); + *os << "// Any operators for interface " << node->name () << be_nl; + *os << "void " << idl_global->export_macro () + << " operator<<= (CORBA::Any &, const " << node->name () + << " &); // copying version" << be_nl; + *os << "void " << idl_global->export_macro () + << " operator<<= (CORBA::Any &, " << node->name () + << "*); // noncopying version" << be_nl; + *os << "CORBA::Boolean " << idl_global->export_macro () + << " operator>>= (const CORBA::Any &, " + << node->name () << " *&);\n"; + + // all we have to do is to visit the scope and generate code + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::visit_interface - " + "codegen for scope failed\n"), -1); + } + + node->cli_hdr_any_op_gen (1); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp new file mode 100644 index 00000000000..0fd468600e8 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp @@ -0,0 +1,115 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for Any operators for Interface in the stubs +// file. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_interface.h" + + +// *************************************************************************** +// Interface visitor for generating Any operator declarations in the client +// stubs file +// *************************************************************************** + +be_visitor_interface_any_op_cs::be_visitor_interface_any_op_cs +(be_visitor_context *ctx) + : be_visitor_interface (ctx) +{ +} + +be_visitor_interface_any_op_cs::~be_visitor_interface_any_op_cs (void) +{ +} + +int +be_visitor_interface_any_op_cs::visit_interface (be_interface *node) +{ + if (node->cli_stub_any_op_gen () || node->imported ()) + return 0; + + TAO_OutStream *os = tao_cg->client_stubs (); + + // generate the Any <<= and >>= operator declarations + // Any <<= and >>= operators + os->indent (); + *os << "void operator<<= (CORBA::Any &_tao_any, " + << node->name () << "_ptr _tao_elem) // copying" << be_nl + << "{" << be_idt_nl + << "CORBA::Environment _tao_env;" << be_nl + << "CORBA::Object_ptr *_tao_obj_ptr;" << be_nl + << "ACE_NEW (_tao_obj_ptr, CORBA::Object_ptr);" << be_nl + << "*_tao_obj_ptr = " << node->name () + << "::_duplicate (_tao_elem);" << be_nl + << "_tao_any.replace (" << node->tc_name () << ", " + << "_tao_obj_ptr, 1, _tao_env);" << be_uidt_nl + << "}" << be_nl; + + *os << "void operator<<= (CORBA::Any &_tao_any, " + << node->name () << "_ptr *_tao_elem) // non copying" << be_nl + << "{" << be_idt_nl + << "CORBA::Environment _tao_env;" << be_nl + << "_tao_any.replace (" << node->tc_name () << ", " + << "_tao_elem, 1, _tao_env); // consume it" << be_uidt_nl + << "}" << be_nl; + + *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, " + << node->name () << "_ptr &_tao_elem)" << be_nl + << "{" << be_idt_nl + << "CORBA::Environment _tao_env;" << be_nl + << "_tao_elem = " << node->name () << "::_nil ();" << be_nl + << "if (!_tao_any.type ()->equal (" << node->tc_name () + << ", _tao_env)) return 0; // not equal" << be_nl + << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());" + << be_nl + << "CORBA::Object_ptr *_tao_obj_ptr;" << be_nl + << "ACE_NEW_RETURN (_tao_obj_ptr, CORBA::Object_ptr, 0);" << be_nl + << "if (stream.decode (" << node->tc_name () + << ", _tao_obj_ptr, 0, _tao_env)" << be_nl + << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl + << "{" << be_idt_nl + << "_tao_elem = " << node->name () + << "::_narrow (*_tao_obj_ptr, _tao_env);" << be_nl + << "if (_tao_env.exception ()) return 0; // narrow failed" << be_nl + << "CORBA::release (*_tao_obj_ptr);" << be_nl + << "*_tao_obj_ptr = _tao_elem;" << be_nl + << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), " + << "_tao_obj_ptr, 1, _tao_env);" + << be_nl + << "if (_tao_env.exception ()) return 0; // narrow failed" << be_nl + << "return 1;" << be_uidt_nl + << "}" << be_nl + << "return 0; // failure" << be_uidt_nl + << "}\n\n"; + + + // all we have to do is to visit the scope and generate code + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::visit_interface - " + "codegen for scope failed\n"), -1); + } + + node->cli_stub_any_op_gen (1); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_interface/collocated_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/collocated_sh.cpp new file mode 100644 index 00000000000..dbc6721bbe8 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_interface/collocated_sh.cpp @@ -0,0 +1,136 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// collocated_sh.cpp +// +// = DESCRIPTION +// Visitor generating code for collocated classes for the Interface node +// inside the server header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_interface.h" + + +// ************************************************************ +// 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 << "," << 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 << "{" << be_nl; + *os << "public:\n"; + os->incr_indent (); + + *os << node->local_coll_name () << " (\n"; + + os->incr_indent (0); + os->incr_indent (); + + // 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. + *os << "POA_"; + } + + *os << node->local_name () << "_ptr " + << " servant," << be_nl; + + *os << "STUB_Object *stub\n"; + os->decr_indent (); + *os << ");\n"; + os->decr_indent (0); + + os->indent (); + if (!node->is_nested ()) + { + // The skeleton name is the outermost, we need to printout the + // POA_ prefix that goes with it. + *os << "POA_"; + } + *os << node->local_name () + << "_ptr _get_servant (void) const;" << 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_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); + } + + os->decr_indent (); + + *os << be_nl << "private:\n"; + os->incr_indent (); + if (!node->is_nested ()) + { + // The skeleton name is the outermost, we need to printout the + // POA_ prefix that goes with it. + *os << "POA_"; + } + *os << node->local_name () << "_ptr servant_;\n"; + os->decr_indent (); + *os << "};\n\n"; + + os->gen_endif (); + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_interface/collocated_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/collocated_ss.cpp new file mode 100644 index 00000000000..46981deb762 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_interface/collocated_ss.cpp @@ -0,0 +1,161 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// collocated_ss.cpp +// +// = DESCRIPTION +// Visitor generating code for collocated classes for an Interface in the +// server skeleton file. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_interface.h" + + +// ************************************************************ +// be_visitor_interface_collacted_ss +// ************************************************************ + +be_visitor_interface_collocated_ss::be_visitor_interface_collocated_ss +(be_visitor_context *ctx) + : be_visitor_interface (ctx) +{ +} + +be_visitor_interface_collocated_ss::~be_visitor_interface_collocated_ss (void) +{ +} + +int be_visitor_interface_collocated_ss::visit_interface (be_interface *node) +{ + TAO_OutStream *os = tao_cg->server_skeletons (); + long i; + + this->ctx_->node (node); + + *os << node->full_coll_name () << "::" + << node->local_coll_name () << " (\n"; + + os->incr_indent (0); + os->incr_indent (); + *os << node->full_skel_name () << "_ptr " + << " servant," << be_nl; + + *os << "STUB_Object *stub\n"; + os->decr_indent (); + *os << ")\n"; + os->decr_indent (0); + + os->incr_indent (); + + if (node->is_nested ()) + { + be_decl* scope = + be_scope::narrow_from_scope (node->defined_in ())->decl (); + + *os << ": ACE_NESTED_CLASS (" + << scope->name () << "," + << node->local_name () + << ") ()," << be_nl; + } + else + { + *os << ": " << node->name () + << " ()," << be_nl; + } + + // @@ We should call the constructor for all base classes, since we + // are using multiple inheritance. + + if (node->traverse_inheritance_graph (be_interface::collocated_ctor_helper, os) + == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_collocated_ss::" + "visit_interface - " + "codegen for base class ctor init failed\n"), + -1); + } + +#if 0 + if (node->n_inherits () > 0) + { + for (i = 0; i < node->n_inherits (); ++i) + { + be_interface* parent = + be_interface::narrow_from_decl (node->inherits()[i]); + if (parent->is_nested ()) + { + be_decl* scope = + be_scope::narrow_from_scope (parent->defined_in())->decl (); + + *os << " ACE_NESTED_CLASS (" + << "POA_" << scope->name () << "," + << parent->local_coll_name () + << ") (servant, stub)," << be_nl; + } + else + { + *os << " " << parent->full_coll_name () + << " (servant, stub)," << be_nl; + } + } + } +#endif + + *os << " CORBA_Object (stub, servant, CORBA::B_TRUE)," << be_nl + << " servant_ (servant)"; + + *os << "\n"; + os->decr_indent (); + *os << "{\n"; + *os << "}\n\n"; + + os->indent (); + *os << node->full_skel_name () << "_ptr " + << node->full_coll_name () << "::" + << "_get_servant (void) const\n" + << "{\n"; + os->incr_indent (); + *os << "return this->servant_;\n"; + os->decr_indent (); + *os << "}\n\n"; + + 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 + << ")" << be_uidt_nl + << "{" << be_idt_nl + << "return this->servant_->_is_a (" << be_idt << be_idt_nl + << "logical_type_id," << be_nl + << "_tao_environment" << be_uidt_nl + << ");" << 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); + } + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp new file mode 100644 index 00000000000..a8d0f2cac6e --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp @@ -0,0 +1,632 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// interface.cpp +// +// = DESCRIPTION +// Visitor generating code for Interfaces. This is a generic visitor. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_interface.h" + +// ****************************************************** +// 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_TIE_SH: + ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_TIE_SH); + break; + case TAO_CodeGen::TAO_INTERFACE_TIE_SI: + ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_TIE_SI); + break; + case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH: + case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS: + 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_ANY_OP_CH: + case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS: + 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: + case TAO_CodeGen::TAO_INTERFACE_TIE_SH: + case TAO_CodeGen::TAO_INTERFACE_TIE_SI: + 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_ANY_OP_CH: + ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS: + ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_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: + case TAO_CodeGen::TAO_INTERFACE_TIE_SH: + case TAO_CodeGen::TAO_INTERFACE_TIE_SI: + 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_ANY_OP_CH: + ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS: + ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_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: + case TAO_CodeGen::TAO_INTERFACE_TIE_SH: + case TAO_CodeGen::TAO_INTERFACE_TIE_SI: + 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_TIE_SH: + ctx.state (TAO_CodeGen::TAO_OPERATION_TIE_SH); + break; + case TAO_CodeGen::TAO_INTERFACE_TIE_SI: + ctx.state (TAO_CodeGen::TAO_OPERATION_TIE_SI); + break; + case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH: + case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS: + 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_ANY_OP_CH: + ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS: + ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_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: + case TAO_CodeGen::TAO_INTERFACE_TIE_SH: + case TAO_CodeGen::TAO_INTERFACE_TIE_SI: + 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_ANY_OP_CH: + ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS: + ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_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: + case TAO_CodeGen::TAO_INTERFACE_TIE_SH: + case TAO_CodeGen::TAO_INTERFACE_TIE_SI: + 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_ANY_OP_CH: + ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS: + ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_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: + case TAO_CodeGen::TAO_INTERFACE_TIE_SH: + case TAO_CodeGen::TAO_INTERFACE_TIE_SI: + 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp new file mode 100644 index 00000000000..c45fb65d730 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp @@ -0,0 +1,214 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// interface_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for Interfaces in the client header +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_interface.h" + + +// ****************************************************** +// 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 () && !node->imported ()) // not already generated and + // not imported + { + + 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 " << idl_global->export_macro () + << " " << 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 + // Generate code that uses the macro. This is required to deal with + // the MSVC++ insanity + *os << " : public virtual ACE_CORBA_1 (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, " << be_idt << be_idt_nl + << "CORBA::Environment &env" << be_uidt_nl + << ");" << be_uidt_nl + << "virtual const char* " + << "_interface_repository_id (void) const;" << be_uidt_nl; + + // generate the "protected" constructor so that users cannot instantiate + // us + *os << "protected:" << be_idt_nl + << node->local_name () << " (void); // default constructor" << be_nl + << node->local_name () + << " (STUB_Object *objref, " << be_idt << be_idt_nl + << "TAO_ServantBase *_tao_servant = 0, " << be_nl + << "CORBA::Boolean _tao_collocated = 0" << be_uidt_nl + << ");" << be_uidt_nl + << "virtual ~" << node->local_name () << " (void);" << be_uidt_nl; + + // 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 (); + + // by using a visitor to declare and define the TypeCode, we have the + // added advantage to conditionally not generate any code. This will be + // based on the command line options. This is still TO-DO + be_visitor *visitor; + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface_ch::" + "visit_interface - " + "TypeCode declaration failed\n" + ), -1); + } + + + node->cli_hdr_gen (I_TRUE); + } // if !cli_hdr_gen + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp new file mode 100644 index 00000000000..b3fd272704d --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp @@ -0,0 +1,102 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// interface_ci.cpp +// +// = DESCRIPTION +// Visitor generating code for Interfaces in the client inline file +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_interface.h" + + +// ************************************************** +// Interface visitor for client inline +// ************************************************** +be_visitor_interface_ci::be_visitor_interface_ci (be_visitor_context *ctx) + : be_visitor_interface (ctx) +{ +} + +be_visitor_interface_ci::~be_visitor_interface_ci (void) +{ +} + +int +be_visitor_interface_ci::visit_interface (be_interface *node) +{ + TAO_OutStream *os; // output stream + + if (node->cli_inline_gen () || node->imported ()) + return 0; + + 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 << " : 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp new file mode 100644 index 00000000000..32e09f04cea --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp @@ -0,0 +1,181 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// interface_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for Interfaces in the client stubs file. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_interface.h" + + +// ************************************************************ +// 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 + + if (node->cli_stub_gen () || node->imported ()) + return 0; + + 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 ()" << be_idt << be_idt << be_idt_nl + << " || !obj->_servant()" << be_nl + << " || obj->_servant()->_downcast (\"" + << node->repoID () << "\") == 0" << be_uidt_nl + << ")" << be_uidt << be_uidt_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 *skel_name = node->full_skel_name (); + const char *coll_name = node->full_coll_name (); + assert (coll_name != 0); + + *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 << " return 1; // success using local knowledge\n"; + os->decr_indent (); + *os << "else" << be_nl; + *os << " return this->CORBA_Object::_is_a (value, env); // remote call\n"; + os->decr_indent (); + *os << "}\n\n"; + + os->indent (); + *os << "const char* " << node->name () + << "::_interface_repository_id (void) const" + << be_nl + << "{" << be_idt_nl + << "return \"" << node->repoID () << "\";" << be_uidt_nl + << "}\n\n"; + + // by using a visitor to declare and define the TypeCode, we have the + // added advantage to conditionally not generate any code. This will be + // based on the command line options. This is still TO-DO + be_visitor *visitor; + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface_cs::" + "visit_interface - " + "TypeCode definition failed\n" + ), -1); + } + + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp new file mode 100644 index 00000000000..e0fbd194310 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp @@ -0,0 +1,191 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// interface_sh.cpp +// +// = DESCRIPTION +// Visitor generating code for Interfaces in the server header +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_interface.h" + + +// ************************************************************ +// 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 + long i; // loop index + static char namebuf [NAMEBUFSIZE]; // holds the class name + + if (node->srv_hdr_gen () || node->imported ()) + return 0; + + 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 " << idl_global->export_macro () + << " " << 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); + } + + // generate the TIE class + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_INTERFACE_TIE_SH); + 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 TIE class failed\n"), + -1); + } + + *os << "\n"; + ctx.stream (tao_cg->server_template_header ()); + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp new file mode 100644 index 00000000000..64fe692d2ba --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp @@ -0,0 +1,81 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// interface_si.cpp +// +// = DESCRIPTION +// Visitor generating code for Interfaces in the server inline file +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_interface.h" + + +// ************************************************************************ +// 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 + + if (node->srv_inline_gen () || node->imported ()) + return 0; + + 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); + } + + // generate the TIE class + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_INTERFACE_TIE_SI); + ctx.stream (tao_cg->server_template_inline ()); + 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 TIE class failed\n"), + -1); + } + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp new file mode 100644 index 00000000000..021de9daeed --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp @@ -0,0 +1,285 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// interface_ss.cpp +// +// = DESCRIPTION +// Visitor generating code for Interfaces in the server skeletons file. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_interface.h" + + +// ************************************************************ +// 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 + + if (node->srv_skel_gen () || node->imported ()) + return 0; + + 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 &_tao_server_request, " << 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 << "static const TAO_Param_Data_Skel " << node->flatname () + << "_is_a_paramdata [] = " << be_nl; + *os << "{" << be_idt_nl; + *os << "{CORBA::_tc_boolean, 0, 0}," << be_nl; + *os << "{CORBA::_tc_string, CORBA::ARG_IN, 0}" << be_uidt_nl; + *os << "};" << be_nl; + *os << "static const TAO_Call_Data_Skel " << node->flatname () + << "_is_a_calldata = " << be_nl; + *os << "{\"_is_a\", 1, 2, " << node->flatname () << "_is_a_paramdata};" + << be_nl; + *os << "CORBA::Environment _tao_skel_environment;" << be_nl; + *os << node->full_skel_name () << "_ptr _tao_impl = (" + << node->full_skel_name () << "_ptr) _tao_object_reference;" + << be_nl; + *os << "CORBA::Boolean _tao_retval;" << be_nl; + *os << "char *_tao_value = 0;" << be_nl; + *os << "_tao_server_request.demarshal (" << be_idt_nl + << "_tao_environment, " << be_nl + << "&" << node->flatname () << "_is_a_calldata, " << be_nl + << "&_tao_retval, " << be_nl + << "&_tao_value" << be_uidt_nl + << ");" << be_nl; + *os << "if (_tao_environment.exception () != 0) return;" << be_nl; + *os << "_tao_retval = _tao_impl->_is_a (_tao_value, " + << "_tao_skel_environment);" << be_nl; + *os << "_tao_server_request.marshal (" << be_idt_nl + << "_tao_environment, " << be_nl + << "_tao_skel_environment," << be_nl + << "&" << node->flatname () << "_is_a_calldata, " << be_nl + << "&_tao_retval, " << be_nl + << "&_tao_value" << be_uidt_nl + << ");" << be_nl; + *os << "CORBA::string_free (_tao_value);" << be_uidt_nl; + *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 << "const char *opname = req.operation (); // 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 << " skel (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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_interface/tie_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/tie_sh.cpp new file mode 100644 index 00000000000..021309aee09 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_interface/tie_sh.cpp @@ -0,0 +1,142 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// tie_sh.cpp +// +// = DESCRIPTION +// Visitor generating code for TIE class for an Interface in the header +// file. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_interface.h" + + +// ************************************************************ +// Interface visitor for server header +// ************************************************************ + +be_visitor_interface_tie_sh::be_visitor_interface_tie_sh (be_visitor_context *ctx) + : be_visitor_interface (ctx) +{ +} + +be_visitor_interface_tie_sh::~be_visitor_interface_tie_sh (void) +{ +} + +int +be_visitor_interface_tie_sh::visit_interface (be_interface *node) +{ + TAO_OutStream *os; // output stream + static char namebuf [NAMEBUFSIZE]; // holds the class name + static char tiename [NAMEBUFSIZE]; // holds the tie name + + if (node->srv_hdr_gen () || node->imported ()) + return 0; + + ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE); + ACE_OS::memset (tiename, '\0', NAMEBUFSIZE); + + os = this->ctx_->stream (); + + // generate the skeleton class name which will be used to determine the TIE + // class name + + // 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 ()); + ACE_OS::sprintf (tiename, "POA_%s_tie", + node->local_name ()->get_string ()); + } + else + { + ACE_OS::sprintf (namebuf, "%s", node->local_name ()->get_string ()); + ACE_OS::sprintf (tiename, "%s_tie", + node->local_name ()->get_string ()); + } + + // now generate the class definition + os->indent (); // start with whatever indentation level we are at + + // Since templates nested inside of classes are broken on most C++ compilers, + // we generate code for this inside a conditional macro. The code is + // activated only if "namespaces" are supported on the platform + if (node->is_nested ()) + { + *os << "\n#if defined (ACE_HAS_USING_KEYWORD)" << be_nl; + } + + *os << "// TIE class: Refer to CORBA v2.2, Section 20.34.4" << be_nl; + *os << "template <class T>" << be_nl; + *os << "class " << idl_global->export_macro () + << " " << tiename << " : public " << namebuf << be_nl; + *os << "{" << be_nl + << "public:" << be_idt_nl + << tiename << " (T &t);" << be_nl + << "// the T& ctor" << be_nl + << tiename << " (T &t, PortableServer::POA_ptr poa);" << be_nl + << "// ctor taking a POA" << be_nl + << tiename << " (T *tp, CORBA::Boolean release=1);" << be_nl + << "// ctor taking pointer and an ownership flag" << be_nl + << tiename << " (T *tp, PortableServer::POA_ptr poa, " + << "CORBA::Boolean release=1);" << be_nl + << "// ctor with T*, ownership flag and a POA" << be_nl + << "~" << tiename << " (void);" << be_nl + << "// dtor" << be_nl << be_nl + << "// TIE specific functions" << be_nl + << "T *_tied_object (void);" << be_nl + << "// return the underlying object" << be_nl + << "void _tied_object (T &obj);" << be_nl + << "// set the underlying object" << be_nl + << "void _tied_object (T *obj, CORBA::Boolean release=1);" << be_nl + << "// set the underlying object and the ownership flag" << be_nl + << "CORBA::Boolean _is_owner (void);" << be_nl + << "// do we own it" << be_nl + << "void _is_owner (CORBA::Boolean b);" << be_nl + << "// set the ownership" << be_nl << be_nl + << "// overridden ServantBase operations" << be_nl + << "PortableServer::POA_ptr _default_POA (CORBA::Environment &env);\n"; + + // generate code for the operations in the scope + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_tie_sh::" + "visit_interface - " + "codegen for scope failed\n"), + -1); + } + + *os << be_uidt << "private:" << be_idt_nl + << "T *ptr_;" << be_nl + << "PortableServer::POA_var poa_;" << be_nl + << "CORBA::Boolean rel_;" << be_nl << be_nl + << "// copy and assignment are not allowed" << be_nl + << tiename << " (const " << tiename << " &);" << be_nl + << "void operator= (const " << tiename << " &);" << be_uidt_nl + << "};\n\n"; + + if (node->is_nested ()) + { + *os << "#endif /* ACE_HAS_USING_KEYWORD */\n"; + } + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_interface/tie_si.cpp b/TAO/TAO_IDL/be/be_visitor_interface/tie_si.cpp new file mode 100644 index 00000000000..15d17f4aba9 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_interface/tie_si.cpp @@ -0,0 +1,188 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// tie_si.cpp +// +// = DESCRIPTION +// Visitor generating code for TIE classes for the Interface node in the +// inline file. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_interface.h" + + +// ************************************************************************ +// Interface visitor for server inline +// ************************************************************************ + +be_visitor_interface_tie_si::be_visitor_interface_tie_si (be_visitor_context *ctx) + : be_visitor_interface (ctx) +{ +} + +be_visitor_interface_tie_si::~be_visitor_interface_tie_si (void) +{ +} + +int +be_visitor_interface_tie_si::visit_interface (be_interface *node) +{ + TAO_OutStream *os; // output stream + static char fulltiename [NAMEBUFSIZE]; // holds the class name + static char localtiename [NAMEBUFSIZE]; // holds the tie name + + if (node->srv_inline_gen () || node->imported ()) + return 0; + + ACE_OS::memset (fulltiename, '\0', NAMEBUFSIZE); + ACE_OS::memset (localtiename, '\0', NAMEBUFSIZE); + + os = this->ctx_->stream (); + + // generate the skeleton class name which will be used to determine the TIE + // class name + + // we are outermost + ACE_OS::sprintf (fulltiename, "%s_tie", node->full_skel_name ()); + if (!node->is_nested ()) + { + ACE_OS::sprintf (localtiename, "POA_%s_tie", + node->local_name ()->get_string ()); + } + else + { + ACE_OS::sprintf (localtiename, "%s_tie", + node->local_name ()->get_string ()); + } + + if (node->is_nested ()) + { + *os << "\n#if defined (ACE_HAS_USING_KEYWORD)\n"; + } + + os->indent (); // start with whatever indentation level we are at + + *os << "template <class T> ACE_INLINE" << be_nl + << fulltiename << "<T>::" << localtiename << " (T &t)" << be_nl + << "\t: ptr_ (&t)," << be_nl + << "\t poa_ (PortableServer::POA::_nil ())," << be_nl + << "\t rel_ (0)" << be_nl + << "{}" << be_nl << be_nl; + + *os << "template <class T> ACE_INLINE" << be_nl + << fulltiename << "<T>::" << localtiename + << " (T &t, PortableServer::POA_ptr poa)" << be_nl + << "\t: ptr_ (&t)," << be_nl + << "\t poa_ (PortableServer::POA::_duplicate (poa))," << be_nl + << "\t rel_ (0)" << be_nl + << "{}" << be_nl << be_nl; + + *os << "template <class T> ACE_INLINE" << be_nl + << fulltiename << "<T>::" << localtiename + << " (T *tp, CORBA::Boolean release)" << be_nl + << "\t: ptr_ (tp)," << be_nl + << "\t poa_ (PortableServer::POA::_nil ())," << be_nl + << "\t rel_ (release)" << be_nl + << "{}" << be_nl << be_nl; + + *os << "template <class T> ACE_INLINE" << be_nl + << fulltiename << "<T>::" << localtiename + << " (T *tp, PortableServer::POA_ptr poa, CORBA::Boolean release)" + << be_nl + << "\t: ptr_ (tp)," << be_nl + << "\t poa_ (PortableServer::POA::_duplicate (poa))," << be_nl + << "\t rel_ (release)" << be_nl + << "{}" << be_nl << be_nl; + + *os << "template <class T> ACE_INLINE" << be_nl + << fulltiename << "<T>::~" << localtiename << " (void)" << be_nl + << "{" << be_idt_nl + << "CORBA::release (this->poa_);" << be_nl + << "if (this->rel_) delete this->ptr_;" << be_uidt_nl + << "}" << be_nl << be_nl; + + *os << "template <class T> ACE_INLINE T *" << be_nl + << fulltiename << "<T>::_tied_object (void)" << be_nl + << "{" << be_idt_nl + << "return this->ptr_;" << be_uidt_nl + << "}" << be_nl << be_nl; + + *os << "template <class T> ACE_INLINE void" << be_nl + << fulltiename << "<T>::_tied_object (T &obj)" << be_nl + << "{" << be_idt_nl + << "if (this->rel_) delete this->ptr_;" << be_nl + << "this->ptr_ = &obj;" << be_nl + << "this->rel_ = 0;" << be_uidt_nl + << "}" << be_nl << be_nl; + + *os << "template <class T> ACE_INLINE void" << be_nl + << fulltiename << "<T>::_tied_object (T *obj, " + << "CORBA::Boolean release)" << be_nl + << "{" << be_idt_nl + << "if (this->rel_) delete this->ptr_;" << be_nl + << "this->ptr_ = obj;" << be_nl + << "this->rel_ = release;" << be_uidt_nl + << "}" << be_nl << be_nl; + + *os << "template <class T> ACE_INLINE CORBA::Boolean" << be_nl + << fulltiename << "<T>::_is_owner (void)" << be_nl + << "{" << be_idt_nl + << "return this->rel_;" << be_uidt_nl + << "}" << be_nl << be_nl; + + *os << "template <class T> ACE_INLINE void" << be_nl + << fulltiename << "<T>::_is_owner (CORBA::Boolean b)" << be_nl + << "{" << be_idt_nl + << "this->rel_ = b;" << be_uidt_nl + << "}" << be_nl << be_nl; + + *os << "template <class T> ACE_INLINE " + << "PortableServer::POA_ptr" << be_nl + << fulltiename << "<T>::_default_POA (CORBA::Environment &env)" << be_nl + << "{" << be_idt_nl + << "if (!CORBA::is_nil (this->poa_.in ()))" << be_idt_nl + << "return PortableServer::POA::_duplicate (this->poa_.in ());" + << be_uidt_nl + << "else" << be_nl + << "{" << be_idt_nl + << "TAO_POA *poa = TAO_ORB_Core_instance ()->root_poa ();" << be_nl + << "PortableServer::POA_var result = poa->_this (env);" << be_nl + << "if (env.exception () != 0)" << be_idt_nl + << "return PortableServer::POA::_nil ();" << be_uidt_nl + << "else" << be_idt_nl + << "return result._retn ();" << be_uidt << be_uidt_nl + << "}" << be_uidt + << "}\n\n"; + + // generate code for the operations in the scope + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_tie_si::" + "visit_interface - " + "codegen for scope failed\n"), + -1); + } + + if (node->is_nested ()) + { + *os << "#endif /* ACE_HAS_USING_KEYWORD */\n"; + } + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_interface_fwd.cpp b/TAO/TAO_IDL/be/be_visitor_interface_fwd.cpp index 3e9ce97d5cf..555cef07429 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface_fwd.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface_fwd.cpp @@ -24,123 +24,6 @@ #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 () && !node->imported ()) - { - 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 () && !node->imported ()) - { - - // 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; -} +// include all the individual files +#include "be_visitor_interface_fwd/interface_fwd_ch.cpp" +#include "be_visitor_interface_fwd/interface_fwd_ci.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_interface_fwd/interface_fwd_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface_fwd/interface_fwd_ch.cpp new file mode 100644 index 00000000000..0f3447f9b49 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_interface_fwd/interface_fwd_ch.cpp @@ -0,0 +1,94 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// interface_fwd_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for Interface_Fwd node in the client header. +// +// = 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 () && !node->imported ()) + { + 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_interface_fwd/interface_fwd_ci.cpp b/TAO/TAO_IDL/be/be_visitor_interface_fwd/interface_fwd_ci.cpp new file mode 100644 index 00000000000..a98a3c077b4 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_interface_fwd/interface_fwd_ci.cpp @@ -0,0 +1,78 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// interface_fwd_ci.cpp +// +// = DESCRIPTION +// Visitor generating code for Interface_Fwd node in the client inline. +// +// = 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 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 () && !node->imported ()) + { + + // 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 index 4f8e5c3a64d..01a7ea2a4fa 100644 --- a/TAO/TAO_IDL/be/be_visitor_module.cpp +++ b/TAO/TAO_IDL/be/be_visitor_module.cpp @@ -24,700 +24,8 @@ #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_ANY_OP_CH: - case TAO_CodeGen::TAO_MODULE_ANY_OP_CS: - 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_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_MODULE_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_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_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_MODULE_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_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; - case TAO_CodeGen::TAO_MODULE_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_MODULE_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS); - 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_ANY_OP_CH: - case TAO_CodeGen::TAO_MODULE_ANY_OP_CS: - 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_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_MODULE_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_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_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_MODULE_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_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_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_MODULE_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_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 - - if (!node->cli_hdr_gen () && !node->imported ()) - { - 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 << "TAO_NAMESPACE " // << idl_global->export_macro () - << " " << node->local_name () << be_nl - << "{\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 - - if (!node->srv_hdr_gen () && !node->imported ()) // not generated and not imported - { - 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 - *os << "TAO_NAMESPACE "; // << idl_global->export_macro () - - if (!node->is_nested ()) - // we are outermost module - *os << " POA_" << node->local_name () << be_nl; - else - // we are inside another module - *os << " " << node->local_name () << be_nl; - - *os << "{" << be_nl - << 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; - -} - -// *************************************************************************** -// Module visitor for generating Any operator declarations in the client header -// and stub -// *************************************************************************** - -be_visitor_module_any_op::be_visitor_module_any_op (be_visitor_context *ctx) - : be_visitor_module (ctx) -{ -} - -be_visitor_module_any_op::~be_visitor_module_any_op (void) -{ -} - -int -be_visitor_module_any_op::visit_module (be_module *node) -{ - // all we have to do is to visit the scope and generate code - 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; -} +// include all the individual files +#include "be_visitor_module/any_op.cpp" +#include "be_visitor_module/module.cpp" +#include "be_visitor_module/module_ch.cpp" +#include "be_visitor_module/module_sh.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_module/any_op.cpp b/TAO/TAO_IDL/be/be_visitor_module/any_op.cpp new file mode 100644 index 00000000000..19fb82922d0 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_module/any_op.cpp @@ -0,0 +1,54 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op.cpp +// +// = DESCRIPTION +// Visitor generating code for Any operators for elements in the scope of +// the Module. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_module.h" + + +// *************************************************************************** +// Module visitor for generating Any operator declarations in the client header +// and stub +// *************************************************************************** + +be_visitor_module_any_op::be_visitor_module_any_op (be_visitor_context *ctx) + : be_visitor_module (ctx) +{ +} + +be_visitor_module_any_op::~be_visitor_module_any_op (void) +{ +} + +int +be_visitor_module_any_op::visit_module (be_module *node) +{ + // all we have to do is to visit the scope and generate code + 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_module/module.cpp b/TAO/TAO_IDL/be/be_visitor_module/module.cpp new file mode 100644 index 00000000000..b746ee940c1 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_module/module.cpp @@ -0,0 +1,590 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// module.cpp +// +// = DESCRIPTION +// Generic visitor generating 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_ANY_OP_CH: + case TAO_CodeGen::TAO_MODULE_ANY_OP_CS: + 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_ANY_OP_CH: + ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_MODULE_ANY_OP_CS: + ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_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_ANY_OP_CH: + ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_MODULE_ANY_OP_CS: + ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_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; + case TAO_CodeGen::TAO_MODULE_ANY_OP_CH: + ctx.state (TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_MODULE_ANY_OP_CS: + ctx.state (TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS); + 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_ANY_OP_CH: + case TAO_CodeGen::TAO_MODULE_ANY_OP_CS: + 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_ANY_OP_CH: + ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_MODULE_ANY_OP_CS: + ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_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_ANY_OP_CH: + ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_MODULE_ANY_OP_CS: + ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_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_ANY_OP_CH: + ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_MODULE_ANY_OP_CS: + ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_module/module_ch.cpp b/TAO/TAO_IDL/be/be_visitor_module/module_ch.cpp new file mode 100644 index 00000000000..23d9590d06f --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_module/module_ch.cpp @@ -0,0 +1,78 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// module_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for Module in the client header +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_module.h" + + +// ****************************************************** +// 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 + + if (!node->cli_hdr_gen () && !node->imported ()) + { + 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 << "TAO_NAMESPACE " // << idl_global->export_macro () + << " " << node->local_name () << be_nl + << "{\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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_module/module_sh.cpp b/TAO/TAO_IDL/be/be_visitor_module/module_sh.cpp new file mode 100644 index 00000000000..0f658b199d1 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_module/module_sh.cpp @@ -0,0 +1,81 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// module_sh.cpp +// +// = DESCRIPTION +// Visitor generating code for Module in the server header +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_module.h" + + +// ************************************************************ +// 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 + + if (!node->srv_hdr_gen () && !node->imported ()) // not generated and not imported + { + 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 + *os << "TAO_NAMESPACE "; // << idl_global->export_macro () + + if (!node->is_nested ()) + // we are outermost module + *os << " POA_" << node->local_name () << be_nl; + else + // we are inside another module + *os << " " << node->local_name () << be_nl; + + *os << "{" << be_nl + << 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 index 4cf001bb6ef..c8c1c664aee 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation.cpp @@ -24,3407 +24,25 @@ #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 - be_visitor_context ctx; // visitor context - be_visitor *visitor; // visitor - - 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); - } - - // Generate the return type mapping (same as in the header file) - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_OTHERS); - 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; - - // Generate the operation name - *os << " " << node->name (); - - // 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; - - // 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); - - // 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 - - // Generate the TAO_Param_Data table - os->indent (); - *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"; - - // Check if this operation raises any exceptions. In that case, we must - // generate a list of exception typecodes. This is not valid for - // attributes - if (!this->ctx_->attribute ()) - { - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_EXCEPTLIST_CS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) " - "be_visitor_operation_cs::visit_operation - " - "Exceptionlist generation error\n"), - -1); - } - } - - // 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 - << "{" - << "\""; - // 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 () << "\", "; - - // 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, "; - - // insert exception list (if any) - node for attributes - if (this->ctx_->attribute ()) - *os << "0, 0};\n\n"; - else - { - if (node->exceptions ()) - { - *os << node->exceptions ()->length () - << ", _tao_" << node->flatname () << "_exceptiondata};\n\n"; - } - else - *os << "0, 0};\n\n"; - } - } // end of if !(native) - - // 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 - { - // Generate code that retrieves the underlying stub object and then - // invokes do_static_call on it. - *os << "STUB_Object *istub = this->stubobj (_tao_environment);" << be_nl - << "if (istub)" << be_nl - << "{\n"; - os->incr_indent (0); - - // do any pre do_static_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_static_call failed\n"), - -1); - } - - - // do any pre do_static_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_static_call failed\n"), - -1); - } - - // call do_static_call with appropriate number of arguments - os->indent (); - *os << "istub->do_static_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_static_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_static_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_static_call failed\n"), - -1); - } - - // end the do_static_call - *os << be_uidt_nl; - *os << ");\n"; - - // 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_static_call failed\n"), - -1); - } - - // 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_static_call failed\n"), - -1); - } - - } // end of if (!native) - - os->decr_indent (); - *os << "} // end of if (istub)\n"; - // 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); - } - - // 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); - } - - // 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; - - // 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; - - // 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 - - // 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_ss::" - "visit_operation - " - "visit scope failed\n"), - -1); - } - *os << "\n"; - os->decr_indent (); - *os << "}; // " << node->flatname () << "_paramdata\n\n"; - - // 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 - << "{" - << "\""; - // 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 () << "\", "; - - // 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"; - - os->indent (); - // declare an environment variable for user raised exceptions - *os << "CORBA::Environment _tao_skel_environment;" << be_nl; - // get the right object implementation. - *os << intf->full_skel_name () << " *_tao_impl = (" - << intf->full_skel_name () << " *)_tao_object_reference;\n"; - - // 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); - } - - // 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); - } - - - // 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"; - - // 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); - } - // 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_skel_environment"; - // end the upcall - *os << be_uidt_nl; - *os << ");\n"; - - // 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); - } - - // check if we are oneway in which case, we are done - if (node->flags () == AST_Operation::OP_oneway) - { - // we are done. Nothing else to do, except closing the function body. - os->decr_indent (); - *os << "}\n\n"; - return 0; - } - - // setup parameters for marshaling and marshal them into the - // outgoing stream - os->indent (); - *os << "_tao_server_request.marshal (" << be_idt_nl - << "_tao_environment, " << be_nl - << "_tao_skel_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"; - - // 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); - } - - // do any post processing for the arguments - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_POST_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_ss::" - "visit_operation - " - "codegen for args in post marshal 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_COLLOCATED_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 - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -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 - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_vardecl_cs::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -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_static_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 - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_pre_docall_cs::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -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_static_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 - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_docall_cs::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -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_static_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 - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_return_cs::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -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 () << "_var _tao_retval;\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 *) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - - os->indent (); - // due to the virtual inheritance and the fact that we will be passing the - // address of the objref to the marshaling routine, we use the base - // CORBA::Object_ptr as the type for the return value even though the actual - // return type may be some derived class - *os << "CORBA::Object_var _tao_retval = CORBA::Object::_nil ();" << be_nl; - *os << "CORBA::Object_ptr &_tao_ptr_retval = _tao_retval.out ();\n"; - return 0; -} - -int -be_visitor_operation_rettype_vardecl_ss:: -visit_interface_fwd (be_interface_fwd *) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - - os->indent (); - // due to the virtual inheritance and the fact that we will be passing the - // address of the objref to the marshaling routine, we use the base - // CORBA::Object_ptr as the type for the return value even though the actual - // return type may be some derived class - *os << "CORBA::Object_var _tao_retval = CORBA::Object::_nil ();" << be_nl; - *os << "CORBA::Object_ptr &_tao_ptr_retval = _tao_retval.out ();\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 () << "_var _tao_retval;" << be_nl; - *os << bt->name () << "_ptr &_tao_ptr_retval = _tao_retval.out ();\n"; - break; - case AST_PredefinedType::PT_any: - os->indent (); - *os << bt->name () << "_var _tao_retval;" << be_nl; - *os << bt->name () << "_ptr &_tao_ptr_retval = _tao_retval.out ();\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 () << "_var _tao_retval;" << be_nl; - *os << bt->name () << " *&_tao_ptr_retval = _tao_retval.out ();\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 << "CORBA::String_var _tao_retval;" << be_nl; - *os << "char *&_tao_ptr_retval = _tao_retval.out ();\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 () << "_var _tao_retval;" << be_nl; - *os << bt->name () << " *&_tao_ptr_retval = _tao_retval.out ();\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 - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_vardecl_ss::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -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 () << "_var _tao_retval;" << be_nl; - *os << bt->name () << " *&_tao_ptr_retval = _tao_retval.out ();\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_ptr_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_ptr_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_ptr_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: - os->indent (); - *os << "&_tao_ptr_retval"; - break; - case AST_PredefinedType::PT_any: - os->indent (); - *os << "_tao_ptr_retval"; - break; - 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_ptr_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_ptr_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_ptr_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 - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_marshal_ss::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -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_ptr_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 - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_assign_ss::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -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 *) -{ - return 0; -} - -int -be_visitor_operation_rettype_post_upcall_ss::visit_enum (be_enum *node) -{ - return 0; -} - -int -be_visitor_operation_rettype_post_upcall_ss::visit_interface (be_interface *node) -{ - return 0; -} - -int -be_visitor_operation_rettype_post_upcall_ss::visit_interface_fwd (be_interface_fwd *node) -{ - return 0; -} - -int -be_visitor_operation_rettype_post_upcall_ss::visit_predefined_type (be_predefined_type *node) -{ - return 0; -} - -int -be_visitor_operation_rettype_post_upcall_ss::visit_sequence (be_sequence *node) -{ - return 0; -} - -int -be_visitor_operation_rettype_post_upcall_ss::visit_string (be_string * /* node*/) -{ - return 0; -} - -int -be_visitor_operation_rettype_post_upcall_ss::visit_structure (be_structure *node) -{ - return 0; -} - -int -be_visitor_operation_rettype_post_upcall_ss::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); // set the alias node - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_post_upcall_ss::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -int -be_visitor_operation_rettype_post_upcall_ss::visit_union (be_union *node) -{ - return 0; -} - -// ************************************************************ -// generic operation visitor to handle the pre/post do_static_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_COLLOCATED_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_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_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_COLLOCATED_ARG_UPCALL_SS: - ctx.state (TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_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; - case TAO_CodeGen::TAO_OPERATION_ARG_POST_MARSHAL_SS: - ctx.state (TAO_CodeGen::TAO_ARGUMENT_POST_MARSHAL_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; -} - - -// **************************************************************************** -// visitor to generate the exception list for operations -// **************************************************************************** - -be_visitor_operation_exceptlist_cs::be_visitor_operation_exceptlist_cs (be_visitor_context - *ctx) - : be_visitor_decl (ctx) -{ -} - -be_visitor_operation_exceptlist_cs::~be_visitor_operation_exceptlist_cs (void) -{ -} - -int -be_visitor_operation_exceptlist_cs::visit_operation (be_operation *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - // don't do anything if the exception list is empty - if (node->exceptions ()) - { - os->indent (); -#if 0 - *os << "static CORBA::TypeCode_ptr " << "_tao_" << node->flatname () - << "_exceptlist [] = {" << be_idt_nl; -#endif - *os << "static TAO_Exception_Data " << "_tao_" << node->flatname () - << "_exceptiondata [] = " << be_nl; - *os << "{" << be_idt_nl; - // initialize an iterator to iterate thru the exception list - UTL_ExceptlistActiveIterator *ei; - ACE_NEW_RETURN (ei, - UTL_ExceptlistActiveIterator (node->exceptions ()), - -1); - // continue until each element is visited - while (!ei->is_done ()) - { - be_exception *excp = be_exception::narrow_from_decl (ei->item ()); - - if (excp == 0) - { - delete ei; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_exceptlist_cs" - "visit_operation - " - "codegen for scope failed\n"), -1); - - } - *os << "{"; - *os << excp->tc_name (); - *os << ", "; - *os << excp->name () << "::_alloc}"; - ei->next (); - if (!ei->is_done ()) - { - *os << ",\n"; - os->indent (); - } - // except the last one is processed? - - } // end of while loop - delete ei; - *os << be_uidt_nl << "};\n\n"; - } // end of if - return 0; -} - -// ************************************************************ -// Operation visitor for server header for TIE class operations -// ************************************************************ - -be_visitor_operation_tie_sh::be_visitor_operation_tie_sh (be_visitor_context *ctx) - : be_visitor_scope (ctx) -{ -} - -be_visitor_operation_tie_sh::~be_visitor_operation_tie_sh (void) -{ -} - -int -be_visitor_operation_tie_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 - - // 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_tie_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_tie_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_tie_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_; - // we use the _CH state here because the _SH state produces pure virtual - // methods. - ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_CH); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_tie_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_tie_sh::" - "visit_operation - " - "codegen for argument list failed\n"), - -1); - } - delete visitor; - return 0; -} - -// ************************************************************ -// Operation visitor for server inline for TIE class operations -// ************************************************************ - -be_visitor_operation_tie_si::be_visitor_operation_tie_si -(be_visitor_context *ctx) - : be_visitor_scope (ctx) -{ -} - -be_visitor_operation_tie_si::~be_visitor_operation_tie_si (void) -{ -} - -int be_visitor_operation_tie_si::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_tie_si::" - "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_tie_si::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - os->indent (); - *os << "template <class T> ACE_INLINE\n"; - - // 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_tie_si::" - "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_tie_si::" - "visit_operation - " - "codegen for return type failed\n"), - -1); - } - delete visitor; - - *os << " " << intf->full_skel_name () << "_tie<T>::" - << 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 for argument list\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->ptr_->" << 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; -} +// include all the individual files +#include "be_visitor_operation/arglist.cpp" +#include "be_visitor_operation/argument.cpp" +#include "be_visitor_operation/collocated_sh.cpp" +#include "be_visitor_operation/collocated_ss.cpp" +#include "be_visitor_operation/exceptlist_cs.cpp" +#include "be_visitor_operation/operation_ch.cpp" +#include "be_visitor_operation/operation_cs.cpp" +#include "be_visitor_operation/operation_sh.cpp" +#include "be_visitor_operation/operation_ss.cpp" +#include "be_visitor_operation/rettype.cpp" +#include "be_visitor_operation/rettype_assign_ss.cpp" +#include "be_visitor_operation/rettype_docall_cs.cpp" +#include "be_visitor_operation/rettype_marshal_ss.cpp" +#include "be_visitor_operation/rettype_post_docall_cs.cpp" +#include "be_visitor_operation/rettype_post_upcall_ss.cpp" +#include "be_visitor_operation/rettype_pre_docall_cs.cpp" +#include "be_visitor_operation/rettype_return_cs.cpp" +#include "be_visitor_operation/rettype_vardecl_cs.cpp" +#include "be_visitor_operation/rettype_vardecl_ss.cpp" +#include "be_visitor_operation/tie_sh.cpp" +#include "be_visitor_operation/tie_si.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp new file mode 100644 index 00000000000..e7c4c339dae --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp @@ -0,0 +1,167 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// arglist.cpp +// +// = DESCRIPTION +// Visitor generating code for the parameter list of the Operation signature. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_operation.h" + + +// ************************************************************ +// 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp b/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp new file mode 100644 index 00000000000..5f502360cb1 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp @@ -0,0 +1,184 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// argument.cpp +// +// = DESCRIPTION +// Visitor that calls the visitor for arguments. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_operation.h" + + +// ************************************************************ +// generic operation visitor to handle the pre/post do_static_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_COLLOCATED_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_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_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_COLLOCATED_ARG_UPCALL_SS: + ctx.state (TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_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; + case TAO_CodeGen::TAO_OPERATION_ARG_POST_MARSHAL_SS: + ctx.state (TAO_CodeGen::TAO_ARGUMENT_POST_MARSHAL_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_operation/collocated_sh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/collocated_sh.cpp new file mode 100644 index 00000000000..4493f5c6d5f --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/collocated_sh.cpp @@ -0,0 +1,122 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// collocated_sh.cpp +// +// = DESCRIPTION +// Visitor generating code for collocated operation in the server header +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_operation.h" + + +// ************************************************************************* +// 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/collocated_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/collocated_ss.cpp new file mode 100644 index 00000000000..e7a07aa7ce7 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/collocated_ss.cpp @@ -0,0 +1,163 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// collocated_ss.cpp +// +// = DESCRIPTION +// Visitor generating code for collocated Operation in the skeleton. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_operation.h" + + +// ************************************************************************* +// 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_COLLOCATED_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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp new file mode 100644 index 00000000000..671848b4fa9 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp @@ -0,0 +1,94 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// exceptlist_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for the list of exceptions that an operation +// raises. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_operation.h" + + +// **************************************************************************** +// visitor to generate the exception list for operations +// **************************************************************************** + +be_visitor_operation_exceptlist_cs::be_visitor_operation_exceptlist_cs (be_visitor_context + *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_operation_exceptlist_cs::~be_visitor_operation_exceptlist_cs (void) +{ +} + +int +be_visitor_operation_exceptlist_cs::visit_operation (be_operation *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + // don't do anything if the exception list is empty + if (node->exceptions ()) + { + os->indent (); +#if 0 + *os << "static CORBA::TypeCode_ptr " << "_tao_" << node->flatname () + << "_exceptlist [] = {" << be_idt_nl; +#endif + *os << "static TAO_Exception_Data " << "_tao_" << node->flatname () + << "_exceptiondata [] = " << be_nl; + *os << "{" << be_idt_nl; + // initialize an iterator to iterate thru the exception list + UTL_ExceptlistActiveIterator *ei; + ACE_NEW_RETURN (ei, + UTL_ExceptlistActiveIterator (node->exceptions ()), + -1); + // continue until each element is visited + while (!ei->is_done ()) + { + be_exception *excp = be_exception::narrow_from_decl (ei->item ()); + + if (excp == 0) + { + delete ei; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_exceptlist_cs" + "visit_operation - " + "codegen for scope failed\n"), -1); + + } + *os << "{"; + *os << excp->tc_name (); + *os << ", "; + *os << excp->name () << "::_alloc}"; + ei->next (); + if (!ei->is_done ()) + { + *os << ",\n"; + os->indent (); + } + // except the last one is processed? + + } // end of while loop + delete ei; + *os << be_uidt_nl << "};\n\n"; + } // end of if + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp new file mode 100644 index 00000000000..e86c9c4401b --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp @@ -0,0 +1,120 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// operation_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for Operation node in the client header. +// +// = 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp new file mode 100644 index 00000000000..e36e649fcf9 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp @@ -0,0 +1,461 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// operation_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for Operation in the stubs file. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_operation.h" + + +// ************************************************************ +// 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 + be_visitor_context ctx; // visitor context + be_visitor *visitor; // visitor + + 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); + } + + // Generate the return type mapping (same as in the header file) + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_OTHERS); + 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; + + // Generate the operation name + *os << " " << node->name (); + + // 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; + + // 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); + + // 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 + + // Generate the TAO_Param_Data table + os->indent (); + *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"; + + // Check if this operation raises any exceptions. In that case, we must + // generate a list of exception typecodes. This is not valid for + // attributes + if (!this->ctx_->attribute ()) + { + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_EXCEPTLIST_CS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) " + "be_visitor_operation_cs::visit_operation - " + "Exceptionlist generation error\n"), + -1); + } + } + + // 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 + << "{" + << "\""; + // 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 () << "\", "; + + // 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, "; + + // insert exception list (if any) - node for attributes + if (this->ctx_->attribute ()) + *os << "0, 0};\n\n"; + else + { + if (node->exceptions ()) + { + *os << node->exceptions ()->length () + << ", _tao_" << node->flatname () << "_exceptiondata};\n\n"; + } + else + *os << "0, 0};\n\n"; + } + } // end of if !(native) + + // 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 + { + // Generate code that retrieves the underlying stub object and then + // invokes do_static_call on it. + *os << "STUB_Object *istub = this->stubobj (_tao_environment);" << be_nl + << "if (istub)" << be_nl + << "{\n"; + os->incr_indent (0); + + // do any pre do_static_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_static_call failed\n"), + -1); + } + + + // do any pre do_static_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_static_call failed\n"), + -1); + } + + // call do_static_call with appropriate number of arguments + os->indent (); + *os << "istub->do_static_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_static_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_static_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_static_call failed\n"), + -1); + } + + // end the do_static_call + *os << be_uidt_nl; + *os << ");\n"; + + // 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_static_call failed\n"), + -1); + } + + // 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_static_call failed\n"), + -1); + } + + } // end of if (!native) + + os->decr_indent (); + *os << "} // end of if (istub)\n"; + // 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_sh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_sh.cpp new file mode 100644 index 00000000000..722f9fdf5f6 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_sh.cpp @@ -0,0 +1,144 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// operation_sh.cpp +// +// = DESCRIPTION +// Visitor generating code for Operation in the server header +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_operation.h" + + +// ************************************************************ +// 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp new file mode 100644 index 00000000000..85751032c22 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp @@ -0,0 +1,497 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// operation_ss.cpp +// +// = DESCRIPTION +// Visitor generating code for Operation in the server skeleton +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_operation.h" + + +// ************************************************************ +// 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); + } + + // 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); + } + + // 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; + + // 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; + + // 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 + + // 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_ss::" + "visit_operation - " + "visit scope failed\n"), + -1); + } + *os << "\n"; + os->decr_indent (); + *os << "}; // " << node->flatname () << "_paramdata\n\n"; + + // 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 + << "{" + << "\""; + // 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 () << "\", "; + + // 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"; + + os->indent (); + // declare an environment variable for user raised exceptions + *os << "CORBA::Environment _tao_skel_environment;" << be_nl; + // get the right object implementation. + *os << intf->full_skel_name () << " *_tao_impl = (" + << intf->full_skel_name () << " *)_tao_object_reference;\n"; + + // 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); + } + + // 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); + } + + + // 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"; + + // 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); + } + // 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_skel_environment"; + // end the upcall + *os << be_uidt_nl; + *os << ");\n"; + + // 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); + } + + // check if we are oneway in which case, we are done + if (node->flags () == AST_Operation::OP_oneway) + { + // we are done. Nothing else to do, except closing the function body. + os->decr_indent (); + *os << "}\n\n"; + return 0; + } + + // setup parameters for marshaling and marshal them into the + // outgoing stream + os->indent (); + *os << "_tao_server_request.marshal (" << be_idt_nl + << "_tao_environment, " << be_nl + << "_tao_skel_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"; + + // 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); + } + + // do any post processing for the arguments + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_POST_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_ss::" + "visit_operation - " + "codegen for args in post marshal 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp new file mode 100644 index 00000000000..66851c0b3fc --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp @@ -0,0 +1,257 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// rettype.cpp +// +// = DESCRIPTION +// Visitor generating code for return type of the Operation node +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_operation.h" + + +// **************************************************************************** +// 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 + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} + +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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_assign_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_assign_ss.cpp new file mode 100644 index 00000000000..217817b3c1d --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_assign_ss.cpp @@ -0,0 +1,166 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// rettype_assign_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for assigning the return value of upcall to the +// return type variable. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_operation.h" + + +// **************************************************************************** +// 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 + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_assign_ss::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} + +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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_docall_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_docall_cs.cpp new file mode 100644 index 00000000000..8ea3099c626 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_docall_cs.cpp @@ -0,0 +1,170 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// rettype_docall_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for passing the return type variable to the +// do_static_call method in the stub. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_operation.h" + + +// ***************************************************************************** +// be_visitor_operation_rettype_docall_cs +// +// This visitor generates code that passes the return type variable to the +// do_static_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 + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_docall_cs::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} + +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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_marshal_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_marshal_ss.cpp new file mode 100644 index 00000000000..c379584a560 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_marshal_ss.cpp @@ -0,0 +1,179 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// rettype_marshal_ss.cpp +// +// = DESCRIPTION +// Visitor generating code for marshaling the return type variable +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_operation.h" + + +// **************************************************************************** +// 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_ptr_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_ptr_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_ptr_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: + os->indent (); + *os << "&_tao_ptr_retval"; + break; + case AST_PredefinedType::PT_any: + os->indent (); + *os << "_tao_ptr_retval"; + break; + 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_ptr_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_ptr_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_ptr_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 + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_marshal_ss::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} + +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_ptr_retval"; + else + *os << "&_tao_retval"; + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_post_docall_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_post_docall_cs.cpp new file mode 100644 index 00000000000..a906fcfbd65 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_post_docall_cs.cpp @@ -0,0 +1,70 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// rettype_post_docall_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for return type post processing following a +// do_static_call. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_operation.h" + + +// ******************************************************************************* +// be_visitor_operation_rettype_post_docall_cs +// +// This visitor generates code that passes the return type variable to the +// do_static_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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_post_upcall_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_post_upcall_ss.cpp new file mode 100644 index 00000000000..909cdb9a7aa --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_post_upcall_ss.cpp @@ -0,0 +1,111 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// rettype_post_upcall_ss.cpp +// +// = DESCRIPTION +// Visitor generating code for post-processing of return type after an +// upcall is made +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_operation.h" + + +// **************************************************************************** +// 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 *) +{ + return 0; +} + +int +be_visitor_operation_rettype_post_upcall_ss::visit_enum (be_enum *node) +{ + return 0; +} + +int +be_visitor_operation_rettype_post_upcall_ss::visit_interface (be_interface *node) +{ + return 0; +} + +int +be_visitor_operation_rettype_post_upcall_ss::visit_interface_fwd (be_interface_fwd *node) +{ + return 0; +} + +int +be_visitor_operation_rettype_post_upcall_ss::visit_predefined_type (be_predefined_type *node) +{ + return 0; +} + +int +be_visitor_operation_rettype_post_upcall_ss::visit_sequence (be_sequence *node) +{ + return 0; +} + +int +be_visitor_operation_rettype_post_upcall_ss::visit_string (be_string * /* node*/) +{ + return 0; +} + +int +be_visitor_operation_rettype_post_upcall_ss::visit_structure (be_structure *node) +{ + return 0; +} + +int +be_visitor_operation_rettype_post_upcall_ss::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); // set the alias node + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_post_upcall_ss::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} + +int +be_visitor_operation_rettype_post_upcall_ss::visit_union (be_union *node) +{ + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_pre_docall_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_pre_docall_cs.cpp new file mode 100644 index 00000000000..73ac0632b3e --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_pre_docall_cs.cpp @@ -0,0 +1,148 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// rettype_pre_docall_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for doing any pre-processing of return type prior +// to making the do_static_call. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_operation.h" + + +// ***************************************************************************** +// be_visitor_operation_rettype_pre_docall_cs +// +// This visitor generates code that passes the return type variable to the +// do_static_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 *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + *os << "ACE_ALLOCATOR_RETURN (_tao_retval, " << node->name () + << "_alloc (), _tao_retval);\n"; + 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 + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_pre_docall_cs::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} + +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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_return_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_return_cs.cpp new file mode 100644 index 00000000000..72e59343e27 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_return_cs.cpp @@ -0,0 +1,158 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// rettype_return_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for returning the return type variable. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_operation.h" + + +// ************************************************************ +// 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 + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_return_cs::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} + +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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_cs.cpp new file mode 100644 index 00000000000..ac98bffcd56 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_cs.cpp @@ -0,0 +1,230 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// rettype_vardecl_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for return type variable declaration in the stubs. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_operation.h" + + +// ************************************************************ +// 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 + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_vardecl_cs::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} + +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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_ss.cpp new file mode 100644 index 00000000000..0f5abf1bea9 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_ss.cpp @@ -0,0 +1,236 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// rettype_vardecl_ss.cpp +// +// = DESCRIPTION +// Visitor generating code for return type variable declaration in the +// skeleton file. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_operation.h" + + +// ******************************************************************************** +// 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 () << "_var _tao_retval;" << be_nl; + *os << bt->name () << "_slice *&_tao_ptr_retval = _tao_retval.out ();\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 *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + // due to the virtual inheritance and the fact that we will be passing the + // address of the objref to the marshaling routine, we use the base + // CORBA::Object_ptr as the type for the return value even though the actual + // return type may be some derived class + *os << "CORBA::Object_var _tao_retval = CORBA::Object::_nil ();" << be_nl; + *os << "CORBA::Object_ptr &_tao_ptr_retval = _tao_retval.out ();\n"; + return 0; +} + +int +be_visitor_operation_rettype_vardecl_ss:: +visit_interface_fwd (be_interface_fwd *) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + os->indent (); + // due to the virtual inheritance and the fact that we will be passing the + // address of the objref to the marshaling routine, we use the base + // CORBA::Object_ptr as the type for the return value even though the actual + // return type may be some derived class + *os << "CORBA::Object_var _tao_retval = CORBA::Object::_nil ();" << be_nl; + *os << "CORBA::Object_ptr &_tao_ptr_retval = _tao_retval.out ();\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 () << "_var _tao_retval;" << be_nl; + *os << bt->name () << "_ptr &_tao_ptr_retval = _tao_retval.out ();\n"; + break; + case AST_PredefinedType::PT_any: + os->indent (); + *os << bt->name () << "_var _tao_retval;" << be_nl; + *os << bt->name () << "_ptr &_tao_ptr_retval = _tao_retval.out ();\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 () << "_var _tao_retval;" << be_nl; + *os << bt->name () << " *&_tao_ptr_retval = _tao_retval.out ();\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 << "CORBA::String_var _tao_retval;" << be_nl; + *os << "char *&_tao_ptr_retval = _tao_retval.out ();\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 () << "_var _tao_retval;" << be_nl; + *os << bt->name () << " *&_tao_ptr_retval = _tao_retval.out ();\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 + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_vardecl_ss::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} + +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 () << "_var _tao_retval;" << be_nl; + *os << bt->name () << " *&_tao_ptr_retval = _tao_retval.out ();\n"; + } + else + *os << bt->name () << " _tao_retval;\n"; + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/tie_sh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/tie_sh.cpp new file mode 100644 index 00000000000..5ec925ee3f5 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/tie_sh.cpp @@ -0,0 +1,119 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// tie_sh.cpp +// +// = DESCRIPTION +// Visitor generating code for operations of the TIE class in the header +// file. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_operation.h" + + +// ************************************************************ +// Operation visitor for server header for TIE class operations +// ************************************************************ + +be_visitor_operation_tie_sh::be_visitor_operation_tie_sh (be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_operation_tie_sh::~be_visitor_operation_tie_sh (void) +{ +} + +int +be_visitor_operation_tie_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 + + // 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_tie_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_tie_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_tie_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_; + // we use the _CH state here because the _SH state produces pure virtual + // methods. + ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_CH); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_tie_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_tie_sh::" + "visit_operation - " + "codegen for argument list failed\n"), + -1); + } + delete visitor; + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/tie_si.cpp b/TAO/TAO_IDL/be/be_visitor_operation/tie_si.cpp new file mode 100644 index 00000000000..53de27865e8 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/tie_si.cpp @@ -0,0 +1,164 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// tie_si.cpp +// +// = DESCRIPTION +// Visitor generating code for operations for the TIE class. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_operation.h" + + +// ************************************************************ +// Operation visitor for server inline for TIE class operations +// ************************************************************ + +be_visitor_operation_tie_si::be_visitor_operation_tie_si +(be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_operation_tie_si::~be_visitor_operation_tie_si (void) +{ +} + +int be_visitor_operation_tie_si::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_tie_si::" + "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_tie_si::" + "visit_operation - " + "Bad return type\n"), + -1); + } + + os->indent (); + *os << "template <class T> ACE_INLINE\n"; + + // 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_tie_si::" + "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_tie_si::" + "visit_operation - " + "codegen for return type failed\n"), + -1); + } + delete visitor; + + *os << " " << intf->full_skel_name () << "_tie<T>::" + << 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 for argument list\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->ptr_->" << 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_root.cpp b/TAO/TAO_IDL/be/be_visitor_root.cpp index 980109c42ae..e6c7c6c6c34 100644 --- a/TAO/TAO_IDL/be/be_visitor_root.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root.cpp @@ -21,960 +21,12 @@ #include "be.h" #include "be_visitor_root.h" -// Generic Root visitor -be_visitor_root::be_visitor_root (be_visitor_context *ctx) - : be_visitor_scope (ctx) -{ -} - -be_visitor_root::~be_visitor_root (void) -{ -} - -// this method must be overridden by the derived root visitors -int -be_visitor_root::init (void) -{ - return -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_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root::init - " - "failed to initialize context\n"), -1); - } - - // all we have to do is to visit the scope and generate code - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root::visit_root - " - "codegen for scope failed\n"), -1); - } - - // The last thing we need to do is make one more pass thru the entire tree - // and generate code for all the <<= and >>= operators for all the - // user-defined types. - // - // XXXASG - this part of the code may be conditionally generated because at - // times it is not necessary to have these operators at all. TO-DO. - be_visitor_context ctx (*this->ctx_); - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_ROOT_CH: - ctx.state (TAO_CodeGen::TAO_ROOT_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_ROOT_CS: - ctx.state (TAO_CodeGen::TAO_ROOT_ANY_OP_CS); - break; - case TAO_CodeGen::TAO_ROOT_SH: - (void) tao_cg->end_server_header (); - (void) tao_cg->end_server_template_header (); - return 0; - break; - case TAO_CodeGen::TAO_ROOT_CI: - case TAO_CodeGen::TAO_ROOT_SI: - return 0; // nothing to be done - case TAO_CodeGen::TAO_ROOT_SS: - (void) tao_cg->end_server_template_skeletons (); - 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_root - " - "NUL visitor\n" - ), -1); - } - - // generate the <<= and >>= operators for all the user-defined data types in - // the outermost scope - if (node->accept (visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root::" - "visit_root - " - "failed to generate Any operators\n" - ), -1); - } - delete visitor; - - // generate any final code such as #endifs - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_ROOT_CH: - (void) tao_cg->end_client_header (); - break; - default: - break; - } - return 0; -} - -// =all common visit methods for root visitor - -// visit a constant -int -be_visitor_root::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_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_ANY_OP_CH: - case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: - 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; -} - -//visit an enum -int -be_visitor_root::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_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_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_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; -} - -// 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_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_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; -} - -// visit an interface -int -be_visitor_root::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_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; - case TAO_CodeGen::TAO_ROOT_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS); - break; - default: - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root::" - "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_root::" - "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_root::" - "visit_interface - " - "failed to accept visitor\n" - ), -1); - } - delete visitor; - return 0; -} - -// 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_ANY_OP_CH: - case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: - 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; -} - -// visit an module -int -be_visitor_root::visit_module (be_module *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_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; - case TAO_CodeGen::TAO_ROOT_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_MODULE_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_MODULE_ANY_OP_CS); - 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; -} - -// 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_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_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; -} - -// visit an union -int -be_visitor_root::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_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_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_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; - } - - be_visitor *visitor = tao_cg->make_visitor (&ctx); - if (!visitor) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root::" - "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_root::" - "visit_union - " - "failed to accept visitor\n" - ), -1); - } - delete visitor; - return 0; -} - -// 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_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_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 client header -// ******************************** - -be_visitor_root_ch::be_visitor_root_ch (be_visitor_context *ctx) - : be_visitor_root (ctx) -{ -} - -be_visitor_root_ch::~be_visitor_root_ch (void) -{ -} - -int -be_visitor_root_ch::init (void) -{ - // first open the client-side header file for writing - if (tao_cg->start_client_header (idl_global->be_get_client_hdr_fname ()) - == -1) - { - ACE_ERROR ((LM_ERROR, - "(%N:%l) be_visitor_root_ch::init - " - "Error opening client header file\n")); - return -1; - } - - // init the stream - this->ctx_->stream (tao_cg->client_header ()); - return 0; -} - -// ********************************* -// Root visitor for client inline -// ********************************* - -be_visitor_root_ci::be_visitor_root_ci (be_visitor_context *ctx) - : be_visitor_root (ctx) -{ -} - -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->start_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 client stubs -// *********************************** - -be_visitor_root_cs::be_visitor_root_cs (be_visitor_context *ctx) - : be_visitor_root (ctx) -{ -} - -be_visitor_root_cs::~be_visitor_root_cs (void) -{ -} - -int -be_visitor_root_cs::init (void) -{ - // first open the file - if (tao_cg->start_client_stubs (idl_global->be_get_client_stub_fname ()) - == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root_cs - " - "Error opening client stub file\n"), -1); - } - - // init stream - this->ctx_->stream (tao_cg->client_stubs ()); - return 0; -} - -// *********************************** -// Root visitor for server header -// *********************************** - -be_visitor_root_sh::be_visitor_root_sh (be_visitor_context *ctx) - : be_visitor_root (ctx) -{ -} - -be_visitor_root_sh::~be_visitor_root_sh (void) -{ -} - -int -be_visitor_root_sh::init (void) -{ - // open the file - if (tao_cg->start_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); - } - - if (tao_cg->start_server_template_header - (idl_global->be_get_server_template_hdr_fname ()) - == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root_sh::init - " - "Error opening server template header file\n"), - -1); - } - - // set the stream and the next state - this->ctx_->stream (tao_cg->server_header ()); - return 0; -} - -// *********************************************** -// Root visitor for server inline -// *********************************************** - -be_visitor_root_si::be_visitor_root_si (be_visitor_context *ctx) - : be_visitor_root (ctx) -{ -} - -be_visitor_root_si::~be_visitor_root_si (void) -{ -} - -int -be_visitor_root_si::init (void) -{ - // first open the file for writing - if (tao_cg->start_server_inline (idl_global->be_get_server_inline_fname ()) - == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root_si::init - " - "server inline open failed\n"), -1); - } - - if (tao_cg->start_server_template_inline - (idl_global->be_get_server_template_inline_fname ()) - == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root_si::init - " - "Error opening server template inline file\n"), - -1); - } - - // init stream - this->ctx_->stream (tao_cg->server_inline ()); - return 0; -} - -// ****************************************************** -// Root visitor for server skeletons -// ****************************************************** - -be_visitor_root_ss::be_visitor_root_ss (be_visitor_context *ctx) - : be_visitor_root (ctx) -{ -} - -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->start_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); - } - - if (tao_cg->start_server_template_skeletons - (idl_global->be_get_server_template_skeleton_fname ()) - == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root_ss::init - " - "Error opening server template skeleton file\n"), - -1); - } - - // set stream - this->ctx_->stream (tao_cg->server_skeletons ()); - return 0; -} - -// *************************************************************************** -// Root visitor for generating Any operator declarations in the client header -// and stub -// *************************************************************************** - -be_visitor_root_any_op::be_visitor_root_any_op (be_visitor_context *ctx) - : be_visitor_root (ctx) -{ -} - -be_visitor_root_any_op::~be_visitor_root_any_op (void) -{ -} - -int -be_visitor_root_any_op::visit_root (be_root *node) -{ - // all we have to do is to visit the scope and generate code - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root::visit_root - " - "codegen for scope failed\n"), -1); - } - return 0; -} +// include all the individual files +#include "be_visitor_root/any_op.cpp" +#include "be_visitor_root/root.cpp" +#include "be_visitor_root/root_ch.cpp" +#include "be_visitor_root/root_ci.cpp" +#include "be_visitor_root/root_cs.cpp" +#include "be_visitor_root/root_sh.cpp" +#include "be_visitor_root/root_si.cpp" +#include "be_visitor_root/root_ss.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_root/any_op.cpp b/TAO/TAO_IDL/be/be_visitor_root/any_op.cpp new file mode 100644 index 00000000000..740fed8b97c --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_root/any_op.cpp @@ -0,0 +1,54 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op.cpp +// +// = DESCRIPTION +// Visitor generating code for the Any operators for types defined in Root's +// scope. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_root.h" + + +// *************************************************************************** +// Root visitor for generating Any operator declarations in the client header +// and stub +// *************************************************************************** + +be_visitor_root_any_op::be_visitor_root_any_op (be_visitor_context *ctx) + : be_visitor_root (ctx) +{ +} + +be_visitor_root_any_op::~be_visitor_root_any_op (void) +{ +} + +int +be_visitor_root_any_op::visit_root (be_root *node) +{ + // all we have to do is to visit the scope and generate code + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::visit_root - " + "codegen for scope failed\n"), -1); + } + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_root/root.cpp b/TAO/TAO_IDL/be/be_visitor_root/root.cpp new file mode 100644 index 00000000000..3b1cf0fef05 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_root/root.cpp @@ -0,0 +1,745 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// root.cpp +// +// = DESCRIPTION +// Visitor generating code for the Root node. This is a generic visitor. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_root.h" + + +// Generic Root visitor +be_visitor_root::be_visitor_root (be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_root::~be_visitor_root (void) +{ +} + +// this method must be overridden by the derived root visitors +int +be_visitor_root::init (void) +{ + return -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_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::init - " + "failed to initialize context\n"), -1); + } + + // all we have to do is to visit the scope and generate code + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::visit_root - " + "codegen for scope failed\n"), -1); + } + + // The last thing we need to do is make one more pass thru the entire tree + // and generate code for all the <<= and >>= operators for all the + // user-defined types. + // + // XXXASG - this part of the code may be conditionally generated because at + // times it is not necessary to have these operators at all. TO-DO. + be_visitor_context ctx (*this->ctx_); + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_ROOT_CH: + ctx.state (TAO_CodeGen::TAO_ROOT_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_ROOT_CS: + ctx.state (TAO_CodeGen::TAO_ROOT_ANY_OP_CS); + break; + case TAO_CodeGen::TAO_ROOT_SH: + (void) tao_cg->end_server_header (); + (void) tao_cg->end_server_template_header (); + return 0; + break; + case TAO_CodeGen::TAO_ROOT_CI: + case TAO_CodeGen::TAO_ROOT_SI: + return 0; // nothing to be done + case TAO_CodeGen::TAO_ROOT_SS: + (void) tao_cg->end_server_template_skeletons (); + 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_root - " + "NUL visitor\n" + ), -1); + } + + // generate the <<= and >>= operators for all the user-defined data types in + // the outermost scope + if (node->accept (visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_root - " + "failed to generate Any operators\n" + ), -1); + } + delete visitor; + + // generate any final code such as #endifs + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_ROOT_CH: + (void) tao_cg->end_client_header (); + break; + default: + break; + } + return 0; +} + +// =all common visit methods for root visitor + +// visit a constant +int +be_visitor_root::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_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_ANY_OP_CH: + case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: + 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; +} + +//visit an enum +int +be_visitor_root::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_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_ANY_OP_CH: + ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: + ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_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; +} + +// 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_ANY_OP_CH: + ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: + ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_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; +} + +// visit an interface +int +be_visitor_root::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_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; + case TAO_CodeGen::TAO_ROOT_ANY_OP_CH: + ctx.state (TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: + ctx.state (TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS); + break; + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "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_root::" + "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_root::" + "visit_interface - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// 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_ANY_OP_CH: + case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: + 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; +} + +// visit an module +int +be_visitor_root::visit_module (be_module *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_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; + case TAO_CodeGen::TAO_ROOT_ANY_OP_CH: + ctx.state (TAO_CodeGen::TAO_MODULE_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: + ctx.state (TAO_CodeGen::TAO_MODULE_ANY_OP_CS); + 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; +} + +// 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_ANY_OP_CH: + ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: + ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_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; +} + +// visit an union +int +be_visitor_root::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_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_ANY_OP_CH: + ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: + ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_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; + } + + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "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_root::" + "visit_union - " + "failed to accept visitor\n" + ), -1); + } + delete visitor; + return 0; +} + +// 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_ANY_OP_CH: + ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: + ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp new file mode 100644 index 00000000000..4b90947687d --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp @@ -0,0 +1,57 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// root_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for Root in the client header +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_root.h" + + +// ******************************** +// Root visitor for client header +// ******************************** + +be_visitor_root_ch::be_visitor_root_ch (be_visitor_context *ctx) + : be_visitor_root (ctx) +{ +} + +be_visitor_root_ch::~be_visitor_root_ch (void) +{ +} + +int +be_visitor_root_ch::init (void) +{ + // first open the client-side header file for writing + if (tao_cg->start_client_header (idl_global->be_get_client_hdr_fname ()) + == -1) + { + ACE_ERROR ((LM_ERROR, + "(%N:%l) be_visitor_root_ch::init - " + "Error opening client header file\n")); + return -1; + } + + // init the stream + this->ctx_->stream (tao_cg->client_header ()); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ci.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ci.cpp new file mode 100644 index 00000000000..a4849fb6ab4 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_root/root_ci.cpp @@ -0,0 +1,56 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// root_ci.cpp +// +// = DESCRIPTION +// Visitor generating code for the Root in the client inline +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_root.h" + + +// ********************************* +// Root visitor for client inline +// ********************************* + +be_visitor_root_ci::be_visitor_root_ci (be_visitor_context *ctx) + : be_visitor_root (ctx) +{ +} + +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->start_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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_cs.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_cs.cpp new file mode 100644 index 00000000000..12e6f6155da --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_root/root_cs.cpp @@ -0,0 +1,56 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// root_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for Root in the client stubs file. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_root.h" + + +// *********************************** +// Root visitor for client stubs +// *********************************** + +be_visitor_root_cs::be_visitor_root_cs (be_visitor_context *ctx) + : be_visitor_root (ctx) +{ +} + +be_visitor_root_cs::~be_visitor_root_cs (void) +{ +} + +int +be_visitor_root_cs::init (void) +{ + // first open the file + if (tao_cg->start_client_stubs (idl_global->be_get_client_stub_fname ()) + == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root_cs - " + "Error opening client stub file\n"), -1); + } + + // init stream + this->ctx_->stream (tao_cg->client_stubs ()); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_sh.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_sh.cpp new file mode 100644 index 00000000000..a6bb7e00f32 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_root/root_sh.cpp @@ -0,0 +1,66 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// root_sh.cpp +// +// = DESCRIPTION +// Visitor generating code for Root in the server header +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_root.h" + + +// *********************************** +// Root visitor for server header +// *********************************** + +be_visitor_root_sh::be_visitor_root_sh (be_visitor_context *ctx) + : be_visitor_root (ctx) +{ +} + +be_visitor_root_sh::~be_visitor_root_sh (void) +{ +} + +int +be_visitor_root_sh::init (void) +{ + // open the file + if (tao_cg->start_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); + } + + if (tao_cg->start_server_template_header + (idl_global->be_get_server_template_hdr_fname ()) + == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root_sh::init - " + "Error opening server template header file\n"), + -1); + } + + // set the stream and the next state + this->ctx_->stream (tao_cg->server_header ()); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_si.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_si.cpp new file mode 100644 index 00000000000..414a40083fb --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_root/root_si.cpp @@ -0,0 +1,66 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// root_si.cpp +// +// = DESCRIPTION +// Visitor generating code for the Root in the server inline file +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_root.h" + + +// *********************************************** +// Root visitor for server inline +// *********************************************** + +be_visitor_root_si::be_visitor_root_si (be_visitor_context *ctx) + : be_visitor_root (ctx) +{ +} + +be_visitor_root_si::~be_visitor_root_si (void) +{ +} + +int +be_visitor_root_si::init (void) +{ + // first open the file for writing + if (tao_cg->start_server_inline (idl_global->be_get_server_inline_fname ()) + == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root_si::init - " + "server inline open failed\n"), -1); + } + + if (tao_cg->start_server_template_inline + (idl_global->be_get_server_template_inline_fname ()) + == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root_si::init - " + "Error opening server template inline file\n"), + -1); + } + + // init stream + this->ctx_->stream (tao_cg->server_inline ()); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ss.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ss.cpp new file mode 100644 index 00000000000..ce0486ffad6 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_root/root_ss.cpp @@ -0,0 +1,67 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// root_ss.cpp +// +// = DESCRIPTION +// Visitor generating code for the Root in the server skeletons file +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_root.h" + + +// ****************************************************** +// Root visitor for server skeletons +// ****************************************************** + +be_visitor_root_ss::be_visitor_root_ss (be_visitor_context *ctx) + : be_visitor_root (ctx) +{ +} + +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->start_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); + } + + if (tao_cg->start_server_template_skeletons + (idl_global->be_get_server_template_skeleton_fname ()) + == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root_ss::init - " + "Error opening server template skeleton file\n"), + -1); + } + + // set stream + this->ctx_->stream (tao_cg->server_skeletons ()); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_sequence.cpp b/TAO/TAO_IDL/be/be_visitor_sequence.cpp index 466d3959f85..eb251923059 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence.cpp @@ -21,1651 +21,12 @@ #include "be.h" #include "be_visitor_sequence.h" -// Root visitor for client header -be_visitor_sequence_ch::be_visitor_sequence_ch (be_visitor_context *ctx) - : be_visitor_decl (ctx) -{ -} - -be_visitor_sequence_ch::~be_visitor_sequence_ch (void) -{ -} - -int -be_visitor_sequence_ch::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_ch::" - "visit_sequence - " - "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_CH); - be_visitor *visitor = tao_cg->make_visitor (&ctx); - - 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; - - // 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_ch::visit_sequence (be_sequence *node) -{ - be_type *bt; // type node - TAO_OutStream *os = this->ctx_->stream (); - - // 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); - } - - if (node->cli_hdr_gen () || node->imported ()) - return 0; - - // 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 " << idl_global->export_macro () - << " " << 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 () << " (" << be_idt_nl; - if (node->unbounded ()) - { - // unbounded seq takes this extra parameter - *os << "CORBA::ULong max, " << be_nl; - } - *os << "CORBA::ULong length, " << be_nl; - // 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, " << be_nl - << "CORBA::Boolean release=0" << be_uidt_nl - << ");" << 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"; - - if (!this->ctx_->tdef ()) - { - // by using a visitor to declare and define the TypeCode, we have the - // added advantage to conditionally not generate any code. This will be - // based on the command line options. This is still TO-DO - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_sequence_ch::" - "visit_sequence - " - "TypeCode declaration failed\n" - ), -1); - } - } - - os->gen_endif (); // endif macro - - // generate the ifdefined macro for the var type - os->gen_ifdef_macro (node->flatname (), "_var"); - - // generate the var and out types - 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 (); - node->cli_hdr_gen (1); - - 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 " << idl_global->export_macro () - << " " << 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_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 (); - - // generate the private section - *os << "private:\n"; - os->incr_indent (); - *os << node->local_name () << " *ptr_;\n"; - - 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 - - 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 " << idl_global->export_macro () << " " - << 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_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) -{ -} - -int -be_visitor_sequence_ci::visit_sequence (be_sequence *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - if (node->cli_inline_gen () || node->imported ()) - return 0; - - // 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 - << " " << ": 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 << " : 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 << " this->ptr_ = new " << node->name () << "(*p.ptr_);" << be_nl; - *os << "else" << be_nl; - *os << " this->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 << " : 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 << " : 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 << " : 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); - } - 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 (); - - if (node->cli_stub_gen () || node->imported ()) - return 0; - - // 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 - << "{}\n\n"; - - if (!this->ctx_->tdef ()) - { - // by using a visitor to declare and define the TypeCode, we have the - // added advantage to conditionally not generate any code. This will be - // based on the command line options. This is still TO-DO - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_sequence_cs::" - "visit_sequence - " - "TypeCode definition failed\n" - ), -1); - } - } - - os->gen_endif (); - - return 0; -} - -// **************************************************************** -// We have to generate the parameters for the template that implements -// each sequence type. -// **************************************************************** - -be_visitor_sequence_base:: -be_visitor_sequence_base (be_visitor_context *ctx) - : be_visitor_decl (ctx) -{ -} - -be_visitor_sequence_base::~be_visitor_sequence_base (void) -{ -} - -int -be_visitor_sequence_base::visit_predefined_type (be_predefined_type *node) -{ - 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; - - 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::visit_sequence (be_sequence *node) -{ - 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::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_exception (be_exception *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 - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_sequence_base::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -// **************************************************************** -// 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_buffer_type::visit_node (be_type *node) -{ - 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_buffer_type::visit_predefined_type (be_predefined_type *node) -{ - 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_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->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_interface_fwd (be_interface_fwd *node) -{ - 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_buffer_type::visit_structure (be_structure *node) -{ - return this->visit_node (node); -} - -int -be_visitor_sequence_buffer_type::visit_union (be_union *node) -{ - return this->visit_node (node); -} - -int -be_visitor_sequence_buffer_type::visit_enum (be_enum *node) -{ - return this->visit_node (node); -} - -int -be_visitor_sequence_buffer_type::visit_exception (be_exception *node) -{ - return this->visit_node (node); -} - -int -be_visitor_sequence_buffer_type::visit_array (be_array *node) -{ - return this->visit_node (node); -} - -int -be_visitor_sequence_buffer_type::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); // set the alias node - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_sequence_buffer_type::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -// *********************************************************** -// sequence element type visitor for return types of [] methods -// *********************************************************** - - -be_visitor_sequence_elemtype:: -be_visitor_sequence_elemtype (be_visitor_context *ctx) - : be_visitor_decl (ctx) -{ -} - -be_visitor_sequence_elemtype::~be_visitor_sequence_elemtype (void) -{ -} - -// helper -int -be_visitor_sequence_elemtype::visit_node (be_type *node) -{ - 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_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->ctx_->stream (); - be_type *bt; - - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - switch (node->pt ()) - { - case AST_PredefinedType::PT_pseudo: - if (this->ctx_->state () == TAO_CodeGen::TAO_SEQELEM_RETTYPE_CH) - { - *os << "TAO_Object_Manager<" << bt->nested_type_name - (this->ctx_->scope ()) << "> "; - } - else - *os << "TAO_Object_Manager<" << bt->name () << "> "; - break; - default: - 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_sequence (be_sequence *node) -{ - return this->visit_node (node); -} - -int -be_visitor_sequence_elemtype::visit_interface (be_interface *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_type *bt; - - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - - *os << "TAO_Object_Manager <" - << bt->nested_type_name (this->ctx_->scope ()) - << " > "; - - return 0; -} - -int -be_visitor_sequence_elemtype::visit_interface_fwd (be_interface_fwd *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_type *bt; - - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - - *os << "TAO_Object_Manager <" - << bt->nested_type_name (this->ctx_->scope ()) - << " > "; - - return 0; -} - -int -be_visitor_sequence_elemtype::visit_string (be_string *) -{ - TAO_OutStream *os = this->ctx_->stream (); - - *os << "TAO_String_Manager "; - return 0; -} - -int -be_visitor_sequence_elemtype::visit_structure (be_structure *node) -{ - return this->visit_node (node); -} - -int -be_visitor_sequence_elemtype::visit_union (be_union *node) -{ - return this->visit_node (node); -} - -int -be_visitor_sequence_elemtype::visit_enum (be_enum *node) -{ - return this->visit_node (node); -} - -int -be_visitor_sequence_elemtype::visit_exception (be_exception *node) -{ - return this->visit_node (node); -} - -int -be_visitor_sequence_elemtype::visit_array (be_array *node) -{ - return this->visit_node (node); -} - -int -be_visitor_sequence_elemtype::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_sequence_elemtype::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -// *************************************************************************** -// Sequence visitor for generating Any operator declarations in the client header -// *************************************************************************** - -be_visitor_sequence_any_op_ch::be_visitor_sequence_any_op_ch -(be_visitor_context *ctx) - : be_visitor_decl (ctx) -{ -} - -be_visitor_sequence_any_op_ch::~be_visitor_sequence_any_op_ch (void) -{ -} - -int -be_visitor_sequence_any_op_ch::visit_sequence (be_sequence *node) -{ - if (node->cli_hdr_any_op_gen () || node->imported ()) - return 0; - - TAO_OutStream *os = tao_cg->client_header (); - - // generate the Any <<= and >>= operators - os->indent (); - *os << "void " << idl_global->export_macro () - << " operator<<= (CORBA::Any &, const " << node->name () - << " &); // copying version" << be_nl; - *os << "void " << idl_global->export_macro () - << " operator<<= (CORBA::Any &, " << node->name () - << "*); // noncopying version" << be_nl; - *os << "CORBA::Boolean " << idl_global->export_macro () - << " operator>>= (const CORBA::Any &, " - << node->name () << " *&);\n"; - - node->cli_hdr_any_op_gen (1); - return 0; -} - -// *************************************************************************** -// Sequence visitor for generating Any operator declarations in the client -// stubs file -// *************************************************************************** - -be_visitor_sequence_any_op_cs::be_visitor_sequence_any_op_cs -(be_visitor_context *ctx) - : be_visitor_decl (ctx) -{ -} - -be_visitor_sequence_any_op_cs::~be_visitor_sequence_any_op_cs (void) -{ -} - -int -be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) -{ - if (node->cli_stub_any_op_gen () || node->imported ()) - return 0; - - TAO_OutStream *os = tao_cg->client_stubs (); - - // Any <<= and >>= operators - os->indent (); - *os << "void operator<<= (CORBA::Any &_tao_any, const " - << node->name () << " &_tao_elem) // copying" << be_nl - << "{" << be_idt_nl - << "CORBA::Environment _tao_env;" << be_nl - << "_tao_any.replace (" << node->tc_name () << ", &" - << "_tao_elem, 1, _tao_env);" << be_uidt_nl - << "}" << be_nl; - - *os << "void operator<<= (CORBA::Any &_tao_any, " - << node->name () << " *_tao_elem) // non copying" << be_nl - << "{" << be_idt_nl - << "CORBA::Environment _tao_env;" << be_nl - << "_tao_any.replace (" << node->tc_name () << ", " - << "_tao_elem, 0, _tao_env);" << be_uidt_nl - << "}" << be_nl; - - *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, " - << node->name () << " *&_tao_elem)" << be_nl - << "{" << be_idt_nl - << "CORBA::Environment _tao_env;" << be_nl - << "if (!_tao_any.type ()->equal (" << node->tc_name () - << ", _tao_env)) return 0; // not equal" << be_nl - << "if (_tao_any.any_owns_data ())" << be_nl - << "{" << be_idt_nl - << "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);" - << be_nl - << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());" - << be_nl - << "if (stream.decode (" << node->tc_name () - << ", _tao_elem, 0, _tao_env)" << be_nl - << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl - << "{" << be_idt_nl - << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), " - << "_tao_elem, 1, _tao_env);" - << be_nl - << " return 1;" << be_uidt_nl - << "}" << be_nl - << "else" << be_nl // decode failed - << "{" << be_idt_nl - << "delete _tao_elem;" << be_nl - << "return 0;" << be_uidt_nl - << "}" << be_uidt_nl - << "}" << be_nl - << "else" << be_nl // else any does not own the data - << "{" << be_idt_nl - << "_tao_elem = (" << node->name () << " *)_tao_any.value ();" - << be_nl - << "return 1;" << be_uidt_nl - << "}" << be_uidt_nl - << "}\n\n"; - - - node->cli_stub_any_op_gen (1); - return 0; -} +// include all the individual files +#include "be_visitor_sequence/any_op_ch.cpp" +#include "be_visitor_sequence/any_op_cs.cpp" +#include "be_visitor_sequence/buffer_type.cpp" +#include "be_visitor_sequence/elemtype.cpp" +#include "be_visitor_sequence/sequence_base.cpp" +#include "be_visitor_sequence/sequence_ch.cpp" +#include "be_visitor_sequence/sequence_ci.cpp" +#include "be_visitor_sequence/sequence_cs.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/any_op_ch.cpp new file mode 100644 index 00000000000..09bb17911ca --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_sequence/any_op_ch.cpp @@ -0,0 +1,64 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for Any operators for the Sequence +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_sequence.h" + + +// *************************************************************************** +// Sequence visitor for generating Any operator declarations in the client header +// *************************************************************************** + +be_visitor_sequence_any_op_ch::be_visitor_sequence_any_op_ch +(be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_sequence_any_op_ch::~be_visitor_sequence_any_op_ch (void) +{ +} + +int +be_visitor_sequence_any_op_ch::visit_sequence (be_sequence *node) +{ + if (node->cli_hdr_any_op_gen () || node->imported ()) + return 0; + + TAO_OutStream *os = tao_cg->client_header (); + + // generate the Any <<= and >>= operators + os->indent (); + *os << "void " << idl_global->export_macro () + << " operator<<= (CORBA::Any &, const " << node->name () + << " &); // copying version" << be_nl; + *os << "void " << idl_global->export_macro () + << " operator<<= (CORBA::Any &, " << node->name () + << "*); // noncopying version" << be_nl; + *os << "CORBA::Boolean " << idl_global->export_macro () + << " operator>>= (const CORBA::Any &, " + << node->name () << " *&);\n"; + + node->cli_hdr_any_op_gen (1); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp new file mode 100644 index 00000000000..22f4e6df5d9 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp @@ -0,0 +1,107 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for Any operator for the Sequence node +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_sequence.h" + + +// *************************************************************************** +// Sequence visitor for generating Any operator declarations in the client +// stubs file +// *************************************************************************** + +be_visitor_sequence_any_op_cs::be_visitor_sequence_any_op_cs +(be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_sequence_any_op_cs::~be_visitor_sequence_any_op_cs (void) +{ +} + +int +be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) +{ + if (node->cli_stub_any_op_gen () || node->imported ()) + return 0; + + TAO_OutStream *os = tao_cg->client_stubs (); + + // Any <<= and >>= operators + os->indent (); + *os << "void operator<<= (CORBA::Any &_tao_any, const " + << node->name () << " &_tao_elem) // copying" << be_nl + << "{" << be_idt_nl + << "CORBA::Environment _tao_env;" << be_nl + << "_tao_any.replace (" << node->tc_name () << ", &" + << "_tao_elem, 1, _tao_env);" << be_uidt_nl + << "}" << be_nl; + + *os << "void operator<<= (CORBA::Any &_tao_any, " + << node->name () << " *_tao_elem) // non copying" << be_nl + << "{" << be_idt_nl + << "CORBA::Environment _tao_env;" << be_nl + << "_tao_any.replace (" << node->tc_name () << ", " + << "_tao_elem, 0, _tao_env);" << be_uidt_nl + << "}" << be_nl; + + *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, " + << node->name () << " *&_tao_elem)" << be_nl + << "{" << be_idt_nl + << "CORBA::Environment _tao_env;" << be_nl + << "if (!_tao_any.type ()->equal (" << node->tc_name () + << ", _tao_env)) return 0; // not equal" << be_nl + << "if (_tao_any.any_owns_data ())" << be_nl + << "{" << be_idt_nl + << "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);" + << be_nl + << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());" + << be_nl + << "if (stream.decode (" << node->tc_name () + << ", _tao_elem, 0, _tao_env)" << be_nl + << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl + << "{" << be_idt_nl + << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), " + << "_tao_elem, 1, _tao_env);" + << be_nl + << " return 1;" << be_uidt_nl + << "}" << be_nl + << "else" << be_nl // decode failed + << "{" << be_idt_nl + << "delete _tao_elem;" << be_nl + << "return 0;" << be_uidt_nl + << "}" << be_uidt_nl + << "}" << be_nl + << "else" << be_nl // else any does not own the data + << "{" << be_idt_nl + << "_tao_elem = (" << node->name () << " *)_tao_any.value ();" + << be_nl + << "return 1;" << be_uidt_nl + << "}" << be_uidt_nl + << "}\n\n"; + + + node->cli_stub_any_op_gen (1); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp new file mode 100644 index 00000000000..5474bceb86a --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp @@ -0,0 +1,152 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// buffer_type.cpp +// +// = DESCRIPTION +// Visitor generating code for the internal buffer type of the Sequence node +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_sequence.h" + + +// **************************************************************** +// 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_buffer_type::visit_node (be_type *node) +{ + 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_buffer_type::visit_predefined_type (be_predefined_type *node) +{ + 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_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->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_interface_fwd (be_interface_fwd *node) +{ + 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_buffer_type::visit_structure (be_structure *node) +{ + return this->visit_node (node); +} + +int +be_visitor_sequence_buffer_type::visit_union (be_union *node) +{ + return this->visit_node (node); +} + +int +be_visitor_sequence_buffer_type::visit_enum (be_enum *node) +{ + return this->visit_node (node); +} + +int +be_visitor_sequence_buffer_type::visit_exception (be_exception *node) +{ + return this->visit_node (node); +} + +int +be_visitor_sequence_buffer_type::visit_array (be_array *node) +{ + return this->visit_node (node); +} + +int +be_visitor_sequence_buffer_type::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); // set the alias node + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_sequence_buffer_type::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp new file mode 100644 index 00000000000..4837066484d --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp @@ -0,0 +1,190 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// elemtype.cpp +// +// = DESCRIPTION +// Visitor generating code for the element type for the Sequence +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_sequence.h" + + +// *********************************************************** +// sequence element type visitor for return types of [] methods +// *********************************************************** + + +be_visitor_sequence_elemtype:: +be_visitor_sequence_elemtype (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_sequence_elemtype::~be_visitor_sequence_elemtype (void) +{ +} + +// helper +int +be_visitor_sequence_elemtype::visit_node (be_type *node) +{ + 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_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->ctx_->stream (); + be_type *bt; + + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + switch (node->pt ()) + { + case AST_PredefinedType::PT_pseudo: + if (this->ctx_->state () == TAO_CodeGen::TAO_SEQELEM_RETTYPE_CH) + { + *os << "TAO_Object_Manager<" << bt->nested_type_name + (this->ctx_->scope ()) << "> "; + } + else + *os << "TAO_Object_Manager<" << bt->name () << "> "; + break; + default: + 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_sequence (be_sequence *node) +{ + return this->visit_node (node); +} + +int +be_visitor_sequence_elemtype::visit_interface (be_interface *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + be_type *bt; + + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + + *os << "TAO_Object_Manager <" + << bt->nested_type_name (this->ctx_->scope ()) + << " > "; + + return 0; +} + +int +be_visitor_sequence_elemtype::visit_interface_fwd (be_interface_fwd *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + be_type *bt; + + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + + *os << "TAO_Object_Manager <" + << bt->nested_type_name (this->ctx_->scope ()) + << " > "; + + return 0; +} + +int +be_visitor_sequence_elemtype::visit_string (be_string *) +{ + TAO_OutStream *os = this->ctx_->stream (); + + *os << "TAO_String_Manager "; + return 0; +} + +int +be_visitor_sequence_elemtype::visit_structure (be_structure *node) +{ + return this->visit_node (node); +} + +int +be_visitor_sequence_elemtype::visit_union (be_union *node) +{ + return this->visit_node (node); +} + +int +be_visitor_sequence_elemtype::visit_enum (be_enum *node) +{ + return this->visit_node (node); +} + +int +be_visitor_sequence_elemtype::visit_exception (be_exception *node) +{ + return this->visit_node (node); +} + +int +be_visitor_sequence_elemtype::visit_array (be_array *node) +{ + return this->visit_node (node); +} + +int +be_visitor_sequence_elemtype::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_sequence_elemtype::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_base.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_base.cpp new file mode 100644 index 00000000000..207a573b9fe --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_base.cpp @@ -0,0 +1,139 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// sequence_base.cpp +// +// = DESCRIPTION +// Visitor generating code for the base type of the Sequence +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_sequence.h" + + +// **************************************************************** +// We have to generate the parameters for the template that implements +// each sequence type. +// **************************************************************** + +be_visitor_sequence_base:: +be_visitor_sequence_base (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_sequence_base::~be_visitor_sequence_base (void) +{ +} + +int +be_visitor_sequence_base::visit_predefined_type (be_predefined_type *node) +{ + 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; + + 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::visit_sequence (be_sequence *node) +{ + 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::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_exception (be_exception *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 + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_sequence_base::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp new file mode 100644 index 00000000000..224e414c606 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp @@ -0,0 +1,475 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// sequence_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for Sequence in the client header +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_sequence.h" + + +// Root visitor for client header +be_visitor_sequence_ch::be_visitor_sequence_ch (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_sequence_ch::~be_visitor_sequence_ch (void) +{ +} + +int +be_visitor_sequence_ch::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_ch::" + "visit_sequence - " + "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_CH); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + + 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; + + // 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_ch::visit_sequence (be_sequence *node) +{ + be_type *bt; // type node + TAO_OutStream *os = this->ctx_->stream (); + + // 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); + } + + if (node->cli_hdr_gen () || node->imported ()) + return 0; + + // 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 " << idl_global->export_macro () + << " " << 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 () << " (" << be_idt_nl; + if (node->unbounded ()) + { + // unbounded seq takes this extra parameter + *os << "CORBA::ULong max, " << be_nl; + } + *os << "CORBA::ULong length, " << be_nl; + // 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, " << be_nl + << "CORBA::Boolean release=0" << be_uidt_nl + << ");" << 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"; + + if (!this->ctx_->tdef ()) + { + // by using a visitor to declare and define the TypeCode, we have the + // added advantage to conditionally not generate any code. This will be + // based on the command line options. This is still TO-DO + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_ch::" + "visit_sequence - " + "TypeCode declaration failed\n" + ), -1); + } + } + + os->gen_endif (); // endif macro + + // generate the ifdefined macro for the var type + os->gen_ifdef_macro (node->flatname (), "_var"); + + // generate the var and out types + 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 (); + node->cli_hdr_gen (1); + + 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 " << idl_global->export_macro () + << " " << 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_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 (); + + // generate the private section + *os << "private:\n"; + os->incr_indent (); + *os << node->local_name () << " *ptr_;\n"; + + 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 + + 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 " << idl_global->export_macro () << " " + << 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_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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp new file mode 100644 index 00000000000..e336c230fa1 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp @@ -0,0 +1,469 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// sequence_ci.cpp +// +// = DESCRIPTION +// Visitor generating code for Sequence in the client inline file +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_sequence.h" + + +// *********************************************************** +// 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) +{ +} + +int +be_visitor_sequence_ci::visit_sequence (be_sequence *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + + if (node->cli_inline_gen () || node->imported ()) + return 0; + + // 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 + << " " << ": 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 << " : 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 << " this->ptr_ = new " << node->name () << "(*p.ptr_);" << be_nl; + *os << "else" << be_nl; + *os << " this->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 << " : 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 << " : 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 << " : 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp new file mode 100644 index 00000000000..b508e405204 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp @@ -0,0 +1,261 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// sequence_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for Sequences in the client stubs file +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_sequence.h" + + +// ************************************************************ +// 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); + } + 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 (); + + if (node->cli_stub_gen () || node->imported ()) + return 0; + + // 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 + << "{}\n\n"; + + if (!this->ctx_->tdef ()) + { + // by using a visitor to declare and define the TypeCode, we have the + // added advantage to conditionally not generate any code. This will be + // based on the command line options. This is still TO-DO + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_cs::" + "visit_sequence - " + "TypeCode definition failed\n" + ), -1); + } + } + + os->gen_endif (); + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_structure.cpp b/TAO/TAO_IDL/be/be_visitor_structure.cpp index 3e5261a34c6..06b3ddf1e91 100644 --- a/TAO/TAO_IDL/be/be_visitor_structure.cpp +++ b/TAO/TAO_IDL/be/be_visitor_structure.cpp @@ -24,455 +24,10 @@ #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 () && !node->imported ()) // not already generated and - // not imported - { - os = this->ctx_->stream (); - - os->indent (); // start from whatever indentation level we were at - *os << "struct " << node->local_name () << be_nl - << "{" << be_idt << "\n"; - - // 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"; - } - - // by using a visitor to declare and define the TypeCode, we have the - // added advantage to conditionally not generate any code. This will be - // based on the command line options. This is still TO-DO - be_visitor *visitor; - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_structure_ch::" - "visit_structure - " - "TypeCode declaration failed\n" - ), -1); - } - - - 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 () && !node->imported ()) - { - 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 () && !node->imported ()) - { - os = this->ctx_->stream (); - - // by using a visitor to declare and define the TypeCode, we have the - // added advantage to conditionally not generate any code. This will be - // based on the command line options. This is still TO-DO - be_visitor *visitor; - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_structure_cs::" - "visit_structure - " - "TypeCode definition failed\n" - ), -1); - } - - - // 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; -} - -// *************************************************************************** -// Structure visitor for generating Any operator declarations in the client header -// *************************************************************************** - -be_visitor_structure_any_op_ch::be_visitor_structure_any_op_ch -(be_visitor_context *ctx) - : be_visitor_structure (ctx) -{ -} - -be_visitor_structure_any_op_ch::~be_visitor_structure_any_op_ch (void) -{ -} - -int -be_visitor_structure_any_op_ch::visit_structure (be_structure *node) -{ - if (node->cli_hdr_any_op_gen () || node->imported ()) - return 0; - - TAO_OutStream *os = tao_cg->client_header (); - - // generate the Any <<= and >>= operator declarations - os->indent (); - *os << "void " << idl_global->export_macro () - << " operator<<= (CORBA::Any &, const " << node->name () - << " &); // copying version" << be_nl; - *os << "void " << idl_global->export_macro () - << " operator<<= (CORBA::Any &, " << node->name () - << "*); // noncopying version" << be_nl; - *os << "CORBA::Boolean " << idl_global->export_macro () - << " operator>>= (const CORBA::Any &, " - << node->name () << " *&);\n"; - - - // all we have to do is to visit the scope and generate code - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_structure::visit_structure - " - "codegen for scope failed\n"), -1); - } - - node->cli_hdr_any_op_gen (1); - return 0; -} - -int -be_visitor_structure_any_op_ch::visit_field (be_field *node) -{ - be_type *bt; // field's type - - // 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_structure_any_op_ch::" - "visit_field - " - "Bad field type\n" - ), -1); - } - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_structure_any_op_ch::" - "visit_field - " - "codegen for field type failed\n" - ), -1); - } - return 0; -} - -// *************************************************************************** -// Structure visitor for generating Any operator declarations in the client -// stubs file -// *************************************************************************** - -be_visitor_structure_any_op_cs::be_visitor_structure_any_op_cs -(be_visitor_context *ctx) - : be_visitor_structure (ctx) -{ -} - -be_visitor_structure_any_op_cs::~be_visitor_structure_any_op_cs (void) -{ -} - -int -be_visitor_structure_any_op_cs::visit_structure (be_structure *node) -{ - if (node->cli_stub_any_op_gen () || node->imported ()) - return 0; - - TAO_OutStream *os = tao_cg->client_stubs (); - - // generate the Any <<= and >>= operator declarations - // Any <<= and >>= operators - os->indent (); - *os << "void operator<<= (CORBA::Any &_tao_any, const " - << node->name () << " &_tao_elem) // copying" << be_nl - << "{" << be_idt_nl - << "CORBA::Environment _tao_env;" << be_nl - << "_tao_any.replace (" << node->tc_name () << ", new " - << node->name () << "(_tao_elem), 1, _tao_env);" - << " // copy the value" << be_uidt_nl - << "}" << be_nl; - - *os << "void operator<<= (CORBA::Any &_tao_any, " - << node->name () << " *_tao_elem) // non copying" << be_nl - << "{" << be_idt_nl - << "CORBA::Environment _tao_env;" << be_nl - << "_tao_any.replace (" << node->tc_name () << ", " - << "_tao_elem, 1, _tao_env); // consume it" << be_uidt_nl - << "}" << be_nl; - - *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, " - << node->name () << " *&_tao_elem)" << be_nl - << "{" << be_idt_nl - << "CORBA::Environment _tao_env;" << be_nl - << "if (!_tao_any.type ()->equal (" << node->tc_name () - << ", _tao_env)) return 0; // not equal" << be_nl - << "if (_tao_any.any_owns_data ())" << be_nl - << "{" << be_idt_nl - << "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);" - << be_nl - << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());" - << be_nl - << "if (stream.decode (" << node->tc_name () - << ", _tao_elem, 0, _tao_env)" << be_nl - << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl - << "{" << be_idt_nl - << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), " - << "_tao_elem, 1, _tao_env);" - << be_nl - << " return 1;" << be_uidt_nl - << "}" << be_nl - << "else" << be_nl // decode failed - << "{" << be_idt_nl - << "delete _tao_elem;" << be_nl - << "return 0;" << be_uidt_nl - << "}" << be_uidt_nl - << "}" << be_nl - << "else" << be_nl // else any does not own the data - << "{" << be_idt_nl - << "_tao_elem = (" << node->name () << " *)_tao_any.value ();" - << be_nl - << "return 1;" << be_uidt_nl - << "}" << be_uidt_nl - << "}\n\n"; - - - // all we have to do is to visit the scope and generate code - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_structure::visit_structure - " - "codegen for scope failed\n"), -1); - } - - node->cli_stub_any_op_gen (1); - return 0; -} - -int -be_visitor_structure_any_op_cs::visit_field (be_field *node) -{ - be_type *bt; // field's type - - // 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_structure_any_op_cs::" - "visit_field - " - "Bad field type\n" - ), -1); - } - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_structure_any_op_cs::" - "visit_field - " - "codegen for field type failed\n" - ), -1); - } - return 0; -} +// include all the individual files +#include "be_visitor_structure/any_op_ch.cpp" +#include "be_visitor_structure/any_op_cs.cpp" +#include "be_visitor_structure/structure.cpp" +#include "be_visitor_structure/structure_ch.cpp" +#include "be_visitor_structure/structure_ci.cpp" +#include "be_visitor_structure/structure_cs.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_structure/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_structure/any_op_ch.cpp new file mode 100644 index 00000000000..d3c705e34d2 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_structure/any_op_ch.cpp @@ -0,0 +1,100 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for Any operators for structures +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_structure.h" + + +// *************************************************************************** +// Structure visitor for generating Any operator declarations in the client header +// *************************************************************************** + +be_visitor_structure_any_op_ch::be_visitor_structure_any_op_ch +(be_visitor_context *ctx) + : be_visitor_structure (ctx) +{ +} + +be_visitor_structure_any_op_ch::~be_visitor_structure_any_op_ch (void) +{ +} + +int +be_visitor_structure_any_op_ch::visit_structure (be_structure *node) +{ + if (node->cli_hdr_any_op_gen () || node->imported ()) + return 0; + + TAO_OutStream *os = tao_cg->client_header (); + + // generate the Any <<= and >>= operator declarations + os->indent (); + *os << "void " << idl_global->export_macro () + << " operator<<= (CORBA::Any &, const " << node->name () + << " &); // copying version" << be_nl; + *os << "void " << idl_global->export_macro () + << " operator<<= (CORBA::Any &, " << node->name () + << "*); // noncopying version" << be_nl; + *os << "CORBA::Boolean " << idl_global->export_macro () + << " operator>>= (const CORBA::Any &, " + << node->name () << " *&);\n"; + + + // all we have to do is to visit the scope and generate code + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_structure::visit_structure - " + "codegen for scope failed\n"), -1); + } + + node->cli_hdr_any_op_gen (1); + return 0; +} + +int +be_visitor_structure_any_op_ch::visit_field (be_field *node) +{ + be_type *bt; // field's type + + // 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_structure_any_op_ch::" + "visit_field - " + "Bad field type\n" + ), -1); + } + + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_structure_any_op_ch::" + "visit_field - " + "codegen for field type failed\n" + ), -1); + } + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp new file mode 100644 index 00000000000..43078696baa --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp @@ -0,0 +1,144 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for Any operators for structures +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_structure.h" + + +// *************************************************************************** +// Structure visitor for generating Any operator declarations in the client +// stubs file +// *************************************************************************** + +be_visitor_structure_any_op_cs::be_visitor_structure_any_op_cs +(be_visitor_context *ctx) + : be_visitor_structure (ctx) +{ +} + +be_visitor_structure_any_op_cs::~be_visitor_structure_any_op_cs (void) +{ +} + +int +be_visitor_structure_any_op_cs::visit_structure (be_structure *node) +{ + if (node->cli_stub_any_op_gen () || node->imported ()) + return 0; + + TAO_OutStream *os = tao_cg->client_stubs (); + + // generate the Any <<= and >>= operator declarations + // Any <<= and >>= operators + os->indent (); + *os << "void operator<<= (CORBA::Any &_tao_any, const " + << node->name () << " &_tao_elem) // copying" << be_nl + << "{" << be_idt_nl + << "CORBA::Environment _tao_env;" << be_nl + << "_tao_any.replace (" << node->tc_name () << ", new " + << node->name () << "(_tao_elem), 1, _tao_env);" + << " // copy the value" << be_uidt_nl + << "}" << be_nl; + + *os << "void operator<<= (CORBA::Any &_tao_any, " + << node->name () << " *_tao_elem) // non copying" << be_nl + << "{" << be_idt_nl + << "CORBA::Environment _tao_env;" << be_nl + << "_tao_any.replace (" << node->tc_name () << ", " + << "_tao_elem, 1, _tao_env); // consume it" << be_uidt_nl + << "}" << be_nl; + + *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, " + << node->name () << " *&_tao_elem)" << be_nl + << "{" << be_idt_nl + << "CORBA::Environment _tao_env;" << be_nl + << "if (!_tao_any.type ()->equal (" << node->tc_name () + << ", _tao_env)) return 0; // not equal" << be_nl + << "if (_tao_any.any_owns_data ())" << be_nl + << "{" << be_idt_nl + << "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);" + << be_nl + << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());" + << be_nl + << "if (stream.decode (" << node->tc_name () + << ", _tao_elem, 0, _tao_env)" << be_nl + << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl + << "{" << be_idt_nl + << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), " + << "_tao_elem, 1, _tao_env);" + << be_nl + << " return 1;" << be_uidt_nl + << "}" << be_nl + << "else" << be_nl // decode failed + << "{" << be_idt_nl + << "delete _tao_elem;" << be_nl + << "return 0;" << be_uidt_nl + << "}" << be_uidt_nl + << "}" << be_nl + << "else" << be_nl // else any does not own the data + << "{" << be_idt_nl + << "_tao_elem = (" << node->name () << " *)_tao_any.value ();" + << be_nl + << "return 1;" << be_uidt_nl + << "}" << be_uidt_nl + << "}\n\n"; + + + // all we have to do is to visit the scope and generate code + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_structure::visit_structure - " + "codegen for scope failed\n"), -1); + } + + node->cli_stub_any_op_gen (1); + return 0; +} + +int +be_visitor_structure_any_op_cs::visit_field (be_field *node) +{ + be_type *bt; // field's type + + // 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_structure_any_op_cs::" + "visit_field - " + "Bad field type\n" + ), -1); + } + + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_structure_any_op_cs::" + "visit_field - " + "codegen for field type failed\n" + ), -1); + } + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_structure/structure.cpp b/TAO/TAO_IDL/be/be_visitor_structure/structure.cpp new file mode 100644 index 00000000000..4bb06dd49ca --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_structure/structure.cpp @@ -0,0 +1,100 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// structure.cpp +// +// = DESCRIPTION +// Visitor generating code for Structures. This is a generic visitor. +// +// = 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_structure/structure_ch.cpp b/TAO/TAO_IDL/be/be_visitor_structure/structure_ch.cpp new file mode 100644 index 00000000000..79b14735d82 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_structure/structure_ch.cpp @@ -0,0 +1,114 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// structure_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for Structure in the client header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_structure.h" + + +// ****************************************************** +// 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 () && !node->imported ()) // not already generated and + // not imported + { + os = this->ctx_->stream (); + + os->indent (); // start from whatever indentation level we were at + *os << "struct " << node->local_name () << be_nl + << "{" << be_idt << "\n"; + + // 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"; + } + + // by using a visitor to declare and define the TypeCode, we have the + // added advantage to conditionally not generate any code. This will be + // based on the command line options. This is still TO-DO + be_visitor *visitor; + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_structure_ch::" + "visit_structure - " + "TypeCode declaration failed\n" + ), -1); + } + + + node->cli_hdr_gen (I_TRUE); + } + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_structure/structure_ci.cpp b/TAO/TAO_IDL/be/be_visitor_structure/structure_ci.cpp new file mode 100644 index 00000000000..e4b78ca86ca --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_structure/structure_ci.cpp @@ -0,0 +1,72 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// structure_ci.cpp +// +// = DESCRIPTION +// Visitor generating code for Structure in the inline file. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_structure.h" + + +// ****************************************************** +// 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 () && !node->imported ()) + { + 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_structure/structure_cs.cpp b/TAO/TAO_IDL/be/be_visitor_structure/structure_cs.cpp new file mode 100644 index 00000000000..412faaea865 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_structure/structure_cs.cpp @@ -0,0 +1,79 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// structure_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for Structures in the client stubs file. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_structure.h" + + +// *************************************************************************** +// 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 () && !node->imported ()) + { + os = this->ctx_->stream (); + + // by using a visitor to declare and define the TypeCode, we have the + // added advantage to conditionally not generate any code. This will be + // based on the command line options. This is still TO-DO + be_visitor *visitor; + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_structure_cs::" + "visit_structure - " + "TypeCode definition failed\n" + ), -1); + } + + + // 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_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode.cpp index 165f2f76c28..9e11d5c2885 100644 --- a/TAO/TAO_IDL/be/be_visitor_typecode.cpp +++ b/TAO/TAO_IDL/be/be_visitor_typecode.cpp @@ -24,291 +24,6 @@ #include "be_visitor_typecode.h" -// ****************************************************** -// TypeCode declarations -// ****************************************************** - -be_visitor_typecode_decl::be_visitor_typecode_decl (be_visitor_context *ctx) - : be_visitor_decl (ctx) -{ -} - -be_visitor_typecode_decl::~be_visitor_typecode_decl (void) -{ -} - -int -be_visitor_typecode_decl::visit_type (be_type *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - // Generate the typecode decl - if (node->is_nested ()) - { - // we have a scoped name - os->indent (); - // is our enclosing scope a module? We need this check because for - // platforms that support namespaces, the typecode must be declared - // extern - if (node->defined_in ()->scope_node_type () == AST_Decl::NT_module) - *os << "TAO_NAMESPACE_STORAGE_CLASS "; - else - *os << "static "; - *os << "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"; - } - return 0; -} - -int -be_visitor_typecode_decl::visit_array (be_array *node) -{ - return this->visit_type (node); -} - -int -be_visitor_typecode_decl::visit_enum (be_enum *node) -{ - return this->visit_type (node); -} - -int -be_visitor_typecode_decl::visit_exception (be_exception *node) -{ - return this->visit_type (node); -} - -int -be_visitor_typecode_decl::visit_interface (be_interface *node) -{ - return this->visit_type (node); -} - -int -be_visitor_typecode_decl::visit_sequence (be_sequence *node) -{ - return this->visit_type (node); -} - -int -be_visitor_typecode_decl::visit_structure (be_structure *node) -{ - return this->visit_type (node); -} - -int -be_visitor_typecode_decl::visit_typedef (be_typedef *node) -{ - return this->visit_type (node); -} - -int -be_visitor_typecode_decl::visit_union (be_union *node) -{ - return this->visit_type (node); -} - -// ****************************************************** -// TypeCode Definitions -// ****************************************************** - -be_visitor_typecode_defn::be_visitor_typecode_defn (be_visitor_context *ctx) - : be_visitor_decl (ctx) -{ -} - -be_visitor_typecode_defn::~be_visitor_typecode_defn (void) -{ -} - -// the following needs to be done to deal with the most bizarre behavior of -// MSVC++ compiler -int -be_visitor_typecode_defn::gen_nested_namespace_begin (be_module *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - UTL_IdListActiveIterator *i; - - i = new UTL_IdListActiveIterator (node->name ()); - while (!(i->is_done ())) - { - if (ACE_OS::strcmp (i->item ()->get_string (), "") != 0) - { - // leave the outermost root scope - *os << "TAO_NAMESPACE_BEGIN (" << i->item ()->get_string () - << ")" << be_nl; - } - i->next (); - } - delete i; - return 0; -} - -// the following needs to be done to deal with the most bizarre behavior of -// MSVC++ compiler -int -be_visitor_typecode_defn::gen_nested_namespace_end (be_module *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - UTL_IdListActiveIterator *i; - - i = new UTL_IdListActiveIterator (node->name ()); - while (!(i->is_done ())) - { - if (ACE_OS::strcmp (i->item ()->get_string (), "") != 0) - { - // leave the outermost root scope - *os << "TAO_NAMESPACE_END" << be_nl; - } - i->next (); - } - delete i; - return 0; -} - -int -be_visitor_typecode_defn::visit_type (be_type *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - os->indent (); - // generate the typecode information here - *os << "static const CORBA::Long _oc_" << node->flatname () << "[] =" - << be_nl; - *os << "{" << be_idt << "\n"; - // 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_typecode_defn::" - "visit_type - " - "codegen for typecode failed\n"), -1); - } - *os << be_uidt << "};" << be_nl; - - *os << "static CORBA::TypeCode _tc__tc_" << node->flatname () - << " ("; - switch (node->node_type ()) - { - case AST_Decl::NT_array: - *os << "CORBA::tk_array"; - break; - case AST_Decl::NT_enum: - *os << "CORBA::tk_enum"; - break; - case AST_Decl::NT_except: - *os << "CORBA::tk_except"; - break; - case AST_Decl::NT_interface: - *os << "CORBA::tk_objref"; - break; - case AST_Decl::NT_sequence: - *os << "CORBA::tk_sequence"; - break; - case AST_Decl::NT_struct: - *os << "CORBA::tk_struct"; - break; - case AST_Decl::NT_typedef: - *os << "CORBA::tk_alias"; - break; - case AST_Decl::NT_union: - *os << "CORBA::tk_union"; - break; - default: - return -1; // error - } - - *os << ", sizeof (_oc_" << node->flatname () - << "), (char *) &_oc_" << node->flatname () - << ", CORBA::B_FALSE);" << be_nl; - - // is our enclosing scope a module? We need this check because for - // platforms that support namespaces, the typecode must be declared - // extern - if (node->is_nested () && - node->defined_in ()->scope_node_type () == AST_Decl::NT_module) - { - *os << "TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr)" << be_nl; - be_module *module = be_module::narrow_from_scope (node->defined_in ()); - if (!module || (this->gen_nested_namespace_begin (module) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_typecode_defn::visit_type - " - "Error parsing nested name\n"), - -1); - } - *os << "TAO_NAMESPACE_DEFINE (CORBA::TypeCode_ptr, _tc_" - << node->local_name () << ", &_tc__tc_" - << node->flatname () << ")" << be_nl; - if (this->gen_nested_namespace_end (module) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_typecode_defn::visit_type - " - "Error parsing nested name\n"), - -1); - } - } - else - { - // outermost scope. - *os << "CORBA::TypeCode_ptr " << node->tc_name () << " = &_tc__tc_" - << node->flatname () << ";\n\n"; - } - return 0; -} - -int -be_visitor_typecode_defn::visit_array (be_array *node) -{ - return this->visit_type (node); -} - -int -be_visitor_typecode_defn::visit_enum (be_enum *node) -{ - return this->visit_type (node); -} - -int -be_visitor_typecode_defn::visit_exception (be_exception *node) -{ - return this->visit_type (node); -} - -int -be_visitor_typecode_defn::visit_interface (be_interface *node) -{ - return this->visit_type (node); -} - -int -be_visitor_typecode_defn::visit_sequence (be_sequence *node) -{ - return this->visit_type (node); -} - -int -be_visitor_typecode_defn::visit_structure (be_structure *node) -{ - return this->visit_type (node); -} - -int -be_visitor_typecode_defn::visit_typedef (be_typedef *node) -{ - return this->visit_type (node); -} - -int -be_visitor_typecode_defn::visit_union (be_union *node) -{ - return this->visit_type (node); -} +// include all the individual files +#include "be_visitor_typecode/typecode_decl.cpp" +#include "be_visitor_typecode/typecode_defn.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp new file mode 100644 index 00000000000..e145106b3fc --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp @@ -0,0 +1,117 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// typecode_decl.cpp +// +// = DESCRIPTION +// Visitor generating code for TypeCode declaration for a type +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_typecode.h" + + +// ****************************************************** +// TypeCode declarations +// ****************************************************** + +be_visitor_typecode_decl::be_visitor_typecode_decl (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_typecode_decl::~be_visitor_typecode_decl (void) +{ +} + +int +be_visitor_typecode_decl::visit_type (be_type *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + + // Generate the typecode decl + if (node->is_nested ()) + { + // we have a scoped name + os->indent (); + // is our enclosing scope a module? We need this check because for + // platforms that support namespaces, the typecode must be declared + // extern + if (node->defined_in ()->scope_node_type () == AST_Decl::NT_module) + *os << "TAO_NAMESPACE_STORAGE_CLASS "; + else + *os << "static "; + *os << "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"; + } + return 0; +} + +int +be_visitor_typecode_decl::visit_array (be_array *node) +{ + return this->visit_type (node); +} + +int +be_visitor_typecode_decl::visit_enum (be_enum *node) +{ + return this->visit_type (node); +} + +int +be_visitor_typecode_decl::visit_exception (be_exception *node) +{ + return this->visit_type (node); +} + +int +be_visitor_typecode_decl::visit_interface (be_interface *node) +{ + return this->visit_type (node); +} + +int +be_visitor_typecode_decl::visit_sequence (be_sequence *node) +{ + return this->visit_type (node); +} + +int +be_visitor_typecode_decl::visit_structure (be_structure *node) +{ + return this->visit_type (node); +} + +int +be_visitor_typecode_decl::visit_typedef (be_typedef *node) +{ + return this->visit_type (node); +} + +int +be_visitor_typecode_decl::visit_union (be_union *node) +{ + return this->visit_type (node); +} diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp new file mode 100644 index 00000000000..c1f676449ee --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp @@ -0,0 +1,224 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// typecode_defn.cpp +// +// = DESCRIPTION +// Visitor generating code for TypeCode definitions for types. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_typecode.h" + + +// ****************************************************** +// TypeCode Definitions +// ****************************************************** + +be_visitor_typecode_defn::be_visitor_typecode_defn (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +be_visitor_typecode_defn::~be_visitor_typecode_defn (void) +{ +} + +// the following needs to be done to deal with the most bizarre behavior of +// MSVC++ compiler +int +be_visitor_typecode_defn::gen_nested_namespace_begin (be_module *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + UTL_IdListActiveIterator *i; + + i = new UTL_IdListActiveIterator (node->name ()); + while (!(i->is_done ())) + { + if (ACE_OS::strcmp (i->item ()->get_string (), "") != 0) + { + // leave the outermost root scope + *os << "TAO_NAMESPACE_BEGIN (" << i->item ()->get_string () + << ")" << be_nl; + } + i->next (); + } + delete i; + return 0; +} + +// the following needs to be done to deal with the most bizarre behavior of +// MSVC++ compiler +int +be_visitor_typecode_defn::gen_nested_namespace_end (be_module *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + UTL_IdListActiveIterator *i; + + i = new UTL_IdListActiveIterator (node->name ()); + while (!(i->is_done ())) + { + if (ACE_OS::strcmp (i->item ()->get_string (), "") != 0) + { + // leave the outermost root scope + *os << "TAO_NAMESPACE_END" << be_nl; + } + i->next (); + } + delete i; + return 0; +} + +int +be_visitor_typecode_defn::visit_type (be_type *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + + os->indent (); + // generate the typecode information here + *os << "static const CORBA::Long _oc_" << node->flatname () << "[] =" + << be_nl; + *os << "{" << be_idt << "\n"; + // 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_typecode_defn::" + "visit_type - " + "codegen for typecode failed\n"), -1); + } + *os << be_uidt << "};" << be_nl; + + *os << "static CORBA::TypeCode _tc__tc_" << node->flatname () + << " ("; + switch (node->node_type ()) + { + case AST_Decl::NT_array: + *os << "CORBA::tk_array"; + break; + case AST_Decl::NT_enum: + *os << "CORBA::tk_enum"; + break; + case AST_Decl::NT_except: + *os << "CORBA::tk_except"; + break; + case AST_Decl::NT_interface: + *os << "CORBA::tk_objref"; + break; + case AST_Decl::NT_sequence: + *os << "CORBA::tk_sequence"; + break; + case AST_Decl::NT_struct: + *os << "CORBA::tk_struct"; + break; + case AST_Decl::NT_typedef: + *os << "CORBA::tk_alias"; + break; + case AST_Decl::NT_union: + *os << "CORBA::tk_union"; + break; + default: + return -1; // error + } + + *os << ", sizeof (_oc_" << node->flatname () + << "), (char *) &_oc_" << node->flatname () + << ", CORBA::B_FALSE);" << be_nl; + + // is our enclosing scope a module? We need this check because for + // platforms that support namespaces, the typecode must be declared + // extern + if (node->is_nested () && + node->defined_in ()->scope_node_type () == AST_Decl::NT_module) + { + *os << "TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr)" << be_nl; + be_module *module = be_module::narrow_from_scope (node->defined_in ()); + if (!module || (this->gen_nested_namespace_begin (module) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_typecode_defn::visit_type - " + "Error parsing nested name\n"), + -1); + } + *os << "TAO_NAMESPACE_DEFINE (CORBA::TypeCode_ptr, _tc_" + << node->local_name () << ", &_tc__tc_" + << node->flatname () << ")" << be_nl; + if (this->gen_nested_namespace_end (module) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_typecode_defn::visit_type - " + "Error parsing nested name\n"), + -1); + } + } + else + { + // outermost scope. + *os << "CORBA::TypeCode_ptr " << node->tc_name () << " = &_tc__tc_" + << node->flatname () << ";\n\n"; + } + return 0; +} + +int +be_visitor_typecode_defn::visit_array (be_array *node) +{ + return this->visit_type (node); +} + +int +be_visitor_typecode_defn::visit_enum (be_enum *node) +{ + return this->visit_type (node); +} + +int +be_visitor_typecode_defn::visit_exception (be_exception *node) +{ + return this->visit_type (node); +} + +int +be_visitor_typecode_defn::visit_interface (be_interface *node) +{ + return this->visit_type (node); +} + +int +be_visitor_typecode_defn::visit_sequence (be_sequence *node) +{ + return this->visit_type (node); +} + +int +be_visitor_typecode_defn::visit_structure (be_structure *node) +{ + return this->visit_type (node); +} + +int +be_visitor_typecode_defn::visit_typedef (be_typedef *node) +{ + return this->visit_type (node); +} + +int +be_visitor_typecode_defn::visit_union (be_union *node) +{ + return this->visit_type (node); +} diff --git a/TAO/TAO_IDL/be/be_visitor_typedef.cpp b/TAO/TAO_IDL/be/be_visitor_typedef.cpp index 2c3921daa59..6a0f7c6562a 100644 --- a/TAO/TAO_IDL/be/be_visitor_typedef.cpp +++ b/TAO/TAO_IDL/be/be_visitor_typedef.cpp @@ -24,1781 +24,10 @@ #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_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_ARRAY_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_ARRAY_ANY_OP_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_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_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_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_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_SEQUENCE_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_SEQUENCE_ANY_OP_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_ANY_OP_CH: - case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS: - 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_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_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_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CH); - break; - case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_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); - } - - // 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); - } - this->ctx_->alias (0); // reset - } - 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); - } - - // generate the typecode decl for this typedef node - if (!node->imported ()) - { - // by using a visitor to declare and define the TypeCode, we have the - // added advantage to conditionally not generate any code. This will be - // based on the command line options. This is still TO-DO - be_visitor *visitor; - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_typedef_ch::" - "visit_typedef - " - "TypeCode declaration failed\n" - ), -1); - } - - - } - this->ctx_->tdef (0); // reset - } - - 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; - - // is the base type an alias to an array node or an actual array node - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - // is our base type an array node. If so, generate code for that array node - if (bt->node_type () == AST_Decl::NT_array) - { - // 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); - } - } - else - { - // base type is simply an alias to an array node. Simply output the - // required 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, copy, and free methods - *os << "static " << tdef->nested_type_name (scope, "_slice") << " *" - << tdef->nested_type_name (scope, "_alloc") << " (void);" << be_nl; - *os << "static " << tdef->nested_type_name (scope, "_slice") << " *" - << tdef->nested_type_name (scope, "_dup") << " (const " - << tdef->nested_type_name (scope, "_slice") << " *_tao_slice);" << be_nl; - *os << "static void " << tdef->nested_type_name (scope, "_copy") << " (" - << tdef->nested_type_name (scope, "_slice") << " *_tao_to, const " - << tdef->nested_type_name (scope, "_slice") << " *_tao_from);" << be_nl; - *os << "static void " << tdef->nested_type_name (scope, "_free") << " (" - << tdef->nested_type_name (scope, "_slice") << " *_tao_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_interface (be_interface *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 _ptr - *os << "typedef " << bt->nested_type_name (scope, "_ptr") - << " " << tdef->nested_type_name (scope, "_ptr") << ";" << be_nl; - - // typedef the _var - *os << "typedef " << bt->nested_type_name (scope, "_var") - << " " << tdef->nested_type_name (scope, "_var") << ";" << 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 - *os << "typedef " << bt->nested_type_name (scope) - << " " << tdef->nested_type_name (scope) << ";" << be_nl; - if ((node->pt () == AST_PredefinedType::PT_pseudo) || - (node->pt () == AST_PredefinedType::PT_any)) - { - // typedef the _ptr and _var - *os << "typedef " << bt->nested_type_name (scope, "_ptr") - << " " << tdef->nested_type_name (scope, "_ptr") << ";" << be_nl; - *os << "typedef " << bt->nested_type_name (scope, "_var") - << " " << tdef->nested_type_name (scope, "_var") << ";" << 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 - *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); - } - // 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); - } - - this->ctx_->alias (0); - } - 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); - } - - this->ctx_->tdef (0); - } - 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); - } - } - else - { - // generate the inline code for alloc, dup, copy, and free methods - - // alloc method - os->indent (); - *os << "ACE_INLINE " << tdef->name () << "_slice *" << be_nl; - *os << tdef->name () << "_alloc (void)" << be_nl; - *os << "{" << be_idt_nl; - *os << "return " << bt->name () << "_alloc ();" << be_uidt_nl; - *os << "}\n\n"; - - // dup method - os->indent (); - *os << "ACE_INLINE " << tdef->name () << "_slice *" << be_nl; - *os << tdef->name () << "_dup (const " << tdef->name () - << "_slice *_tao_src)" << be_nl; - *os << "{" << be_idt_nl; - *os << "return " << bt->name () << "_dup (_tao_src);" << be_uidt_nl; - *os << "}\n\n"; - - // copy method - os->indent (); - *os << "ACE_INLINE void" << be_nl; - *os << tdef->name () << "_copy (" << tdef->name () - << "_slice *_tao_dest, const " << tdef->name () - << "_slice *_tao_src)" << be_nl; - *os << "{" << be_idt_nl; - *os << bt->name () << "_copy (_tao_dest, _tao_src);" << be_uidt_nl; - *os << "}\n\n"; - - // free method - os->indent (); - *os << "ACE_INLINE void" << be_nl; - *os << tdef->name () << "_free (" << tdef->name () - << "_slice *_tao_src)" << be_nl; - *os << "{" << be_idt_nl; - *os << bt->name () << "_free (_tao_src);" << be_uidt_nl; - *os << "}\n\n"; - } - 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); - } - // 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); - } - this->ctx_->alias (0); - } - 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); - } - - if (!node->imported ()) - { - // by using a visitor to declare and define the TypeCode, we have the - // added advantage to conditionally not generate any code. This will be - // based on the command line options. This is still TO-DO - be_visitor *visitor; - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_typedef_cs::" - "visit_typedef - " - "TypeCode definition failed\n" - ), -1); - } - - } - this->ctx_->tdef (0); - } - - return 0; -} - -// *************************************************************************** -// Typedef visitor for generating Any operator declarations in the client header -// *************************************************************************** - -be_visitor_typedef_any_op_ch::be_visitor_typedef_any_op_ch -(be_visitor_context *ctx) - : be_visitor_typedef (ctx) -{ -} - -be_visitor_typedef_any_op_ch::~be_visitor_typedef_any_op_ch (void) -{ -} - -int -be_visitor_typedef_any_op_ch::visit_typedef (be_typedef *node) -{ - if (node->cli_hdr_any_op_gen () || node->imported ()) - return 0; - - TAO_OutStream *os = tao_cg->client_header (); - - // generate the Any <<= and >>= operator declarations - // Any <<= and >>= operators - os->indent (); - - // 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_any_op_ch::" - "visit_typedef - " - "bad primitive 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_any_op_ch::" - "visit_typedef - " - "failed to accept visitor\n" - ), -1); - } - this->ctx_->alias (0); // reset - } - 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_any_op_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_any_op_ch::" - "visit_typedef - " - "failed to accept visitor\n" - ), -1); - } - - this->ctx_->tdef (0); // reset - } - - node->cli_hdr_any_op_gen (1); - return 0; -} - -int -be_visitor_typedef_any_op_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->imported () && - 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_any_op_ch::" - "visit_array - " - "base class visitor failed \n" - ), -1); - } - } - - return 0; -} - -int -be_visitor_typedef_any_op_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_any_op_ch::" - "visit_enum - " - "base class visitor failed \n" - ), -1); - } - } - - return 0; -} - -int -be_visitor_typedef_any_op_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_any_op_ch::" - "visit_sequence - " - "base class visitor failed \n" - ), -1); - } - } - - return 0; -} - -int -be_visitor_typedef_any_op_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_any_op_ch::" - "visit_structure - " - "base class visitor failed \n" - ), -1); - } - } - - return 0; -} - -int -be_visitor_typedef_any_op_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_any_op_ch::" - "visit_union - " - "base class visitor failed \n" - ), -1); - } - } - - return 0; -} - -// *************************************************************************** -// Typedef visitor for generating Any operator declarations in the client -// stubs file -// *************************************************************************** - -be_visitor_typedef_any_op_cs::be_visitor_typedef_any_op_cs -(be_visitor_context *ctx) - : be_visitor_typedef (ctx) -{ -} - -be_visitor_typedef_any_op_cs::~be_visitor_typedef_any_op_cs (void) -{ -} - -int -be_visitor_typedef_any_op_cs::visit_typedef (be_typedef *node) -{ - if (node->cli_stub_any_op_gen () || node->imported ()) - return 0; - - TAO_OutStream *os = tao_cg->client_stubs (); - - // generate the Any <<= and >>= operator declarations - // Any <<= and >>= operators - os->indent (); - - // 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_any_op_cs::" - "visit_typedef - " - "bad primitive 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_any_op_cs::" - "visit_typedef - " - "failed to accept visitor\n" - ), -1); - } - this->ctx_->alias (0); // reset - } - 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_any_op_cs::" - "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_any_op_cs::" - "visit_typedef - " - "failed to accept visitor\n" - ), -1); - } - - this->ctx_->tdef (0); // reset - } - - node->cli_stub_any_op_gen (1); - return 0; -} - -int -be_visitor_typedef_any_op_cs::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->imported () && - 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_any_op_cs::" - "visit_array - " - "base class visitor failed \n" - ), -1); - } - } - - return 0; -} - -int -be_visitor_typedef_any_op_cs::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_any_op_cs::" - "visit_enum - " - "base class visitor failed \n" - ), -1); - } - } - - return 0; -} - -int -be_visitor_typedef_any_op_cs::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_any_op_cs::" - "visit_sequence - " - "base class visitor failed \n" - ), -1); - } - } - - return 0; -} - -int -be_visitor_typedef_any_op_cs::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_any_op_cs::" - "visit_structure - " - "base class visitor failed \n" - ), -1); - } - } - - return 0; -} - -int -be_visitor_typedef_any_op_cs::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_any_op_cs::" - "visit_union - " - "base class visitor failed \n" - ), -1); - } - } - - return 0; -} +// include all the individual files +#include "be_visitor_typedef/any_op_ch.cpp" +#include "be_visitor_typedef/any_op_cs.cpp" +#include "be_visitor_typedef/typedef.cpp" +#include "be_visitor_typedef/typedef_ch.cpp" +#include "be_visitor_typedef/typedef_ci.cpp" +#include "be_visitor_typedef/typedef_cs.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_typedef/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_typedef/any_op_ch.cpp new file mode 100644 index 00000000000..ebeb21d5cb1 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_typedef/any_op_ch.cpp @@ -0,0 +1,291 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for Any operators of a Typedef node +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_typedef.h" + + +// *************************************************************************** +// Typedef visitor for generating Any operator declarations in the client header +// *************************************************************************** + +be_visitor_typedef_any_op_ch::be_visitor_typedef_any_op_ch +(be_visitor_context *ctx) + : be_visitor_typedef (ctx) +{ +} + +be_visitor_typedef_any_op_ch::~be_visitor_typedef_any_op_ch (void) +{ +} + +int +be_visitor_typedef_any_op_ch::visit_typedef (be_typedef *node) +{ + if (node->cli_hdr_any_op_gen () || node->imported ()) + return 0; + + TAO_OutStream *os = tao_cg->client_header (); + + // generate the Any <<= and >>= operator declarations + // Any <<= and >>= operators + os->indent (); + + // 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_any_op_ch::" + "visit_typedef - " + "bad primitive 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_any_op_ch::" + "visit_typedef - " + "failed to accept visitor\n" + ), -1); + } + this->ctx_->alias (0); // reset + } + 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_any_op_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_any_op_ch::" + "visit_typedef - " + "failed to accept visitor\n" + ), -1); + } + + this->ctx_->tdef (0); // reset + } + + node->cli_hdr_any_op_gen (1); + return 0; +} + +int +be_visitor_typedef_any_op_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->imported () && + 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_any_op_ch::" + "visit_array - " + "base class visitor failed \n" + ), -1); + } + } + + return 0; +} + +int +be_visitor_typedef_any_op_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_any_op_ch::" + "visit_enum - " + "base class visitor failed \n" + ), -1); + } + } + + return 0; +} + +int +be_visitor_typedef_any_op_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_any_op_ch::" + "visit_sequence - " + "base class visitor failed \n" + ), -1); + } + } + + return 0; +} + +int +be_visitor_typedef_any_op_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_any_op_ch::" + "visit_structure - " + "base class visitor failed \n" + ), -1); + } + } + + return 0; +} + +int +be_visitor_typedef_any_op_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_any_op_ch::" + "visit_union - " + "base class visitor failed \n" + ), -1); + } + } + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_typedef/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_typedef/any_op_cs.cpp new file mode 100644 index 00000000000..62dc1e4ef76 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_typedef/any_op_cs.cpp @@ -0,0 +1,292 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for Any operators in the client stubs +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_typedef.h" + + +// *************************************************************************** +// Typedef visitor for generating Any operator declarations in the client +// stubs file +// *************************************************************************** + +be_visitor_typedef_any_op_cs::be_visitor_typedef_any_op_cs +(be_visitor_context *ctx) + : be_visitor_typedef (ctx) +{ +} + +be_visitor_typedef_any_op_cs::~be_visitor_typedef_any_op_cs (void) +{ +} + +int +be_visitor_typedef_any_op_cs::visit_typedef (be_typedef *node) +{ + if (node->cli_stub_any_op_gen () || node->imported ()) + return 0; + + TAO_OutStream *os = tao_cg->client_stubs (); + + // generate the Any <<= and >>= operator declarations + // Any <<= and >>= operators + os->indent (); + + // 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_any_op_cs::" + "visit_typedef - " + "bad primitive 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_any_op_cs::" + "visit_typedef - " + "failed to accept visitor\n" + ), -1); + } + this->ctx_->alias (0); // reset + } + 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_any_op_cs::" + "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_any_op_cs::" + "visit_typedef - " + "failed to accept visitor\n" + ), -1); + } + + this->ctx_->tdef (0); // reset + } + + node->cli_stub_any_op_gen (1); + return 0; +} + +int +be_visitor_typedef_any_op_cs::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->imported () && + 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_any_op_cs::" + "visit_array - " + "base class visitor failed \n" + ), -1); + } + } + + return 0; +} + +int +be_visitor_typedef_any_op_cs::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_any_op_cs::" + "visit_enum - " + "base class visitor failed \n" + ), -1); + } + } + + return 0; +} + +int +be_visitor_typedef_any_op_cs::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_any_op_cs::" + "visit_sequence - " + "base class visitor failed \n" + ), -1); + } + } + + return 0; +} + +int +be_visitor_typedef_any_op_cs::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_any_op_cs::" + "visit_structure - " + "base class visitor failed \n" + ), -1); + } + } + + return 0; +} + +int +be_visitor_typedef_any_op_cs::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_any_op_cs::" + "visit_union - " + "base class visitor failed \n" + ), -1); + } + } + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_typedef/typedef.cpp b/TAO/TAO_IDL/be/be_visitor_typedef/typedef.cpp new file mode 100644 index 00000000000..1f10f25a85b --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_typedef/typedef.cpp @@ -0,0 +1,457 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// typedef.cpp +// +// = DESCRIPTION +// Generic visitor generating code for Typedefs +// +// = 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_ANY_OP_CH: + ctx.state (TAO_CodeGen::TAO_ARRAY_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS: + ctx.state (TAO_CodeGen::TAO_ARRAY_ANY_OP_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_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_ANY_OP_CH: + ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS: + ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_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_ANY_OP_CH: + ctx.state (TAO_CodeGen::TAO_SEQUENCE_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS: + ctx.state (TAO_CodeGen::TAO_SEQUENCE_ANY_OP_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_ANY_OP_CH: + case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS: + 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_ANY_OP_CH: + ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS: + ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_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_ANY_OP_CH: + ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CH); + break; + case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS: + ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_typedef/typedef_ch.cpp b/TAO/TAO_IDL/be/be_visitor_typedef/typedef_ch.cpp new file mode 100644 index 00000000000..c1f10f36d51 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_typedef/typedef_ch.cpp @@ -0,0 +1,458 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// typedef_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for Typedef in the client header +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_typedef.h" + + +// ****************************************************** +// 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); + } + + // 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); + } + this->ctx_->alias (0); // reset + } + 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); + } + + // generate the typecode decl for this typedef node + if (!node->imported ()) + { + // by using a visitor to declare and define the TypeCode, we have the + // added advantage to conditionally not generate any code. This will be + // based on the command line options. This is still TO-DO + be_visitor *visitor; + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef_ch::" + "visit_typedef - " + "TypeCode declaration failed\n" + ), -1); + } + + + } + this->ctx_->tdef (0); // reset + } + + 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; + + // is the base type an alias to an array node or an actual array node + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + // is our base type an array node. If so, generate code for that array node + if (bt->node_type () == AST_Decl::NT_array) + { + // 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); + } + } + else + { + // base type is simply an alias to an array node. Simply output the + // required 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, copy, and free methods + *os << "static " << tdef->nested_type_name (scope, "_slice") << " *" + << tdef->nested_type_name (scope, "_alloc") << " (void);" << be_nl; + *os << "static " << tdef->nested_type_name (scope, "_slice") << " *" + << tdef->nested_type_name (scope, "_dup") << " (const " + << tdef->nested_type_name (scope, "_slice") << " *_tao_slice);" << be_nl; + *os << "static void " << tdef->nested_type_name (scope, "_copy") << " (" + << tdef->nested_type_name (scope, "_slice") << " *_tao_to, const " + << tdef->nested_type_name (scope, "_slice") << " *_tao_from);" << be_nl; + *os << "static void " << tdef->nested_type_name (scope, "_free") << " (" + << tdef->nested_type_name (scope, "_slice") << " *_tao_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_interface (be_interface *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 _ptr + *os << "typedef " << bt->nested_type_name (scope, "_ptr") + << " " << tdef->nested_type_name (scope, "_ptr") << ";" << be_nl; + + // typedef the _var + *os << "typedef " << bt->nested_type_name (scope, "_var") + << " " << tdef->nested_type_name (scope, "_var") << ";" << 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 + *os << "typedef " << bt->nested_type_name (scope) + << " " << tdef->nested_type_name (scope) << ";" << be_nl; + if ((node->pt () == AST_PredefinedType::PT_pseudo) || + (node->pt () == AST_PredefinedType::PT_any)) + { + // typedef the _ptr and _var + *os << "typedef " << bt->nested_type_name (scope, "_ptr") + << " " << tdef->nested_type_name (scope, "_ptr") << ";" << be_nl; + *os << "typedef " << bt->nested_type_name (scope, "_var") + << " " << tdef->nested_type_name (scope, "_var") << ";" << 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 + *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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_typedef/typedef_ci.cpp b/TAO/TAO_IDL/be/be_visitor_typedef/typedef_ci.cpp new file mode 100644 index 00000000000..93b7cdc3306 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_typedef/typedef_ci.cpp @@ -0,0 +1,287 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// typedef_ci.cpp +// +// = DESCRIPTION +// Visitor generating code for Typedefs in the client inline file. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_typedef.h" + + +// ****************************************************** +// 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); + } + // 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); + } + + this->ctx_->alias (0); + } + 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); + } + + this->ctx_->tdef (0); + } + 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); + } + } + else + { + // generate the inline code for alloc, dup, copy, and free methods + + // alloc method + os->indent (); + *os << "ACE_INLINE " << tdef->name () << "_slice *" << be_nl; + *os << tdef->name () << "_alloc (void)" << be_nl; + *os << "{" << be_idt_nl; + *os << "return " << bt->name () << "_alloc ();" << be_uidt_nl; + *os << "}\n\n"; + + // dup method + os->indent (); + *os << "ACE_INLINE " << tdef->name () << "_slice *" << be_nl; + *os << tdef->name () << "_dup (const " << tdef->name () + << "_slice *_tao_src)" << be_nl; + *os << "{" << be_idt_nl; + *os << "return " << bt->name () << "_dup (_tao_src);" << be_uidt_nl; + *os << "}\n\n"; + + // copy method + os->indent (); + *os << "ACE_INLINE void" << be_nl; + *os << tdef->name () << "_copy (" << tdef->name () + << "_slice *_tao_dest, const " << tdef->name () + << "_slice *_tao_src)" << be_nl; + *os << "{" << be_idt_nl; + *os << bt->name () << "_copy (_tao_dest, _tao_src);" << be_uidt_nl; + *os << "}\n\n"; + + // free method + os->indent (); + *os << "ACE_INLINE void" << be_nl; + *os << tdef->name () << "_free (" << tdef->name () + << "_slice *_tao_src)" << be_nl; + *os << "{" << be_idt_nl; + *os << bt->name () << "_free (_tao_src);" << be_uidt_nl; + *os << "}\n\n"; + } + 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_typedef/typedef_cs.cpp b/TAO/TAO_IDL/be/be_visitor_typedef/typedef_cs.cpp new file mode 100644 index 00000000000..ff4338e002a --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_typedef/typedef_cs.cpp @@ -0,0 +1,150 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// typedef_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for Typedef in the client stubs +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_typedef.h" + + +// ****************************************************** +// 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); + } + // 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); + } + this->ctx_->alias (0); + } + 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); + } + + if (!node->imported ()) + { + // by using a visitor to declare and define the TypeCode, we have the + // added advantage to conditionally not generate any code. This will be + // based on the command line options. This is still TO-DO + be_visitor *visitor; + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typedef_cs::" + "visit_typedef - " + "TypeCode definition failed\n" + ), -1); + } + + } + this->ctx_->tdef (0); + } + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_union.cpp b/TAO/TAO_IDL/be/be_visitor_union.cpp index 09ea167c66b..92cc1c717cb 100644 --- a/TAO/TAO_IDL/be/be_visitor_union.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union.cpp @@ -24,1013 +24,13 @@ #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 () && !node->imported ()) // not already generated and - // not imported - { - 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"; - - // by using a visitor to declare and define the TypeCode, we have the - // added advantage to conditionally not generate any code. This will be - // based on the command line options. This is still TO-DO - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_union_ch::" - "visit_union - " - "TypeCode declaration failed\n" - ), -1); - } - - - 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 () && !node->imported ()) - { - 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 () && !node->imported ()) - { - 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"; - - // by using a visitor to declare and define the TypeCode, we have the - // added advantage to conditionally not generate any code. This will be - // based on the command line options. This is still TO-DO - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_union_cs::" - "visit_union - " - "TypeCode definition failed\n" - ), -1); - } - - - 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); - } - this->ctx_->alias (0); - 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); - } - this->ctx_->alias (0); - - 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; -} - -// *************************************************************************** -// Union visitor for generating Any operator declarations in the client header -// *************************************************************************** - -be_visitor_union_any_op_ch::be_visitor_union_any_op_ch -(be_visitor_context *ctx) - : be_visitor_union (ctx) -{ -} - -be_visitor_union_any_op_ch::~be_visitor_union_any_op_ch (void) -{ -} - -int -be_visitor_union_any_op_ch::visit_union (be_union *node) -{ - if (node->cli_hdr_any_op_gen () || node->imported ()) - return 0; - - TAO_OutStream *os = tao_cg->client_header (); - - // generate the Any <<= and >>= operator declarations - os->indent (); - *os << "void " << idl_global->export_macro () - << " operator<<= (CORBA::Any &, const " << node->name () - << " &); // copying version" << be_nl; - *os << "void " << idl_global->export_macro () - << " operator<<= (CORBA::Any &, " << node->name () - << "*); // noncopying version" << be_nl; - *os << "CORBA::Boolean " << idl_global->export_macro () - << " operator>>= (const CORBA::Any &, " - << node->name () << " *&);\n"; - - - // all we have to do is to visit the scope and generate code - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_union::visit_union - " - "codegen for scope failed\n"), -1); - } - - node->cli_hdr_any_op_gen (1); - return 0; -} - -int -be_visitor_union_any_op_ch::visit_union_branch (be_union_branch *node) -{ - be_type *bt; // field's type - - // 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_any_op_ch::" - "visit_union_branch - " - "Bad field type\n" - ), -1); - } - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_union_any_op_ch::" - "visit_field - " - "codegen for field type failed\n" - ), -1); - } - return 0; -} - -// *************************************************************************** -// Union visitor for generating Any operator declarations in the client -// stubs file -// *************************************************************************** - -be_visitor_union_any_op_cs::be_visitor_union_any_op_cs -(be_visitor_context *ctx) - : be_visitor_union (ctx) -{ -} - -be_visitor_union_any_op_cs::~be_visitor_union_any_op_cs (void) -{ -} - -int -be_visitor_union_any_op_cs::visit_union (be_union *node) -{ - if (node->cli_stub_any_op_gen () || node->imported ()) - return 0; - - TAO_OutStream *os = tao_cg->client_stubs (); - - // generate the Any <<= and >>= operator declarations - os->indent (); - *os << "void operator<<= (CORBA::Any &_tao_any, const " - << node->name () << " &_tao_elem) // copying" << be_nl - << "{" << be_idt_nl - << "CORBA::Environment _tao_env;" << be_nl - << "_tao_any.replace (" << node->tc_name () << ", new " - << node->name () << "(_tao_elem), 1, _tao_env);" << be_uidt_nl - << "}" << be_nl; - - *os << "void operator<<= (CORBA::Any &_tao_any, " - << node->name () << " *_tao_elem) // non copying" << be_nl - << "{" << be_idt_nl - << "CORBA::Environment _tao_env;" << be_nl - << "_tao_any.replace (" << node->tc_name () << ", " - << "_tao_elem, 1, _tao_env); // consume it" << be_uidt_nl - << "}" << be_nl; - - *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, " - << node->name () << " *&_tao_elem)" << be_nl - << "{" << be_idt_nl - << "CORBA::Environment _tao_env;" << be_nl - << "if (!_tao_any.type ()->equal (" << node->tc_name () - << ", _tao_env)) return 0; // not equal" << be_nl - << "if (_tao_any.any_owns_data ())" << be_nl - << "{" << be_idt_nl - << "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);" - << be_nl - << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());" - << be_nl - << "if (stream.decode (" << node->tc_name () - << ", _tao_elem, 0, _tao_env)" << be_nl - << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl - << "{" << be_idt_nl - << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), " - << "_tao_elem, 1, _tao_env);" - << be_nl - << " return 1;" << be_uidt_nl - << "}" << be_nl - << "else" << be_nl // decode failed - << "{" << be_idt_nl - << "delete _tao_elem;" << be_nl - << "return 0;" << be_uidt_nl - << "}" << be_uidt_nl - << "}" << be_nl - << "else" << be_nl // else any does not own the data - << "{" << be_idt_nl - << "_tao_elem = (" << node->name () << " *)_tao_any.value ();" - << be_nl - << "return 1;" << be_uidt_nl - << "}" << be_uidt_nl - << "}\n\n"; - - - // all we have to do is to visit the scope and generate code - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_union::visit_union - " - "codegen for scope failed\n"), -1); - } - - node->cli_stub_any_op_gen (1); - return 0; -} - -int -be_visitor_union_any_op_cs::visit_union_branch (be_union_branch *node) -{ - be_type *bt; // field's type - - // 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_any_op_cs::" - "visit_union_branch - " - "Bad field type\n" - ), -1); - } - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_union_any_op_cs::" - "visit_union_branch - " - "codegen for field type failed\n" - ), -1); - } - return 0; -} +// include all the individual files +#include "be_visitor_union/any_op_ch.cpp" +#include "be_visitor_union/any_op_cs.cpp" +#include "be_visitor_union/discriminant_ch.cpp" +#include "be_visitor_union/discriminant_ci.cpp" +#include "be_visitor_union/discriminant_cs.cpp" +#include "be_visitor_union/union.cpp" +#include "be_visitor_union/union_ch.cpp" +#include "be_visitor_union/union_ci.cpp" +#include "be_visitor_union/union_cs.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_union/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union/any_op_ch.cpp new file mode 100644 index 00000000000..0a1d05e1033 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_union/any_op_ch.cpp @@ -0,0 +1,100 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for Any operators for Union. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_union.h" + + +// *************************************************************************** +// Union visitor for generating Any operator declarations in the client header +// *************************************************************************** + +be_visitor_union_any_op_ch::be_visitor_union_any_op_ch +(be_visitor_context *ctx) + : be_visitor_union (ctx) +{ +} + +be_visitor_union_any_op_ch::~be_visitor_union_any_op_ch (void) +{ +} + +int +be_visitor_union_any_op_ch::visit_union (be_union *node) +{ + if (node->cli_hdr_any_op_gen () || node->imported ()) + return 0; + + TAO_OutStream *os = tao_cg->client_header (); + + // generate the Any <<= and >>= operator declarations + os->indent (); + *os << "void " << idl_global->export_macro () + << " operator<<= (CORBA::Any &, const " << node->name () + << " &); // copying version" << be_nl; + *os << "void " << idl_global->export_macro () + << " operator<<= (CORBA::Any &, " << node->name () + << "*); // noncopying version" << be_nl; + *os << "CORBA::Boolean " << idl_global->export_macro () + << " operator>>= (const CORBA::Any &, " + << node->name () << " *&);\n"; + + + // all we have to do is to visit the scope and generate code + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union::visit_union - " + "codegen for scope failed\n"), -1); + } + + node->cli_hdr_any_op_gen (1); + return 0; +} + +int +be_visitor_union_any_op_ch::visit_union_branch (be_union_branch *node) +{ + be_type *bt; // field's type + + // 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_any_op_ch::" + "visit_union_branch - " + "Bad field type\n" + ), -1); + } + + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_any_op_ch::" + "visit_field - " + "codegen for field type failed\n" + ), -1); + } + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp new file mode 100644 index 00000000000..78e2fca68d3 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp @@ -0,0 +1,142 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for Any operators for Union. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_union.h" + + +// *************************************************************************** +// Union visitor for generating Any operator declarations in the client +// stubs file +// *************************************************************************** + +be_visitor_union_any_op_cs::be_visitor_union_any_op_cs +(be_visitor_context *ctx) + : be_visitor_union (ctx) +{ +} + +be_visitor_union_any_op_cs::~be_visitor_union_any_op_cs (void) +{ +} + +int +be_visitor_union_any_op_cs::visit_union (be_union *node) +{ + if (node->cli_stub_any_op_gen () || node->imported ()) + return 0; + + TAO_OutStream *os = tao_cg->client_stubs (); + + // generate the Any <<= and >>= operator declarations + os->indent (); + *os << "void operator<<= (CORBA::Any &_tao_any, const " + << node->name () << " &_tao_elem) // copying" << be_nl + << "{" << be_idt_nl + << "CORBA::Environment _tao_env;" << be_nl + << "_tao_any.replace (" << node->tc_name () << ", new " + << node->name () << "(_tao_elem), 1, _tao_env);" << be_uidt_nl + << "}" << be_nl; + + *os << "void operator<<= (CORBA::Any &_tao_any, " + << node->name () << " *_tao_elem) // non copying" << be_nl + << "{" << be_idt_nl + << "CORBA::Environment _tao_env;" << be_nl + << "_tao_any.replace (" << node->tc_name () << ", " + << "_tao_elem, 1, _tao_env); // consume it" << be_uidt_nl + << "}" << be_nl; + + *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, " + << node->name () << " *&_tao_elem)" << be_nl + << "{" << be_idt_nl + << "CORBA::Environment _tao_env;" << be_nl + << "if (!_tao_any.type ()->equal (" << node->tc_name () + << ", _tao_env)) return 0; // not equal" << be_nl + << "if (_tao_any.any_owns_data ())" << be_nl + << "{" << be_idt_nl + << "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);" + << be_nl + << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());" + << be_nl + << "if (stream.decode (" << node->tc_name () + << ", _tao_elem, 0, _tao_env)" << be_nl + << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl + << "{" << be_idt_nl + << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), " + << "_tao_elem, 1, _tao_env);" + << be_nl + << " return 1;" << be_uidt_nl + << "}" << be_nl + << "else" << be_nl // decode failed + << "{" << be_idt_nl + << "delete _tao_elem;" << be_nl + << "return 0;" << be_uidt_nl + << "}" << be_uidt_nl + << "}" << be_nl + << "else" << be_nl // else any does not own the data + << "{" << be_idt_nl + << "_tao_elem = (" << node->name () << " *)_tao_any.value ();" + << be_nl + << "return 1;" << be_uidt_nl + << "}" << be_uidt_nl + << "}\n\n"; + + + // all we have to do is to visit the scope and generate code + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union::visit_union - " + "codegen for scope failed\n"), -1); + } + + node->cli_stub_any_op_gen (1); + return 0; +} + +int +be_visitor_union_any_op_cs::visit_union_branch (be_union_branch *node) +{ + be_type *bt; // field's type + + // 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_any_op_cs::" + "visit_union_branch - " + "Bad field type\n" + ), -1); + } + + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_any_op_cs::" + "visit_union_branch - " + "codegen for field type failed\n" + ), -1); + } + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_union/discriminant_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union/discriminant_ch.cpp new file mode 100644 index 00000000000..64f6418f620 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_union/discriminant_ch.cpp @@ -0,0 +1,143 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// discriminant_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for discriminant of the Union +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_union.h" + + +// ************************************************************************* +// 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); + } + this->ctx_->alias (0); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_union/discriminant_ci.cpp b/TAO/TAO_IDL/be/be_visitor_union/discriminant_ci.cpp new file mode 100644 index 00000000000..02ab7c6aa3c --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_union/discriminant_ci.cpp @@ -0,0 +1,137 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// discriminant_ci.cpp +// +// = DESCRIPTION +// Visitor generating code for discriminant of the union. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_union.h" + + +// ************************************************************************* +// 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); + } + this->ctx_->alias (0); + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_union/discriminant_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union/discriminant_cs.cpp new file mode 100644 index 00000000000..09c8e4d4e48 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_union/discriminant_cs.cpp @@ -0,0 +1,89 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// discriminant_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for discriminant of the union +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_union.h" + + +// ************************************************************************* +// 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/union.cpp b/TAO/TAO_IDL/be/be_visitor_union/union.cpp new file mode 100644 index 00000000000..49d159cdee8 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_union/union.cpp @@ -0,0 +1,106 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// union.cpp +// +// = DESCRIPTION +// Generic visitor generating code for Unions +// +// = 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp new file mode 100644 index 00000000000..a209021e578 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp @@ -0,0 +1,203 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// union_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for Unions in the client header +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_union.h" + + +// ****************************************************** +// 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 () && !node->imported ()) // not already generated and + // not imported + { + 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"; + + // by using a visitor to declare and define the TypeCode, we have the + // added advantage to conditionally not generate any code. This will be + // based on the command line options. This is still TO-DO + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_ch::" + "visit_union - " + "TypeCode declaration failed\n" + ), -1); + } + + + 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_union/union_ci.cpp b/TAO/TAO_IDL/be/be_visitor_union/union_ci.cpp new file mode 100644 index 00000000000..14f43322f8f --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_union/union_ci.cpp @@ -0,0 +1,145 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// union_ci.cpp +// +// = DESCRIPTION +// Visitor generating code for Union in the client inline file +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_union.h" + + +// ****************************************************** +// 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 () && !node->imported ()) + { + 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp new file mode 100644 index 00000000000..28c5cdeff2b --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp @@ -0,0 +1,179 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// union_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for Unions in the client stubs +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_union.h" + + +// ****************************************************** +// 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 () && !node->imported ()) + { + 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"; + + // by using a visitor to declare and define the TypeCode, we have the + // added advantage to conditionally not generate any code. This will be + // based on the command line options. This is still TO-DO + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_union_cs::" + "visit_union - " + "TypeCode definition failed\n" + ), -1); + } + + + node->cli_stub_gen (I_TRUE); + } + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch.cpp index 21ccba8608b..3f3d63da167 100644 --- a/TAO/TAO_IDL/be/be_visitor_union_branch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union_branch.cpp @@ -23,2091 +23,9 @@ #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); - } - this->ctx_->alias (0); - 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, "_ptr") << " " << 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, "_ptr") << " " << 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, "_ptr") << " " << 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 << "char *" << 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); - } - - this->ctx_->alias (0); - 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) -{ - 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_sequence - " - "bad context information\n" - ), -1); - } - os = this->ctx_->stream (); - - // (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 - << "if (!this->" << ub->local_name () << "_)" << be_idt_nl - << "this->" << ub->local_name () << "_ = new " - << bt->name () << ";" << be_uidt_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_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 - << " this->" << ub->local_name () - << "_ = new CORBA::String_var (val);" << be_nl - << "else" << be_nl - << " *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 - << " this->" << ub->local_name () - << "_ = new CORBA::String_var (val);" << be_nl - << "else" << be_nl - << " *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 - << " this->" << ub->local_name () - << "_ = new CORBA::String_var (val);" << be_nl - << "else" << be_nl - << " *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); - } - - this->ctx_->alias (0); - 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; -} +// include all the individual files +#include "be_visitor_union_branch/private_ch.cpp" +#include "be_visitor_union_branch/public_assign_cs.cpp" +#include "be_visitor_union_branch/public_ch.cpp" +#include "be_visitor_union_branch/public_ci.cpp" +#include "be_visitor_union_branch/public_cs.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp new file mode 100644 index 00000000000..d1b481f1aa2 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp @@ -0,0 +1,390 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// private_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for Union branch for the private part of the +// class. +// +// = 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 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, "_ptr") << " " << 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, "_ptr") << " " << 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, "_ptr") << " " << 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 << "char *" << 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); + } + + this->ctx_->alias (0); + 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp new file mode 100644 index 00000000000..274cea03844 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp @@ -0,0 +1,79 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// public_assign_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for Union Branch for the assignment operator +// +// = 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 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/be_visitor_union_branch/public_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_ch.cpp new file mode 100644 index 00000000000..7c2619d3cf9 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_ch.cpp @@ -0,0 +1,608 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// public_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for Union_branch in the public part. +// +// = 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); + } + this->ctx_->alias (0); + 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp new file mode 100644 index 00000000000..8037d378bea --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp @@ -0,0 +1,949 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// public_ci.cpp +// +// = DESCRIPTION +// Visitor generating code for Union Branch in the client inline file. +// +// = 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 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) +{ + 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_sequence - " + "bad context information\n" + ), -1); + } + os = this->ctx_->stream (); + + // (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 + << "if (!this->" << ub->local_name () << "_)" << be_idt_nl + << "this->" << ub->local_name () << "_ = new " + << bt->name () << ";" << be_uidt_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_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 + << " this->" << ub->local_name () + << "_ = new CORBA::String_var (val);" << be_nl + << "else" << be_nl + << " *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 + << " this->" << ub->local_name () + << "_ = new CORBA::String_var (val);" << be_nl + << "else" << be_nl + << " *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 + << " this->" << ub->local_name () + << "_ = new CORBA::String_var (val);" << be_nl + << "else" << be_nl + << " *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); + } + + this->ctx_->alias (0); + 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; +} diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/public_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_cs.cpp new file mode 100644 index 00000000000..dc2c7700d2a --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_cs.cpp @@ -0,0 +1,193 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// public_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for Union Branch in the client stubs +// +// = 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 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; +} diff --git a/TAO/TAO_IDL/be_include/be_visitor_args.h b/TAO/TAO_IDL/be_include/be_visitor_args.h deleted file mode 100644 index 95772b59119..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_args.h +++ /dev/null @@ -1,606 +0,0 @@ -// -// $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_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 - - //= 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_arglist : public be_visitor_args -{ - // - // = 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 the declaration output, in other words, - // it outputs both the arguments and their types. - // -public: - be_visitor_args_arglist (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_args_arglist (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_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_static_call - // -public: - be_visitor_args_pre_docall_cs (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_args_pre_docall_cs (void); - // destructor - - virtual int void_return_type (void); - // return true if the operation return type is void - - 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_static_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_static_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 - - // =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_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); - // visit the typedef type - -}; - -// ************************************************************ -// 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 - - 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_marshal_ss -// ************************************************************ -class be_visitor_args_post_marshal_ss : public be_visitor_args -{ - // - // = TITLE - // be_visitor_args_post_marshal_ss - // - // = DESCRIPTION - // Visitor for post processing after marshal - // -public: - be_visitor_args_post_marshal_ss (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_args_post_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); - // visit the typedef type - -}; - -#endif // _BE_VISITOR_ARGS_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument.h b/TAO/TAO_IDL/be_include/be_visitor_argument.h new file mode 100644 index 00000000000..6b4a6c0ed63 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_argument.h @@ -0,0 +1,38 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_args.h +// +// = DESCRIPTION +// Visitors for generation of code for Arguments. These are used for the +// interpretive styled stubs and skeletons +// +// = AUTHOR +// Aniruddha Gokhale and Carlos O' Ryan +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ARGUMENT_H) +#define _BE_VISITOR_ARGUMENT_H + +#include "be_visitor_decl.h" +#include "be_visitor_argument/argument.h" +#include "be_visitor_argument/arglist.h" +#include "be_visitor_argument/pre_docall_cs.h" +#include "be_visitor_argument/docall_cs.h" +#include "be_visitor_argument/post_docall_cs.h" +#include "be_visitor_argument/vardecl_ss.h" +#include "be_visitor_argument/pre_upcall_ss.h" +#include "be_visitor_argument/upcall_ss.h" +#include "be_visitor_argument/post_upcall_ss.h" +#include "be_visitor_argument/marshal_ss.h" +#include "be_visitor_argument/post_marshal_ss.h" + +#endif /* _BE_VISITOR_ARGUMENT_H */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/arglist.h b/TAO/TAO_IDL/be_include/be_visitor_argument/arglist.h new file mode 100644 index 00000000000..7042280a22e --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_argument/arglist.h @@ -0,0 +1,88 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// arglist.h +// +// = DESCRIPTION +// Visitors for generation of code for Arguments as parameter lists in the +// operation signature +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ARGUMENT_ARGLIST_H_) +#define _BE_VISITOR_ARGUMENT_ARGLIST_H_ + +class be_visitor_args_arglist : public be_visitor_args +{ + // + // = 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 the declaration output, in other words, + // it outputs both the arguments and their types. + // +public: + be_visitor_args_arglist (be_visitor_context *ctx); + // constructor + + virtual ~be_visitor_args_arglist (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_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 + +}; + +#endif /* _BE_VISITOR_ARGUMENT_ARGLIST_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/argument.h b/TAO/TAO_IDL/be_include/be_visitor_argument/argument.h new file mode 100644 index 00000000000..537811f8b94 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_argument/argument.h @@ -0,0 +1,59 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// argument.h +// +// = DESCRIPTION +// Visitors for generation of code for Arguments +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ARGUMENT_ARGUMENT_H_) +#define _BE_VISITOR_ARGUMENT_ARGUMENT_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 + + //= 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 +}; + +#endif /* _BE_VISITOR_ARGUMENT_ARGUMENT_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/docall_cs.h b/TAO/TAO_IDL/be_include/be_visitor_argument/docall_cs.h new file mode 100644 index 00000000000..0b876370660 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_argument/docall_cs.h @@ -0,0 +1,81 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// docall_cs.h +// +// = DESCRIPTION +// Visitors for generation of code for Arguments for passing the arguments +// to the docall in the client side stub. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ARGUMENT_DOCALL_CS_H_) +#define _BE_VISITOR_ARGUMENT_DOCALL_CS_H_ + +// ************************************************************ +// 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_static_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 + +}; + +#endif /* _BE_VISITOR_ARGUMENT_DOCALL_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/marshal_ss.h b/TAO/TAO_IDL/be_include/be_visitor_argument/marshal_ss.h new file mode 100644 index 00000000000..ea26a66fde3 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_argument/marshal_ss.h @@ -0,0 +1,81 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// marshal_ss.h +// +// = DESCRIPTION +// Visitors for generation of code for Arguments. This generates the +// code to pass the arguments to the call to the marshaler/demarshaler +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ARGUMENT_MARSHAL_SS_H_) +#define _BE_VISITOR_ARGUMENT_MARSHAL_SS_H_ + +// ************************************************************ +// 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); + // visit the typedef type + +}; + +#endif /* _BE_VISITOR_ARGUMENT_MARSHAL_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/post_docall_cs.h b/TAO/TAO_IDL/be_include/be_visitor_argument/post_docall_cs.h new file mode 100644 index 00000000000..e292de4fa0a --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_argument/post_docall_cs.h @@ -0,0 +1,59 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// post_docall_cs.h +// +// = DESCRIPTION +// Visitors for generation of code for Arguments for docall post processing +// in the client side stub. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ARGUMENT_POST_DOCALL_CS_H_) +#define _BE_VISITOR_ARGUMENT_POST_DOCALL_CS_H_ + +// ************************************************************ +// 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_static_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 +}; + +#endif /* _BE_VISITOR_ARGUMENT_POST_DOCALL_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/post_marshal_ss.h b/TAO/TAO_IDL/be_include/be_visitor_argument/post_marshal_ss.h new file mode 100644 index 00000000000..4988ff66ad2 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_argument/post_marshal_ss.h @@ -0,0 +1,81 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// post_marshal_ss.h +// +// = DESCRIPTION +// Visitors for generation of code for Arguments. This generates the +// code that does post-marshal processing (cleaning up) for arguments +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ARGUMENT_POST_MARSHAL_SS_H_) +#define _BE_VISITOR_ARGUMENT_POST_MARSHAL_SS_H_ + +// ************************************************************ +// class be_visitor_args_post_marshal_ss +// ************************************************************ +class be_visitor_args_post_marshal_ss : public be_visitor_args +{ + // + // = TITLE + // be_visitor_args_post_marshal_ss + // + // = DESCRIPTION + // Visitor for post processing after marshal + // +public: + be_visitor_args_post_marshal_ss (be_visitor_context *ctx); + // constructor + + virtual ~be_visitor_args_post_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); + // visit the typedef type + +}; + +#endif /* _BE_VISITOR_ARGUMENT_POST_MARSHAL_SS_H */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/post_upcall_ss.h b/TAO/TAO_IDL/be_include/be_visitor_argument/post_upcall_ss.h new file mode 100644 index 00000000000..7b87ba9bf35 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_argument/post_upcall_ss.h @@ -0,0 +1,82 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// post_upcall_ss.h +// +// = DESCRIPTION +// Visitors for generation of code for Arguments. This generates the +// code for post upcall processing of the arguments +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + + +#if !defined (_BE_VISITOR_ARGUMENT_POST_UPCALL_SS_H_) +#define _BE_VISITOR_ARGUMENT_POST_UPCALL_SS_H_ + +// ************************************************************ +// 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 + + 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 + +}; + +#endif /* _BE_VISITOR_ARGUMENT_POST_UPCALL_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/pre_docall_cs.h b/TAO/TAO_IDL/be_include/be_visitor_argument/pre_docall_cs.h new file mode 100644 index 00000000000..f5238423590 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_argument/pre_docall_cs.h @@ -0,0 +1,81 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// pre_docall_cs.h +// +// = DESCRIPTION +// Visitors for generation of code for Arguments for pre docall processing +// in client side stub that uses interpretive marshaling. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ARGUMENT_PRE_DOCALL_CS_H_) +#define _BE_VISITOR_ARGUMENT_PRE_DOCALL_CS_H_ + +// ************************************************************ +// 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_static_call + // +public: + be_visitor_args_pre_docall_cs (be_visitor_context *ctx); + // constructor + + virtual ~be_visitor_args_pre_docall_cs (void); + // destructor + + virtual int void_return_type (void); + // return true if the operation return type is void + + 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 + +}; + +#endif /* _BE_VISITOR_ARGUMENT_PRE_DOCALL_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/pre_upcall_ss.h b/TAO/TAO_IDL/be_include/be_visitor_argument/pre_upcall_ss.h new file mode 100644 index 00000000000..24bf3e88054 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_argument/pre_upcall_ss.h @@ -0,0 +1,81 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// pre_upcall_ss.h +// +// = DESCRIPTION +// Visitors for generation of code for Arguments. This generates the +// pre upcall processing of arguments in the server-side skeleton. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ARGUMENT_PRE_UPCALL_SS_H_) +#define _BE_VISITOR_ARGUMENT_PRE_UPCALL_SS_H_ + +// ************************************************************ +// 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 + +}; + +#endif /* _BE_VISITOR_ARGUMENT_PRE_UPCALL_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/upcall_ss.h b/TAO/TAO_IDL/be_include/be_visitor_argument/upcall_ss.h new file mode 100644 index 00000000000..5bd504fcded --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_argument/upcall_ss.h @@ -0,0 +1,81 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// upcall_ss.h +// +// = DESCRIPTION +// Visitors for generation of code for Arguments. This generates the +// passing of arguments to the upcall. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ARGUMENT_UPCALL_SS_H_) +#define _BE_VISITOR_ARGUMENT_UPCALL_SS_H_ + +// ************************************************************ +// 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 + + // =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 + +}; + +#endif /* _BE_VISITOR_ARGUMENT_UPCALL_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/vardecl_ss.h b/TAO/TAO_IDL/be_include/be_visitor_argument/vardecl_ss.h new file mode 100644 index 00000000000..40018f1f0e2 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_argument/vardecl_ss.h @@ -0,0 +1,81 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// vardecl_ss.h +// +// = DESCRIPTION +// Visitors for generation of code for Arguments. This generates the +// variable declartion for the argument in the server-sde skeleton +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ARGUMENT_VARDECL_SS_H_) +#define _BE_VISITOR_ARGUMENT_VARDECL_SS_H_ + +// ************************************************************ +// 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 + +}; + +#endif /* _BE_VISITOR_ARGUMENT_VARDECL_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_array.h b/TAO/TAO_IDL/be_include/be_visitor_array.h index 1aed4d15daa..2f461c49cd4 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_array.h +++ b/TAO/TAO_IDL/be_include/be_visitor_array.h @@ -18,139 +18,17 @@ // // ============================================================================ -#ifndef _BE_VISITOR_ARRAY_H -#define _BE_VISITOR_ARRAY_H +#if !defined (TAO_BE_VISITOR_ARRAY_H) +#define TAO_BE_VISITOR_ARRAY_H #include "be_visitor_decl.h" - - -// ************************************************************ -// class be_visitor_array_ch -// ************************************************************ - -class be_visitor_array_ch : public be_visitor_decl -{ - // - // = TITLE - // be_visitor_array_ch - // - // = DESCRIPTION - // Code to be generated for arrays in the client header file - // -public: - be_visitor_array_ch (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_array_ch (void); - // destructor - - virtual int visit_array (be_array *node); - // visit the array node - -}; - -// ************************************************************ -// class be_visitor_array_ci -// ************************************************************ - -class be_visitor_array_ci : public be_visitor_decl -{ - // - // = TITLE - // be_visitor_array_ci - // - // = DESCRIPTION - // Code to be generated for arrays in the client inline file - // -public: - be_visitor_array_ci (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_array_ci (void); - // destructor - - virtual int visit_array (be_array *node); - // visit the array node - -}; - -// ************************************************************ -// class be_visitor_array_cs -// ************************************************************ - -class be_visitor_array_cs : public be_visitor_decl -{ - // - // = TITLE - // be_visitor_array_cs - // - // = DESCRIPTION - // Code to be generated for arrays in the client stub file - // -public: - be_visitor_array_cs (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_array_cs (void); - // destructor - - virtual int visit_array (be_array *node); - // visit the array node - -}; - -// ************************************************************ -// class be_visitor_array_cs -// ************************************************************ - -class be_visitor_array_any_op_ch : public be_visitor_decl -{ - // - // = TITLE - // be_visitor_array_any_op_ch - // - // = DESCRIPTION - // This is a concrete visitor for array that generates the Any operator - // declarations - // - -public: - be_visitor_array_any_op_ch (be_visitor_context *ctx); - // constructor - - ~be_visitor_array_any_op_ch (void); - // destructor - - virtual int visit_array (be_array *node); - // visit array - -}; - -// ************************************************************ -// class be_visitor_array_cs -// ************************************************************ - -class be_visitor_array_any_op_cs : public be_visitor_decl -{ - // - // = TITLE - // be_visitor_array_any_op_cs - // - // = DESCRIPTION - // This is a concrete visitor for array that generates the Any operator - // implementations - // - -public: - be_visitor_array_any_op_cs (be_visitor_context *ctx); - // constructor - - ~be_visitor_array_any_op_cs (void); - // destructor - - virtual int visit_array (be_array *node); - // visit array - -}; - -#endif +// generic visitor +#include "be_visitor_array/array.h" +// concrete visitors +#include "be_visitor_array/array_ch.h" +#include "be_visitor_array/array_ci.h" +#include "be_visitor_array/array_cs.h" +#include "be_visitor_array/any_op_ch.h" +#include "be_visitor_array/any_op_cs.h" + +#endif /* TAO_BE_VISITOR_ARRAY_H */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_array/any_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_array/any_op_ch.h new file mode 100644 index 00000000000..dffce321f77 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_array/any_op_ch.h @@ -0,0 +1,52 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_ch.h +// +// = DESCRIPTION +// Visitors for generation of code for Arrays in client header. This one +// generates the Any operators. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ARRAY_ANY_OP_CH_H_) +#define _BE_VISITOR_ARRAY_ANY_OP_CH_H_ + +// ************************************************************ +// class be_visitor_array_any_op_ch +// ************************************************************ + +class be_visitor_array_any_op_ch : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_array_any_op_ch + // + // = DESCRIPTION + // This is a concrete visitor for array that generates the Any operator + // declarations + // + +public: + be_visitor_array_any_op_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_array_any_op_ch (void); + // destructor + + virtual int visit_array (be_array *node); + // visit array + +}; + +#endif /* _BE_VISITOR_ARRAY_ANY_OP_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_array/any_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_array/any_op_cs.h new file mode 100644 index 00000000000..fc3c814c0d6 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_array/any_op_cs.h @@ -0,0 +1,52 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_cs.h +// +// = DESCRIPTION +// Visitors for generation of code for Arrays in client stubs. This one +// generates the Any operators. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ARRAY_ANY_OP_CS_H_) +#define _BE_VISITOR_ARRAY_ANY_OP_CS_H_ + +// ************************************************************ +// class be_visitor_array_cs +// ************************************************************ + +class be_visitor_array_any_op_cs : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_array_any_op_cs + // + // = DESCRIPTION + // This is a concrete visitor for array that generates the Any operator + // implementations + // + +public: + be_visitor_array_any_op_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_array_any_op_cs (void); + // destructor + + virtual int visit_array (be_array *node); + // visit array + +}; + +#endif /* _BE_VISITOR_ARRAY_ANY_OP_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_array/array.h b/TAO/TAO_IDL/be_include/be_visitor_array/array.h new file mode 100644 index 00000000000..0a9510ce383 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_array/array.h @@ -0,0 +1,84 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// array.h +// +// = DESCRIPTION +// Visitors for generation of code for Arrays. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ARRAY_ARRAY_H_) +#define _BE_VISITOR_ARRAY_ARRAY_H_ + +// ************************************************************ +// class be_visitor_array +// ************************************************************ + +class be_visitor_array : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_array + // + // = DESCRIPTION + // This is a generic visitor for arrays + // + // +public: + be_visitor_array (be_visitor_context *ctx); + // Constructor + + ~be_visitor_array (void); + // destructor + + virtual int visit_array (be_array *); + // visit the array node + + // = Visitor methods on array types + + virtual int visit_enum (be_enum *node); + // visit an enum + + virtual int visit_interface (be_interface *node); + // visit an interface + + virtual int visit_interface_fwd (be_interface_fwd *node); + // visit an interface forward node + + virtual int visit_predefined_type (be_predefined_type *node); + // visit a predefined type node + + virtual int visit_sequence (be_sequence *node); + // visit sequence + + virtual int visit_string (be_string *node); + // visit string + + virtual int visit_structure (be_structure *node); + // visit structure + + virtual int visit_typedef (be_typedef *node); + // visit typedef + + virtual int visit_union (be_union *node); + // visit union + +protected: + + int visit_node (be_type *); + // helper that does the common job + +}; + +#endif /* _BE_VISITOR_ARRAY_ARRAY_H_*/ diff --git a/TAO/TAO_IDL/be_include/be_visitor_array/array_ch.h b/TAO/TAO_IDL/be_include/be_visitor_array/array_ch.h new file mode 100644 index 00000000000..7a859d85527 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_array/array_ch.h @@ -0,0 +1,49 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// array_ch.h +// +// = DESCRIPTION +// Visitors for generation of code for Arrays in client header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ARRAY_CH_H_) +#define _BE_VISITOR_ARRAY_CH_H_ + +// ************************************************************ +// class be_visitor_array_ch +// ************************************************************ + +class be_visitor_array_ch : public be_visitor_array +{ + // + // = TITLE + // be_visitor_array_ch + // + // = DESCRIPTION + // Code to be generated for arrays in the client header file + // +public: + be_visitor_array_ch (be_visitor_context *ctx); + // constructor + + virtual ~be_visitor_array_ch (void); + // destructor + + virtual int visit_array (be_array *node); + // visit the array node + +}; + +#endif /* _BE_VISITOR_ARRAY_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_array/array_ci.h b/TAO/TAO_IDL/be_include/be_visitor_array/array_ci.h new file mode 100644 index 00000000000..3cb5f06cb6d --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_array/array_ci.h @@ -0,0 +1,49 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// array_ci.h +// +// = DESCRIPTION +// Visitors for generation of code for Arrays in client inline. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ARRAY_CI_H_) +#define _BE_VISITOR_ARRAY_CI_H_ + +// ************************************************************ +// class be_visitor_array_ci +// ************************************************************ + +class be_visitor_array_ci : public be_visitor_array +{ + // + // = TITLE + // be_visitor_array_ci + // + // = DESCRIPTION + // Code to be generated for arrays in the client inline file + // +public: + be_visitor_array_ci (be_visitor_context *ctx); + // constructor + + virtual ~be_visitor_array_ci (void); + // destructor + + virtual int visit_array (be_array *node); + // visit the array node + +}; + +#endif /* _BE_VISITOR_ARRAY_CI_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_array/array_cs.h b/TAO/TAO_IDL/be_include/be_visitor_array/array_cs.h new file mode 100644 index 00000000000..101ce40ce31 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_array/array_cs.h @@ -0,0 +1,49 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// array_cs.h +// +// = DESCRIPTION +// Visitors for generation of code for Arrays in client stubs. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ARRAY_CS_H_) +#define _BE_VISITOR_ARRAY_CS_H_ + +// ************************************************************ +// class be_visitor_array_cs +// ************************************************************ + +class be_visitor_array_cs : public be_visitor_array +{ + // + // = TITLE + // be_visitor_array_cs + // + // = DESCRIPTION + // Code to be generated for arrays in the client stub file + // +public: + be_visitor_array_cs (be_visitor_context *ctx); + // constructor + + virtual ~be_visitor_array_cs (void); + // destructor + + virtual int visit_array (be_array *node); + // visit the array node + +}; + +#endif /* _BE_VISITOR_ARRAY_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_attribute.h b/TAO/TAO_IDL/be_include/be_visitor_attribute.h index 6db40e2a693..0e9fb275ae6 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_attribute.h +++ b/TAO/TAO_IDL/be_include/be_visitor_attribute.h @@ -24,33 +24,6 @@ #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 - -}; - +#include "be_visitor_attribute/attribute.h" #endif diff --git a/TAO/TAO_IDL/be_include/be_visitor_attribute/attribute.h b/TAO/TAO_IDL/be_include/be_visitor_attribute/attribute.h new file mode 100644 index 00000000000..c330de69537 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_attribute/attribute.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// attribute.h +// +// = DESCRIPTION +// Visitor for the Attribute class. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ATTRIBUTE_ATTRIBUTE_H) +#define _BE_VISITOR_ATTRIBUTE_ATTRIBUTE_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 /* _BE_VISITOR_ATTRIBUTE_ATTRIBUTE_H*/ diff --git a/TAO/TAO_IDL/be_include/be_visitor_constant.h b/TAO/TAO_IDL/be_include/be_visitor_constant.h index f91580e3dd0..4bd864c7aa3 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_constant.h +++ b/TAO/TAO_IDL/be_include/be_visitor_constant.h @@ -24,56 +24,7 @@ #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 - - // = special methods - - virtual int gen_nested_namespace_begin (be_module *node); - // generate the nested namespace begins - - virtual int gen_nested_namespace_end (be_module *node); - // generate the nested namespace ends -}; +#include "be_visitor_constant/constant_ch.h" +#include "be_visitor_constant/constant_cs.h" #endif // TAO_BE_VISITOR_CONSTANT_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_constant/constant_ch.h b/TAO/TAO_IDL/be_include/be_visitor_constant/constant_ch.h new file mode 100644 index 00000000000..3d6113ddbd6 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_constant/constant_ch.h @@ -0,0 +1,47 @@ +/* -*- C++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// constant_ch.h +// +// = DESCRIPTION +// Concrete visitor for the constant class generating code in the client header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_CONSTANT_CONSTANT_CH_H_) +#define _BE_VISITOR_CONSTANT_CONSTANT_CH_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. + +}; + +#endif /* _BE_VISITOR_CONSTANT_CONSTANT_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_constant/constant_cs.h b/TAO/TAO_IDL/be_include/be_visitor_constant/constant_cs.h new file mode 100644 index 00000000000..104614536a1 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_constant/constant_cs.h @@ -0,0 +1,54 @@ +/* -*- C++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// constant_cs.h +// +// = DESCRIPTION +// Concrete visitor for the constant class generating code in the client stub. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_CONSTANT_CONSTANT_CS_H_) +#define _BE_VISITOR_CONSTANT_CONSTANT_CS_H_ + +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 + + // = special methods + + virtual int gen_nested_namespace_begin (be_module *node); + // generate the nested namespace begins + + virtual int gen_nested_namespace_end (be_module *node); + // generate the nested namespace ends +}; + +#endif /* _BE_VISITOR_CONSTANT_CONSTANT_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_enum.h b/TAO/TAO_IDL/be_include/be_visitor_enum.h index bd8779d7349..070cceda0b0 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_enum.h +++ b/TAO/TAO_IDL/be_include/be_visitor_enum.h @@ -24,102 +24,9 @@ #include "be_visitor.h" #include "be_visitor_scope.h" +#include "be_visitor_enum/enum_ch.h" +#include "be_visitor_enum/enum_cs.h" +#include "be_visitor_enum/any_op_ch.h" +#include "be_visitor_enum/any_op_cs.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 - -}; - -class be_visitor_enum_any_op_ch : public be_visitor_scope -{ - // - // = TITLE - // be_visitor_enum_any_op_ch - // - // = DESCRIPTION - // This is a concrete visitor for enum that generates the Any operator - // declarations - // - -public: - be_visitor_enum_any_op_ch (be_visitor_context *ctx); - // constructor - - ~be_visitor_enum_any_op_ch (void); - // destructor - - virtual int visit_enum (be_enum *node); - // visit enum -}; - -class be_visitor_enum_any_op_cs : public be_visitor_scope -{ - // - // = TITLE - // be_visitor_enum_any_op_cs - // - // = DESCRIPTION - // This is a concrete visitor for enum that generates the Any operator - // implementations - // - -public: - be_visitor_enum_any_op_cs (be_visitor_context *ctx); - // constructor - - ~be_visitor_enum_any_op_cs (void); - // destructor - - virtual int visit_enum (be_enum *node); - // visit enum -}; - -#endif // TAO_BE_VISITOR_ENUM_H +#endif /* TAO_BE_VISITOR_ENUM_H */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_enum/any_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_enum/any_op_ch.h new file mode 100644 index 00000000000..469e661bb2c --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_enum/any_op_ch.h @@ -0,0 +1,47 @@ +/* -*- C++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_ch.h +// +// = DESCRIPTION +// Concrete visitor for Enums generating code for the Any operators +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ENUM_ANY_OP_CH_H_) +#define _BE_VISITOR_ENUM_ANY_OP_CH_H_ + +class be_visitor_enum_any_op_ch : public be_visitor_scope +{ + // + // = TITLE + // be_visitor_enum_any_op_ch + // + // = DESCRIPTION + // This is a concrete visitor for enum that generates the Any operator + // declarations + // + +public: + be_visitor_enum_any_op_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_enum_any_op_ch (void); + // destructor + + virtual int visit_enum (be_enum *node); + // visit enum +}; + +#endif /* _BE_VISITOR_ENUM_ANY_OP_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_enum/any_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_enum/any_op_cs.h new file mode 100644 index 00000000000..aab50eb6305 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_enum/any_op_cs.h @@ -0,0 +1,47 @@ +/* -*- C++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_cs.h +// +// = DESCRIPTION +// Concrete visitor for Enums generating code for the Any operators +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ENUM_ANY_OP_CS_H_) +#define _BE_VISITOR_ENUM_ANY_OP_CS_H_ + +class be_visitor_enum_any_op_cs : public be_visitor_scope +{ + // + // = TITLE + // be_visitor_enum_any_op_cs + // + // = DESCRIPTION + // This is a concrete visitor for enum that generates the Any operator + // implementations + // + +public: + be_visitor_enum_any_op_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_enum_any_op_cs (void); + // destructor + + virtual int visit_enum (be_enum *node); + // visit enum +}; + +#endif /* _BE_VISITOR_ENUM_ANY_OP_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_enum/enum_ch.h b/TAO/TAO_IDL/be_include/be_visitor_enum/enum_ch.h new file mode 100644 index 00000000000..bd1effe5e0e --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_enum/enum_ch.h @@ -0,0 +1,56 @@ +/* -*- C++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// enum_ch.h +// +// = DESCRIPTION +// Concrete visitor for Enums generating code in the client header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ENUM_ENUM_CH_H_) +#define _BE_VISITOR_ENUM_ENUM_CH_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 +}; + +#endif /* _BE_VISITOR_ENUM_ENUM_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_enum/enum_cs.h b/TAO/TAO_IDL/be_include/be_visitor_enum/enum_cs.h new file mode 100644 index 00000000000..f1684ff1d01 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_enum/enum_cs.h @@ -0,0 +1,47 @@ +/* -*- C++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// enum_cs.h +// +// = DESCRIPTION +// Concrete visitor for Enums generating code in the client stubs. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ENUM_ENUM_CS_H_) +#define _BE_VISITOR_ENUM_ENUM_CS_H_ + +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 /* _BE_VISITOR_ENUM_ENUM_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception.h b/TAO/TAO_IDL/be_include/be_visitor_exception.h index a569cec9eb8..7d5069ddc63 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_exception.h +++ b/TAO/TAO_IDL/be_include/be_visitor_exception.h @@ -24,258 +24,13 @@ #include "be_visitor.h" #include "be_visitor_scope.h" - -class be_visitor_exception : public be_visitor_scope -{ - // - // = TITLE - // be_visitor_exception - // - // = DESCRIPTION - // This is the base visitor for exception - // - // -public: - be_visitor_exception (be_visitor_context *ctx); - // ctor - - ~be_visitor_exception (void); - // dtor - - virtual int visit_exception (be_exception *node); - // visit exception. 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_exception_ch : public be_visitor_exception -{ - // - // = TITLE - // be_visitor_exception_ch - // - // = DESCRIPTION - // This is a concrete visitor to generate the client header for exception - // - // -public: - be_visitor_exception_ch (be_visitor_context *ctx); - // constructureor - - ~be_visitor_exception_ch (void); - // destructureor - - virtual int visit_exception (be_exception *node); - // visit exception. We provide code for this method in the derived class - -}; - -class be_visitor_exception_ci : public be_visitor_exception -{ - // - // = TITLE - // be_visitor_exception_ci - // - // = DESCRIPTION - // This is a concrete visitor to generate the client inline for exception - // - // -public: - be_visitor_exception_ci (be_visitor_context *ctx); - // ctor - - ~be_visitor_exception_ci (void); - // dtor - - virtual int visit_exception (be_exception *node); - // visit exception. We provide code for this method in the derived class - -}; - -class be_visitor_exception_cs : public be_visitor_exception -{ - // - // = TITLE - // be_visitor_exception_cs - // - // = DESCRIPTION - // This is a concrete visitor to generate the client stubs for exception - // - // -public: - be_visitor_exception_cs (be_visitor_context *ctx); - // ctor - - ~be_visitor_exception_cs (void); - // dtor - - virtual int visit_exception (be_exception *node); - // visit exception. We provide code for this method in the derived class - -}; - -class be_visitor_exception_ctor : public be_visitor_scope -{ - // =TITLE - // be_visitor_exception_ctor - // - // =DESCRIPTION - // generation of the special constructor -public: - be_visitor_exception_ctor (be_visitor_context *ctx); - // ctor - - ~be_visitor_exception_ctor (void); - // dtor - - virtual int post_process (void); - // post processing after each element - - virtual int visit_exception (be_exception *node); - // visit exception. We provide code for this method in the derived class - - virtual int visit_field (be_field *node); - // visit the argument node - - // =visit all the nodes that can be the types for the field - - 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_exception_ctor_assign : public be_visitor_scope -{ - // =TITLE - // be_visitor_exception_ctor_assign - // - // =DESCRIPTION - // generation of the assignment statements in -public: - be_visitor_exception_ctor_assign (be_visitor_context *ctx); - // ctor - - ~be_visitor_exception_ctor_assign (void); - // dtor - - virtual int visit_exception (be_exception *node); - // visit exception. - - virtual int visit_field (be_field *node); - // visit the field node - - // =visit all the nodes that can be the types for the field - - 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_exception_any_op_ch : public be_visitor_scope -{ - // - // = TITLE - // be_visitor_exception_any_op_ch - // - // = DESCRIPTION - // This is a concrete visitor for exception that generates the Any operator - // declarations - // - -public: - be_visitor_exception_any_op_ch (be_visitor_context *ctx); - // constructor - - ~be_visitor_exception_any_op_ch (void); - // destructor - - virtual int visit_exception (be_exception *node); - // visit exception - - virtual int visit_field (be_field *node); - // visit field -}; - -class be_visitor_exception_any_op_cs : public be_visitor_scope -{ - // - // = TITLE - // be_visitor_exception_any_op_cs - // - // = DESCRIPTION - // This is a concrete visitor for exception that generates the Any operator - // implementations - // - -public: - be_visitor_exception_any_op_cs (be_visitor_context *ctx); - // constructor - - ~be_visitor_exception_any_op_cs (void); - // destructor - - virtual int visit_exception (be_exception *node); - // visit exception - - virtual int visit_field (be_field *node); - // visit field -}; - -#endif // TAO_BE_VISITOR_EXCEPTION_H +#include "be_visitor_exception/exception.h" +#include "be_visitor_exception/exception_ch.h" +#include "be_visitor_exception/exception_ci.h" +#include "be_visitor_exception/exception_cs.h" +#include "be_visitor_exception/ctor.h" +#include "be_visitor_exception/ctor_assign.h" +#include "be_visitor_exception/any_op_ch.h" +#include "be_visitor_exception/any_op_cs.h" + +#endif /* TAO_BE_VISITOR_EXCEPTION_H */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception/any_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_exception/any_op_ch.h new file mode 100644 index 00000000000..6ad35719449 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_exception/any_op_ch.h @@ -0,0 +1,51 @@ +/* -*- C++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_ch.h +// +// = DESCRIPTION +// Visitor for Exceptions. +// For code generation of Any operator in client header +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_EXCEPTION_ANY_OP_CH_H_) +#define _BE_VISITOR_EXCEPTION_ANY_OP_CH_H_ + +class be_visitor_exception_any_op_ch : public be_visitor_scope +{ + // + // = TITLE + // be_visitor_exception_any_op_ch + // + // = DESCRIPTION + // This is a concrete visitor for exception that generates the Any operator + // declarations + // + +public: + be_visitor_exception_any_op_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_exception_any_op_ch (void); + // destructor + + virtual int visit_exception (be_exception *node); + // visit exception + + virtual int visit_field (be_field *node); + // visit field +}; + +#endif /* _BE_VISITOR_EXCEPTION_ANY_OP_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception/any_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_exception/any_op_cs.h new file mode 100644 index 00000000000..dc96479b918 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_exception/any_op_cs.h @@ -0,0 +1,51 @@ +/* -*- C++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_cs.h +// +// = DESCRIPTION +// Visitor for Exceptions. +// For code generation of Any operator in client stubs +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_EXCEPTION_ANY_OP_CS_H_) +#define _BE_VISITOR_EXCEPTION_ANY_OP_CS_H_ + +class be_visitor_exception_any_op_cs : public be_visitor_scope +{ + // + // = TITLE + // be_visitor_exception_any_op_cs + // + // = DESCRIPTION + // This is a concrete visitor for exception that generates the Any operator + // implementations + // + +public: + be_visitor_exception_any_op_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_exception_any_op_cs (void); + // destructor + + virtual int visit_exception (be_exception *node); + // visit exception + + virtual int visit_field (be_field *node); + // visit field +}; + +#endif /* _BE_VISITOR_EXCEPTION_ANY_OP_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception/ctor.h b/TAO/TAO_IDL/be_include/be_visitor_exception/ctor.h new file mode 100644 index 00000000000..ac774c1388e --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_exception/ctor.h @@ -0,0 +1,83 @@ +/* -*- C++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// ctor.h +// +// = DESCRIPTION +// Visitor for Exceptions. +// For code generation for the special constructor for exceptions +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_EXCEPTION_CTOR_H_) +#define _BE_VISITOR_EXCEPTION_CTOR_H_ + +class be_visitor_exception_ctor : public be_visitor_scope +{ + // =TITLE + // be_visitor_exception_ctor + // + // =DESCRIPTION + // generation of the special constructor +public: + be_visitor_exception_ctor (be_visitor_context *ctx); + // ctor + + ~be_visitor_exception_ctor (void); + // dtor + + virtual int post_process (void); + // post processing after each element + + virtual int visit_exception (be_exception *node); + // visit exception. We provide code for this method in the derived class + + virtual int visit_field (be_field *node); + // visit the argument node + + // =visit all the nodes that can be the types for the field + + 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 + +}; + +#endif /* _BE_VISITOR_EXCEPTION_CTOR_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception/ctor_assign.h b/TAO/TAO_IDL/be_include/be_visitor_exception/ctor_assign.h new file mode 100644 index 00000000000..e40610ac2fb --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_exception/ctor_assign.h @@ -0,0 +1,81 @@ +/* -*- C++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// ctor_assign.h +// +// = DESCRIPTION +// Visitor for Exceptions. +// For code generation for the special constructor and assignment operator +// for exceptions. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_EXCEPTION_CTOR_ASSIGN_H_) +#define _BE_VISITOR_EXCEPTION_CTOR_ASSIGN_H_ + +class be_visitor_exception_ctor_assign : public be_visitor_scope +{ + // =TITLE + // be_visitor_exception_ctor_assign + // + // =DESCRIPTION + // generation of the assignment statements in +public: + be_visitor_exception_ctor_assign (be_visitor_context *ctx); + // ctor + + ~be_visitor_exception_ctor_assign (void); + // dtor + + virtual int visit_exception (be_exception *node); + // visit exception. + + virtual int visit_field (be_field *node); + // visit the field node + + // =visit all the nodes that can be the types for the field + + 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 + +}; + +#endif /* _BE_VISITOR_EXCEPTION_CTOR_ASSIGN_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception/exception.h b/TAO/TAO_IDL/be_include/be_visitor_exception/exception.h new file mode 100644 index 00000000000..f7e4bab2d26 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_exception/exception.h @@ -0,0 +1,52 @@ +/* -*- C++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// exception.h +// +// = DESCRIPTION +// Visitor for Exceptions. +// This is the generic (common) visitor for all exceptions. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_EXCEPTION_EXCEPTION_H_) +#define _BE_VISITOR_EXCEPTION_EXCEPTION_H_ + +class be_visitor_exception : public be_visitor_scope +{ + // + // = TITLE + // be_visitor_exception + // + // = DESCRIPTION + // This is the base visitor for exception + // + // +public: + be_visitor_exception (be_visitor_context *ctx); + // ctor + + ~be_visitor_exception (void); + // dtor + + virtual int visit_exception (be_exception *node); + // visit exception. 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 +}; + +#endif /* _BE_VISITOR_EXCEPTION_EXCEPTION_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception/exception_ch.h b/TAO/TAO_IDL/be_include/be_visitor_exception/exception_ch.h new file mode 100644 index 00000000000..9211782a96e --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_exception/exception_ch.h @@ -0,0 +1,48 @@ +/* -*- C++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// exception_ch.h +// +// = DESCRIPTION +// Visitor for Exceptions. +// For code generation in client header +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_EXCEPTION_EXCEPTION_CH_H_) +#define _BE_VISITOR_EXCEPTION_EXCEPTION_CH_H_ + +class be_visitor_exception_ch : public be_visitor_exception +{ + // + // = TITLE + // be_visitor_exception_ch + // + // = DESCRIPTION + // This is a concrete visitor to generate the client header for exception + // + // +public: + be_visitor_exception_ch (be_visitor_context *ctx); + // constructureor + + ~be_visitor_exception_ch (void); + // destructureor + + virtual int visit_exception (be_exception *node); + // visit exception. We provide code for this method in the derived class + +}; + +#endif /* _BE_VISITOR_EXCEPTION_EXCEPTION_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception/exception_ci.h b/TAO/TAO_IDL/be_include/be_visitor_exception/exception_ci.h new file mode 100644 index 00000000000..67ca3e1c449 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_exception/exception_ci.h @@ -0,0 +1,48 @@ +/* -*- C++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// exception_ci.h +// +// = DESCRIPTION +// Visitor for Exceptions. +// For code generation in client inline. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_EXCEPTION_EXCEPTION_CI_H_) +#define _BE_VISITOR_EXCEPTION_EXCEPTION_CI_H_ + +class be_visitor_exception_ci : public be_visitor_exception +{ + // + // = TITLE + // be_visitor_exception_ci + // + // = DESCRIPTION + // This is a concrete visitor to generate the client inline for exception + // + // +public: + be_visitor_exception_ci (be_visitor_context *ctx); + // ctor + + ~be_visitor_exception_ci (void); + // dtor + + virtual int visit_exception (be_exception *node); + // visit exception. + +}; + +#endif /* _BE_VISITOR_EXCEPTION_EXCEPTION_CI_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception/exception_cs.h b/TAO/TAO_IDL/be_include/be_visitor_exception/exception_cs.h new file mode 100644 index 00000000000..0b1edd4cc6c --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_exception/exception_cs.h @@ -0,0 +1,48 @@ +/* -*- C++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// exception_cs.h +// +// = DESCRIPTION +// Visitor for Exceptions. +// For code generation in client stubs. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_EXCEPTION_EXCEPTION_CS_H_) +#define _BE_VISITOR_EXCEPTION_EXCEPTION_CS_H_ + +class be_visitor_exception_cs : public be_visitor_exception +{ + // + // = TITLE + // be_visitor_exception_cs + // + // = DESCRIPTION + // This is a concrete visitor to generate the client stubs for exception + // + // +public: + be_visitor_exception_cs (be_visitor_context *ctx); + // ctor + + ~be_visitor_exception_cs (void); + // dtor + + virtual int visit_exception (be_exception *node); + // visit exception. We provide code for this method in the derived class + +}; + +#endif /* _BE_VISITOR_EXCEPTION_EXCEPTION_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception/exception_ctor.h b/TAO/TAO_IDL/be_include/be_visitor_exception/exception_ctor.h new file mode 100644 index 00000000000..94ad9534889 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_exception/exception_ctor.h @@ -0,0 +1,83 @@ +/* -*- C++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// exception_ctor.h +// +// = DESCRIPTION +// Visitor for Exceptions. +// For code generation for the special constructor for exceptions +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_EXCEPTION_EXCEPTION_CTOR_H_) +#define _BE_VISITOR_EXCEPTION_EXCEPTION_CTOR_H_ + +class be_visitor_exception_ctor : public be_visitor_scope +{ + // =TITLE + // be_visitor_exception_ctor + // + // =DESCRIPTION + // generation of the special constructor +public: + be_visitor_exception_ctor (be_visitor_context *ctx); + // ctor + + ~be_visitor_exception_ctor (void); + // dtor + + virtual int post_process (void); + // post processing after each element + + virtual int visit_exception (be_exception *node); + // visit exception. We provide code for this method in the derived class + + virtual int visit_field (be_field *node); + // visit the argument node + + // =visit all the nodes that can be the types for the field + + 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 + +}; + +#endif /* _BE_VISITOR_EXCEPTION_EXCEPTION_CTOR_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_field.h b/TAO/TAO_IDL/be_include/be_visitor_field.h index 9846554bccc..e1af83716e5 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_field.h +++ b/TAO/TAO_IDL/be_include/be_visitor_field.h @@ -14,7 +14,7 @@ // Concrete visitor for the base "BE_Field" node // // = AUTHOR -// Aniruddha Gokhale and Carlos O'Ryan +// Aniruddha Gokhale // // ============================================================================ @@ -23,140 +23,8 @@ #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 +#include "be_visitor_field/field_ch.h" +#include "be_visitor_field/field_ci.h" +#include "be_visitor_field/field_cs.h" - ~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_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 - -}; - -#endif // TAO_BE_VISITOR_FIELD_H +#endif /* TAO_BE_VISITOR_FIELD_H */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_field/field_ch.h b/TAO/TAO_IDL/be_include/be_visitor_field/field_ch.h new file mode 100644 index 00000000000..aa72105c520 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_field/field_ch.h @@ -0,0 +1,78 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// field_ch.h +// +// = DESCRIPTION +// Concrete visitor for the base "BE_Field" node +// This generates code for structure members in the client header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_FIELD_CH_H_) +#define _BE_VISITOR_FIELD_CH_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 + +}; + +#endif /* _BE_VISITOR_FIELD_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_field/field_ci.h b/TAO/TAO_IDL/be_include/be_visitor_field/field_ci.h new file mode 100644 index 00000000000..0e2c3797a5e --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_field/field_ci.h @@ -0,0 +1,65 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// field_ci.h +// +// = DESCRIPTION +// Concrete visitor for the base "BE_Field" node +// This generates code for structure members in the client inline. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_FIELD_CI_H_) +#define _BE_VISITOR_FIELD_CI_H_ + +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 + +}; + +#endif /* _BE_VISITOR_FIELD_CI_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_field/field_cs.h b/TAO/TAO_IDL/be_include/be_visitor_field/field_cs.h new file mode 100644 index 00000000000..7edaae3b4c2 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_field/field_cs.h @@ -0,0 +1,68 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// field_cs.h +// +// = DESCRIPTION +// Concrete visitor for the base "BE_Field" node +// This generates code for structure members in the client stubs. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_FIELD_CS_H_) +#define _BE_VISITOR_FIELD_CS_H_ + +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_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 + +}; + +#endif /* _BE_VISITOR_FIELD_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface.h b/TAO/TAO_IDL/be_include/be_visitor_interface.h index 14aa6d95166..4aac0f9050a 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_interface.h +++ b/TAO/TAO_IDL/be_include/be_visitor_interface.h @@ -23,322 +23,18 @@ #include "be_visitor_scope.h" - -// = DESCRIPTION -// Interface code generation is complex, the client stubs require -// two different class and the server also require other two. -// 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. -// -// = NOTE -// Visitors were added recently into the compiler, so some -// code is still generated using the old "state oriented" approach; -// notably only the _collocated class is actually generated using -// the visitor, in the other cases (the interface class and the -// skeleton class) we still call back the old code generation -// methods. -// - -class be_visitor_interface : public be_visitor_scope -{ - // - // = TITLE - // be_visitor_interface - // - // = DESCRIPTION - // This is a concrete visitor for interface that abstracts all common tasks - // - -public: - be_visitor_interface (be_visitor_context *ctx); - // constructor - - ~be_visitor_interface (void); - // destructor - - virtual int visit_interface (be_interface *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_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_interface_collocated_sh (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_interface_collocated_sh (void); - // destructor - - virtual int visit_interface (be_interface *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 - -}; - -class be_visitor_interface_any_op_ch : public be_visitor_interface -{ - // - // = TITLE - // be_visitor_interface_any_op_ch - // - // = DESCRIPTION - // This is a concrete visitor for interface that generates the Any operator - // declarations - // - -public: - be_visitor_interface_any_op_ch (be_visitor_context *ctx); - // constructor - - ~be_visitor_interface_any_op_ch (void); - // destructor - - virtual int visit_interface (be_interface *node); - // visit interface -}; - -class be_visitor_interface_any_op_cs : public be_visitor_interface -{ - // - // = TITLE - // be_visitor_interface_any_op_cs - // - // = DESCRIPTION - // This is a concrete visitor for interface that generates the Any operator - // implementations - // - -public: - be_visitor_interface_any_op_cs (be_visitor_context *ctx); - // constructor - - ~be_visitor_interface_any_op_cs (void); - // destructor - - virtual int visit_interface (be_interface *node); - // visit interface -}; - -class be_visitor_interface_tie_sh : public be_visitor_interface -{ - // - // = TITLE - // be_visitor_interface_tie_sh - // - // = DESCRIPTION - // This is a concrete visitor to generate the server header for the TIE class - // - // -public: - be_visitor_interface_tie_sh (be_visitor_context *ctx); - // constructor - - ~be_visitor_interface_tie_sh (void); - // destructor - - virtual int visit_interface (be_interface *node); - // set the right context and make a visitor -}; - -class be_visitor_interface_tie_si : public be_visitor_interface -{ - // - // = TITLE - // be_visitor_interface_tie_si - // - // = DESCRIPTION - // This is a concrete visitor to generate the server inline for operations - // of the TIE class - // - // -public: - be_visitor_interface_tie_si (be_visitor_context *ctx); - // constructor - - ~be_visitor_interface_tie_si (void); - // destructor - - virtual int visit_interface (be_interface *node); - // set the right context and make a visitor -}; - -#endif // _BE_VISITOR_INTERFACE_H +#include "be_visitor_interface/interface.h" +#include "be_visitor_interface/interface_ch.h" +#include "be_visitor_interface/interface_ci.h" +#include "be_visitor_interface/interface_cs.h" +#include "be_visitor_interface/interface_sh.h" +#include "be_visitor_interface/interface_si.h" +#include "be_visitor_interface/interface_ss.h" +#include "be_visitor_interface/collocated_sh.h" +#include "be_visitor_interface/collocated_ss.h" +#include "be_visitor_interface/any_op_ch.h" +#include "be_visitor_interface/any_op_cs.h" +#include "be_visitor_interface/tie_sh.h" +#include "be_visitor_interface/tie_si.h" + +#endif /* _BE_VISITOR_INTERFACE_H */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/any_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface/any_op_ch.h new file mode 100644 index 00000000000..4e635bfd8a3 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_interface/any_op_ch.h @@ -0,0 +1,47 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_ch.h +// +// = DESCRIPTION +// Concrete visitor for the Interface node. +// This one provides code generation for the Any operators +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_INTERFACE_ANY_OP_CH_H_) +#define _BE_INTERFACE_ANY_OP_CH_H_ + +class be_visitor_interface_any_op_ch : public be_visitor_interface +{ + // + // = TITLE + // be_visitor_interface_any_op_ch + // + // = DESCRIPTION + // This is a concrete visitor for interface that generates the Any operator + // declarations + // + +public: + be_visitor_interface_any_op_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_interface_any_op_ch (void); + // destructor + + virtual int visit_interface (be_interface *node); + // visit interface +}; + +#endif /* _BE_INTERFACE_ANY_OP_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/any_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_interface/any_op_cs.h new file mode 100644 index 00000000000..012aca9d3f8 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_interface/any_op_cs.h @@ -0,0 +1,47 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_cs.h +// +// = DESCRIPTION +// Concrete visitor for the Interface node. +// This one provides code generation for the Any operators +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_INTERFACE_ANY_OP_CS_H_) +#define _BE_INTERFACE_ANY_OP_CS_H_ + +class be_visitor_interface_any_op_cs : public be_visitor_interface +{ + // + // = TITLE + // be_visitor_interface_any_op_cs + // + // = DESCRIPTION + // This is a concrete visitor for interface that generates the Any operator + // implementations + // + +public: + be_visitor_interface_any_op_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_interface_any_op_cs (void); + // destructor + + virtual int visit_interface (be_interface *node); + // visit interface +}; + +#endif /* _BE_INTERFACE_ANY_OP_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/collocated_sh.h b/TAO/TAO_IDL/be_include/be_visitor_interface/collocated_sh.h new file mode 100644 index 00000000000..a96c5a6701d --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_interface/collocated_sh.h @@ -0,0 +1,42 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// collocated_sh.h +// +// = DESCRIPTION +// Concrete visitor for the Interface node. +// This provides code generation for collocated classes in server header +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_INTERFACE_COLLOCATED_SH_H_) +#define _BE_INTERFACE_COLLOCATED_SH_H_ + +class be_visitor_interface_collocated_sh : public be_visitor_interface +{ + // = TITLE + // Generate the "collocated" class declaration. + +public: + 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); + // visit an interface + +}; + +#endif /* _BE_INTERFACE_COLLOCATED_SH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/collocated_ss.h b/TAO/TAO_IDL/be_include/be_visitor_interface/collocated_ss.h new file mode 100644 index 00000000000..ad49cbb1448 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_interface/collocated_ss.h @@ -0,0 +1,42 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// collocated_ss.h +// +// = DESCRIPTION +// Concrete visitor for the Interface node. +// This provides code generation for collocated classes in server skeleton +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_INTERFACE_COLLOCATED_SS_H_) +#define _BE_INTERFACE_COLLOCATED_SS_H_ + +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 + +}; + +#endif /* _BE_INTERFACE_COLLOCATED_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/interface.h b/TAO/TAO_IDL/be_include/be_visitor_interface/interface.h new file mode 100644 index 00000000000..086c8f1b56b --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface.h @@ -0,0 +1,91 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// interface.h +// +// = DESCRIPTION +// Concrete visitor for the Interface node. +// This one provides the generic visitor for interfaces from which others +// will inherit. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_INTERFACE_INTERFACE_H_) +#define _BE_INTERFACE_INTERFACE_H_ + +// = DESCRIPTION +// Interface code generation is complex, the client stubs require +// two different class and the server also require other two. +// 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. +// +// = NOTE +// Visitors were added recently into the compiler, so some +// code is still generated using the old "state oriented" approach; +// notably only the _collocated class is actually generated using +// the visitor, in the other cases (the interface class and the +// skeleton class) we still call back the old code generation +// methods. +// + +class be_visitor_interface : public be_visitor_scope +{ + // + // = TITLE + // be_visitor_interface + // + // = DESCRIPTION + // This is a concrete visitor for interface that abstracts all common tasks + // + +public: + be_visitor_interface (be_visitor_context *ctx); + // constructor + + ~be_visitor_interface (void); + // destructor + + virtual int visit_interface (be_interface *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 + +}; + +#endif /* _BE_INTERFACE_INTERFACE_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ch.h new file mode 100644 index 00000000000..7dc997f7f15 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ch.h @@ -0,0 +1,50 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// interface_ch.h +// +// = DESCRIPTION +// Concrete visitor for the Interface node. +// This one provides code generation for interfaces in the client header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_INTERFACE_INTERFACE_CH_H_) +#define _BE_INTERFACE_INTERFACE_CH_H_ + +// 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 + +}; + +#endif /* _BE_INTERFACE_INTERFACE_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ci.h b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ci.h new file mode 100644 index 00000000000..4eff86b2099 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ci.h @@ -0,0 +1,47 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// interface_ci.h +// +// = DESCRIPTION +// Concrete visitor for the Interface node. +// This one provides code generation for interfaces in the client inline. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_INTERFACE_INTERFACE_CI_H_) +#define _BE_INTERFACE_INTERFACE_CI_H_ + +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 + +}; + +#endif /* _BE_INTERFACE_INTERFACE_CI_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_cs.h b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_cs.h new file mode 100644 index 00000000000..7acede89420 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_cs.h @@ -0,0 +1,46 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// interface_cs.h +// +// = DESCRIPTION +// Concrete visitor for the Interface node. +// This one provides code generation for interfaces in the client stubs. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_INTERFACE_INTERFACE_CS_H_) +#define _BE_INTERFACE_INTERFACE_CS_H_ + +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 +}; + +#endif /* _BE_INTERFACE_INTERFACE_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_sh.h b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_sh.h new file mode 100644 index 00000000000..a2f09833147 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_sh.h @@ -0,0 +1,46 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// interface_sh.h +// +// = DESCRIPTION +// Concrete visitor for the Interface node. +// This provides for code generation in the server header +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_INTERFACE_INTERFACE_SH_H_) +#define _BE_INTERFACE_INTERFACE_SH_H_ + +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 +}; + +#endif /* _BE_INTERFACE_INTERFACE_SH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_si.h b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_si.h new file mode 100644 index 00000000000..e8c7bae245c --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_si.h @@ -0,0 +1,46 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// interface_si.h +// +// = DESCRIPTION +// Concrete visitor for the Interface node. +// This provides for code generation in the server inline +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_INTERFACE_INTERFACE_SI_H_) +#define _BE_INTERFACE_INTERFACE_SI_H_ + +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 +}; + +#endif /* _BE_INTERFACE_INTERFACE_SI_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ss.h b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ss.h new file mode 100644 index 00000000000..78c5d48cbab --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ss.h @@ -0,0 +1,46 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// interface_ss.h +// +// = DESCRIPTION +// Concrete visitor for the Interface node. +// This provides for code generation in the server skeleton +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_INTERFACE_INTERFACE_SS_H_) +#define _BE_INTERFACE_INTERFACE_SS_H_ + +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 +}; + +#endif /* _BE_INTERFACE_INTERFACE_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/tie_sh.h b/TAO/TAO_IDL/be_include/be_visitor_interface/tie_sh.h new file mode 100644 index 00000000000..c9417e04d22 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_interface/tie_sh.h @@ -0,0 +1,46 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// tie_sh.h +// +// = DESCRIPTION +// Concrete visitor for the Interface node. +// This one provides the code generation for TIE classes +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_INTERFACE_TIE_SH_H_) +#define _BE_INTERFACE_TIE_SH_H_ + +class be_visitor_interface_tie_sh : public be_visitor_interface +{ + // + // = TITLE + // be_visitor_interface_tie_sh + // + // = DESCRIPTION + // This is a concrete visitor to generate the server header for the TIE class + // + // +public: + be_visitor_interface_tie_sh (be_visitor_context *ctx); + // constructor + + ~be_visitor_interface_tie_sh (void); + // destructor + + virtual int visit_interface (be_interface *node); + // set the right context and make a visitor +}; + +#endif /* _BE_INTERFACE_TIE_SH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/tie_si.h b/TAO/TAO_IDL/be_include/be_visitor_interface/tie_si.h new file mode 100644 index 00000000000..51221dfedc5 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_interface/tie_si.h @@ -0,0 +1,47 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// tie_si.h +// +// = DESCRIPTION +// Concrete visitor for the Interface node. +// This one provides the code generation for TIE classes +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_INTERFACE_TIE_SI_H_) +#define _BE_INTERFACE_TIE_SI_H_ + +class be_visitor_interface_tie_si : public be_visitor_interface +{ + // + // = TITLE + // be_visitor_interface_tie_si + // + // = DESCRIPTION + // This is a concrete visitor to generate the server inline for operations + // of the TIE class + // + // +public: + be_visitor_interface_tie_si (be_visitor_context *ctx); + // constructor + + ~be_visitor_interface_tie_si (void); + // destructor + + virtual int visit_interface (be_interface *node); + // set the right context and make a visitor +}; + +#endif /* _BE_INTERFACE_TIE_SI_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 index b24a9942e39..e139af36707 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_interface_fwd.h +++ b/TAO/TAO_IDL/be_include/be_visitor_interface_fwd.h @@ -25,48 +25,7 @@ #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 +#include "be_visitor_interface_fwd/interface_fwd_ch.h" +#include "be_visitor_interface_fwd/interface_fwd_ci.h" - ~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 +#endif /* TAO_BE_VISITOR_INTERFACE_FWD_H */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface_fwd/interface_fwd_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface_fwd/interface_fwd_ch.h new file mode 100644 index 00000000000..788faa611db --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_interface_fwd/interface_fwd_ch.h @@ -0,0 +1,47 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// interface_fwd_ch.h +// +// = DESCRIPTION +// Concrete visitor for the Interface Forward node. +// This one provides code generation for interface forward node. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_INTERFACE_INTERFACE_FWD_CH_H_) +#define _BE_INTERFACE_INTERFACE_FWD_CH_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. + +}; + +#endif /* _BE_INTERFACE_INTERFACE_FWD_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface_fwd/interface_fwd_ci.h b/TAO/TAO_IDL/be_include/be_visitor_interface_fwd/interface_fwd_ci.h new file mode 100644 index 00000000000..a53bd7d7a05 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_interface_fwd/interface_fwd_ci.h @@ -0,0 +1,47 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// interface_fwd_ci.h +// +// = DESCRIPTION +// Concrete visitor for the Interface Forward node. +// This one provides code generation for interface forward node. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_INTERFACE_INTERFACE_FWD_CI_H_) +#define _BE_INTERFACE_INTERFACE_FWD_CI_H_ + +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 /* _BE_INTERFACE_INTERFACE_FWD_CH_I_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_module.h b/TAO/TAO_IDL/be_include/be_visitor_module.h index 272af5bad45..9ccf934e2f5 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_module.h +++ b/TAO/TAO_IDL/be_include/be_visitor_module.h @@ -25,121 +25,11 @@ #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 - -}; - +#include "be_visitor_module/module.h" // 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 - -}; - -class be_visitor_module_any_op : public be_visitor_module -{ - // - // = TITLE - // be_visitor_module_any_op - // - // = DESCRIPTION - // This is a concrete visitor for module that generates the Any operator - // declarations and implementations - // - -public: - be_visitor_module_any_op (be_visitor_context *ctx); - // constructor - - ~be_visitor_module_any_op (void); - // destructor - - virtual int visit_module (be_module *node); - // visit module -}; +#include "be_visitor_module/module_ch.h" +#include "be_visitor_module/module_sh.h" +#include "be_visitor_module/any_op.h" #endif // TAO_BE_VISITOR_MODULE_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_module/any_op.h b/TAO/TAO_IDL/be_include/be_visitor_module/any_op.h new file mode 100644 index 00000000000..ab941bc345b --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_module/any_op.h @@ -0,0 +1,49 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op.h +// +// = DESCRIPTION +// Concrete visitor for the Module class +// This one provides visitors to generate the Any operators for elements in +// the Module's scope. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_MODULE_ANY_OP_H_) +#define _BE_VISITOR_MODULE_ANY_OP_H_ + +class be_visitor_module_any_op : public be_visitor_module +{ + // + // = TITLE + // be_visitor_module_any_op + // + // = DESCRIPTION + // This is a concrete visitor for module that generates the Any operator + // declarations and implementations + // + +public: + be_visitor_module_any_op (be_visitor_context *ctx); + // constructor + + ~be_visitor_module_any_op (void); + // destructor + + virtual int visit_module (be_module *node); + // visit module +}; + +#endif /* _BE_VISITOR_MODULE_ANY_OP_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_module/module.h b/TAO/TAO_IDL/be_include/be_visitor_module/module.h new file mode 100644 index 00000000000..58c4f951cb8 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_module/module.h @@ -0,0 +1,74 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// module.h +// +// = DESCRIPTION +// Concrete visitor for the Module class +// This one provides the generic visitor for the Module node. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_MODULE_MODULE_H_) +#define _BE_VISITOR_MODULE_MODULE_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 + +}; + +#endif /* _BE_VISITOR_MODULE_MODULE_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_module/module_ch.h b/TAO/TAO_IDL/be_include/be_visitor_module/module_ch.h new file mode 100644 index 00000000000..f001d3e4900 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_module/module_ch.h @@ -0,0 +1,48 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// module_ch.h +// +// = DESCRIPTION +// Concrete visitor for the Module class +// This provides code generation for the module in the client header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_MODULE_MODULE_CH_H_) +#define _BE_VISITOR_MODULE_MODULE_CH_H_ + +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 + +}; + +#endif /* _BE_VISITOR_MODULE_MODULE_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_module/module_sh.h b/TAO/TAO_IDL/be_include/be_visitor_module/module_sh.h new file mode 100644 index 00000000000..0ee2c25379c --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_module/module_sh.h @@ -0,0 +1,48 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// module_sh.h +// +// = DESCRIPTION +// Concrete visitor for the Module class +// This provides code generation for the module in the server header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_MODULE_MODULE_SH_H_) +#define _BE_VISITOR_MODULE_MODULE_SH_H_ + +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 /* _BE_VISITOR_MODULE_MODULE_SH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation.h b/TAO/TAO_IDL/be_include/be_visitor_operation.h index 414d848311c..0fdcd877f9e 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_operation.h +++ b/TAO/TAO_IDL/be_include/be_visitor_operation.h @@ -24,816 +24,27 @@ #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 operation declaration inside the TIE class -// *********************************************************************** - -class be_visitor_operation_tie_sh : public be_visitor_scope -{ - // - // = TITLE - // be_visitor_operation_tie_sh - // - // = DESCRIPTION - // This is a concrete visitor to generate the operaton inside a TIE class - // - // -public: - be_visitor_operation_tie_sh (be_visitor_context *ctx); - // constructor - - ~be_visitor_operation_tie_sh (void); - // destructor - - virtual int visit_operation (be_operation *node); - // set the right context and make a visitor -}; - -// *********************************************************************** -// Operation visitor for operation declaration inside the TIE class -// *********************************************************************** - -class be_visitor_operation_tie_si : public be_visitor_scope -{ - // - // = TITLE - // be_visitor_operation_tie_ss - // - // = DESCRIPTION - // This is a concrete visitor to generate the operaton inside a TIE class - // - // -public: - be_visitor_operation_tie_si (be_visitor_context *ctx); - // constructor - - ~be_visitor_operation_tie_si (void); - // destructor - - virtual int visit_operation (be_operation *node); - // set the right context and make a visitor -}; - -// *********************************************************************** -// 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_static_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_static_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_static_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_static_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_static_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 - -}; - -// ****************************************************************************** -// Visitor for -// ****************************************************************************** - -class be_visitor_operation_exceptlist_cs : public be_visitor_decl -{ - // - // = TITLE - // be_visitor_operaion_exceptlist_cs - // - // = DESCRIPTION - // This is a visitor to generate operation exception list to be provided to - // the do_static_call - // - // -public: - be_visitor_operation_exceptlist_cs (be_visitor_context *ctx); - // constructor - - ~be_visitor_operation_exceptlist_cs (void); - // destructor - - int visit_operation (be_operation *node); - // visit the operation - -}; - -// ************************************************************ -// 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 - -}; +#include "be_visitor_operation/operation_ch.h" +#include "be_visitor_operation/operation_cs.h" +#include "be_visitor_operation/operation_sh.h" +#include "be_visitor_operation/operation_ss.h" +#include "be_visitor_operation/tie_sh.h" +#include "be_visitor_operation/tie_si.h" +#include "be_visitor_operation/collocated_sh.h" +#include "be_visitor_operation/collocated_ss.h" +#include "be_visitor_operation/arglist.h" +#include "be_visitor_operation/rettype.h" +#include "be_visitor_operation/rettype_vardecl_cs.h" +#include "be_visitor_operation/rettype_pre_docall_cs.h" +#include "be_visitor_operation/rettype_pre_docall_cs.h" +#include "be_visitor_operation/rettype_docall_cs.h" +#include "be_visitor_operation/rettype_post_docall_cs.h" +#include "be_visitor_operation/rettype_return_cs.h" +#include "be_visitor_operation/exceptlist_cs.h" +#include "be_visitor_operation/argument.h" +#include "be_visitor_operation/rettype_vardecl_ss.h" +#include "be_visitor_operation/rettype_assign_ss.h" +#include "be_visitor_operation/rettype_post_upcall_ss.h" +#include "be_visitor_operation/rettype_marshal_ss.h" #endif // TAO_BE_VISITOR_OPERATION_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/arglist.h b/TAO/TAO_IDL/be_include/be_visitor_operation/arglist.h new file mode 100644 index 00000000000..42f418a97ed --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/arglist.h @@ -0,0 +1,54 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// arglist.h +// +// = DESCRIPTION +// Visitor for generating code for IDL operations. This generates the +// operation signature. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_OPERATION_ARGLIST_H_) +#define _BE_VISITOR_OPERATION_ARGLIST_H_ + +// ****************************************************************************** +// 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 + +}; + +#endif /* _BE_VISITOR_OPERATION_ARGLIST_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/argument.h b/TAO/TAO_IDL/be_include/be_visitor_operation/argument.h new file mode 100644 index 00000000000..6fc51da3ca7 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/argument.h @@ -0,0 +1,57 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// argument.h +// +// = DESCRIPTION +// Visitor for generating code for IDL operations. This is a generic visitor +// that calls visitors for the Argument class. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_OPERATION_ARGUMENT_H_) +#define _BE_VISITOR_OPERATION_ARGUMENT_H_ + +// ************************************************************ +// 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 + +}; + +#endif /* _BE_VISITOR_OPERATION_ARGUMENT_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/collocated_sh.h b/TAO/TAO_IDL/be_include/be_visitor_operation/collocated_sh.h new file mode 100644 index 00000000000..dc31959e345 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/collocated_sh.h @@ -0,0 +1,52 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// collocated_ch.h +// +// = DESCRIPTION +// Visitor for generating code for IDL operations for the collocated case +// inside of the servant header +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_OPERATION_COLLOCATED_SH_H_) +#define _BE_VISITOR_OPERATION_COLLOCATED_SH_H_ + +// ************************************************************ +// 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. + +}; + +#endif /* _BE_VISITOR_OPERATION_COLLOCATED_SH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/collocated_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/collocated_ss.h new file mode 100644 index 00000000000..48b7966e9aa --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/collocated_ss.h @@ -0,0 +1,52 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// collocated_ss.h +// +// = DESCRIPTION +// Visitor for generating code for IDL operations for the collocated case +// inside of the servant skeleton +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_OPERATION_COLLOCATED_SS_H_) +#define _BE_VISITOR_OPERATION_COLLOCATED_SS_H_ + +// ***************************************************************** +// 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. + +}; + +#endif /* _BE_VISITOR_OPERATION_COLLOCATED_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/exceptlist_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/exceptlist_cs.h new file mode 100644 index 00000000000..32c9e1c3d22 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/exceptlist_cs.h @@ -0,0 +1,52 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// exceptlist_cs.h +// +// = DESCRIPTION +// Visitor for generating code for IDL operations. This generates the tables +// for the exceptions used by the stubs. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_OPERATION_EXCEPTIONLIST_CS_H_) +#define _BE_VISITOR_OPERATION_EXCEPTIONLIST_CS_H_ + +// ****************************************************************************** +// Visitor for generating the exception list +// ****************************************************************************** + +class be_visitor_operation_exceptlist_cs : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_operaion_exceptlist_cs + // + // = DESCRIPTION + // This is a visitor to generate operation exception list to be provided to + // the do_static_call + // + // +public: + be_visitor_operation_exceptlist_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_operation_exceptlist_cs (void); + // destructor + + int visit_operation (be_operation *node); + // visit the operation + +}; + +#endif /* _BE_VISITOR_OPERATION_EXCEPTIONLIST_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ch.h b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ch.h new file mode 100644 index 00000000000..e039623dd5d --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ch.h @@ -0,0 +1,50 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// operation_ch.h +// +// = DESCRIPTION +// Visitor for generating code for IDL operations in client header +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_OPERATION_OPERATION_CH_H_) +#define _BE_VISITOR_OPERATION_OPERATION_CH_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 + +}; + +#endif /* _BE_VISITOR_OPERATION_OPERATION_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/operation_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_cs.h new file mode 100644 index 00000000000..1228b684e21 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_cs.h @@ -0,0 +1,55 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// operation_cs.h +// +// = DESCRIPTION +// Visitor for generating code for IDL operations in client stubs +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_OPERATION_OPERATION_CS_H_) +#define _BE_VISITOR_OPERATION_OPERATION_CS_H_ + +// ************************************************************ +// 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 +}; + +#endif /* _BE_VISITOR_OPERATION_OPERATION_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/operation_sh.h b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_sh.h new file mode 100644 index 00000000000..702a0dc2251 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_sh.h @@ -0,0 +1,50 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// operation_sh.h +// +// = DESCRIPTION +// Visitor for generating code for IDL operations in server header +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_OPERATION_OPERATION_SH_H_) +#define _BE_VISITOR_OPERATION_OPERATION_SH_H_ + +// ************************************************************ +// 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 + +}; + +#endif /* _BE_VISITOR_OPERATION_OPERATION_SH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ss.h new file mode 100644 index 00000000000..14cf41e7863 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ss.h @@ -0,0 +1,55 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// operation_ss.h +// +// = DESCRIPTION +// Visitor for generating code for IDL operations in server skeletons +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_OPERATION_OPERATION_SS_H_) +#define _BE_VISITOR_OPERATION_OPERATION_SS_H_ + +// ************************************************************ +// 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 +}; + +#endif /* _BE_VISITOR_OPERATION_OPERATION_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype.h b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype.h new file mode 100644 index 00000000000..9a4fc0a8ac3 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype.h @@ -0,0 +1,81 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// rettype.h +// +// = DESCRIPTION +// Visitor for generating code for IDL operations. This generates the return +// type of the operation +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_OPERATION_RETTYPE_H_) +#define _BE_VISITOR_OPERATION_RETTYPE_H_ + +// *********************************************************************** +// 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 + +}; + +#endif /* _BE_VISITOR_OPERATION_RETTYPE_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_assign_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_assign_ss.h new file mode 100644 index 00000000000..ff35c744e62 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_assign_ss.h @@ -0,0 +1,80 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// rettype_assign_ss.h +// +// = DESCRIPTION +// Visitor for generating code for IDL operations. This generates the +// assignment of the return value of the upcall to the return type variabel +// inside the server-skeleton. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_OPERATION_RETTYPE_ASSIGN_SS_H_) +#define _BE_VISITOR_OPERATION_RETTYPE_ASSIGN_SS_H_ + +// *********************************************************************** +// 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 + +}; + +#endif /* _BE_VISITOR_OPERATION_RETTYPE_ASSIGN_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_docall_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_docall_cs.h new file mode 100644 index 00000000000..eb3b287ce9c --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_docall_cs.h @@ -0,0 +1,79 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// rettype_docall_cs.h +// +// = DESCRIPTION +// Visitor for generating code for IDL operations. This generates the code +// for passing the return type variable to the docall +// made. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_OPERATION_RETTYPE_DOCALL_CS_H_) +#define _BE_VISITOR_OPERATION_RETTYPE_DOCALL_CS_H_ + +// ************************************************************ +// Operation visitor for passing return variable to do_static_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 + +}; + +#endif /* _BE_VISITOR_OPERATION_RETTYPE_DOCALL_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_marshal_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_marshal_ss.h new file mode 100644 index 00000000000..b3f95579a6a --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_marshal_ss.h @@ -0,0 +1,79 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// rettype_marshal_ss.h +// +// = DESCRIPTION +// Visitor for generating code for IDL operations. This generates the code +// for passing the return type variable to the marshaler. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_OPERATION_RETTYPE_MARSHAL_SS_H_) +#define _BE_VISITOR_OPERATION_RETTYPE_MARSHAL_SSH_ + +// *********************************************************************** +// 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 + +}; + +#endif /* _BE_VISITOR_OPERATION_RETTYPE_MARSHAL_SSH_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_post_docall_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_post_docall_cs.h new file mode 100644 index 00000000000..e2299617a35 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_post_docall_cs.h @@ -0,0 +1,54 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// rettype_post_docall_cs.h +// +// = DESCRIPTION +// Visitor for generating code for IDL operations. This generates the code +// for post processing of the return type variable after the docall is +// made. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_OPERATION_RETTYPE_POST_DOCALL_CS_H_) +#define _BE_VISITOR_OPERATION_RETTYPE_POST_DOCALL_CS_H_ + +// ************************************************************ +// Operation visitor for postprocessing after do_static_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_static_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 +}; + +#endif /* _BE_VISITOR_OPERATION_RETTYPE_POST_DOCALL_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_post_upcall_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_post_upcall_ss.h new file mode 100644 index 00000000000..6cfbd7566ed --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_post_upcall_ss.h @@ -0,0 +1,79 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// rettype_post_upcall_ss.h +// +// = DESCRIPTION +// Visitor for generating code for IDL operations. This generates the code +// for post processing of the return type variable after the upcall is +// made. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_OPERATION_RETTYPE_POST_UPCALL_SS_H_) +#define _BE_VISITOR_OPERATION_RETTYPE_POST_UPCALL_SS_H_ + +// *********************************************************************** +// 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 /* _BE_VISITOR_OPERATION_RETTYPE_POST_UPCALL_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_pre_docall_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_pre_docall_cs.h new file mode 100644 index 00000000000..acb296f6ac9 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_pre_docall_cs.h @@ -0,0 +1,73 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// rettype_pre_docall_cs.h +// +// = DESCRIPTION +// Visitor for generating code for IDL operations. This generates the code +// for pre processing of the return type variable before the docall is +// made. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_OPERATION_RETTYPE_PRE_DOCALL_CS_H_) +#define _BE_VISITOR_OPERATION_RETTYPE_PRE_DOCALL_CS_H_ + +// ************************************************************ +// Operation visitor for preprocessing before do_static_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_static_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 + +}; + +#endif /* _BE_VISITOR_OPERATION_RETTYPE_PRE_DOCALL_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_return_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_return_cs.h new file mode 100644 index 00000000000..ec9b8383342 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_return_cs.h @@ -0,0 +1,78 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// rettype_return_cs.h +// +// = DESCRIPTION +// Visitor for generating code for IDL operations. This generates the return +// statement for returning the return type variable in the client stub. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_OPERATION_RETTYPE_RETURN_CS_H_) +#define _BE_VISITOR_OPERATION_RETTYPE_CS_H_ + +// ************************************************************ +// 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 + +}; + +#endif /* _BE_VISITOR_OPERATION_RETTYPE_RETURN_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_vardecl_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_vardecl_cs.h new file mode 100644 index 00000000000..ca9b7ba99e7 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_vardecl_cs.h @@ -0,0 +1,78 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// rettype_vardecl_cs.h +// +// = DESCRIPTION +// Visitor for generating code for IDL operations. This generates the return +// type variable declaration in the client side stub. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_OPERATION_RETTYPE_VARDECL_CS_H_) +#define _BE_VISITOR_OPERATION_RETTYPE_VARDECL_CS_H_ + +// ************************************************************ +// 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 + +}; + +#endif /* _BE_VISITOR_OPERATION_RETTYPE_VARDECL_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_vardecl_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_vardecl_ss.h new file mode 100644 index 00000000000..57678e6371b --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_vardecl_ss.h @@ -0,0 +1,79 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// rettype_vardecl_ss.h +// +// = DESCRIPTION +// Visitor for generating code for IDL operations. This generates the return +// type variable declaration in the server side skeleton. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_OPERATION_RETTYPE_VARDECL_SS_H_) +#define _BE_VISITOR_OPERATION_RETTYPE_VARDECL_SS_H_ + +// ************************************************************ +// 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 + +}; + +#endif /* _BE_VISITOR_OPERATION_RETTYPE_VARDECL_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/tie_sh.h b/TAO/TAO_IDL/be_include/be_visitor_operation/tie_sh.h new file mode 100644 index 00000000000..f5329bfe963 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/tie_sh.h @@ -0,0 +1,50 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// tie_sh.h +// +// = DESCRIPTION +// Visitor for generating code for IDL operations for the TIE class inside +// the server header +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_OPERATION_TIE_SH_H_) +#define _BE_VISITOR_OPERATION_TIE_SH_H_ + +// *********************************************************************** +// Operation visitor for operation declaration inside the TIE class +// *********************************************************************** + +class be_visitor_operation_tie_sh : public be_visitor_scope +{ + // + // = TITLE + // be_visitor_operation_tie_sh + // + // = DESCRIPTION + // This is a concrete visitor to generate the operaton inside a TIE class + // + // +public: + be_visitor_operation_tie_sh (be_visitor_context *ctx); + // constructor + + ~be_visitor_operation_tie_sh (void); + // destructor + + virtual int visit_operation (be_operation *node); + // set the right context and make a visitor +}; + +#endif /* _BE_VISITOR_OPERATION_TIE_SH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/tie_si.h b/TAO/TAO_IDL/be_include/be_visitor_operation/tie_si.h new file mode 100644 index 00000000000..f6168878069 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/tie_si.h @@ -0,0 +1,50 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// tie_si.h +// +// = DESCRIPTION +// Visitor for generating code for IDL operations for the TIE class inside +// the server inline +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_OPERATION_TIE_SI_H_) +#define _BE_VISITOR_OPERATION_TIE_SI_H_ + +// *********************************************************************** +// Operation visitor for operation declaration inside the TIE class +// *********************************************************************** + +class be_visitor_operation_tie_si : public be_visitor_scope +{ + // + // = TITLE + // be_visitor_operation_tie_ss + // + // = DESCRIPTION + // This is a concrete visitor to generate the operaton inside a TIE class + // + // +public: + be_visitor_operation_tie_si (be_visitor_context *ctx); + // constructor + + ~be_visitor_operation_tie_si (void); + // destructor + + virtual int visit_operation (be_operation *node); + // set the right context and make a visitor +}; + +#endif /* _BE_VISITOR_OPERATION_TIE_SI_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root.h b/TAO/TAO_IDL/be_include/be_visitor_root.h index 68d3dcf4867..b18ad225c15 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root.h @@ -25,208 +25,13 @@ #include "be_visitor.h" #include "be_visitor_scope.h" -class be_visitor_root : public be_visitor_scope -{ - // - // = TITLE - // be_visitor_root - // - // = DESCRIPTION - // This is a concrete visitor for root that abstracts all common tasks - // - -public: - be_visitor_root (be_visitor_context *ctx); - // constructor - - ~be_visitor_root (void); - // destructor - - virtual int visit_root (be_root *node); - // visit root - - // =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 - - 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 - - // =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 - // be_visitor_root_ch - // - // = DESCRIPTION - // This is a concrete visitor to generate the client header for root - // - // -public: - be_visitor_root_ch (be_visitor_context *ctx); - // constructor - - ~be_visitor_root_ch (void); - // destructor - - virtual int init (void); - // set the right context and make a visitor -}; - -class be_visitor_root_ci : public be_visitor_root -{ - // - // = TITLE - // be_visitor_root_ci - // - // = DESCRIPTION - // This is a concrete visitor to generate the client inline for root - // - // -public: - be_visitor_root_ci (be_visitor_context *ctx); - // constructor - - ~be_visitor_root_ci (void); - // destructor - - virtual int init (void); - // set the right context and make a visitor -}; - -class be_visitor_root_cs : public be_visitor_root -{ - // - // = TITLE - // be_visitor_root_cs - // - // = DESCRIPTION - // This is a concrete visitor to generate the client stubs for root - // - // -public: - be_visitor_root_cs (be_visitor_context *ctx); - // constructor - - ~be_visitor_root_cs (void); - // destructor - - virtual int init (void); - // set the right context and make a visitor -}; - -class be_visitor_root_sh : public be_visitor_root -{ - // - // = TITLE - // be_visitor_root_sh - // - // = DESCRIPTION - // This is a concrete visitor to generate the server header for root - // - // -public: - be_visitor_root_sh (be_visitor_context *ctx); - // constructor - - ~be_visitor_root_sh (void); - // destructor - - virtual int init (void); - // set the right context and make a visitor -}; - -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_root -{ - // - // = TITLE - // be_visitor_root_ss - // - // = DESCRIPTION - // This is a concrete visitor to generate the server skeletons for root - // - // -public: - be_visitor_root_ss (be_visitor_context *ctx); - // constructor - - ~be_visitor_root_ss (void); - // destructor - - virtual int init (void); - // set the right context and make a visitor -}; - - -class be_visitor_root_any_op : public be_visitor_root -{ - // - // = TITLE - // be_visitor_root_any_op - // - // = DESCRIPTION - // This is a concrete visitor for root that generates the Any operator - // declarations and implementations - // - -public: - be_visitor_root_any_op (be_visitor_context *ctx); - // constructor - - ~be_visitor_root_any_op (void); - // destructor - - virtual int visit_root (be_root *node); - // visit root -}; +#include "be_visitor_root/root.h" +#include "be_visitor_root/root_ch.h" +#include "be_visitor_root/root_ci.h" +#include "be_visitor_root/root_cs.h" +#include "be_visitor_root/root_sh.h" +#include "be_visitor_root/root_si.h" +#include "be_visitor_root/root_ss.h" +#include "be_visitor_root/any_op.h" #endif // TAO_BE_VISITOR_ROOT_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/any_op.h b/TAO/TAO_IDL/be_include/be_visitor_root/any_op.h new file mode 100644 index 00000000000..55bea266f7b --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_root/any_op.h @@ -0,0 +1,49 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op.h +// +// = DESCRIPTION +// Concrete visitor for the Root class +// This one provides code generation for the Any operators for elements of +// the Root scope. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ROOT_ANY_OP_H_) +#define _BE_VISITOR_ROOT_ANY_OP_H_ + +class be_visitor_root_any_op : public be_visitor_root +{ + // + // = TITLE + // be_visitor_root_any_op + // + // = DESCRIPTION + // This is a concrete visitor for root that generates the Any operator + // declarations and implementations + // + +public: + be_visitor_root_any_op (be_visitor_context *ctx); + // constructor + + ~be_visitor_root_any_op (void); + // destructor + + virtual int visit_root (be_root *node); + // visit root +}; + +#endif /* _BE_VISITOR_ROOT_ANY_OP_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root.h b/TAO/TAO_IDL/be_include/be_visitor_root/root.h new file mode 100644 index 00000000000..106bf26355d --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root.h @@ -0,0 +1,81 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// root.h +// +// = DESCRIPTION +// Concrete visitor for the Root class +// This one provides the generic visitor for the Root node. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ROOT_ROOT_H_) +#define _BE_VISITOR_ROOT_ROOT_H_ + +class be_visitor_root : public be_visitor_scope +{ + // + // = TITLE + // be_visitor_root + // + // = DESCRIPTION + // This is a concrete visitor for root that abstracts all common tasks + // + +public: + be_visitor_root (be_visitor_context *ctx); + // constructor + + ~be_visitor_root (void); + // destructor + + virtual int visit_root (be_root *node); + // visit root + + // =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 + + 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 + + // =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 +}; + +#endif /* _BE_VISITOR_ROOT_ROOT_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_ch.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_ch.h new file mode 100644 index 00000000000..47dd1f09b56 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_ch.h @@ -0,0 +1,48 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// root_ch.h +// +// = DESCRIPTION +// Concrete visitor for the Root class +// This one provides code generation for elements of the Root node in the +// client header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ROOT_ROOT_CH_H_) +#define _BE_VISITOR_ROOT_ROOT_CH_H_ + +class be_visitor_root_ch : public be_visitor_root +{ + // + // = TITLE + // be_visitor_root_ch + // + // = DESCRIPTION + // This is a concrete visitor to generate the client header for root + // + // +public: + be_visitor_root_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_root_ch (void); + // destructor + + virtual int init (void); + // set the right context and make a visitor +}; + +#endif /* _BE_VISITOR_ROOT_ROOT_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_ci.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_ci.h new file mode 100644 index 00000000000..1362397511b --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_ci.h @@ -0,0 +1,48 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// root_ci.h +// +// = DESCRIPTION +// Concrete visitor for the Root class +// This one provides code generation for elements of the Root node in the +// client inline. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ROOT_ROOT_CI_H_) +#define _BE_VISITOR_ROOT_ROOT_CI_H_ + +class be_visitor_root_ci : public be_visitor_root +{ + // + // = TITLE + // be_visitor_root_ci + // + // = DESCRIPTION + // This is a concrete visitor to generate the client inline for root + // + // +public: + be_visitor_root_ci (be_visitor_context *ctx); + // constructor + + ~be_visitor_root_ci (void); + // destructor + + virtual int init (void); + // set the right context and make a visitor +}; + +#endif /* _BE_VISITOR_ROOT_ROOT_CI_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_cs.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_cs.h new file mode 100644 index 00000000000..e8462a0df49 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_cs.h @@ -0,0 +1,48 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// root_cs.h +// +// = DESCRIPTION +// Concrete visitor for the Root class +// This one provides code generation for elements of the Root node in the +// client stubs. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ROOT_ROOT_CS_H_) +#define _BE_VISITOR_ROOT_ROOT_CS_H_ + +class be_visitor_root_cs : public be_visitor_root +{ + // + // = TITLE + // be_visitor_root_cs + // + // = DESCRIPTION + // This is a concrete visitor to generate the client stubs for root + // + // +public: + be_visitor_root_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_root_cs (void); + // destructor + + virtual int init (void); + // set the right context and make a visitor +}; + +#endif /* _BE_VISITOR_ROOT_ROOT_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_sh.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_sh.h new file mode 100644 index 00000000000..45a15201de8 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_sh.h @@ -0,0 +1,48 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// root_sh.h +// +// = DESCRIPTION +// Concrete visitor for the Root class +// This one provides code generation for elements of the Root node in the +// server header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ROOT_ROOT_SH_H_) +#define _BE_VISITOR_ROOT_ROOT_SH_H_ + +class be_visitor_root_sh : public be_visitor_root +{ + // + // = TITLE + // be_visitor_root_sh + // + // = DESCRIPTION + // This is a concrete visitor to generate the server header for root + // + // +public: + be_visitor_root_sh (be_visitor_context *ctx); + // constructor + + ~be_visitor_root_sh (void); + // destructor + + virtual int init (void); + // set the right context and make a visitor +}; + +#endif /* _BE_VISITOR_ROOT_ROOT_SH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_si.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_si.h new file mode 100644 index 00000000000..5ff6648ebb8 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_si.h @@ -0,0 +1,48 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// root_si.h +// +// = DESCRIPTION +// Concrete visitor for the Root class +// This one provides code generation for elements of the Root node in the +// server inline. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ROOT_ROOT_SI_H_) +#define _BE_VISITOR_ROOT_ROOT_SI_H_ + +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 +}; + +#endif /* _BE_VISITOR_ROOT_ROOT_SI_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_ss.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_ss.h new file mode 100644 index 00000000000..412f93df56b --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_ss.h @@ -0,0 +1,48 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// root_ss.h +// +// = DESCRIPTION +// Concrete visitor for the Root class +// This one provides code generation for elements of the Root node in the +// server skeletons. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_ROOT_ROOT_SS_H_) +#define _BE_VISITOR_ROOT_ROOT_SS_H_ + +class be_visitor_root_ss : public be_visitor_root +{ + // + // = TITLE + // be_visitor_root_ss + // + // = DESCRIPTION + // This is a concrete visitor to generate the server skeletons for root + // + // +public: + be_visitor_root_ss (be_visitor_context *ctx); + // constructor + + ~be_visitor_root_ss (void); + // destructor + + virtual int init (void); + // set the right context and make a visitor +}; + +#endif /* _BE_VISITOR_ROOT_ROOT_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence.h b/TAO/TAO_IDL/be_include/be_visitor_sequence.h index da412d0b9e4..1cda7cdae2f 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_sequence.h +++ b/TAO/TAO_IDL/be_include/be_visitor_sequence.h @@ -8,251 +8,15 @@ #include "be_visitor_decl.h" -class be_visitor_sequence_ch : public be_visitor_decl -{ - // - // = TITLE - // be_visitor_sequence_ch - // - // = DESCRIPTION - // This is a concrete visitor to generate the client header for - // sequences - // -public: - be_visitor_sequence_ch (be_visitor_context *ctx); - // constructor - - ~be_visitor_sequence_ch (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 - - virtual int gen_var_defn (be_sequence *node); - // generate the var defn - - virtual int gen_out_defn (be_sequence *node); - // generate the out defn -}; - -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 - - 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_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 - -}; - +#include "be_visitor_sequence/sequence_ch.h" +#include "be_visitor_sequence/sequence_ci.h" +#include "be_visitor_sequence/sequence_cs.h" // =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 - // for a TAO_*_Sequence instantiation. - // - // = BUGS - // The class name is misleading, eventually this class could be - // used to generate code in other files, not only the client - // header. - // The visitor factory should provide a factory method that builds - // this class on the fly. - // -public: - be_visitor_sequence_base (be_visitor_context *ctx); - // Constructor - - ~be_visitor_sequence_base (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_exception (be_exception *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 - -}; - -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_exception (be_exception *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 - -}; - -class be_visitor_sequence_elemtype : public be_visitor_decl -{ - // - // = TITLE - // be_visitor_sequence_elemtype - // - // = DESCRIPTION - // This is a concrete visitor to generate the return type for the - // [] operators - // - // = NOTES - // This class may eventually go away when the _var and _out classes are - // generated using templates -public: - be_visitor_sequence_elemtype (be_visitor_context *ctx); - // Constructor - - ~be_visitor_sequence_elemtype (void); - // destructor - - // = Visitors - 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_exception (be_exception *node); - virtual int visit_union (be_union *node); - virtual int visit_array (be_array *node); - virtual int visit_sequence (be_sequence *node); - virtual int visit_typedef (be_typedef *node); - virtual int visit_string (be_string *node); - -protected: - int visit_node (be_type *); - // helper that does the common job - -}; - -class be_visitor_sequence_any_op_ch : public be_visitor_decl -{ - // - // = TITLE - // be_visitor_sequence_any_op_ch - // - // = DESCRIPTION - // This is a concrete visitor for sequence that generates the Any operator - // declarations - // - -public: - be_visitor_sequence_any_op_ch (be_visitor_context *ctx); - // constructor - - ~be_visitor_sequence_any_op_ch (void); - // destructor - - virtual int visit_sequence (be_sequence *node); - // visit sequence -}; - -class be_visitor_sequence_any_op_cs : public be_visitor_decl -{ - // - // = TITLE - // be_visitor_sequence_any_op_cs - // - // = DESCRIPTION - // This is a concrete visitor for sequence that generates the Any operator - // implementations - // - -public: - be_visitor_sequence_any_op_cs (be_visitor_context *ctx); - // constructor - - ~be_visitor_sequence_any_op_cs (void); - // destructor - - virtual int visit_sequence (be_sequence *node); - // visit sequence -}; +#include "be_visitor_sequence/sequence_base.h" +#include "be_visitor_sequence/buffer_type.h" +#include "be_visitor_sequence/elemtype.h" +// = any operators +#include "be_visitor_sequence/any_op_ch.h" +#include "be_visitor_sequence/any_op_cs.h" #endif /* TAO_BE_VISITOR_SEQUENCE_H */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence/any_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_sequence/any_op_ch.h new file mode 100644 index 00000000000..b0b1f8a666e --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/any_op_ch.h @@ -0,0 +1,49 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_ch.h +// +// = DESCRIPTION +// Concrete visitor for the Sequence class +// This one provides code generation for the Any operators for the Sequence +// node in the client header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_SEQUENCE_ANY_OP_CH_H_) +#define _BE_VISITOR_SEQUENCE_ANY_OP_CH_H_ + +class be_visitor_sequence_any_op_ch : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_sequence_any_op_ch + // + // = DESCRIPTION + // This is a concrete visitor for sequence that generates the Any operator + // declarations + // + +public: + be_visitor_sequence_any_op_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_sequence_any_op_ch (void); + // destructor + + virtual int visit_sequence (be_sequence *node); + // visit sequence +}; + +#endif /* _BE_VISITOR_SEQUENCE_ANY_OP_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence/any_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_sequence/any_op_cs.h new file mode 100644 index 00000000000..4252635baef --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/any_op_cs.h @@ -0,0 +1,49 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_cs.h +// +// = DESCRIPTION +// Concrete visitor for the Sequence class +// This one provides code generation for the Sequence node in the client +// header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_SEQUENCE_ANY_OP_CS_H_) +#define _BE_VISITOR_SEQUENCE_ANY_OP_CS_H_ + +class be_visitor_sequence_any_op_cs : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_sequence_any_op_cs + // + // = DESCRIPTION + // This is a concrete visitor for sequence that generates the Any operator + // implementations + // + +public: + be_visitor_sequence_any_op_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_sequence_any_op_cs (void); + // destructor + + virtual int visit_sequence (be_sequence *node); + // visit sequence +}; + +#endif /* _BE_VISITOR_SEQUENCE_ANY_OP_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence/buffer_type.h b/TAO/TAO_IDL/be_include/be_visitor_sequence/buffer_type.h new file mode 100644 index 00000000000..449e5efd482 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/buffer_type.h @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// buffer_type.h +// +// = DESCRIPTION +// Concrete visitor for the Sequence class +// This one provides code generation for the buffer type of the Sequence +// node. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_SEQUENCE_BUFFER_TYPE_H_) +#define _BE_VISITOR_SEQUENCE_BUFFER_TYPE_H_ + +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_exception (be_exception *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 + +}; + +#endif /* _BE_VISITOR_SEQUENCE_BUFFER_TYPE_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence/elemtype.h b/TAO/TAO_IDL/be_include/be_visitor_sequence/elemtype.h new file mode 100644 index 00000000000..88212e3ac0e --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/elemtype.h @@ -0,0 +1,66 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// elemtype.h +// +// = DESCRIPTION +// Concrete visitor for the Sequence class +// This one provides code generation for the element type returned by the [] +// operators for the Sequence node. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_SEQUENCE_ELEMTYPE_H_) +#define _BE_VISITOR_SEQUENCE_ELEMTYPE_H_ + +class be_visitor_sequence_elemtype : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_sequence_elemtype + // + // = DESCRIPTION + // This is a concrete visitor to generate the return type for the + // [] operators + // + // = NOTES + // This class may eventually go away when the _var and _out classes are + // generated using templates +public: + be_visitor_sequence_elemtype (be_visitor_context *ctx); + // Constructor + + ~be_visitor_sequence_elemtype (void); + // destructor + + // = Visitors + 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_exception (be_exception *node); + virtual int visit_union (be_union *node); + virtual int visit_array (be_array *node); + virtual int visit_sequence (be_sequence *node); + virtual int visit_typedef (be_typedef *node); + virtual int visit_string (be_string *node); + +protected: + int visit_node (be_type *); + // helper that does the common job + +}; + +#endif /* _BE_VISITOR_SEQUENCE_ELEMTYPE_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_base.h b/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_base.h new file mode 100644 index 00000000000..71673e2c230 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_base.h @@ -0,0 +1,69 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// sequence_base.h +// +// = DESCRIPTION +// Concrete visitor for the Sequence class +// This one provides code generation for the base typ of the Sequence node. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_SEQUENCE_SEQUENCE_BASE_H_) +#define _BE_VISITOR_SEQUENCE_SEQUENCE_BASE_H_ + +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 + // for a TAO_*_Sequence instantiation. + // + // = BUGS + // The class name is misleading, eventually this class could be + // used to generate code in other files, not only the client + // header. + // The visitor factory should provide a factory method that builds + // this class on the fly. + // +public: + be_visitor_sequence_base (be_visitor_context *ctx); + // Constructor + + ~be_visitor_sequence_base (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_exception (be_exception *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 + +}; + +#endif /* _BE_VISITOR_SEQUENCE_SEQUENCE_BASE_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_ch.h b/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_ch.h new file mode 100644 index 00000000000..8e7a3fd3e24 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_ch.h @@ -0,0 +1,57 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// sequence_ch.h +// +// = DESCRIPTION +// Concrete visitor for the Sequence class +// This one provides code generation for the Sequence node in the client +// header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_SEQUENCE_SEQUENCE_CH_H_) +#define _BE_VISITOR_SEQUENCE_SEQUENCE_CH_H_ + +class be_visitor_sequence_ch : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_sequence_ch + // + // = DESCRIPTION + // This is a concrete visitor to generate the client header for + // sequences + // +public: + be_visitor_sequence_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_sequence_ch (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 + + virtual int gen_var_defn (be_sequence *node); + // generate the var defn + + virtual int gen_out_defn (be_sequence *node); + // generate the out defn +}; + +#endif /* _BE_VISITOR_SEQUENCE_SEQUENCE_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_ci.h b/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_ci.h new file mode 100644 index 00000000000..fbe8890c7c8 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_ci.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// sequence_ci.h +// +// = DESCRIPTION +// Concrete visitor for the Sequence class +// This one provides code generation for the Sequence node in the client +// inline. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_SEQUENCE_SEQUENCE_CI_H_) +#define _BE_VISITOR_SEQUENCE_SEQUENCE_CI_H_ + +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 + + virtual int gen_out_impl (be_sequence *node); + // generate the out impl +}; + +#endif /* _BE_VISITOR_SEQUENCE_SEQUENCE_CI_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_cs.h b/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_cs.h new file mode 100644 index 00000000000..f60808eda4d --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_cs.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// sequence_cs.h +// +// = DESCRIPTION +// Concrete visitor for the Sequence class +// This one provides code generation for the Sequence node in the client +// stubs. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_SEQUENCE_SEQUENCE_CS_H_) +#define _BE_VISITOR_SEQUENCE_SEQUENCE_CS_H_ + +class be_visitor_sequence_cs : public be_visitor_decl +{ + // + // = TITLE + // 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 + +}; + +#endif /* _BE_VISITOR_SEQUENCE_SEQUENCE_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure.h b/TAO/TAO_IDL/be_include/be_visitor_structure.h index 63484a80692..3dafbd10eb8 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_structure.h +++ b/TAO/TAO_IDL/be_include/be_visitor_structure.h @@ -25,147 +25,13 @@ #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 - -}; - -class be_visitor_structure_any_op_ch : public be_visitor_structure -{ - // - // = TITLE - // be_visitor_structure_any_op_ch - // - // = DESCRIPTION - // This is a concrete visitor for structure that generates the Any operator - // declarations - // - -public: - be_visitor_structure_any_op_ch (be_visitor_context *ctx); - // constructor - - ~be_visitor_structure_any_op_ch (void); - // destructor - - virtual int visit_structure (be_structure *node); - // visit structure - - virtual int visit_field (be_field *node); - // visit field -}; - -class be_visitor_structure_any_op_cs : public be_visitor_structure -{ - // - // = TITLE - // be_visitor_structure_any_op_cs - // - // = DESCRIPTION - // This is a concrete visitor for structure that generates the Any operator - // implementations - // - -public: - be_visitor_structure_any_op_cs (be_visitor_context *ctx); - // constructor - - ~be_visitor_structure_any_op_cs (void); - // destructor - - virtual int visit_structure (be_structure *node); - // visit structure - - virtual int visit_field (be_field *node); - // visit field -}; - +// generic visitor +#include "be_visitor_structure/structure.h" +// concrete visitors +#include "be_visitor_structure/structure_ch.h" +#include "be_visitor_structure/structure_ci.h" +#include "be_visitor_structure/structure_cs.h" +#include "be_visitor_structure/any_op_ch.h" +#include "be_visitor_structure/any_op_cs.h" #endif // TAO_BE_VISITOR_STRUCTURE_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure/any_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_structure/any_op_ch.h new file mode 100644 index 00000000000..1bd7384f191 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_structure/any_op_ch.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_ch.h +// +// = DESCRIPTION +// Concrete visitor for the Structure class +// This one provides code generation for the Any operators for the structure +// in the client header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_STRUCTURE_ANY_OP_CH_H_) +#define _BE_VISITOR_STRUCTURE_ANY_OP_CH_H_ + +class be_visitor_structure_any_op_ch : public be_visitor_structure +{ + // + // = TITLE + // be_visitor_structure_any_op_ch + // + // = DESCRIPTION + // This is a concrete visitor for structure that generates the Any operator + // declarations + // + +public: + be_visitor_structure_any_op_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_structure_any_op_ch (void); + // destructor + + virtual int visit_structure (be_structure *node); + // visit structure + + virtual int visit_field (be_field *node); + // visit field +}; + +#endif /* _BE_VISITOR_STRUCTURE_ANY_OP_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure/any_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_structure/any_op_cs.h new file mode 100644 index 00000000000..1ee098a905a --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_structure/any_op_cs.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_ch.h +// +// = DESCRIPTION +// Concrete visitor for the Structure class +// This one provides code generation for the Any operators for the structure +// in the client header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_STRUCTURE_ANY_OP_CS_H_) +#define _BE_VISITOR_STRUCTURE_ANY_OP_CS_H_ + +class be_visitor_structure_any_op_cs : public be_visitor_structure +{ + // + // = TITLE + // be_visitor_structure_any_op_cs + // + // = DESCRIPTION + // This is a concrete visitor for structure that generates the Any operator + // implementations + // + +public: + be_visitor_structure_any_op_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_structure_any_op_cs (void); + // destructor + + virtual int visit_structure (be_structure *node); + // visit structure + + virtual int visit_field (be_field *node); + // visit field +}; + +#endif /* _BE_VISITOR_STRUCTURE_ANY_OP_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure/structure.h b/TAO/TAO_IDL/be_include/be_visitor_structure/structure.h new file mode 100644 index 00000000000..a10531ccf9c --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_structure/structure.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// structure.h +// +// = DESCRIPTION +// Concrete visitor for the STRUCTURE class +// This one provides the generic visitor for the Structure node. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_STRUCTURE_STRUCTURE_H_) +#define _BE_VISITOR_STRUCTURE_STRUCTURE_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 +}; + +#endif /* _BE_VISITOR_STRUCTURE_STRUCTURE_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure/structure_ch.h b/TAO/TAO_IDL/be_include/be_visitor_structure/structure_ch.h new file mode 100644 index 00000000000..f946d033288 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_structure/structure_ch.h @@ -0,0 +1,48 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// structure_ch.h +// +// = DESCRIPTION +// Concrete visitor for the Structure class +// This one provides code generation for the structure in the client header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_STRUCTURE_STRUCTURE_CH_H_) +#define _BE_VISITOR_STRUCTURE_STRUCTURE_CH_H_ + +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 + +}; + +#endif /* _BE_VISITOR_STRUCTURE_STRUCTURE_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure/structure_ci.h b/TAO/TAO_IDL/be_include/be_visitor_structure/structure_ci.h new file mode 100644 index 00000000000..ac47118f00d --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_structure/structure_ci.h @@ -0,0 +1,48 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// structure_ci.h +// +// = DESCRIPTION +// Concrete visitor for the Structure class +// This one provides code generation for the structure in the client inline. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_STRUCTURE_STRUCTURE_CI_H_) +#define _BE_VISITOR_STRUCTURE_STRUCTURE_CI_H_ + +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 + +}; + +#endif /* _BE_VISITOR_STRUCTURE_STRUCTURE_CI_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure/structure_cs.h b/TAO/TAO_IDL/be_include/be_visitor_structure/structure_cs.h new file mode 100644 index 00000000000..06c4c0c51d0 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_structure/structure_cs.h @@ -0,0 +1,48 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// structure_cs.h +// +// = DESCRIPTION +// Concrete visitor for the Structure class +// This one provides code generation for the structure in the client stubs. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_STRUCTURE_STRUCTURE_CS_H_) +#define _BE_VISITOR_STRUCTURE_STRUCTURE_CS_H_ + +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 /* _BE_VISITOR_STRUCTURE_STRUCTURE_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode.h b/TAO/TAO_IDL/be_include/be_visitor_typecode.h index 23bb9f5f3ea..cbd083c4fb7 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_typecode.h +++ b/TAO/TAO_IDL/be_include/be_visitor_typecode.h @@ -24,109 +24,8 @@ #include "be_visitor_decl.h" -class be_visitor_typecode_decl : public be_visitor_decl -{ - // - // = TITLE - // be_visitor_typecode_decl - // - // = DESCRIPTION - // This is a concrete visitor for generating TypeCode declarations - // +#include "be_visitor_typecode/typecode_decl.h" +#include "be_visitor_typecode/typecode_defn.h" -public: - be_visitor_typecode_decl (be_visitor_context *ctx); - // constructor - - ~be_visitor_typecode_decl (void); - // destructor - - virtual int visit_type (be_type *node); - // visit a generic be_type node - - // =visit methods on all types. They call the generic visit_type - - virtual int visit_array (be_array *node); - // visit a array - - virtual int visit_enum (be_enum *node); - // visit an enum - - virtual int visit_exception (be_exception *node); - // visit an enum - - virtual int visit_interface (be_interface *node); - // visit interface - - virtual int visit_sequence (be_sequence *node); - // visit a sequence - - virtual int visit_structure (be_structure *node); - // visit a structure - - virtual int visit_typedef (be_typedef *node); - // visit a typedef - - virtual int visit_union (be_union *node); - // visit a union - -}; - - -class be_visitor_typecode_defn : public be_visitor_decl -{ - // - // = TITLE - // be_visitor_typecode_defn - // - // = DESCRIPTION - // This is a concrete visitor for generating TypeCode definitions - // - -public: - be_visitor_typecode_defn (be_visitor_context *ctx); - // constructor - - ~be_visitor_typecode_defn (void); - // destructor - - virtual int visit_type (be_type *node); - // visit a generic be_type node - - // =visit methods on all types. They call the generic visit_type - - virtual int visit_array (be_array *node); - // visit a array - - virtual int visit_enum (be_enum *node); - // visit an enum - - virtual int visit_exception (be_exception *node); - // visit an enum - - virtual int visit_interface (be_interface *node); - // visit interface - - virtual int visit_sequence (be_sequence *node); - // visit a sequence - - virtual int visit_structure (be_structure *node); - // visit a structure - - virtual int visit_typedef (be_typedef *node); - // visit a typedef - - virtual int visit_union (be_union *node); - // visit a union - - - // = special methods - - virtual int gen_nested_namespace_begin (be_module *node); - // generate the nested namespace begins - - virtual int gen_nested_namespace_end (be_module *node); - // generate the nested namespace ends -}; #endif /* TAO_BE_VISITOR_TYPECODE_H */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_decl.h b/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_decl.h new file mode 100644 index 00000000000..c6f67b4fc4a --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_decl.h @@ -0,0 +1,74 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// typecode_decl.h +// +// = DESCRIPTION +// Concrete visitor for the generation of TypeCodes. +// This one generates the declaration. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_TYPECODE_TYPECODE_DECL_H_) +#define _BE_VISITOR_TYPECODE_TYPECODE_DECL_H_ + +class be_visitor_typecode_decl : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_typecode_decl + // + // = DESCRIPTION + // This is a concrete visitor for generating TypeCode declarations + // + +public: + be_visitor_typecode_decl (be_visitor_context *ctx); + // constructor + + ~be_visitor_typecode_decl (void); + // destructor + + virtual int visit_type (be_type *node); + // visit a generic be_type node + + // =visit methods on all types. They call the generic visit_type + + virtual int visit_array (be_array *node); + // visit a array + + virtual int visit_enum (be_enum *node); + // visit an enum + + virtual int visit_exception (be_exception *node); + // visit an enum + + virtual int visit_interface (be_interface *node); + // visit interface + + virtual int visit_sequence (be_sequence *node); + // visit a sequence + + virtual int visit_structure (be_structure *node); + // visit a structure + + virtual int visit_typedef (be_typedef *node); + // visit a typedef + + virtual int visit_union (be_union *node); + // visit a union + +}; + +#endif /* _BE_VISITOR_TYPECODE_TYPECODE_DECL_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h b/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h new file mode 100644 index 00000000000..b87b57dfa05 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h @@ -0,0 +1,82 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// typecode_defn.h +// +// = DESCRIPTION +// Concrete visitor for the generation of TypeCodes. +// This one generates the definitions. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_TYPECODE_TYPECODE_DEFN_H_) +#define _BE_VISITOR_TYPECODE_TYPECODE_DEFN_H_ + +class be_visitor_typecode_defn : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_typecode_defn + // + // = DESCRIPTION + // This is a concrete visitor for generating TypeCode definitions + // + +public: + be_visitor_typecode_defn (be_visitor_context *ctx); + // constructor + + ~be_visitor_typecode_defn (void); + // destructor + + virtual int visit_type (be_type *node); + // visit a generic be_type node + + // =visit methods on all types. They call the generic visit_type + + virtual int visit_array (be_array *node); + // visit a array + + virtual int visit_enum (be_enum *node); + // visit an enum + + virtual int visit_exception (be_exception *node); + // visit an enum + + virtual int visit_interface (be_interface *node); + // visit interface + + virtual int visit_sequence (be_sequence *node); + // visit a sequence + + virtual int visit_structure (be_structure *node); + // visit a structure + + virtual int visit_typedef (be_typedef *node); + // visit a typedef + + virtual int visit_union (be_union *node); + // visit a union + + + // = special methods + + virtual int gen_nested_namespace_begin (be_module *node); + // generate the nested namespace begins + + virtual int gen_nested_namespace_end (be_module *node); + // generate the nested namespace ends +}; + +#endif /* _BE_VISITOR_TYPECODE_TYPECODE_DEFN_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef.h b/TAO/TAO_IDL/be_include/be_visitor_typedef.h index 7e5370057db..206410cb13f 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_typedef.h +++ b/TAO/TAO_IDL/be_include/be_visitor_typedef.h @@ -25,243 +25,13 @@ #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_interface (be_interface *node); - // visit an interface; - - 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 - -}; - -class be_visitor_typedef_any_op_ch : public be_visitor_typedef -{ - // - // = TITLE - // be_visitor_typedef_any_op_ch - // - // = DESCRIPTION - // This is a concrete visitor for typedef that generates the Any operator - // declarations and implementations - // - -public: - be_visitor_typedef_any_op_ch (be_visitor_context *ctx); - // constructor - - ~be_visitor_typedef_any_op_ch (void); - // destructor - - virtual int visit_typedef (be_typedef *node); - // visit typedef - - // =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_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_any_op_cs : public be_visitor_typedef -{ - // - // = TITLE - // be_visitor_typedef_any_op_cs - // - // = DESCRIPTION - // This is a concrete visitor for typedef that generates the Any operator - // declarations and implementations - // - -public: - be_visitor_typedef_any_op_cs (be_visitor_context *ctx); - // constructor - - ~be_visitor_typedef_any_op_cs (void); - // destructor - - virtual int visit_typedef (be_typedef *node); - // visit typedef - - // =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_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 - -}; - +// generic visitor +#include "be_visitor_typedef/typedef.h" +// concrete visitors +#include "be_visitor_typedef/typedef_ch.h" +#include "be_visitor_typedef/typedef_ci.h" +#include "be_visitor_typedef/typedef_cs.h" +#include "be_visitor_typedef/any_op_ch.h" +#include "be_visitor_typedef/any_op_cs.h" #endif // TAO_BE_VISITOR_TYPEDEF_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef/any_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_typedef/any_op_ch.h new file mode 100644 index 00000000000..915465ed1fb --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_typedef/any_op_ch.h @@ -0,0 +1,69 @@ + +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_ch.h +// +// = DESCRIPTION +// Concrete visitor for the Typedef class +// This provides the code generation for the Any operators of the Typedef +// class in the client header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_TYPEDEF_ANY_OP_CH_H_) +#define _BE_VISITOR_TYPEDEF_ANY_OP_CH_H_ + +class be_visitor_typedef_any_op_ch : public be_visitor_typedef +{ + // + // = TITLE + // be_visitor_typedef_any_op_ch + // + // = DESCRIPTION + // This is a concrete visitor for typedef that generates the Any operator + // declarations and implementations + // + +public: + be_visitor_typedef_any_op_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_typedef_any_op_ch (void); + // destructor + + virtual int visit_typedef (be_typedef *node); + // visit typedef + + // =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_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 + +}; + +#endif /* _BE_VISITOR_TYPEDEF_ANY_OP_CH_H_*/ diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef/any_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_typedef/any_op_cs.h new file mode 100644 index 00000000000..9014b277d1d --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_typedef/any_op_cs.h @@ -0,0 +1,69 @@ + +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_cs.h +// +// = DESCRIPTION +// Concrete visitor for the Typedef class +// This provides the code generation for the Any operators of the Typedef +// class in the client stubs. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_TYPEDEF_ANY_OP_CS_H_) +#define _BE_VISITOR_TYPEDEF_ANY_OP_CS_H_ + +class be_visitor_typedef_any_op_cs : public be_visitor_typedef +{ + // + // = TITLE + // be_visitor_typedef_any_op_cs + // + // = DESCRIPTION + // This is a concrete visitor for typedef that generates the Any operator + // declarations and implementations + // + +public: + be_visitor_typedef_any_op_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_typedef_any_op_cs (void); + // destructor + + virtual int visit_typedef (be_typedef *node); + // visit typedef + + // =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_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 + +}; + +#endif /* _BE_VISITOR_TYPEDEF_ANY_OP_CS_H_*/ diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef.h b/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef.h new file mode 100644 index 00000000000..4b9f9f48507 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef.h @@ -0,0 +1,72 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// typedef.h +// +// = DESCRIPTION +// Concrete visitor for the Typedef class +// This provides the generic visitors for the Typedef class. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_TYPEDEF_TYPEDEF_H_) +#define _BE_VISITOR_TYPEDEF_TYPEDEF_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 + +}; + +#endif /* _BE_VISITOR_TYPEDEF_TYPEDEF_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_ch.h b/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_ch.h new file mode 100644 index 00000000000..a18b580d489 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_ch.h @@ -0,0 +1,76 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// typedef_ch.h +// +// = DESCRIPTION +// Concrete visitor for the Typedef class +// This provides the code generation for the Typedef class in the client +// header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_TYPEDEF_TYPEDEF_CH_H_) +#define _BE_VISITOR_TYPEDEF_TYPEDEF_CH_H_ + +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_interface (be_interface *node); + // visit an interface; + + 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 + +}; + +#endif /* _BE_VISITOR_TYPEDEF_TYPEDEF_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_ci.h b/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_ci.h new file mode 100644 index 00000000000..38c0276c33a --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_ci.h @@ -0,0 +1,65 @@ + +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// typedef_ci.h +// +// = DESCRIPTION +// Concrete visitor for the Typedef class +// This provides the code generation for the Typedef class in the client +// inline. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_TYPEDEF_TYPEDEF_CI_H_) +#define _BE_VISITOR_TYPEDEF_TYPEDEF_CI_H_ + +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 + +}; + +#endif /* _BE_VISITOR_TYPEDEF_TYPEDEF_CI_H_*/ diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_cs.h b/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_cs.h new file mode 100644 index 00000000000..091ac01e22c --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_cs.h @@ -0,0 +1,50 @@ + +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// typedef_cs.h +// +// = DESCRIPTION +// Concrete visitor for the Typedef class +// This provides the code generation for the Typedef class in the client +// stubs. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_TYPEDEF_TYPEDEF_CS_H_) +#define _BE_VISITOR_TYPEDEF_TYPEDEF_CS_H_ + +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 /* _BE_VISITOR_TYPEDEF_TYPEDEF_CS_H_*/ diff --git a/TAO/TAO_IDL/be_include/be_visitor_union.h b/TAO/TAO_IDL/be_include/be_visitor_union.h index c812317d841..1111d4bd198 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_union.h +++ b/TAO/TAO_IDL/be_include/be_visitor_union.h @@ -25,226 +25,16 @@ #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 - -}; - -class be_visitor_union_any_op_ch : public be_visitor_union -{ - // - // = TITLE - // be_visitor_union_any_op_ch - // - // = DESCRIPTION - // This is a concrete visitor for union that generates the Any operator - // declarations - // - -public: - be_visitor_union_any_op_ch (be_visitor_context *ctx); - // constructor - - ~be_visitor_union_any_op_ch (void); - // destructor - - virtual int visit_union (be_union *node); - // visit union - - virtual int visit_union_branch (be_union_branch *node); - // visit union_branch -}; - -class be_visitor_union_any_op_cs : public be_visitor_union -{ - // - // = TITLE - // be_visitor_union_any_op_cs - // - // = DESCRIPTION - // This is a concrete visitor for union that generates the Any operator - // implementations - // - -public: - be_visitor_union_any_op_cs (be_visitor_context *ctx); - // constructor - - ~be_visitor_union_any_op_cs (void); - // destructor - - virtual int visit_union (be_union *node); - // visit union - - virtual int visit_union_branch (be_union_branch *node); - // visit union_branch -}; +// generic visitor +#include "be_visitor_union/union.h" +// concrete visitors +#include "be_visitor_union/union_ch.h" +#include "be_visitor_union/union_ci.h" +#include "be_visitor_union/union_cs.h" +#include "be_visitor_union/discriminant_ch.h" +#include "be_visitor_union/discriminant_ci.h" +#include "be_visitor_union/discriminant_cs.h" +#include "be_visitor_union/any_op_ch.h" +#include "be_visitor_union/any_op_cs.h" #endif // TAO_BE_VISITOR_UNION_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_union/any_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_union/any_op_ch.h new file mode 100644 index 00000000000..2f045164396 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_union/any_op_ch.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_ch.h +// +// = DESCRIPTION +// Visitor for the Union class. +// This one generates code for the Any operators for the Union in the client +// header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_UNION_ANY_OP_CH_H_) +#define _BE_VISITOR_UNION_ANY_OP_CH_H_ + +class be_visitor_union_any_op_ch : public be_visitor_union +{ + // + // = TITLE + // be_visitor_union_any_op_ch + // + // = DESCRIPTION + // This is a concrete visitor for union that generates the Any operator + // declarations + // + +public: + be_visitor_union_any_op_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_union_any_op_ch (void); + // destructor + + virtual int visit_union (be_union *node); + // visit union + + virtual int visit_union_branch (be_union_branch *node); + // visit union_branch +}; + +#endif /* _BE_VISITOR_UNION_ANY_OP_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_union/any_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_union/any_op_cs.h new file mode 100644 index 00000000000..95bf8baaa82 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_union/any_op_cs.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// any_op_cs.h +// +// = DESCRIPTION +// Visitor for the Union class. +// This one generates code for the Any operators for the Union in the client +// header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_UNION_ANY_OP_CS_H_) +#define _BE_VISITOR_UNION_ANY_OP_CS_H_ + +class be_visitor_union_any_op_cs : public be_visitor_union +{ + // + // = TITLE + // be_visitor_union_any_op_cs + // + // = DESCRIPTION + // This is a concrete visitor for union that generates the Any operator + // implementations + // + +public: + be_visitor_union_any_op_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_union_any_op_cs (void); + // destructor + + virtual int visit_union (be_union *node); + // visit union + + virtual int visit_union_branch (be_union_branch *node); + // visit union_branch +}; + +#endif /* _BE_VISITOR_UNION_ANY_OP_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_union/discriminant_ch.h b/TAO/TAO_IDL/be_include/be_visitor_union/discriminant_ch.h new file mode 100644 index 00000000000..5c46ba2cd58 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_union/discriminant_ch.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// discriminant_ch.h +// +// = DESCRIPTION +// Visitor for the Union class. +// This one generates code for the discriminant of the Union in the client +// header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_UNION_DISCRIMINANT_CH_H_) +#define _BE_VISITOR_UNION_DISCRIMINANT_CH_H_ + +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 +}; + +#endif /* _BE_VISITOR_UNION_DISCRIMINANT_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_union/discriminant_ci.h b/TAO/TAO_IDL/be_include/be_visitor_union/discriminant_ci.h new file mode 100644 index 00000000000..bb44c2f12ee --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_union/discriminant_ci.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// discriminant_ci.h +// +// = DESCRIPTION +// Visitor for the Union class. +// This one generates code for the discriminant of the Union in the client +// inline file. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_UNION_DISCRIMINANT_CI_H_) +#define _BE_VISITOR_UNION_DISCRIMINANT_CI_H_ + +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 +}; + +#endif /* _BE_VISITOR_UNION_DISCRIMINANT_CI_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_union/discriminant_cs.h b/TAO/TAO_IDL/be_include/be_visitor_union/discriminant_cs.h new file mode 100644 index 00000000000..23cbe129a22 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_union/discriminant_cs.h @@ -0,0 +1,51 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// discriminant_cs.h +// +// = DESCRIPTION +// Visitor for the Union class. +// This one generates code for the discriminant of the Union in the client +// stubs. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_UNION_DISCRIMINANT_CS_H_) +#define _BE_VISITOR_UNION_DISCRIMINANT_CS_H_ + +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 /* _BE_VISITOR_UNION_DISCRIMINANT_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_union/union.h b/TAO/TAO_IDL/be_include/be_visitor_union/union.h new file mode 100644 index 00000000000..568f32b6d8b --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_union/union.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// union.h +// +// = DESCRIPTION +// Visitor for the Union class. +// This one is a generic visitor. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_UNION_UNION_H_) +#define _BE_VISITOR_UNION_UNION_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 +}; + +#endif /* _BE_VISITOR_UNION_UNION_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_union/union_ch.h b/TAO/TAO_IDL/be_include/be_visitor_union/union_ch.h new file mode 100644 index 00000000000..5d2f389fb5e --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_union/union_ch.h @@ -0,0 +1,48 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// union_ch.h +// +// = DESCRIPTION +// Visitor for the Union class. +// This one generates code in the client header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_UNION_UNION_CH_H_) +#define _BE_VISITOR_UNION_UNION_CH_H_ + +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 + +}; + +#endif /* _BE_VISITOR_UNION_UNION_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_union/union_ci.h b/TAO/TAO_IDL/be_include/be_visitor_union/union_ci.h new file mode 100644 index 00000000000..b0a2c52afe5 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_union/union_ci.h @@ -0,0 +1,48 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// union_ci.h +// +// = DESCRIPTION +// Visitor for the Union class. +// This one generates code in the client inline file. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_UNION_UNION_CI_H_) +#define _BE_VISITOR_UNION_UNION_CI_H_ + +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 + +}; + +#endif /* _BE_VISITOR_UNION_UNION_CI_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_union/union_cs.h b/TAO/TAO_IDL/be_include/be_visitor_union/union_cs.h new file mode 100644 index 00000000000..3a6ef0322aa --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_union/union_cs.h @@ -0,0 +1,48 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// union_cs.h +// +// = DESCRIPTION +// Visitor for the Union class. +// This one generates code in the client stubs. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_UNION_UNION_CS_H_) +#define _BE_VISITOR_UNION_UNION_CS_H_ + +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 + +}; + +#endif /* _BE_VISITOR_UNION_UNION_CS_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 index 780099165eb..7607d2a7f81 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_union_branch.h +++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch.h @@ -23,232 +23,10 @@ #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 - -}; +#include "be_visitor_union_branch/public_ch.h" +#include "be_visitor_union_branch/public_ci.h" +#include "be_visitor_union_branch/public_cs.h" +#include "be_visitor_union_branch/public_assign_cs.h" +#include "be_visitor_union_branch/private_ch.h" #endif // TAO_BE_VISITOR_UNION_BRANCH_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/private_ch.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/private_ch.h new file mode 100644 index 00000000000..5037fb586ea --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/private_ch.h @@ -0,0 +1,82 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// private_ch.h +// +// = DESCRIPTION +// Visitor for the Union class. +// This one generates code for private part of the union class for the union +// members in the client header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_UNION_BRANCH_PRIVATE_CH_H_) +#define _BE_VISITOR_UNION_BRANCH_PRIVATE_CH_H_ + +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 + +}; + +#endif /* _BE_VISITOR_UNION_BRANCH_PRIVATE_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_assign_cs.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_assign_cs.h new file mode 100644 index 00000000000..71d2dd7cc3b --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_assign_cs.h @@ -0,0 +1,49 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// public_assign_cs.h +// +// = DESCRIPTION +// Visitor for the Union class. +// This one generates code for the assignment operator of the union class +// for the union members in the client stubs. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_UNION_BRANCH_PUBLIC_ASSIGN_CS_H_) +#define _BE_VISITOR_UNION_BRANCH_PUBLIC_ASSIGN_CS_H_ + +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 /* _BE_VISITOR_UNION_BRANCH_PUBLIC_ASSIGN_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_ch.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_ch.h new file mode 100644 index 00000000000..43387f44cfa --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_ch.h @@ -0,0 +1,82 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// public_ch.h +// +// = DESCRIPTION +// Visitor for the Union class. +// This one generates code for public part of the union class for the union +// members in the client header. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_UNION_BRANCH_PUBLIC_CH_H_) +#define _BE_VISITOR_UNION_BRANCH_PUBLIC_CH_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 + +}; + +#endif /* _BE_VISITOR_UNION_BRANCH_PUBLIC_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_ci.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_ci.h new file mode 100644 index 00000000000..7462bdfe3de --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_ci.h @@ -0,0 +1,81 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// public_ci.h +// +// = DESCRIPTION +// Visitor for the Union class. +// This one generates code for public part of the union class for the union +// members in the client inline. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_UNION_BRANCI_PUBLIC_CI_H_) +#define _BE_VISITOR_UNION_BRANCI_PUBLIC_CI_H_ + +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 + +}; + +#endif /* _BE_VISITOR_UNION_BRANCI_PUBLIC_CI_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_cs.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_cs.h new file mode 100644 index 00000000000..f727b019644 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_cs.h @@ -0,0 +1,69 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// public_cs.h +// +// = DESCRIPTION +// Visitor for the Union class. +// This one generates code for public part of the union class for the union +// members in the client stubs. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#if !defined (_BE_VISITOR_UNION_BRANCS_PUBLIC_CS_H_) +#define _BE_VISITOR_UNION_BRANCS_PUBLIC_CS_H_ + +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 + +}; + +#endif /* _BE_VISITOR_UNION_BRANCS_PUBLIC_CS_H_ */ diff --git a/TAO/orbsvcs/orbsvcs/CosTrading.idl b/TAO/orbsvcs/orbsvcs/CosTrading.idl index ab9cbc2df05..7261d61e5b6 100644 --- a/TAO/orbsvcs/orbsvcs/CosTrading.idl +++ b/TAO/orbsvcs/orbsvcs/CosTrading.idl @@ -2,7 +2,7 @@ // ======================================================================== // $Id$ -// +// // = FILENAME // CosTrading.idl // @@ -10,7 +10,7 @@ // Trader Service v1.0 described in CORBAservices: Common Object // Services Specification, chapter 16 OMG IDL for Trading Function // Module, p 16-74 -// +// // ======================================================================== @@ -54,8 +54,8 @@ module CosTrading { typedef Istring Constraint; enum FollowOption { - local_only, - if_no_local, + local_only, + if_no_local, always }; @@ -115,7 +115,7 @@ module CosTrading { exception InvalidLookupRef { Lookup target; }; - + exception IllegalOfferId { OfferId id; }; @@ -195,7 +195,7 @@ module CosTrading { Policy the_policy; }; - void query ( + void query ( in ServiceTypeName type, in Constraint constr, in Preference pref, @@ -274,11 +274,11 @@ module CosTrading { in Object reference, in ServiceTypeName type, in PropertySeq properties - ) raises ( + ) raises ( InvalidObjectRef, IllegalServiceType, UnknownServiceType, - InterfaceTypeMismatch, + InterfaceTypeMismatch, IllegalPropertyName, // e.g. prop_name = "<foo-bar" PropertyTypeMismatch, ReadonlyDynamicProperty, @@ -306,9 +306,9 @@ module CosTrading { in OfferId id, in PropertyNameSeq del_list, in PropertySeq modify_list - ) raises ( + ) raises ( NotImplemented, - IllegalOfferId, + IllegalOfferId, UnknownOfferId, ProxyOfferId, IllegalPropertyName, @@ -369,12 +369,12 @@ module CosTrading { FollowOption max_link_follow_policy; }; - void add_link ( + void add_link ( in LinkName name, in Lookup target, in FollowOption def_pass_on_follow_rule, in FollowOption limiting_follow_rule - ) raises ( + ) raises ( IllegalLinkName, DuplicateLinkName, InvalidLookupRef, // e.g. nil @@ -398,11 +398,11 @@ module CosTrading { LinkNameSeq list_links ( ); - void modify_link ( + void modify_link ( in LinkName name, in FollowOption def_pass_on_follow_rule, in FollowOption limiting_follow_rule - ) raises ( + ) raises ( IllegalLinkName, UnknownLinkName, DefaultFollowTooPermissive, @@ -414,7 +414,7 @@ module CosTrading { typedef Istring ConstraintRecipe; - struct ProxyInfo { + struct ProxyInfo { ServiceTypeName type; Lookup target; PropertySeq properties; @@ -670,7 +670,7 @@ module CosTradingRepos { CosTrading::UnknownServiceType, DuplicateServiceTypeName ); - + void remove_type ( in CosTrading::ServiceTypeName name ) raises ( |