summaryrefslogtreecommitdiff
path: root/TAO
diff options
context:
space:
mode:
Diffstat (limited to 'TAO')
-rw-r--r--TAO/TAO_IDL/Makefile.BE10
-rw-r--r--TAO/TAO_IDL/Makefile.EXE2
-rw-r--r--TAO/TAO_IDL/Makefile.FE7
-rw-r--r--TAO/TAO_IDL/TAO_IDL_BE.bor10
-rw-r--r--TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp92
-rw-r--r--TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp88
-rw-r--r--TAO/TAO_IDL/TAO_IDL_FE.bor7
-rw-r--r--TAO/TAO_IDL/TAO_IDL_FE_DLL.dsp80
-rw-r--r--TAO/TAO_IDL/TAO_IDL_FE_LIB.dsp76
-rw-r--r--TAO/TAO_IDL/ast/Makefile.am7
-rw-r--r--TAO/TAO_IDL/ast/ast_argument.cpp14
-rw-r--r--TAO/TAO_IDL/ast/ast_array.cpp35
-rw-r--r--TAO/TAO_IDL/ast/ast_attribute.cpp4
-rw-r--r--TAO/TAO_IDL/ast/ast_check.cpp43
-rw-r--r--TAO/TAO_IDL/ast/ast_component.cpp182
-rw-r--r--TAO/TAO_IDL/ast/ast_component_fwd.cpp57
-rw-r--r--TAO/TAO_IDL/ast/ast_concrete_type.cpp7
-rw-r--r--TAO/TAO_IDL/ast/ast_constant.cpp152
-rw-r--r--TAO/TAO_IDL/ast/ast_decl.cpp388
-rw-r--r--TAO/TAO_IDL/ast/ast_enum.cpp53
-rw-r--r--TAO/TAO_IDL/ast/ast_enum_val.cpp9
-rw-r--r--TAO/TAO_IDL/ast/ast_exception.cpp34
-rw-r--r--TAO/TAO_IDL/ast/ast_expression.cpp348
-rw-r--r--TAO/TAO_IDL/ast/ast_factory.cpp20
-rw-r--r--TAO/TAO_IDL/ast/ast_field.cpp19
-rw-r--r--TAO/TAO_IDL/ast/ast_generator.cpp278
-rw-r--r--TAO/TAO_IDL/ast/ast_home.cpp137
-rw-r--r--TAO/TAO_IDL/ast/ast_interface.cpp951
-rw-r--r--TAO/TAO_IDL/ast/ast_interface_fwd.cpp75
-rw-r--r--TAO/TAO_IDL/ast/ast_module.cpp719
-rw-r--r--TAO/TAO_IDL/ast/ast_native.cpp16
-rw-r--r--TAO/TAO_IDL/ast/ast_operation.cpp65
-rw-r--r--TAO/TAO_IDL/ast/ast_predefined_type.cpp149
-rw-r--r--TAO/TAO_IDL/ast/ast_recursive.cpp9
-rw-r--r--TAO/TAO_IDL/ast/ast_redef.cpp14
-rw-r--r--TAO/TAO_IDL/ast/ast_root.cpp26
-rw-r--r--TAO/TAO_IDL/ast/ast_sequence.cpp24
-rw-r--r--TAO/TAO_IDL/ast/ast_string.cpp50
-rw-r--r--TAO/TAO_IDL/ast/ast_structure.cpp67
-rw-r--r--TAO/TAO_IDL/ast/ast_structure_fwd.cpp76
-rw-r--r--TAO/TAO_IDL/ast/ast_type.cpp380
-rw-r--r--TAO/TAO_IDL/ast/ast_typedef.cpp40
-rw-r--r--TAO/TAO_IDL/ast/ast_union.cpp86
-rw-r--r--TAO/TAO_IDL/ast/ast_union_branch.cpp9
-rw-r--r--TAO/TAO_IDL/ast/ast_union_fwd.cpp76
-rw-r--r--TAO/TAO_IDL/ast/ast_union_label.cpp11
-rw-r--r--TAO/TAO_IDL/ast/ast_valuetype.cpp241
-rw-r--r--TAO/TAO_IDL/ast/ast_valuetype_fwd.cpp61
-rw-r--r--TAO/TAO_IDL/ast/ast_visitor.cpp6
-rw-r--r--TAO/TAO_IDL/be/Makefile.am8
-rw-r--r--TAO/TAO_IDL/be/be_argument.cpp9
-rw-r--r--TAO/TAO_IDL/be/be_array.cpp143
-rw-r--r--TAO/TAO_IDL/be/be_attribute.cpp9
-rw-r--r--TAO/TAO_IDL/be/be_codegen.cpp80
-rw-r--r--TAO/TAO_IDL/be/be_component.cpp91
-rw-r--r--TAO/TAO_IDL/be/be_component_fwd.cpp64
-rw-r--r--TAO/TAO_IDL/be/be_constant.cpp65
-rw-r--r--TAO/TAO_IDL/be/be_decl.cpp219
-rw-r--r--TAO/TAO_IDL/be/be_enum.cpp19
-rw-r--r--TAO/TAO_IDL/be/be_enum_val.cpp19
-rw-r--r--TAO/TAO_IDL/be/be_exception.cpp13
-rw-r--r--TAO/TAO_IDL/be/be_expression.cpp9
-rw-r--r--TAO/TAO_IDL/be/be_factory.cpp9
-rw-r--r--TAO/TAO_IDL/be/be_field.cpp34
-rw-r--r--TAO/TAO_IDL/be/be_generator.cpp213
-rw-r--r--TAO/TAO_IDL/be/be_global.cpp172
-rw-r--r--TAO/TAO_IDL/be/be_helper.cpp14
-rw-r--r--TAO/TAO_IDL/be/be_home.cpp93
-rw-r--r--TAO/TAO_IDL/be/be_interface.cpp527
-rw-r--r--TAO/TAO_IDL/be/be_interface_fwd.cpp17
-rw-r--r--TAO/TAO_IDL/be/be_interface_strategy.cpp297
-rw-r--r--TAO/TAO_IDL/be/be_module.cpp17
-rw-r--r--TAO/TAO_IDL/be/be_native.cpp9
-rw-r--r--TAO/TAO_IDL/be/be_operation.cpp79
-rw-r--r--TAO/TAO_IDL/be/be_operation_strategy.cpp16
-rw-r--r--TAO/TAO_IDL/be/be_predefined_type.cpp136
-rw-r--r--TAO/TAO_IDL/be/be_produce.cpp283
-rw-r--r--TAO/TAO_IDL/be/be_root.cpp15
-rw-r--r--TAO/TAO_IDL/be/be_scope.cpp42
-rw-r--r--TAO/TAO_IDL/be/be_sequence.cpp108
-rw-r--r--TAO/TAO_IDL/be/be_stream_factory.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_string.cpp55
-rw-r--r--TAO/TAO_IDL/be/be_structure.cpp72
-rw-r--r--TAO/TAO_IDL/be/be_structure_fwd.cpp60
-rw-r--r--TAO/TAO_IDL/be/be_sunsoft.cpp14
-rw-r--r--TAO/TAO_IDL/be/be_tmplinst.cpp18
-rw-r--r--TAO/TAO_IDL/be/be_type.cpp313
-rw-r--r--TAO/TAO_IDL/be/be_typedef.cpp32
-rw-r--r--TAO/TAO_IDL/be/be_union.cpp66
-rw-r--r--TAO/TAO_IDL/be/be_union_branch.cpp39
-rw-r--r--TAO/TAO_IDL/be/be_union_fwd.cpp60
-rw-r--r--TAO/TAO_IDL/be/be_union_label.cpp15
-rw-r--r--TAO/TAO_IDL/be/be_valuetype.cpp831
-rw-r--r--TAO/TAO_IDL/be/be_valuetype_fwd.cpp29
-rw-r--r--TAO/TAO_IDL/be/be_visitor.cpp35
-rw-r--r--TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp87
-rw-r--r--TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp250
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument.cpp26
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp50
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/argument.cpp38
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/invoke_cs.cpp98
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/marshal_ss.cpp103
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/paramlist.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/post_invoke_cs.cpp59
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/post_marshal_ss.cpp163
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/post_upcall_ss.cpp27
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/pre_invoke_cs.cpp13
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/request_info_arglist.cpp28
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/request_info_ch.cpp62
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/request_info_cs.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/request_info_result.cpp126
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/request_info_sh.cpp73
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/request_info_ss.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/upcall_ss.cpp385
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/vardecl_ss.cpp263
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array.cpp25
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/any_op_ch.cpp10
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/any_op_cs.cpp9
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/array.cpp133
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp58
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp461
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/array_cs.cpp77
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/cdr_op_ch.cpp15
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp108
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/cdr_op_cs.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_visitor_attribute.cpp15
-rw-r--r--TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp448
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component.cpp27
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component_fwd.cpp27
-rw-r--r--TAO/TAO_IDL/be/be_visitor_constant.cpp14
-rw-r--r--TAO/TAO_IDL/be/be_visitor_constant/constant_ch.cpp77
-rw-r--r--TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp63
-rw-r--r--TAO/TAO_IDL/be/be_visitor_context.cpp339
-rw-r--r--TAO/TAO_IDL/be/be_visitor_decl.cpp53
-rw-r--r--TAO/TAO_IDL/be/be_visitor_enum.cpp13
-rw-r--r--TAO/TAO_IDL/be/be_visitor_enum/any_op_ch.cpp18
-rw-r--r--TAO/TAO_IDL/be/be_visitor_enum/any_op_cs.cpp14
-rw-r--r--TAO/TAO_IDL/be/be_visitor_enum/cdr_op_ch.cpp21
-rw-r--r--TAO/TAO_IDL/be/be_visitor_enum/cdr_op_ci.cpp11
-rw-r--r--TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp94
-rw-r--r--TAO/TAO_IDL/be/be_visitor_enum/enum_cs.cpp24
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception.cpp26
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/any_op_ch.cpp10
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ch.cpp33
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ci.cpp108
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/cdr_op_cs.cpp33
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/ctor_assign.cpp151
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/exception.cpp96
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp169
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/exception_ci.cpp19
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp544
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/exception_ctor.cpp280
-rw-r--r--TAO/TAO_IDL/be/be_visitor_factory.cpp820
-rw-r--r--TAO/TAO_IDL/be/be_visitor_field.cpp28
-rw-r--r--TAO/TAO_IDL/be/be_visitor_field/cdr_op_ch.cpp175
-rw-r--r--TAO/TAO_IDL/be/be_visitor_field/cdr_op_ci.cpp270
-rw-r--r--TAO/TAO_IDL/be/be_visitor_field/cdr_op_cs.cpp193
-rw-r--r--TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp174
-rw-r--r--TAO/TAO_IDL/be/be_visitor_field/field_ci.cpp181
-rw-r--r--TAO/TAO_IDL/be/be_visitor_field/field_cs.cpp205
-rw-r--r--TAO/TAO_IDL/be/be_visitor_home.cpp27
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface.cpp43
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/amh_ch.cpp24
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/amh_rh_sh.cpp21
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/amh_rh_ss.cpp25
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp25
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp17
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/ami_interface_ch.cpp18
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/any_op_ch.cpp13
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp240
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/base_proxy_broker_ch.cpp27
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/base_proxy_impl_ch.cpp117
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ch.cpp39
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ci.cpp24
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp84
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp97
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_ss.cpp101
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interceptors_ch.cpp48
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interceptors_cs.cpp99
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interceptors_sh.cpp20
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interceptors_ss.cpp93
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface.cpp1097
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp651
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp46
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp814
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_ih.cpp84
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_is.cpp94
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp185
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp47
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp246
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/proxy_brokers_ch.cpp36
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/proxy_impls_ch.cpp42
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_broker_ch.cpp33
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_broker_cs.cpp30
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_impl_ch.cpp105
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_impl_cs.cpp109
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_ch.cpp67
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_cs.cpp20
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_sh.cpp54
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp105
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_sh.cpp126
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_ss.cpp100
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/tie_sh.cpp57
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/tie_si.cpp101
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface_fwd.cpp13
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface_fwd/any_op_ch.cpp11
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface_fwd/cdr_op_ch.cpp17
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface_fwd/cdr_op_ci.cpp11
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface_fwd/interface_fwd_ch.cpp20
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface_fwd/interface_fwd_ci.cpp15
-rw-r--r--TAO/TAO_IDL/be/be_visitor_module.cpp37
-rw-r--r--TAO/TAO_IDL/be/be_visitor_module/any_op.cpp16
-rw-r--r--TAO/TAO_IDL/be/be_visitor_module/cdr_op.cpp16
-rw-r--r--TAO/TAO_IDL/be/be_visitor_module/module.cpp1065
-rw-r--r--TAO/TAO_IDL/be/be_visitor_module/module_ch.cpp27
-rw-r--r--TAO/TAO_IDL/be/be_visitor_module/module_ih.cpp20
-rw-r--r--TAO/TAO_IDL/be/be_visitor_module/module_sh.cpp25
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation.cpp40
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/amh_rh_sh.cpp31
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp10
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp15
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp10
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/ami_ch.cpp33
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp226
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/ami_exception_holder_operation_cs.cpp13
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_ch.cpp31
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_cs.cpp230
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp15
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/argument.cpp131
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/argument_invoke.cpp59
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/argument_marshal.cpp99
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/base_proxy_impl_ch.cpp64
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp92
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/interceptors_arglist.cpp140
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp17
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp173
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp11
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/interceptors_info_rettype.cpp192
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/interceptors_result.cpp40
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp31
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/interceptors_ss.cpp208
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/inv_arglist.cpp103
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation.cpp964
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp51
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp196
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_ih.cpp51
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_is.cpp113
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_sh.cpp82
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp151
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp58
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp925
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp17
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/rettype_assign_ss.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/rettype_is.cpp75
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/rettype_marshal_ss.cpp30
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/rettype_post_invoke_cs.cpp30
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/rettype_post_upcall_ss.cpp24
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/rettype_pre_invoke_cs.cpp88
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/rettype_return_cs.cpp68
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_cs.cpp173
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_ss.cpp22
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_ch.cpp70
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_cs.cpp83
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/thru_poa_proxy_impl_ss.cpp210
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/tie_sh.cpp62
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/tie_si.cpp68
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root.cpp39
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/any_op.cpp16
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/cdr_op.cpp18
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root.cpp1561
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp19
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_ci.cpp19
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_cs.cpp14
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_ih.cpp13
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_is.cpp20
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_sh.cpp11
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_si.cpp14
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_ss.cpp14
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_sth.cpp14
-rw-r--r--TAO/TAO_IDL/be/be_visitor_scope.cpp11
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence.cpp30
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/any_op_ch.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp10
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp83
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp27
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ci.cpp26
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp292
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp123
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ch.cpp85
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ci.cpp171
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_cs.cpp73
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_sequence_ch.cpp53
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_sequence_ci.cpp148
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_sequence_cs.cpp80
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_str_sequence_ch.cpp66
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_str_sequence_ci.cpp50
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_str_sequence_cs.cpp50
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_wstr_sequence_ch.cpp59
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_wstr_sequence_ci.cpp50
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_wstr_sequence_cs.cpp44
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ch.cpp90
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ci.cpp161
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_cs.cpp118
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_ch.cpp56
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_ci.cpp184
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_cs.cpp93
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/sequence_base.cpp34
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp138
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp100
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp216
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure.cpp15
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/any_op_ch.cpp10
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp10
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ch.cpp35
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ci.cpp118
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/cdr_op_cs.cpp33
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/structure.cpp95
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/structure_ch.cpp47
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/structure_ci.cpp26
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/structure_cs.cpp19
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure_fwd.cpp31
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure_fwd/structure_fwd_ch.cpp53
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode.cpp29
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp14
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp93
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typedef.cpp27
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typedef/any_op_ch.cpp16
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typedef/any_op_cs.cpp16
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typedef/cdr_op_ch.cpp18
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typedef/cdr_op_ci.cpp22
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typedef/cdr_op_cs.cpp118
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typedef/typedef.cpp557
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typedef/typedef_ch.cpp61
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typedef/typedef_ci.cpp72
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typedef/typedef_cs.cpp70
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union.cpp21
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/any_op_ch.cpp15
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp26
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/cdr_op_ch.cpp35
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/cdr_op_ci.cpp96
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/cdr_op_cs.cpp32
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/discriminant_ch.cpp41
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/discriminant_ci.cpp103
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/discriminant_cs.cpp57
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/union.cpp122
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp304
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/union_ci.cpp77
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp441
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch.cpp31
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ch.cpp193
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ci.cpp172
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_cs.cpp201
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp144
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/public_access_cs.cpp446
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp217
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/public_ch.cpp207
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp643
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/public_cs.cpp186
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/public_reset_cs.cpp262
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_fwd.cpp31
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_fwd/union_fwd_ch.cpp53
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype.cpp53
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_ch.cpp54
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_cs.cpp62
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/any_op_ch.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/any_op_cs.cpp111
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp150
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp48
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ci.cpp53
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_cs.cpp112
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_ch.cpp203
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_ci.cpp662
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/field_ch.cpp295
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/field_ci.cpp250
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp1194
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/marshal_ch.cpp11
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp64
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/obv_module.cpp97
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp776
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp428
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp112
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp367
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init.cpp10
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp60
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp101
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ci.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_cs.cpp85
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp57
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ci.cpp17
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp67
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_sh.cpp135
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_si.cpp44
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ss.cpp203
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype_fwd.cpp16
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ch.cpp24
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ci.cpp20
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ch.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ci.cpp10
-rw-r--r--TAO/TAO_IDL/be_include/Makefile.am8
-rw-r--r--TAO/TAO_IDL/be_include/be.h148
-rw-r--r--TAO/TAO_IDL/be_include/be_array.h14
-rw-r--r--TAO/TAO_IDL/be_include/be_codegen.h22
-rw-r--r--TAO/TAO_IDL/be_include/be_component.h59
-rw-r--r--TAO/TAO_IDL/be_include/be_component_fwd.h54
-rw-r--r--TAO/TAO_IDL/be_include/be_constant.h7
-rw-r--r--TAO/TAO_IDL/be_include/be_decl.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_enum_val.h8
-rw-r--r--TAO/TAO_IDL/be_include/be_extern.h9
-rw-r--r--TAO/TAO_IDL/be_include/be_field.h4
-rw-r--r--TAO/TAO_IDL/be_include/be_generator.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_global.h217
-rw-r--r--TAO/TAO_IDL/be_include/be_helper.h16
-rw-r--r--TAO/TAO_IDL/be_include/be_home.h61
-rw-r--r--TAO/TAO_IDL/be_include/be_interface.h57
-rw-r--r--TAO/TAO_IDL/be_include/be_interface_fwd.h8
-rw-r--r--TAO/TAO_IDL/be_include/be_interface_strategy.h5
-rw-r--r--TAO/TAO_IDL/be_include/be_module.h4
-rw-r--r--TAO/TAO_IDL/be_include/be_native.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_operation.h12
-rw-r--r--TAO/TAO_IDL/be_include/be_operation_strategy.h78
-rw-r--r--TAO/TAO_IDL/be_include/be_predefined_type.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_sequence.h4
-rw-r--r--TAO/TAO_IDL/be_include/be_string.h12
-rw-r--r--TAO/TAO_IDL/be_include/be_structure.h4
-rw-r--r--TAO/TAO_IDL/be_include/be_structure_fwd.h58
-rw-r--r--TAO/TAO_IDL/be_include/be_type.h15
-rw-r--r--TAO/TAO_IDL/be_include/be_typedef.h5
-rw-r--r--TAO/TAO_IDL/be_include/be_union.h12
-rw-r--r--TAO/TAO_IDL/be_include/be_union_branch.h8
-rw-r--r--TAO/TAO_IDL/be_include/be_union_fwd.h58
-rw-r--r--TAO/TAO_IDL/be_include/be_valuetype.h73
-rw-r--r--TAO/TAO_IDL/be_include/be_valuetype_fwd.h11
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor.h20
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_amh_pre_proc.h11
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_ami_pre_proc.h13
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_argument.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_argument/argument.h5
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_argument/marshal_ss.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_argument/post_marshal_ss.h29
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_argument/upcall_ss.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_argument/vardecl_ss.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_array.h4
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_array/array.h7
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_array/array_cs.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_ch.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_ci.h8
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_cs.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_attribute.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_attribute/attribute.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component.h27
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component_fwd.h27
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_constant.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_constant/constant_ch.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_context.h30
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_enum.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_enum/cdr_op_ch.h2
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_enum/cdr_op_ci.h2
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_enum/enum_cs.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_exception.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_exception/ctor.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_exception/ctor_assign.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_factory.h67
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_field.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_ch.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_ci.h12
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_cs.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_field/field_ch.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_field/field_ci.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_field/field_cs.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_home.h27
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface.h9
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/base_proxy_impl_ch.h5
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/cdr_op_ch.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/cdr_op_ci.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/cdr_op_cs.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/direct_proxy_impl_sh.h5
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/direct_proxy_impl_ss.h5
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/interceptors_ch.h43
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/interceptors_cs.h5
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/interceptors_ss.h5
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/interface.h16
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/interface_ch.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/interface_ci.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/interface_cs.h14
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/interface_ih.h4
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/interface_is.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/interface_sh.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/interface_ss.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_impl_ch.h5
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_impl_cs.h5
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/thru_poa_proxy_impl_sh.h5
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/thru_poa_proxy_impl_ss.h5
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface_fwd.h5
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface_fwd/cdr_op_ch.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface_fwd/cdr_op_ci.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface_fwd/interface_fwd_ch.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface_fwd/interface_fwd_ci.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_module.h4
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_module/module.h9
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_module/module_ch.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_module/module_ih.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_module/module_sh.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation.h4
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/ami_cs.h59
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_reply_stub_operation_cs.h61
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/arglist.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/argument_invoke.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/argument_marshal.h10
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/direct_proxy_impl_ss.h5
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/inv_arglist.h55
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/operation.h34
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/operation_ch.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/operation_cs.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/operation_ih.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/operation_is.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/operation_sh.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/remote_proxy_impl_cs.h19
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/smart_proxy_cs.h5
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/thru_poa_proxy_impl_ss.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_root.h2
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_root/root.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_root/root_ih.h2
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_scope.h2
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_sequence.h5
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_sequence/buffer_type.h2
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_sequence/cdr_op_ch.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_sequence/elemtype.h2
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_base.h2
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_structure.h9
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_structure/cdr_op_ch.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_structure/cdr_op_ci.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_structure/structure_ch.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_structure/structure_ci.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_structure/structure_cs.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_structure_fwd.h28
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_structure_fwd/structure_fwd_ch.h42
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typecode.h4
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typedef.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typedef/cdr_op_ch.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typedef/cdr_op_ci.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typedef/cdr_op_cs.h4
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typedef/typedef.h7
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_ch.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_ci.h2
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_cs.h2
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch.h4
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/cdr_op_ci.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/private_ch.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/public_access_cs.h80
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/public_assign_cs.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/public_ch.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/public_ci.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/public_cs.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/public_reset_cs.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_fwd.h28
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_fwd/union_fwd_ch.h42
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/arglist.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype.h9
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_ch.h10
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_sh.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_si.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_ss.h51
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd.h4
-rw-r--r--TAO/TAO_IDL/driver/Makefile.am5
-rw-r--r--TAO/TAO_IDL/driver/drv_args.cpp319
-rw-r--r--TAO/TAO_IDL/driver/drv_preproc.cpp452
-rw-r--r--TAO/TAO_IDL/driver/drv_private.cpp83
-rw-r--r--TAO/TAO_IDL/fe/Makefile.am1
-rw-r--r--TAO/TAO_IDL/fe/fe_declarator.cpp49
-rw-r--r--TAO/TAO_IDL/fe/fe_extern.cpp29
-rw-r--r--TAO/TAO_IDL/fe/fe_global.cpp9
-rw-r--r--TAO/TAO_IDL/fe/fe_init.cpp252
-rw-r--r--TAO/TAO_IDL/fe/fe_interface_header.cpp861
-rw-r--r--TAO/TAO_IDL/fe/fe_lookup.cpp8
-rw-r--r--TAO/TAO_IDL/fe/fe_private.cpp22
-rw-r--r--TAO/TAO_IDL/fe/fe_tmplinst.cpp100
-rw-r--r--TAO/TAO_IDL/fe/idl.ll67
-rw-r--r--TAO/TAO_IDL/fe/idl.yy3456
-rw-r--r--TAO/TAO_IDL/fe/lex.yy.cpp2784
-rw-r--r--TAO/TAO_IDL/fe/lex.yy.cpp.diff56
-rw-r--r--TAO/TAO_IDL/fe/y.tab.cpp5206
-rw-r--r--TAO/TAO_IDL/fe/y.tab.cpp.diff20
-rw-r--r--TAO/TAO_IDL/fe/y.tab.h105
-rw-r--r--TAO/TAO_IDL/include/Makefile.am7
-rw-r--r--TAO/TAO_IDL/include/ast.h1
-rw-r--r--TAO/TAO_IDL/include/ast_argument.h2
-rw-r--r--TAO/TAO_IDL/include/ast_array.h13
-rw-r--r--TAO/TAO_IDL/include/ast_attribute.h6
-rw-r--r--TAO/TAO_IDL/include/ast_component.h87
-rw-r--r--TAO/TAO_IDL/include/ast_component_fwd.h35
-rw-r--r--TAO/TAO_IDL/include/ast_concrete_type.h2
-rw-r--r--TAO/TAO_IDL/include/ast_constant.h24
-rw-r--r--TAO/TAO_IDL/include/ast_decl.h68
-rw-r--r--TAO/TAO_IDL/include/ast_enum.h22
-rw-r--r--TAO/TAO_IDL/include/ast_enum_val.h2
-rw-r--r--TAO/TAO_IDL/include/ast_exception.h5
-rw-r--r--TAO/TAO_IDL/include/ast_expression.h49
-rw-r--r--TAO/TAO_IDL/include/ast_extern.h26
-rw-r--r--TAO/TAO_IDL/include/ast_factory.h5
-rw-r--r--TAO/TAO_IDL/include/ast_field.h6
-rw-r--r--TAO/TAO_IDL/include/ast_generator.h161
-rw-r--r--TAO/TAO_IDL/include/ast_home.h64
-rw-r--r--TAO/TAO_IDL/include/ast_interface.h90
-rw-r--r--TAO/TAO_IDL/include/ast_interface_fwd.h17
-rw-r--r--TAO/TAO_IDL/include/ast_module.h19
-rw-r--r--TAO/TAO_IDL/include/ast_native.h2
-rw-r--r--TAO/TAO_IDL/include/ast_operation.h14
-rw-r--r--TAO/TAO_IDL/include/ast_predefined_type.h17
-rw-r--r--TAO/TAO_IDL/include/ast_root.h8
-rw-r--r--TAO/TAO_IDL/include/ast_sequence.h12
-rw-r--r--TAO/TAO_IDL/include/ast_string.h16
-rw-r--r--TAO/TAO_IDL/include/ast_structure.h15
-rw-r--r--TAO/TAO_IDL/include/ast_structure_fwd.h45
-rw-r--r--TAO/TAO_IDL/include/ast_type.h58
-rw-r--r--TAO/TAO_IDL/include/ast_typedef.h9
-rw-r--r--TAO/TAO_IDL/include/ast_union.h10
-rw-r--r--TAO/TAO_IDL/include/ast_union_branch.h7
-rw-r--r--TAO/TAO_IDL/include/ast_union_fwd.h45
-rw-r--r--TAO/TAO_IDL/include/ast_union_label.h14
-rw-r--r--TAO/TAO_IDL/include/ast_valuetype.h66
-rw-r--r--TAO/TAO_IDL/include/ast_valuetype_fwd.h35
-rw-r--r--TAO/TAO_IDL/include/ast_visitor.h31
-rw-r--r--TAO/TAO_IDL/include/drv_extern.h13
-rw-r--r--TAO/TAO_IDL/include/drv_private.h92
-rw-r--r--TAO/TAO_IDL/include/fe_declarator.h8
-rw-r--r--TAO/TAO_IDL/include/fe_extern.h33
-rw-r--r--TAO/TAO_IDL/include/fe_interface_header.h193
-rw-r--r--TAO/TAO_IDL/include/fe_private.h16
-rw-r--r--TAO/TAO_IDL/include/global_extern.h6
-rw-r--r--TAO/TAO_IDL/include/idl.h97
-rw-r--r--TAO/TAO_IDL/include/idl_bool.h12
-rw-r--r--TAO/TAO_IDL/include/idl_defines.h3
-rw-r--r--TAO/TAO_IDL/include/idl_extern.h79
-rw-r--r--TAO/TAO_IDL/include/idl_fwd.h148
-rw-r--r--TAO/TAO_IDL/include/idl_global.h81
-rw-r--r--TAO/TAO_IDL/include/nr_extern.h3
-rw-r--r--TAO/TAO_IDL/include/util.h84
-rw-r--r--TAO/TAO_IDL/include/utl_decllist.h25
-rw-r--r--TAO/TAO_IDL/include/utl_err.h73
-rw-r--r--TAO/TAO_IDL/include/utl_exceptlist.h35
-rw-r--r--TAO/TAO_IDL/include/utl_exprlist.h41
-rw-r--r--TAO/TAO_IDL/include/utl_identifier.h21
-rw-r--r--TAO/TAO_IDL/include/utl_idlist.h46
-rw-r--r--TAO/TAO_IDL/include/utl_indenter.h42
-rw-r--r--TAO/TAO_IDL/include/utl_labellist.h40
-rw-r--r--TAO/TAO_IDL/include/utl_list.h61
-rw-r--r--TAO/TAO_IDL/include/utl_namelist.h39
-rw-r--r--TAO/TAO_IDL/include/utl_scope.h112
-rw-r--r--TAO/TAO_IDL/include/utl_scoped_name.h13
-rw-r--r--TAO/TAO_IDL/include/utl_stack.h96
-rw-r--r--TAO/TAO_IDL/include/utl_string.h30
-rw-r--r--TAO/TAO_IDL/include/utl_strlist.h47
-rw-r--r--TAO/TAO_IDL/narrow/narrow.cpp39
-rw-r--r--TAO/TAO_IDL/tao_idl.bor2
-rw-r--r--TAO/TAO_IDL/tao_idl.cpp196
-rw-r--r--TAO/TAO_IDL/tao_idl.dsp12
-rw-r--r--TAO/TAO_IDL/tao_idl_static.dsp16
-rw-r--r--TAO/TAO_IDL/util/utl_decllist.cpp40
-rw-r--r--TAO/TAO_IDL/util/utl_err.cpp416
-rw-r--r--TAO/TAO_IDL/util/utl_exceptlist.cpp72
-rw-r--r--TAO/TAO_IDL/util/utl_exprlist.cpp76
-rw-r--r--TAO/TAO_IDL/util/utl_global.cpp216
-rw-r--r--TAO/TAO_IDL/util/utl_identifier.cpp44
-rw-r--r--TAO/TAO_IDL/util/utl_idlist.cpp88
-rw-r--r--TAO/TAO_IDL/util/utl_indenter.cpp61
-rw-r--r--TAO/TAO_IDL/util/utl_labellist.cpp79
-rw-r--r--TAO/TAO_IDL/util/utl_list.cpp119
-rw-r--r--TAO/TAO_IDL/util/utl_namelist.cpp82
-rw-r--r--TAO/TAO_IDL/util/utl_scope.cpp352
-rw-r--r--TAO/TAO_IDL/util/utl_stack.cpp159
-rw-r--r--TAO/TAO_IDL/util/utl_string.cpp34
-rw-r--r--TAO/TAO_IDL/util/utl_strlist.cpp154
-rw-r--r--TAO/TAO_IDL/util/utl_tmpl/utl_idlist.cpp61
-rw-r--r--TAO/TAO_IDL/util/utl_tmpl/utl_strlist.cpp51
679 files changed, 39575 insertions, 27858 deletions
diff --git a/TAO/TAO_IDL/Makefile.BE b/TAO/TAO_IDL/Makefile.BE
index 20df0382345..1b88785ead1 100644
--- a/TAO/TAO_IDL/Makefile.BE
+++ b/TAO/TAO_IDL/Makefile.BE
@@ -26,6 +26,8 @@ SHLIB = $(LIBNAME).$(SOEXT)
FILES = be/be_array \
be/be_argument \
be/be_attribute \
+ be/be_component \
+ be/be_component_fwd \
be/be_constant \
be/be_enum \
be/be_enum_val \
@@ -34,6 +36,7 @@ FILES = be/be_array \
be/be_factory \
be/be_field \
be/be_global \
+ be/be_home \
be/be_interface \
be/be_interface_strategy \
be/be_interface_fwd \
@@ -48,9 +51,11 @@ FILES = be/be_array \
be/be_sequence \
be/be_string \
be/be_structure \
+ be/be_structure_fwd \
be/be_type \
be/be_typedef \
be/be_union \
+ be/be_union_fwd \
be/be_union_branch \
be/be_union_label \
be/be_generator \
@@ -68,12 +73,15 @@ FILES = be/be_array \
be/be_visitor_argument \
be/be_visitor_array \
be/be_visitor_attribute \
+ be/be_visitor_component \
+ be/be_visitor_component_fwd \
be/be_visitor_constant \
be/be_visitor_context \
be/be_visitor_decl \
be/be_visitor_enum \
be/be_visitor_exception \
be/be_visitor_field \
+ be/be_visitor_home \
be/be_visitor_interface \
be/be_visitor_interface_fwd \
be/be_visitor_valuetype \
@@ -84,9 +92,11 @@ FILES = be/be_array \
be/be_visitor_scope \
be/be_visitor_sequence \
be/be_visitor_structure \
+ be/be_visitor_structure_fwd \
be/be_visitor_typecode \
be/be_visitor_typedef \
be/be_visitor_union \
+ be/be_visitor_union_fwd \
be/be_visitor_union_branch \
be/be_tmplinst
diff --git a/TAO/TAO_IDL/Makefile.EXE b/TAO/TAO_IDL/Makefile.EXE
index 071f1360aac..6ebf6142df6 100644
--- a/TAO/TAO_IDL/Makefile.EXE
+++ b/TAO/TAO_IDL/Makefile.EXE
@@ -21,8 +21,6 @@ VPATH = .:driver
MAKEFILE=Makefile.EXE
FILES = tao_idl \
- driver/drv_init \
- driver/drv_private \
driver/drv_args \
driver/drv_preproc
diff --git a/TAO/TAO_IDL/Makefile.FE b/TAO/TAO_IDL/Makefile.FE
index a0baca95d31..0efc13599a9 100644
--- a/TAO/TAO_IDL/Makefile.FE
+++ b/TAO/TAO_IDL/Makefile.FE
@@ -34,6 +34,8 @@ FILES = fe/fe_declarator \
ast/ast_argument \
ast/ast_attribute \
ast/ast_check \
+ ast/ast_component \
+ ast/ast_component_fwd \
ast/ast_concrete_type \
ast/ast_constant \
ast/ast_decl \
@@ -43,6 +45,7 @@ FILES = fe/fe_declarator \
ast/ast_expression \
ast/ast_factory \
ast/ast_field \
+ ast/ast_home \
ast/ast_interface \
ast/ast_interface_fwd \
ast/ast_module \
@@ -53,11 +56,15 @@ FILES = fe/fe_declarator \
ast/ast_sequence \
ast/ast_string \
ast/ast_structure \
+ ast/ast_structure_fwd \
ast/ast_type \
ast/ast_typedef \
ast/ast_union \
+ ast/ast_union_fwd \
ast/ast_union_branch \
ast/ast_union_label \
+ ast/ast_valuetype \
+ ast/ast_valuetype_fwd \
ast/ast_generator \
ast/ast_redef \
ast/ast_recursive \
diff --git a/TAO/TAO_IDL/TAO_IDL_BE.bor b/TAO/TAO_IDL/TAO_IDL_BE.bor
index 84cedba6b5c..39ff741cbc5 100644
--- a/TAO/TAO_IDL/TAO_IDL_BE.bor
+++ b/TAO/TAO_IDL/TAO_IDL_BE.bor
@@ -9,6 +9,8 @@ OBJFILES = \
$(OBJDIR)\be_array.obj \
$(OBJDIR)\be_attribute.obj \
$(OBJDIR)\be_codegen.obj \
+ $(OBJDIR)\be_component.obj \
+ $(OBJDIR)\be_component_fwd.obj \
$(OBJDIR)\be_constant.obj \
$(OBJDIR)\be_decl.obj \
$(OBJDIR)\be_enum.obj \
@@ -20,6 +22,7 @@ OBJFILES = \
$(OBJDIR)\be_generator.obj \
$(OBJDIR)\be_global.obj \
$(OBJDIR)\be_helper.obj \
+ $(OBJDIR)\be_home.obj \
$(OBJDIR)\be_interface.obj \
$(OBJDIR)\be_interface_fwd.obj \
$(OBJDIR)\be_interface_strategy.obj \
@@ -35,10 +38,12 @@ OBJFILES = \
$(OBJDIR)\be_stream_factory.obj \
$(OBJDIR)\be_string.obj \
$(OBJDIR)\be_structure.obj \
+ $(OBJDIR)\be_structure_fwd.obj \
$(OBJDIR)\be_sunsoft.obj \
$(OBJDIR)\be_type.obj \
$(OBJDIR)\be_typedef.obj \
$(OBJDIR)\be_union.obj \
+ $(OBJDIR)\be_union_fwd.obj \
$(OBJDIR)\be_union_branch.obj \
$(OBJDIR)\be_union_label.obj \
$(OBJDIR)\be_valuetype.obj \
@@ -49,6 +54,8 @@ OBJFILES = \
$(OBJDIR)\be_visitor_argument.obj \
$(OBJDIR)\be_visitor_array.obj \
$(OBJDIR)\be_visitor_attribute.obj \
+ $(OBJDIR)\be_visitor_component.obj \
+ $(OBJDIR)\be_visitor_component_fwd.obj \
$(OBJDIR)\be_visitor_constant.obj \
$(OBJDIR)\be_visitor_context.obj \
$(OBJDIR)\be_visitor_decl.obj \
@@ -56,6 +63,7 @@ OBJFILES = \
$(OBJDIR)\be_visitor_exception.obj \
$(OBJDIR)\be_visitor_factory.obj \
$(OBJDIR)\be_visitor_field.obj \
+ $(OBJDIR)\be_visitor_home.obj \
$(OBJDIR)\be_visitor_interface.obj \
$(OBJDIR)\be_visitor_interface_fwd.obj \
$(OBJDIR)\be_visitor_module.obj \
@@ -64,9 +72,11 @@ OBJFILES = \
$(OBJDIR)\be_visitor_scope.obj \
$(OBJDIR)\be_visitor_sequence.obj \
$(OBJDIR)\be_visitor_structure.obj \
+ $(OBJDIR)\be_visitor_structure_fwd.obj \
$(OBJDIR)\be_visitor_typecode.obj \
$(OBJDIR)\be_visitor_typedef.obj \
$(OBJDIR)\be_visitor_union.obj \
+ $(OBJDIR)\be_visitor_union_fwd.obj \
$(OBJDIR)\be_visitor_union_branch.obj \
$(OBJDIR)\be_visitor_valuetype.obj \
$(OBJDIR)\be_visitor_valuetype_fwd.obj
diff --git a/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp b/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp
index 4fc9f86597c..c6c71116985 100644
--- a/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp
+++ b/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp
@@ -118,6 +118,14 @@ SOURCE=.\be\be_codegen.cpp
# End Source File
# Begin Source File
+SOURCE=.\be\be_component.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\be\be_component_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_constant.cpp
# End Source File
# Begin Source File
@@ -162,6 +170,10 @@ SOURCE=.\be\be_helper.cpp
# End Source File
# Begin Source File
+SOURCE=.\be\be_home.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_interface.cpp
# End Source File
# Begin Source File
@@ -222,6 +234,10 @@ SOURCE=.\be\be_structure.cpp
# End Source File
# Begin Source File
+SOURCE=.\be\be_structure_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_sunsoft.cpp
# End Source File
# Begin Source File
@@ -246,6 +262,10 @@ SOURCE=.\be\be_union_branch.cpp
# End Source File
# Begin Source File
+SOURCE=.\be\be_union_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_union_label.cpp
# End Source File
# Begin Source File
@@ -282,6 +302,14 @@ SOURCE=.\be\be_visitor_attribute.cpp
# End Source File
# Begin Source File
+SOURCE=.\be\be_visitor_component.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\be\be_visitor_component_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_visitor_constant.cpp
# End Source File
# Begin Source File
@@ -310,6 +338,10 @@ SOURCE=.\be\be_visitor_field.cpp
# End Source File
# Begin Source File
+SOURCE=.\be\be_visitor_home.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_visitor_interface.cpp
# End Source File
# Begin Source File
@@ -342,6 +374,10 @@ SOURCE=.\be\be_visitor_structure.cpp
# End Source File
# Begin Source File
+SOURCE=.\be\be_visitor_structure_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_visitor_typecode.cpp
# End Source File
# Begin Source File
@@ -358,6 +394,10 @@ SOURCE=.\be\be_visitor_union_branch.cpp
# End Source File
# Begin Source File
+SOURCE=.\be\be_visitor_union_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_visitor_valuetype.cpp
# End Source File
# Begin Source File
@@ -370,10 +410,6 @@ SOURCE=.\be\be_visitor_valuetype_fwd.cpp
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
-SOURCE=.\be_include\be.h
-# End Source File
-# Begin Source File
-
SOURCE=.\be_include\be_argument.h
# End Source File
# Begin Source File
@@ -390,6 +426,14 @@ SOURCE=.\be_include\be_codegen.h
# End Source File
# Begin Source File
+SOURCE=.\be_include\be_component.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\be_include\be_component_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_constant.h
# End Source File
# Begin Source File
@@ -414,6 +458,10 @@ SOURCE=.\be_include\be_expression.h
# End Source File
# Begin Source File
+SOURCE=.\be_include\be_extern.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_factory.h
# End Source File
# Begin Source File
@@ -434,6 +482,10 @@ SOURCE=.\be_include\be_helper.h
# End Source File
# Begin Source File
+SOURCE=.\be_include\be_home.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_interface.h
# End Source File
# Begin Source File
@@ -490,6 +542,10 @@ SOURCE=.\be_include\be_structure.h
# End Source File
# Begin Source File
+SOURCE=.\be_include\be_structure_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_sunsoft.h
# End Source File
# Begin Source File
@@ -510,6 +566,10 @@ SOURCE=.\be_include\be_union_branch.h
# End Source File
# Begin Source File
+SOURCE=.\be_include\be_union_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_union_label.h
# End Source File
# Begin Source File
@@ -526,6 +586,10 @@ SOURCE=.\be_include\be_visitor.h
# End Source File
# Begin Source File
+SOURCE=.\be_include\be_visitor_amh_pre_proc.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_visitor_ami_pre_proc.h
# End Source File
# Begin Source File
@@ -542,6 +606,14 @@ SOURCE=.\be_include\be_visitor_attribute.h
# End Source File
# Begin Source File
+SOURCE=.\be_include\be_visitor_component.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\be_include\be_visitor_component_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_visitor_constant.h
# End Source File
# Begin Source File
@@ -570,6 +642,10 @@ SOURCE=.\be_include\be_visitor_field.h
# End Source File
# Begin Source File
+SOURCE=.\be_include\be_visitor_home.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_visitor_interface.h
# End Source File
# Begin Source File
@@ -602,6 +678,10 @@ SOURCE=.\be_include\be_visitor_structure.h
# End Source File
# Begin Source File
+SOURCE=.\be_include\be_visitor_structure_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_visitor_typecode.h
# End Source File
# Begin Source File
@@ -618,6 +698,10 @@ SOURCE=.\be_include\be_visitor_union_branch.h
# End Source File
# Begin Source File
+SOURCE=.\be_include\be_visitor_union_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_visitor_valuetype.h
# End Source File
# Begin Source File
diff --git a/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp b/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp
index 0be11d06abe..05f0996d0a1 100644
--- a/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp
+++ b/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp
@@ -111,6 +111,14 @@ SOURCE=.\be\be_codegen.cpp
# End Source File
# Begin Source File
+SOURCE=.\be\be_component.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\be\be_component_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_constant.cpp
# End Source File
# Begin Source File
@@ -155,6 +163,10 @@ SOURCE=.\be\be_helper.cpp
# End Source File
# Begin Source File
+SOURCE=.\be\be_home.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_interface.cpp
# End Source File
# Begin Source File
@@ -215,6 +227,10 @@ SOURCE=.\be\be_structure.cpp
# End Source File
# Begin Source File
+SOURCE=.\be\be_structure_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_sunsoft.cpp
# End Source File
# Begin Source File
@@ -239,6 +255,10 @@ SOURCE=.\be\be_union_branch.cpp
# End Source File
# Begin Source File
+SOURCE=.\be\be_union_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_union_label.cpp
# End Source File
# Begin Source File
@@ -275,6 +295,14 @@ SOURCE=.\be\be_visitor_attribute.cpp
# End Source File
# Begin Source File
+SOURCE=.\be\be_visitor_component.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\be\be_visitor_component_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_visitor_constant.cpp
# End Source File
# Begin Source File
@@ -303,6 +331,10 @@ SOURCE=.\be\be_visitor_field.cpp
# End Source File
# Begin Source File
+SOURCE=.\be\be_visitor_home.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_visitor_interface.cpp
# End Source File
# Begin Source File
@@ -335,6 +367,10 @@ SOURCE=.\be\be_visitor_structure.cpp
# End Source File
# Begin Source File
+SOURCE=.\be\be_visitor_structure_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_visitor_typecode.cpp
# End Source File
# Begin Source File
@@ -351,6 +387,10 @@ SOURCE=.\be\be_visitor_union_branch.cpp
# End Source File
# Begin Source File
+SOURCE=.\be\be_visitor_union_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_visitor_valuetype.cpp
# End Source File
# Begin Source File
@@ -363,10 +403,6 @@ SOURCE=.\be\be_visitor_valuetype_fwd.cpp
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
-SOURCE=.\be_include\be.h
-# End Source File
-# Begin Source File
-
SOURCE=.\be_include\be_argument.h
# End Source File
# Begin Source File
@@ -383,6 +419,14 @@ SOURCE=.\be_include\be_codegen.h
# End Source File
# Begin Source File
+SOURCE=.\be_include\be_component.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\be_include\be_component_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_constant.h
# End Source File
# Begin Source File
@@ -407,6 +451,10 @@ SOURCE=.\be_include\be_expression.h
# End Source File
# Begin Source File
+SOURCE=.\be_include\be_extern.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_factory.h
# End Source File
# Begin Source File
@@ -427,6 +475,10 @@ SOURCE=.\be_include\be_helper.h
# End Source File
# Begin Source File
+SOURCE=.\be_include\be_home.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_interface.h
# End Source File
# Begin Source File
@@ -483,6 +535,10 @@ SOURCE=.\be_include\be_structure.h
# End Source File
# Begin Source File
+SOURCE=.\be_include\be_structure_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_sunsoft.h
# End Source File
# Begin Source File
@@ -503,6 +559,10 @@ SOURCE=.\be_include\be_union_branch.h
# End Source File
# Begin Source File
+SOURCE=.\be_include\be_union_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_union_label.h
# End Source File
# Begin Source File
@@ -535,6 +595,14 @@ SOURCE=.\be_include\be_visitor_attribute.h
# End Source File
# Begin Source File
+SOURCE=.\be_include\be_visitor_component.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\be_include\be_visitor_component_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_visitor_constant.h
# End Source File
# Begin Source File
@@ -563,6 +631,10 @@ SOURCE=.\be_include\be_visitor_field.h
# End Source File
# Begin Source File
+SOURCE=.\be_include\be_visitor_home.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_visitor_interface.h
# End Source File
# Begin Source File
@@ -595,6 +667,10 @@ SOURCE=.\be_include\be_visitor_structure.h
# End Source File
# Begin Source File
+SOURCE=.\be_include\be_visitor_structure_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_visitor_typecode.h
# End Source File
# Begin Source File
@@ -611,6 +687,10 @@ SOURCE=.\be_include\be_visitor_union_branch.h
# End Source File
# Begin Source File
+SOURCE=.\be_include\be_visitor_union_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_visitor_valuetype.h
# End Source File
# Begin Source File
diff --git a/TAO/TAO_IDL/TAO_IDL_FE.bor b/TAO/TAO_IDL/TAO_IDL_FE.bor
index 485e05d5cce..a5982e45717 100644
--- a/TAO/TAO_IDL/TAO_IDL_FE.bor
+++ b/TAO/TAO_IDL/TAO_IDL_FE.bor
@@ -9,6 +9,8 @@ OBJFILES = \
$(OBJDIR)\ast_array.obj \
$(OBJDIR)\ast_attribute.obj \
$(OBJDIR)\ast_check.obj \
+ $(OBJDIR)\ast_component.obj \
+ $(OBJDIR)\ast_component_fwd.obj \
$(OBJDIR)\ast_concrete_type.obj \
$(OBJDIR)\ast_constant.obj \
$(OBJDIR)\ast_decl.obj \
@@ -19,6 +21,7 @@ OBJFILES = \
$(OBJDIR)\ast_factory.obj \
$(OBJDIR)\ast_field.obj \
$(OBJDIR)\ast_generator.obj \
+ $(OBJDIR)\ast_home.obj \
$(OBJDIR)\ast_interface.obj \
$(OBJDIR)\ast_interface_fwd.obj \
$(OBJDIR)\ast_module.obj \
@@ -31,11 +34,15 @@ OBJFILES = \
$(OBJDIR)\ast_sequence.obj \
$(OBJDIR)\ast_string.obj \
$(OBJDIR)\ast_structure.obj \
+ $(OBJDIR)\ast_structure_fwd.obj \
$(OBJDIR)\ast_type.obj \
$(OBJDIR)\ast_typedef.obj \
$(OBJDIR)\ast_union.obj \
+ $(OBJDIR)\ast_union_fwd.obj \
$(OBJDIR)\ast_union_branch.obj \
$(OBJDIR)\ast_union_label.obj \
+ $(OBJDIR)\ast_valuetype.obj \
+ $(OBJDIR)\ast_valuetype_fwd.obj \
$(OBJDIR)\ast_visitor.obj \
$(OBJDIR)\fe_declarator.obj \
$(OBJDIR)\fe_extern.obj \
diff --git a/TAO/TAO_IDL/TAO_IDL_FE_DLL.dsp b/TAO/TAO_IDL/TAO_IDL_FE_DLL.dsp
index 0db8938c969..d1f06f15c41 100644
--- a/TAO/TAO_IDL/TAO_IDL_FE_DLL.dsp
+++ b/TAO/TAO_IDL/TAO_IDL_FE_DLL.dsp
@@ -118,6 +118,14 @@ SOURCE=.\ast\ast_check.cpp
# End Source File
# Begin Source File
+SOURCE=.\ast\ast_component.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ast\ast_component_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\ast\ast_concrete_type.cpp
# End Source File
# Begin Source File
@@ -158,6 +166,10 @@ SOURCE=.\ast\ast_generator.cpp
# End Source File
# Begin Source File
+SOURCE=.\ast\ast_home.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\ast\ast_interface.cpp
# End Source File
# Begin Source File
@@ -206,6 +218,10 @@ SOURCE=.\ast\ast_structure.cpp
# End Source File
# Begin Source File
+SOURCE=.\ast\ast_structure_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\ast\ast_type.cpp
# End Source File
# Begin Source File
@@ -222,10 +238,22 @@ SOURCE=.\ast\ast_union_branch.cpp
# End Source File
# Begin Source File
+SOURCE=.\ast\ast_union_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\ast\ast_union_label.cpp
# End Source File
# Begin Source File
+SOURCE=.\ast\ast_valuetype.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ast\ast_valuetype_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\ast\ast_visitor.cpp
# End Source File
# Begin Source File
@@ -338,10 +366,6 @@ SOURCE=.\fe\y.tab.cpp
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
-SOURCE=.\include\ast.h
-# End Source File
-# Begin Source File
-
SOURCE=.\include\ast_argument.h
# End Source File
# Begin Source File
@@ -354,6 +378,14 @@ SOURCE=.\include\ast_attribute.h
# End Source File
# Begin Source File
+SOURCE=.\include\ast_component.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\ast_component_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\include\ast_concrete_type.h
# End Source File
# Begin Source File
@@ -398,6 +430,10 @@ SOURCE=.\include\ast_generator.h
# End Source File
# Begin Source File
+SOURCE=.\include\ast_home.h
+# End Source File
+# Begin Source File
+
SOURCE=.\include\ast_interface.h
# End Source File
# Begin Source File
@@ -438,6 +474,10 @@ SOURCE=.\include\ast_structure.h
# End Source File
# Begin Source File
+SOURCE=.\include\ast_structure_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\include\ast_type.h
# End Source File
# Begin Source File
@@ -454,51 +494,51 @@ SOURCE=.\include\ast_union_branch.h
# End Source File
# Begin Source File
-SOURCE=.\include\ast_union_label.h
+SOURCE=.\include\ast_union_fwd.h
# End Source File
# Begin Source File
-SOURCE=.\include\ast_visitor.h
+SOURCE=.\include\ast_union_label.h
# End Source File
# Begin Source File
-SOURCE=.\include\fe_declarator.h
+SOURCE=.\include\ast_valuetype.h
# End Source File
# Begin Source File
-SOURCE=.\include\fe_extern.h
+SOURCE=.\include\ast_valuetype_fwd.h
# End Source File
# Begin Source File
-SOURCE=.\include\fe_interface_header.h
+SOURCE=.\include\ast_visitor.h
# End Source File
# Begin Source File
-SOURCE=.\include\fe_private.h
+SOURCE=.\include\fe_declarator.h
# End Source File
# Begin Source File
-SOURCE=.\include\global_extern.h
+SOURCE=.\include\fe_extern.h
# End Source File
# Begin Source File
-SOURCE=.\include\idl.h
+SOURCE=.\include\fe_interface_header.h
# End Source File
# Begin Source File
-SOURCE=.\include\idl_bool.h
+SOURCE=.\include\fe_private.h
# End Source File
# Begin Source File
-SOURCE=.\include\idl_defines.h
+SOURCE=.\include\global_extern.h
# End Source File
# Begin Source File
-SOURCE=.\include\idl_extern.h
+SOURCE=.\include\idl_bool.h
# End Source File
# Begin Source File
-SOURCE=.\include\idl_fwd.h
+SOURCE=.\include\idl_defines.h
# End Source File
# Begin Source File
@@ -518,10 +558,6 @@ SOURCE=.\TAO_IDL_FE_Export.h
# End Source File
# Begin Source File
-SOURCE=.\include\util.h
-# End Source File
-# Begin Source File
-
SOURCE=.\include\utl_decllist.h
# End Source File
# Begin Source File
@@ -580,6 +616,10 @@ SOURCE=.\include\utl_string.h
SOURCE=.\include\utl_strlist.h
# End Source File
+# Begin Source File
+
+SOURCE=.\fe\y.tab.h
+# End Source File
# End Group
# End Target
# End Project
diff --git a/TAO/TAO_IDL/TAO_IDL_FE_LIB.dsp b/TAO/TAO_IDL/TAO_IDL_FE_LIB.dsp
index 7af58f7dd53..1e4e4e9e7bd 100644
--- a/TAO/TAO_IDL/TAO_IDL_FE_LIB.dsp
+++ b/TAO/TAO_IDL/TAO_IDL_FE_LIB.dsp
@@ -111,6 +111,14 @@ SOURCE=.\ast\ast_check.cpp
# End Source File
# Begin Source File
+SOURCE=.\ast\ast_component.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ast\ast_component_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\ast\ast_concrete_type.cpp
# End Source File
# Begin Source File
@@ -151,6 +159,10 @@ SOURCE=.\ast\ast_generator.cpp
# End Source File
# Begin Source File
+SOURCE=.\ast\ast_home.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\ast\ast_interface.cpp
# End Source File
# Begin Source File
@@ -199,6 +211,10 @@ SOURCE=.\ast\ast_structure.cpp
# End Source File
# Begin Source File
+SOURCE=.\ast\ast_structure_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\ast\ast_type.cpp
# End Source File
# Begin Source File
@@ -215,10 +231,22 @@ SOURCE=.\ast\ast_union_branch.cpp
# End Source File
# Begin Source File
+SOURCE=.\ast\ast_union_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\ast\ast_union_label.cpp
# End Source File
# Begin Source File
+SOURCE=.\ast\ast_valuetype.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ast\ast_valuetype_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\ast\ast_visitor.cpp
# End Source File
# Begin Source File
@@ -331,10 +359,6 @@ SOURCE=.\fe\y.tab.cpp
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
-SOURCE=.\include\ast.h
-# End Source File
-# Begin Source File
-
SOURCE=.\include\ast_argument.h
# End Source File
# Begin Source File
@@ -347,6 +371,14 @@ SOURCE=.\include\ast_attribute.h
# End Source File
# Begin Source File
+SOURCE=.\include\ast_component.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\ast_component_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\include\ast_concrete_type.h
# End Source File
# Begin Source File
@@ -391,6 +423,10 @@ SOURCE=.\include\ast_generator.h
# End Source File
# Begin Source File
+SOURCE=.\include\ast_home.h
+# End Source File
+# Begin Source File
+
SOURCE=.\include\ast_interface.h
# End Source File
# Begin Source File
@@ -431,6 +467,10 @@ SOURCE=.\include\ast_structure.h
# End Source File
# Begin Source File
+SOURCE=.\include\ast_structure_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\include\ast_type.h
# End Source File
# Begin Source File
@@ -447,51 +487,51 @@ SOURCE=.\include\ast_union_branch.h
# End Source File
# Begin Source File
-SOURCE=.\include\ast_union_label.h
+SOURCE=.\include\ast_union_fwd.h
# End Source File
# Begin Source File
-SOURCE=.\include\ast_visitor.h
+SOURCE=.\include\ast_union_label.h
# End Source File
# Begin Source File
-SOURCE=.\include\fe_declarator.h
+SOURCE=.\include\ast_valuetype.h
# End Source File
# Begin Source File
-SOURCE=.\include\fe_extern.h
+SOURCE=.\include\ast_valuetype_fwd.h
# End Source File
# Begin Source File
-SOURCE=.\include\fe_interface_header.h
+SOURCE=.\include\ast_visitor.h
# End Source File
# Begin Source File
-SOURCE=.\include\fe_private.h
+SOURCE=.\include\fe_declarator.h
# End Source File
# Begin Source File
-SOURCE=.\include\global_extern.h
+SOURCE=.\include\fe_extern.h
# End Source File
# Begin Source File
-SOURCE=.\include\idl.h
+SOURCE=.\include\fe_interface_header.h
# End Source File
# Begin Source File
-SOURCE=.\include\idl_bool.h
+SOURCE=.\include\fe_private.h
# End Source File
# Begin Source File
-SOURCE=.\include\idl_defines.h
+SOURCE=.\include\global_extern.h
# End Source File
# Begin Source File
-SOURCE=.\include\idl_extern.h
+SOURCE=.\include\idl_bool.h
# End Source File
# Begin Source File
-SOURCE=.\include\idl_fwd.h
+SOURCE=.\include\idl_defines.h
# End Source File
# Begin Source File
@@ -511,10 +551,6 @@ SOURCE=.\TAO_IDL_FE_Export.h
# End Source File
# Begin Source File
-SOURCE=.\include\util.h
-# End Source File
-# Begin Source File
-
SOURCE=.\include\utl_decllist.h
# End Source File
# Begin Source File
diff --git a/TAO/TAO_IDL/ast/Makefile.am b/TAO/TAO_IDL/ast/Makefile.am
index 2be4f1bcb08..da994a9d775 100644
--- a/TAO/TAO_IDL/ast/Makefile.am
+++ b/TAO/TAO_IDL/ast/Makefile.am
@@ -22,6 +22,8 @@ libast_la_SOURCES = \
ast_array.cpp \
ast_attribute.cpp \
ast_check.cpp \
+ ast_component.cpp \
+ ast_component_fwd.cpp \
ast_concrete_type.cpp \
ast_constant.cpp \
ast_decl.cpp \
@@ -31,6 +33,7 @@ libast_la_SOURCES = \
ast_expression.cpp \
ast_field.cpp \
ast_generator.cpp \
+ ast_home.cpp \
ast_interface.cpp \
ast_interface_fwd.cpp \
ast_module.cpp \
@@ -43,11 +46,15 @@ libast_la_SOURCES = \
ast_sequence.cpp \
ast_string.cpp \
ast_structure.cpp \
+ ast_structure_fwd.cpp \
ast_type.cpp \
ast_typedef.cpp \
ast_union.cpp \
+ ast_union_fwd.cpp \
ast_union_branch.cpp \
ast_union_label.cpp \
+ ast_valuetype.cpp \
+ ast_valuetype_fwd.cpp \
ast_visitor.cpp
diff --git a/TAO/TAO_IDL/ast/ast_argument.cpp b/TAO/TAO_IDL/ast/ast_argument.cpp
index 877590c6827..7c4349d3824 100644
--- a/TAO/TAO_IDL/ast/ast_argument.cpp
+++ b/TAO/TAO_IDL/ast/ast_argument.cpp
@@ -70,10 +70,12 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// Additionally they have a direction field which takes values
// from the enum AST_Argument::Direction.
-#include "idl.h"
-#include "idl_extern.h"
+#include "ast_argument.h"
+#include "ast_visitor.h"
-ACE_RCSID(ast, ast_argument, "$Id$")
+ACE_RCSID (ast,
+ ast_argument,
+ "$Id$")
// Static functions.
@@ -94,8 +96,6 @@ direction_to_string (AST_Argument::Direction d)
return 0;
}
-// Constructor(s) and destructor.
-
AST_Argument::AST_Argument (void)
: pd_direction (dir_IN)
{
@@ -117,8 +117,6 @@ AST_Argument::~AST_Argument (void)
{
}
-// Redefinition of inherited virtual operations.
-
// Dump this AST_Argument node to the ostream o.
void
AST_Argument::dump (ostream &o)
@@ -133,8 +131,6 @@ AST_Argument::ast_accept (ast_visitor *visitor)
return visitor->visit_argument (this);
}
-// Data accessors.
-
AST_Argument::Direction
AST_Argument::direction (void)
{
diff --git a/TAO/TAO_IDL/ast/ast_array.cpp b/TAO/TAO_IDL/ast/ast_array.cpp
index 03d94ce964c..613c9394aeb 100644
--- a/TAO/TAO_IDL/ast/ast_array.cpp
+++ b/TAO/TAO_IDL/ast/ast_array.cpp
@@ -70,10 +70,15 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// subtype of AST_ConcreteType. This means that we cannot have
// arrays of AST_Interfaces???
-#include "idl.h"
-#include "idl_extern.h"
+#include "ast_array.h"
+#include "ast_expression.h"
+#include "ast_visitor.h"
+#include "utl_exprlist.h"
+#include "utl_identifier.h"
-ACE_RCSID(ast, ast_array, "$Id$")
+ACE_RCSID (ast,
+ ast_array,
+ "$Id$")
// Constructor(s) and destructor.
@@ -142,13 +147,17 @@ void
AST_Array::dump (ACE_OSTREAM_TYPE &o)
{
pd_base_type->dump (o);
+
o << " ";
+
this->local_name ()->dump (o);
for (unsigned long i = 0; i < this->pd_n_dims; i++)
{
o << "[";
+
pd_dims[i]->dump (o);
+
o << "]";
}
}
@@ -159,6 +168,26 @@ AST_Array::ast_accept (ast_visitor *visitor)
return visitor->visit_array (this);
}
+// Compute the size type of the node in question.
+int
+AST_Array::compute_size_type (void)
+{
+ AST_Type *type = this->base_type ();
+
+ if (!type)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::compute_size_type - "
+ "bad base type\n"),
+ -1);
+ }
+
+ // Our size type is the same as our type.
+ this->size_type (type->size_type ());
+
+ return 0;
+}
+
// Data accessors.
unsigned long
AST_Array::n_dims (void)
diff --git a/TAO/TAO_IDL/ast/ast_attribute.cpp b/TAO/TAO_IDL/ast/ast_attribute.cpp
index 306fe3a5386..56d7ec3924b 100644
--- a/TAO/TAO_IDL/ast/ast_attribute.cpp
+++ b/TAO/TAO_IDL/ast/ast_attribute.cpp
@@ -70,8 +70,8 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// of AST_Type) and a boolean indicating whether the attribute is
// readonly.
-#include "idl.h"
-#include "idl_extern.h"
+#include "ast_attribute.h"
+#include "ast_visitor.h"
ACE_RCSID(ast, ast_attribute, "$Id$")
diff --git a/TAO/TAO_IDL/ast/ast_check.cpp b/TAO/TAO_IDL/ast/ast_check.cpp
index 70aafe42f82..3f931e86174 100644
--- a/TAO/TAO_IDL/ast/ast_check.cpp
+++ b/TAO/TAO_IDL/ast/ast_check.cpp
@@ -64,27 +64,29 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
*/
-// The check ensures that for every forward declared interface we also
-// saw a full definition of that interface.
+// The check ensures that for every forward declared struct or union we also
+// saw a full definition.
-#include "idl.h"
-#include "idl_extern.h"
+#include "global_extern.h"
+#include "utl_err.h"
-ACE_RCSID(ast, ast_check, "$Id$")
+ACE_RCSID (ast,
+ ast_check,
+ "$Id$")
// Static storage for remembering nodes.
-static AST_InterfaceFwd **ast_fwds = 0;
+static AST_Type **ast_fwds = 0;
static long ast_n_fwds_used = 0;
static long ast_n_fwds_alloc = 0;
#undef INCREMENT
#define INCREMENT 64
-// Store a node representing a forward declared interface.
+// Store a node representing a forward declared struct or union.
void
-AST_record_fwd_interface (AST_InterfaceFwd *n)
+AST_record_fwd_decl (AST_Type *n)
{
- AST_InterfaceFwd **o_ast_fwds = 0;
+ AST_Type **o_ast_fwds = 0;
long o_ast_n_fwds_alloc = 0;
// Make sure there's space to store one more.
@@ -94,7 +96,7 @@ AST_record_fwd_interface (AST_InterfaceFwd *n)
{
ast_n_fwds_alloc = INCREMENT;
ACE_NEW (ast_fwds,
- AST_InterfaceFwd *[ast_n_fwds_alloc]);
+ AST_Type *[ast_n_fwds_alloc]);
}
else
{
@@ -103,7 +105,7 @@ AST_record_fwd_interface (AST_InterfaceFwd *n)
ast_n_fwds_alloc += INCREMENT;
ACE_NEW (ast_fwds,
- AST_InterfaceFwd *[ast_n_fwds_alloc]);
+ AST_Type *[ast_n_fwds_alloc]);
for (long i = 0; i < o_ast_n_fwds_alloc; i++)
{
@@ -118,24 +120,19 @@ AST_record_fwd_interface (AST_InterfaceFwd *n)
ast_fwds[ast_n_fwds_used++] = n;
}
-// Check that all forward declared interfaces were also defined.
-void
-AST_check_fwd_interface (void)
+// Check that all forward declared structs and unions were also defined.
+TAO_IDL_FE_Export void
+AST_check_fwd_decls (void)
{
- AST_InterfaceFwd *d = 0;
- AST_Interface *itf = 0;
+ AST_Type *d = 0;
- for (long i = 0; i < ast_n_fwds_used; i++)
+ for (long i = 0; i < ast_n_fwds_used; ++i)
{
d = ast_fwds[i];
- itf = d->full_definition ();
- if (!itf->is_defined ())
+ if (!d->is_defined ())
{
- // The old pointer may now be garbage.
- itf->set_file_name (idl_global->filename ());
-
- idl_global->err ()->fwd_decl_not_defined (itf);
+ idl_global->err ()->fwd_decl_not_defined (d);
}
}
}
diff --git a/TAO/TAO_IDL/ast/ast_component.cpp b/TAO/TAO_IDL/ast/ast_component.cpp
new file mode 100644
index 00000000000..d975ee28df3
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_component.cpp
@@ -0,0 +1,182 @@
+// $Id$
+
+#include "ast_component.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
+#include "utl_indenter.h"
+#include "utl_err.h"
+#include "global_extern.h"
+
+ACE_RCSID (ast,
+ ast_component,
+ "$Id$")
+
+AST_Component::AST_Component (void)
+ : pd_base_component (0)
+{
+}
+
+AST_Component::AST_Component (UTL_ScopedName *n,
+ AST_Component *base_component,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface **supports_flat,
+ long n_supports_flat)
+ : AST_Interface (n,
+ supports,
+ n_supports,
+ supports_flat,
+ n_supports_flat,
+ I_TRUE,
+ I_FALSE),
+ AST_Type (AST_Decl::NT_component,
+ n),
+ AST_Decl (AST_Decl::NT_component,
+ n),
+ UTL_Scope (AST_Decl::NT_component),
+ COMMON_Base (I_TRUE,
+ I_FALSE),
+ pd_base_component (base_component)
+{
+}
+
+AST_Component::~AST_Component (void)
+{
+}
+
+void
+AST_Component::redefine (AST_Interface *from)
+{
+ AST_Component *c = AST_Component::narrow_from_decl (from);
+
+ if (c == 0)
+ {
+ idl_global->err ()->redef_error (from->local_name ()->get_string (),
+ this->local_name ()->get_string ());
+ return;
+ }
+
+ // Copy over all the base class members.
+ this->AST_Interface::redefine (from);
+
+ this->pd_base_component = c->pd_base_component;
+ this->pd_provides = c->pd_provides;
+ this->pd_uses = c->pd_uses;
+ this->pd_emits = c->pd_emits;
+ this->pd_publishes = c->pd_publishes;
+ this->pd_consumes = c->pd_consumes;
+}
+
+AST_Component *
+AST_Component::base_component (void) const
+{
+ return this->pd_base_component;
+}
+
+AST_Interface **
+AST_Component::supports (void) const
+{
+ return this->inherits ();
+}
+
+long
+AST_Component::n_supports (void) const
+{
+ return this->n_inherits ();
+}
+
+ACE_Unbounded_Queue<AST_Component::port_description> &
+AST_Component::provides (void)
+{
+ return this->pd_provides;
+}
+
+ACE_Unbounded_Queue<AST_Component::uses_description> &
+AST_Component::uses (void)
+{
+ return this->pd_uses;
+}
+
+ACE_Unbounded_Queue<AST_Component::port_description> &
+AST_Component::emits (void)
+{
+ return this->pd_emits;
+}
+
+ACE_Unbounded_Queue<AST_Component::port_description> &
+AST_Component::publishes (void)
+{
+ return this->pd_publishes;
+}
+
+ACE_Unbounded_Queue<AST_Component::port_description> &
+AST_Component::consumes (void)
+{
+ return this->pd_consumes;
+}
+
+void
+AST_Component::destroy (void)
+{
+ this->AST_Interface::destroy ();
+}
+
+void
+AST_Component::dump (ACE_OSTREAM_TYPE &o)
+{
+ o << "component ";
+
+ this->local_name ()->dump (o);
+
+ o << " ";
+
+ if (this->pd_base_component != 0)
+ {
+ o << ": ";
+ this->pd_base_component->local_name ()->dump (o);
+ }
+
+ if (this->pd_n_inherits > 0)
+ {
+ o << "supports ";
+
+ for (long i = 0; i < this->pd_n_inherits; ++i)
+ {
+ this->pd_inherits[i]->local_name ()->dump (o);
+
+ if (i < this->pd_n_inherits - 1)
+ {
+ o << ", ";
+ }
+ }
+ }
+
+ o << " {\n";
+
+ UTL_Scope::dump (o);
+ idl_global->indent ()->skip_to (o);
+
+ o << "}";
+}
+
+int
+AST_Component::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_component (this);
+}
+
+idl_bool
+AST_Component::redef_clash (void)
+{
+ if (this->AST_Interface::redef_clash ())
+ {
+ return 1;
+ }
+
+ return 0;
+}
+
+// Narrowing methods.
+IMPL_NARROW_METHODS1(AST_Component, AST_Interface)
+IMPL_NARROW_FROM_DECL(AST_Component)
+IMPL_NARROW_FROM_SCOPE(AST_Component)
diff --git a/TAO/TAO_IDL/ast/ast_component_fwd.cpp b/TAO/TAO_IDL/ast/ast_component_fwd.cpp
new file mode 100644
index 00000000000..6dfcf57dbb8
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_component_fwd.cpp
@@ -0,0 +1,57 @@
+// $Id$
+
+#include "ast_component_fwd.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
+
+ACE_RCSID( ast,
+ ast_component_fwd,
+ "$Id$")
+
+AST_ComponentFwd::AST_ComponentFwd (void)
+{
+}
+
+AST_ComponentFwd::AST_ComponentFwd (AST_Interface *dummy,
+ UTL_ScopedName *n)
+ : AST_InterfaceFwd (dummy,
+ n),
+ AST_Type (AST_Decl::NT_component_fwd,
+ n),
+ AST_Decl (AST_Decl::NT_component_fwd,
+ n),
+ COMMON_Base (I_TRUE,
+ I_FALSE)
+{
+}
+
+AST_ComponentFwd::~AST_ComponentFwd (void)
+{
+}
+
+// Redefinition of inherited virtual operations.
+
+// Dump this AST_InterfaceFwd node to the ostream o.
+void
+AST_ComponentFwd::dump (ACE_OSTREAM_TYPE &o)
+{
+ o << "component ";
+
+ this->local_name ()->dump (o);
+}
+
+int
+AST_ComponentFwd::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_component_fwd (this);
+}
+
+void
+AST_ComponentFwd::destroy (void)
+{
+ this->AST_InterfaceFwd::destroy ();
+}
+
+// Narrowing methods.
+IMPL_NARROW_METHODS1 (AST_ComponentFwd, AST_InterfaceFwd)
+IMPL_NARROW_FROM_DECL (AST_ComponentFwd)
diff --git a/TAO/TAO_IDL/ast/ast_concrete_type.cpp b/TAO/TAO_IDL/ast/ast_concrete_type.cpp
index cbdeaf9643a..d82d3ae97b1 100644
--- a/TAO/TAO_IDL/ast/ast_concrete_type.cpp
+++ b/TAO/TAO_IDL/ast/ast_concrete_type.cpp
@@ -67,10 +67,11 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// AST_ConcreteType nodes denote all non-interface types of IDL.
// They are AST_Type nodes.
-#include "idl.h"
-#include "idl_extern.h"
+#include "ast_concrete_type.h"
-ACE_RCSID(ast, ast_concrete_type, "$Id$")
+ACE_RCSID (ast,
+ ast_concrete_type,
+ "$Id$")
// Constructor(s) and destructor.
AST_ConcreteType::AST_ConcreteType (void)
diff --git a/TAO/TAO_IDL/ast/ast_constant.cpp b/TAO/TAO_IDL/ast/ast_constant.cpp
index b79f18b51f1..015da4b8657 100644
--- a/TAO/TAO_IDL/ast/ast_constant.cpp
+++ b/TAO/TAO_IDL/ast/ast_constant.cpp
@@ -71,55 +71,54 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// and the other for use in creating enumerators (see the class
// AST_EnumVal).
-#include "idl.h"
-#include "idl_extern.h"
+#include "ast_constant.h"
+#include "utl_identifier.h"
+#include "ast_visitor.h"
+#include "ast_generator.h"
+#include "nr_extern.h"
-ACE_RCSID(ast, ast_constant, "$Id$")
+ACE_RCSID (ast,
+ ast_constant,
+ "$Id$")
// Static functions.
// Convert a value from the enum AST_Expression::ExprType to a char *.
-static const char *
-exprtype_to_string (AST_Expression::ExprType et)
+const char *
+AST_Constant::exprtype_to_string (AST_Expression::ExprType et)
{
switch (et)
{
case AST_Expression::EV_short:
- return "short";
+ return "Short";
case AST_Expression::EV_ushort:
- return "unsigned short";
+ return "UShort";
case AST_Expression::EV_long:
- return "long";
+ return "Long";
case AST_Expression::EV_ulong:
- return "unsigned long";
+ return "ULong";
case AST_Expression::EV_float:
- return "float";
+ return "Float";
case AST_Expression::EV_double:
- return "double";
+ return "Double";
case AST_Expression::EV_char:
- return "char";
+ return "Char";
case AST_Expression::EV_octet:
- return "octet";
+ return "Octet";
case AST_Expression::EV_bool:
- return "boolean";
+ return "Boolean";
case AST_Expression::EV_string:
- return "string";
- case AST_Expression::EV_any:
- return "any";
- case AST_Expression::EV_void:
- return "void";
- case AST_Expression::EV_none:
- return "none";
+ return "Char*";
case AST_Expression::EV_ulonglong:
- return "unsigned long long";
+ return "ULongLong";
case AST_Expression::EV_longlong:
- return "long long";
+ return "LongLong";
case AST_Expression::EV_wchar:
- return "wchar";
+ return "Wchar";
case AST_Expression::EV_wstring:
- return "wstring";
+ return "Wchar*";
case AST_Expression::EV_longdouble:
- return 0;
+ return "LongDouble";
}
return 0;
@@ -142,7 +141,7 @@ AST_Constant::AST_Constant (AST_Expression::ExprType t,
UTL_ScopedName *n)
: AST_Decl (nt,
n),
- pd_constant_value (idl_global->gen ()->create_expr (v, t)),
+ pd_constant_value (v),
pd_et (t),
ifr_added_ (0)
{
@@ -154,19 +153,29 @@ AST_Constant::AST_Constant (AST_Expression::ExprType t,
UTL_ScopedName *n)
: AST_Decl (AST_Decl::NT_const,
n),
- pd_constant_value (idl_global->gen ()->create_expr (v, t)),
+ pd_constant_value (v),
pd_et (t),
ifr_added_ (0)
{
+ // Avoids a truncation warning on MSVC when assigning a decimal
+ // literal to a float constant.
+ if (t == AST_Expression::EV_float)
+ {
+ AST_Expression::AST_ExprValue *ev =
+ this->pd_constant_value->ev ();
+ ev->et = t;
+ ev->u.fval = (float) ev->u.dval;
+ }
+ // Allows the enum value string name to be used in generating the
+ // rhs of the constant assignment.
+ else if (t == AST_Expression::EV_enum)
+ {
+ this->pd_constant_value->ev ()->et = t;
+ }
}
AST_Constant::~AST_Constant (void)
{
- if (this->pd_constant_value != 0)
- {
- delete this->pd_constant_value;
- this->pd_constant_value = 0;
- }
}
// Redefinition of inherited virtual operations.
@@ -175,9 +184,12 @@ AST_Constant::~AST_Constant (void)
void
AST_Constant::dump (ACE_OSTREAM_TYPE &o)
{
- o << "const " << exprtype_to_string (pd_et) << " ";
+ o << "const " << this->exprtype_to_string () << " ";
+
this->local_name ()->dump (o);
+
o << " = ";
+
this->pd_constant_value->dump (o);
}
@@ -187,6 +199,17 @@ AST_Constant::ast_accept (ast_visitor *visitor)
return visitor->visit_constant (this);
}
+void
+AST_Constant::destroy (void)
+{
+ if (this->pd_constant_value != 0)
+ {
+ this->pd_constant_value->destroy ();
+ delete this->pd_constant_value;
+ this->pd_constant_value = 0;
+ }
+}
+
// Data accessors.
AST_Expression *
@@ -213,6 +236,67 @@ AST_Constant::ifr_added (idl_bool val)
this->ifr_added_ = val;
}
+const char *
+AST_Constant::exprtype_to_string (void)
+{
+ switch (this->pd_et)
+ {
+ case AST_Expression::EV_short:
+ return "CORBA::Short";
+ case AST_Expression::EV_ushort:
+ return "CORBA::UShort";
+ case AST_Expression::EV_long:
+ return "CORBA::Long";
+ case AST_Expression::EV_ulong:
+ return "CORBA::ULong";
+ case AST_Expression::EV_float:
+ return "CORBA::Float";
+ case AST_Expression::EV_double:
+ return "CORBA::Double";
+ case AST_Expression::EV_char:
+ return "CORBA::Char";
+ case AST_Expression::EV_octet:
+ return "CORBA::Octet";
+ case AST_Expression::EV_bool:
+ return "CORBA::Boolean";
+ case AST_Expression::EV_string:
+ return "char *const";
+ case AST_Expression::EV_void:
+ return "void";
+ case AST_Expression::EV_none:
+ return "none";
+ case AST_Expression::EV_longlong:
+ return "CORBA::LongLong";
+ case AST_Expression::EV_ulonglong:
+ return "CORBA::ULongLong";
+ case AST_Expression::EV_wchar:
+ return "CORBA::WChar";
+ case AST_Expression::EV_wstring:
+ return "CORBA::WChar *const";
+ case AST_Expression::EV_longdouble:
+ case AST_Expression::EV_enum:
+ return 0;
+ }
+
+ return 0;
+}
+
+UTL_ScopedName *
+AST_Constant::enum_full_name (void)
+{
+ if (this->pd_et == AST_Expression::EV_enum)
+ {
+ UTL_Scope *s = this->defined_in ();
+ AST_Decl *d = s->lookup_by_name (this->pd_constant_value->n (),
+ 1);
+ return (ScopeAsDecl (d->defined_in ()))->name ();
+ }
+ else
+ {
+ return 0;
+ }
+}
+
// Narrowing methods.
IMPL_NARROW_METHODS1(AST_Constant, AST_Decl)
IMPL_NARROW_FROM_DECL(AST_Constant)
diff --git a/TAO/TAO_IDL/ast/ast_decl.cpp b/TAO/TAO_IDL/ast/ast_decl.cpp
index eae19a70aea..4df44001ad8 100644
--- a/TAO/TAO_IDL/ast/ast_decl.cpp
+++ b/TAO/TAO_IDL/ast/ast_decl.cpp
@@ -62,11 +62,9 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
/*
- * ast_decl.cc - Implementation of class AST_Decl
- *
* AST_Decl is the base class for all AST nodes except AST_Expression.
* AST_Decls have a node type (a value from the enum AST_Decl::NodeType)
* and a name (a UTL_ScopedName).
@@ -76,11 +74,17 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
* main file or an #include'd file.
*/
-#include "idl.h"
-#include "idl_extern.h"
-#include "ace/SString.h"
+#include "ast_interface.h"
+#include "ast_visitor.h"
+#include "global_extern.h"
+#include "nr_extern.h"
+#include "utl_identifier.h"
+#include "utl_scope.h"
+#include "utl_err.h"
-ACE_RCSID(ast, ast_decl, "$Id$")
+ACE_RCSID (ast,
+ ast_decl,
+ "$Id$")
COMMON_Base::COMMON_Base (idl_bool local,
idl_bool abstract)
@@ -116,14 +120,16 @@ AST_Decl::AST_Decl (void)
pd_node_type (NT_module),
pd_line (-1),
pd_file_name (0),
- pd_name (0),
pd_local_name (0),
pd_original_local_name (0),
pd_added (I_FALSE),
full_name_ (0),
prefix_ (0),
version_ (0),
- anonymous_ (I_FALSE)
+ anonymous_ (I_FALSE),
+ typeid_set_ (I_FALSE),
+ flat_name_ (0),
+ last_referenced_as_ (0)
{
}
@@ -133,19 +139,23 @@ AST_Decl::AST_Decl (NodeType nt,
: repoID_ (0),
pd_imported (idl_global->imported ()),
pd_in_main_file (idl_global->in_main_file ()),
- pd_defined_in (idl_global->scopes ()->depth () > 0
- ? idl_global->scopes ()->top ()
+ pd_defined_in (idl_global->scopes ().depth () > 0
+ ? idl_global->scopes ().top ()
: 0),
pd_node_type (nt),
pd_line (idl_global->lineno ()),
pd_file_name (idl_global->filename ()),
pd_name (0),
pd_local_name (n == 0 ? 0 : n->last_component ()->copy ()),
+ pd_original_local_name (0),
pd_added (I_FALSE),
full_name_ (0),
prefix_ (0),
version_ (0),
- anonymous_ (anonymous)
+ anonymous_ (anonymous),
+ typeid_set_ (I_FALSE),
+ flat_name_ (0),
+ last_referenced_as_ (0)
{
this->compute_full_name (n);
@@ -163,7 +173,8 @@ AST_Decl::AST_Decl (NodeType nt,
if (n != 0)
{
- this->original_local_name (n->last_component ()->copy ());
+ // The function body creates its own copy.
+ this->original_local_name (n->last_component ());
}
}
@@ -177,6 +188,14 @@ AST_Decl::~AST_Decl (void)
void
AST_Decl::compute_full_name (UTL_ScopedName *n)
{
+ // This should happen only when we are a non-void predefined type,
+ // in which case our scoped name has already been created by the
+ // AST_PredefinedType constructor.
+ if (n == 0)
+ {
+ return;
+ }
+
UTL_ScopedName *cn = 0;
AST_Decl *d = 0;
@@ -186,7 +205,7 @@ AST_Decl::compute_full_name (UTL_ScopedName *n)
// Global scope?
if (this->defined_in () == 0)
{
- this->pd_name = n;
+ this->pd_name = (UTL_IdList *) n->copy ();
return;
}
@@ -201,7 +220,7 @@ AST_Decl::compute_full_name (UTL_ScopedName *n)
if (cn != 0)
{
- this->pd_name = (UTL_ScopedName *) cn->copy ();
+ this->pd_name = (UTL_IdList *) cn->copy ();
}
if (this->pd_local_name != 0)
@@ -222,22 +241,40 @@ AST_Decl::compute_full_name (UTL_ScopedName *n)
this->pd_name->nconc (conc_name);
}
}
- else
+}
+
+void
+AST_Decl::set_prefix_with_typeprefix_r (char *value)
+{
+ if (this->typeid_set_)
{
- if (this->pd_name == 0)
- {
- ACE_NEW (this->pd_name,
- UTL_ScopedName (0,
- 0));
- }
- else
+ return;
+ }
+
+ delete [] this->repoID_;
+ this->repoID_ = 0;
+ this->prefix (value);
+ this->compute_repoID ();
+ UTL_Scope *s = DeclAsScope (this);
+
+ if (s != 0)
+ {
+ AST_Decl *d = 0;
+
+ for (UTL_ScopeActiveIterator i (s, UTL_Scope::IK_decls);
+ !i.is_done ();
+ i.next ())
{
- UTL_ScopedName *conc_name = 0;
- ACE_NEW (conc_name,
- UTL_ScopedName (0,
- 0));
+ d = i.item ();
- this->pd_name->nconc (conc_name);
+ if (d->typeid_set_)
+ {
+ continue;
+ }
+ else
+ {
+ d->set_prefix_with_typeprefix_r (value);
+ }
}
}
}
@@ -248,7 +285,7 @@ AST_Decl::compute_full_name (UTL_ScopedName *n)
void
AST_Decl::compute_full_name (void)
{
- if (this->full_name_ != 0)
+ if (this->full_name_ != 0)
{
return;
}
@@ -328,15 +365,13 @@ AST_Decl::compute_full_name (void)
}
}
}
-
- return;
}
// Compute stringified repository ID.
void
AST_Decl::compute_repoID (void)
{
- if (this->repoID_ != 0)
+ if (this->repoID_ != 0)
{
return;
}
@@ -480,6 +515,104 @@ AST_Decl::compute_repoID (void)
// Public operations.
+const char *
+AST_Decl::flat_name (void)
+{
+ if (!this->flat_name_)
+ {
+ this->compute_flat_name ();
+ }
+
+ return this->flat_name_;
+}
+
+// Compute stringified flattened fully scoped name.
+void
+AST_Decl::compute_flat_name (void)
+{
+ if (this->flat_name_ != 0)
+ {
+ return;
+ }
+ else
+ {
+ long namelen = 0;
+ long first = I_TRUE;
+ long second = I_FALSE;
+ char *item_name = 0;
+
+ // In the first loop, compute the total length.
+ for (UTL_IdListActiveIterator i (this->name ());
+ !i.is_done ();
+ i.next ())
+ {
+ if (!first)
+ {
+ namelen += 1; // for "_"
+ }
+ else if (second)
+ {
+ first = second = I_FALSE;
+ }
+
+ // Print the identifier.
+ item_name = i.item ()->get_string ();
+ namelen += ACE_OS::strlen (item_name);
+
+ if (first)
+ {
+ if (ACE_OS::strcmp (item_name, "") != 0)
+ {
+ // Does not start with a "".
+ first = I_FALSE;
+ }
+ else
+ {
+ second = I_TRUE;
+ }
+ }
+ }
+
+ ACE_NEW (this->flat_name_,
+ char[namelen + 1]);
+
+ this->flat_name_[0] = '\0';
+ first = I_TRUE;
+ second = I_FALSE;
+
+ for (UTL_IdListActiveIterator j (this->name ());
+ !j.is_done ();
+ j.next ())
+ {
+ if (!first)
+ {
+ ACE_OS::strcat (this->flat_name_, "_");
+ }
+ else if (second)
+ {
+ first = second = I_FALSE;
+ }
+
+ // Print the identifier.
+ item_name = j.item ()->get_string ();
+ ACE_OS::strcat (this->flat_name_, item_name);
+
+ if (first)
+ {
+ if (ACE_OS::strcmp (item_name, "") != 0)
+ {
+ // Does not start with a "".
+ first = I_FALSE;
+ }
+ else
+ {
+ second = I_TRUE;
+ }
+ }
+ }
+ }
+}
+
// Return TRUE if one of my ancestor scopes is "s"
// and FALSE otherwise.
idl_bool
@@ -519,6 +652,21 @@ AST_Decl::is_child (AST_Decl *s)
return 0; // Not a child.
}
+idl_bool
+AST_Decl::is_nested (void)
+{
+ AST_Decl *d = ScopeAsDecl (this->defined_in ());
+
+ // If we have an outermost scope and if that scope is not that of the Root,
+ // then we are defined at some nesting level.
+ if (d != 0 && d->node_type () != AST_Decl::NT_root)
+ {
+ return I_TRUE;
+ }
+
+ return I_FALSE;
+}
+
// Dump this AST_Decl to the ostream o.
void
AST_Decl::dump (ACE_OSTREAM_TYPE &o)
@@ -535,17 +683,27 @@ AST_Decl::ast_accept (ast_visitor *visitor)
void
AST_Decl::destroy (void)
{
- this->pd_name->destroy ();
- delete this->pd_name;
- this->pd_name = 0;
+ // These are not set for the root node.
+ if (this->pd_name != 0)
+ {
+ this->pd_name->destroy ();
+ delete this->pd_name;
+ this->pd_name = 0;
+ }
- this->pd_local_name->destroy ();
- delete this->pd_local_name;
- this->pd_local_name = 0;
+ if (this->pd_local_name != 0)
+ {
+ this->pd_local_name->destroy ();
+ delete this->pd_local_name;
+ this->pd_local_name = 0;
+ }
- this->pd_original_local_name->destroy ();
- delete this->pd_original_local_name;
- this->pd_original_local_name = 0;
+ if (this->pd_original_local_name != 0)
+ {
+ this->pd_original_local_name->destroy ();
+ delete this->pd_original_local_name;
+ this->pd_original_local_name = 0;
+ }
delete [] this->full_name_;
this->full_name_ = 0;
@@ -558,8 +716,13 @@ AST_Decl::destroy (void)
delete [] this->version_;
this->version_ = 0;
+
+ delete [] this->flat_name_;
+ this->flat_name_ = 0;
}
+// Data accessors.
+
const char *
AST_Decl::full_name (void)
{
@@ -610,7 +773,8 @@ AST_Decl::prefix (void)
void
AST_Decl::prefix (char *value)
{
- this->prefix_ = value;
+ delete [] this->prefix_;
+ this->prefix_ = ACE::strnew (value);
}
const char *
@@ -652,6 +816,7 @@ AST_Decl::version (char *value)
if (this->version_ == 0 && this->repoID_ == 0
|| ACE_OS::strcmp (this->version_, value) == 0)
{
+ delete [] this->version_;
this->version_ = value;
}
else
@@ -666,7 +831,93 @@ AST_Decl::anonymous (void) const
return this->anonymous_;
}
-// Data accessors.
+idl_bool
+AST_Decl::typeid_set (void) const
+{
+ return this->typeid_set_;
+}
+
+void
+AST_Decl::typeid_set (idl_bool val)
+{
+ this->typeid_set_ = val;
+}
+
+void
+AST_Decl::set_id_with_typeid (char *value)
+{
+ // Can't call 'typeid' twice, even with the same value.
+ if (this->typeid_set ())
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_TYPEID_RESET,
+ this);
+ }
+
+ // Are we a legal type for 'typeid'?
+ switch (this->pd_node_type)
+ {
+ case AST_Decl::NT_field:
+ {
+ AST_Interface *iface =
+ AST_Interface::narrow_from_scope (this->defined_in ());
+
+ if (iface == 0 || iface->node_type () == AST_Decl::NT_valuetype == 0)
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_INVALID_TYPEID,
+ this);
+
+ return;
+ }
+
+ break;
+ }
+ case AST_Decl::NT_module:
+ case AST_Decl::NT_interface:
+ case AST_Decl::NT_const:
+ case AST_Decl::NT_typedef:
+ case AST_Decl::NT_except:
+ case AST_Decl::NT_attr:
+ case AST_Decl::NT_op:
+ case AST_Decl::NT_enum:
+ case AST_Decl::NT_factory:
+ case AST_Decl::NT_component:
+ case AST_Decl::NT_home:
+ case AST_Decl::NT_finder:
+ case AST_Decl::NT_eventtype:
+ break;
+ default:
+ idl_global->err ()->error1 (UTL_Error::EIDL_INVALID_TYPEID,
+ this);
+
+ return;
+ }
+
+ delete [] this->repoID_;
+ this->repoID_ = 0;
+ this->repoID (value);
+ this->typeid_set (I_TRUE);
+}
+
+void
+AST_Decl::set_prefix_with_typeprefix (char *value)
+{
+ // Are we a legal type for 'typeprefix'? This is checked only at
+ // the top level.
+ switch (this->pd_node_type)
+ {
+ case AST_Decl::NT_module:
+ case AST_Decl::NT_interface:
+ case AST_Decl::NT_eventtype:
+ break;
+ default:
+ idl_global->err ()->error1 (UTL_Error::EIDL_INVALID_TYPEPREFIX,
+ this);
+
+ return;
+ }
+
+ this->set_prefix_with_typeprefix_r (value);
+}
idl_bool
AST_Decl::imported (void)
@@ -828,14 +1079,37 @@ AST_Decl::compute_name (const char *prefix,
void
AST_Decl::set_name (UTL_ScopedName *n)
{
+ if (this->pd_name == n)
+ {
+ return;
+ }
+
+ if (this->pd_name != 0)
+ {
+ this->pd_name->destroy ();
+ delete this->pd_name;
+ }
+
this->pd_name = n;
- if (n != NULL)
+ if (n != 0)
{
+ if (this->pd_local_name != 0)
+ {
+ this->pd_local_name->destroy ();
+ delete this->pd_local_name;
+ }
+
this->pd_local_name = n->last_component ()->copy ();
// The name without _cxx_ prefix removed, if there was any.
- this->original_local_name (n->last_component ()->copy ());
+ if (this->pd_original_local_name != 0)
+ {
+ this->pd_original_local_name->destroy ();
+ delete this->pd_original_local_name;
+ }
+
+ this->original_local_name (n->last_component ());
}
}
@@ -845,6 +1119,18 @@ AST_Decl::local_name (void)
return this->pd_local_name;
}
+void
+AST_Decl::local_name (Identifier *id)
+{
+ if (this->pd_local_name != 0)
+ {
+ this->pd_local_name->destroy ();
+ }
+
+ delete this->pd_local_name;
+ this->pd_local_name = id;
+}
+
Identifier *
AST_Decl::compute_local_name (const char *prefix,
const char *suffix)
@@ -910,6 +1196,18 @@ AST_Decl::original_local_name (void)
return this->pd_original_local_name;
}
+UTL_ScopedName *
+AST_Decl::last_referenced_as (void) const
+{
+ return this->last_referenced_as_;
+}
+
+void
+AST_Decl::last_referenced_as (UTL_ScopedName *n)
+{
+ this->last_referenced_as_ = n;
+}
+
//Narrowing methods for AST_Decl.
IMPL_NARROW_METHODS0(AST_Decl)
IMPL_NARROW_FROM_DECL(AST_Decl)
diff --git a/TAO/TAO_IDL/ast/ast_enum.cpp b/TAO/TAO_IDL/ast/ast_enum.cpp
index 26024fb0478..41a20e0f217 100644
--- a/TAO/TAO_IDL/ast/ast_enum.cpp
+++ b/TAO/TAO_IDL/ast/ast_enum.cpp
@@ -64,12 +64,17 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
*/
-#include "idl.h"
-#include "idl_extern.h"
-
-ACE_RCSID(ast, ast_enum, "$Id$")
-
-// Constructor(s) and destructor,
+#include "ast_enum.h"
+#include "ast_enum_val.h"
+#include "ast_generator.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
+#include "utl_err.h"
+#include "utl_indenter.h"
+
+ACE_RCSID (ast,
+ ast_enum,
+ "$Id$")
AST_Enum::AST_Enum (void)
: pd_enum_counter (0),
@@ -94,8 +99,6 @@ AST_Enum::~AST_Enum (void)
{
}
-// Public operations.
-
// Return the member count.
int
AST_Enum::member_count (void)
@@ -136,7 +139,9 @@ AST_Enum::lookup_by_value (const AST_Expression *v)
AST_EnumVal *item = 0;
AST_Decl *d = 0;
- for (UTL_ScopeActiveIterator i (this, IK_decls);!i.is_done ();i.next ())
+ for (UTL_ScopeActiveIterator i (this, IK_decls);
+ !i.is_done ();
+ i.next ())
{
d = i.item ();
item = AST_EnumVal::narrow_from_decl (d);
@@ -186,7 +191,7 @@ munge_name_for_enumval (UTL_ScopedName *n,
UTL_IdList *id = 0;
ACE_NEW_RETURN (id,
- UTL_IdList (last_component,
+ UTL_IdList (last_component->copy (),
0),
0);
@@ -195,8 +200,6 @@ munge_name_for_enumval (UTL_ScopedName *n,
return hold;
}
-// Private operations.
-
// Compute total number of members.
int
AST_Enum::compute_member_count (void)
@@ -206,7 +209,9 @@ AST_Enum::compute_member_count (void)
// If there are elements in this scope
if (this->nmembers () > 0)
{
- for (UTL_ScopeActiveIterator i (this, IK_decls);!i.is_done ();i.next ())
+ for (UTL_ScopeActiveIterator i (this, IK_decls);
+ !i.is_done ();
+ i.next ())
{
// Get the next AST decl node.
++this->member_count_;
@@ -216,7 +221,7 @@ AST_Enum::compute_member_count (void)
return 0;
}
-// Add an AST_EnumVal node to this scope
+// Add an AST_EnumVal node to this scope.
AST_EnumVal *
AST_Enum::fe_add_enum_val (AST_EnumVal *t)
{
@@ -231,11 +236,16 @@ AST_Enum::fe_add_enum_val (AST_EnumVal *t)
t1 = idl_global->gen ()->create_enum_val (tmp,
t->name ());
- t->set_name (munge_name_for_enumval (t->name (),
- t->local_name ()));
+ UTL_ScopedName *sn =
+ munge_name_for_enumval ((UTL_IdList *) t->name ()->copy (),
+ t->local_name ());
- t1->set_name (munge_name_for_enumval (t1->name (),
- t1->local_name ()));
+ t->set_name (sn);
+
+ sn = munge_name_for_enumval ((UTL_IdList *) t1->name ()->copy (),
+ t1->local_name ());
+
+ t1->set_name (sn);
}
// Already defined and cannot be redefined? Or already used?
@@ -276,7 +286,7 @@ AST_Enum::fe_add_enum_val (AST_EnumVal *t)
t->local_name ());
// Add it to enclosing scope.
- idl_global->scopes ()->next_to_top ()->fe_add_enum_val (t1);
+ idl_global->scopes ().next_to_top ()->fe_add_enum_val (t1);
return t;
}
@@ -299,7 +309,9 @@ AST_Enum::dump (ACE_OSTREAM_TYPE &o)
}
o << "enum ";
+
this->local_name ()->dump (o);
+
o << " {\n";
// Must increment the iterator explicitly inside the loop.
@@ -316,6 +328,7 @@ AST_Enum::dump (ACE_OSTREAM_TYPE &o)
}
idl_global->indent ()->skip_to (o);
+
o << "}";
}
@@ -328,6 +341,8 @@ AST_Enum::ast_accept (ast_visitor *visitor)
void
AST_Enum::destroy (void)
{
+ this->UTL_Scope::destroy ();
+ this->AST_Decl::destroy ();
}
diff --git a/TAO/TAO_IDL/ast/ast_enum_val.cpp b/TAO/TAO_IDL/ast/ast_enum_val.cpp
index 77ceeabc8c9..d0f9f95b974 100644
--- a/TAO/TAO_IDL/ast/ast_enum_val.cpp
+++ b/TAO/TAO_IDL/ast/ast_enum_val.cpp
@@ -68,12 +68,13 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// AST_EnumVals are a subclass of AST_Constant
// AST_EnumVals have no additional fields.
-#include "idl.h"
-#include "idl_extern.h"
+#include "ast_enum_val.h"
+#include "ast_visitor.h"
-ACE_RCSID(ast, ast_enum_val, "$Id$")
+ACE_RCSID (ast,
+ ast_enum_val,
+ "$Id$")
-// Constructor(s) and destructor.
AST_EnumVal::AST_EnumVal (void)
{
}
diff --git a/TAO/TAO_IDL/ast/ast_exception.cpp b/TAO/TAO_IDL/ast/ast_exception.cpp
index 069d8e33e46..1feeb77c371 100644
--- a/TAO/TAO_IDL/ast/ast_exception.cpp
+++ b/TAO/TAO_IDL/ast/ast_exception.cpp
@@ -68,19 +68,27 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// AST_Exceptions are a subclass of AST_Decl (they are not types!)
// and of UTL_Scope.
-#include "idl.h"
-#include "idl_extern.h"
+#include "ast_exception.h"
+#include "ast_field.h"
+#include "ast_union.h"
+#include "ast_enum.h"
+#include "ast_enum_val.h"
+#include "ast_visitor.h"
+#include "utl_err.h"
+#include "utl_identifier.h"
+#include "utl_indenter.h"
+
+ACE_RCSID (ast,
+ ast_exception,
+ "$Id$")
-ACE_RCSID(ast, ast_exception, "$Id$")
-
-// Constructor(s) and destructor.
AST_Exception::AST_Exception (void)
{
}
-AST_Exception::AST_Exception(UTL_ScopedName *n,
- idl_bool local,
- idl_bool abstract)
+AST_Exception::AST_Exception (UTL_ScopedName *n,
+ idl_bool local,
+ idl_bool abstract)
: AST_Structure (AST_Decl::NT_except,
n,
local,
@@ -191,6 +199,16 @@ AST_Exception::fe_add_field (AST_Field *t)
I_FALSE,
t->local_name ());
+ AST_Type *ft = t->field_type ();
+ UTL_ScopedName *mru = ft->last_referenced_as ();
+
+ if (mru != 0)
+ {
+ this->add_to_referenced (ft,
+ I_FALSE,
+ mru->first_component ());
+ }
+
this->fields_.enqueue_tail (t);
return t;
diff --git a/TAO/TAO_IDL/ast/ast_expression.cpp b/TAO/TAO_IDL/ast/ast_expression.cpp
index 6be7806fc4c..eaa196cdf9b 100644
--- a/TAO/TAO_IDL/ast/ast_expression.cpp
+++ b/TAO/TAO_IDL/ast/ast_expression.cpp
@@ -66,18 +66,26 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// AST_Expression nodes denote IDL expressions used in the IDL input.
-#include "idl.h"
-#include "idl_extern.h"
-
-ACE_RCSID(ast, ast_expression, "$Id$")
+#include "ast_expression.h"
+#include "ast_constant.h"
+#include "ast_visitor.h"
+#include "global_extern.h"
+#include "utl_err.h"
+#include "utl_scope.h"
+#include "utl_string.h"
+#include "nr_extern.h"
+
+ACE_RCSID (ast,
+ ast_expression,
+ "$Id$")
// Helper function to fill out the details of where this expression
// is defined.
void
AST_Expression::fill_definition_details (void)
{
- this->pd_defined_in = idl_global->scopes()->depth() > 0
- ? idl_global->scopes()->top()
+ this->pd_defined_in = idl_global->scopes ().depth () > 0
+ ? idl_global->scopes().top ()
: 0 ;
this->pd_line = idl_global->lineno ();
this->pd_file_name = idl_global->filename ();
@@ -88,10 +96,10 @@ AST_Expression::fill_definition_details (void)
// An AST_Expression denoting a symbolic name.
AST_Expression::AST_Expression (UTL_ScopedName *nm)
: pd_ec (EC_symbol),
- pd_ev (0),
- pd_v1 (0),
- pd_v2 (0),
- pd_n (nm)
+ pd_ev (0),
+ pd_v1 (0),
+ pd_v2 (0),
+ pd_n (nm)
{
this->fill_definition_details ();
}
@@ -99,11 +107,11 @@ AST_Expression::AST_Expression (UTL_ScopedName *nm)
// An AST_Expression denoting a type coercion from another AST_Expression.
AST_Expression::AST_Expression (AST_Expression *v,
ExprType t)
- : pd_ec (EC_none),
- pd_ev (0),
- pd_v1 (0),
- pd_v2 (0),
- pd_n (0)
+ : pd_ec (EC_none),
+ pd_ev (0),
+ pd_v1 (0),
+ pd_v2 (0),
+ pd_n (0)
{
this->fill_definition_details ();
@@ -120,12 +128,12 @@ AST_Expression::AST_Expression (AST_Expression *v,
// two other AST_Expressions.
AST_Expression::AST_Expression (ExprComb c,
AST_Expression *ev1,
- AST_Expression *ev2)
+ AST_Expression *ev2)
: pd_ec (c),
- pd_ev (0),
- pd_v1 (ev1),
- pd_v2 (ev2),
- pd_n (0)
+ pd_ev (0),
+ pd_v1 (ev1),
+ pd_v2 (ev2),
+ pd_n (0)
{
this->fill_definition_details ();
}
@@ -133,10 +141,10 @@ AST_Expression::AST_Expression (ExprComb c,
// An AST_Expression denoting a short integer.
AST_Expression::AST_Expression (short sv)
: pd_ec (EC_none),
- pd_ev (0),
- pd_v1 (0),
- pd_v2 (0),
- pd_n (0)
+ pd_ev (0),
+ pd_v1 (0),
+ pd_v2 (0),
+ pd_n (0)
{
this->fill_definition_details ();
@@ -150,10 +158,10 @@ AST_Expression::AST_Expression (short sv)
// An AST_Expression denoting an unsigned short integer.
AST_Expression::AST_Expression (unsigned short usv)
: pd_ec (EC_none),
- pd_ev (0),
- pd_v1 (0),
- pd_v2 (0),
- pd_n (0)
+ pd_ev (0),
+ pd_v1 (0),
+ pd_v2 (0),
+ pd_n (0)
{
this->fill_definition_details ();
@@ -167,10 +175,10 @@ AST_Expression::AST_Expression (unsigned short usv)
// An AST_Expression denoting a long integer.
AST_Expression::AST_Expression (long lv)
: pd_ec (EC_none),
- pd_ev (0),
- pd_v1 (0),
- pd_v2 (0),
- pd_n (0)
+ pd_ev (0),
+ pd_v1 (0),
+ pd_v2 (0),
+ pd_n (0)
{
this->fill_definition_details ();
@@ -184,11 +192,11 @@ AST_Expression::AST_Expression (long lv)
// An AST_Expression denoting a long integer being used as a boolean.
AST_Expression::AST_Expression (long lv,
ExprType t)
- : pd_ec (EC_none),
- pd_ev (0),
- pd_v1 (0),
- pd_v2 (0),
- pd_n (0)
+ : pd_ec (EC_none),
+ pd_ev (0),
+ pd_v1 (0),
+ pd_v2 (0),
+ pd_n (0)
{
this->fill_definition_details ();
@@ -202,11 +210,11 @@ AST_Expression::AST_Expression (long lv,
// An AST_Expression denoting an unsigned long integer.
AST_Expression::AST_Expression (unsigned long ulv)
- : pd_ec (EC_none),
- pd_ev (0),
- pd_v1 (0),
- pd_v2 (0),
- pd_n (NULL)
+ : pd_ec (EC_none),
+ pd_ev (0),
+ pd_v1 (0),
+ pd_v2 (0),
+ pd_n (NULL)
{
this->fill_definition_details ();
@@ -219,11 +227,11 @@ AST_Expression::AST_Expression (unsigned long ulv)
// An AST_Expression denoting a 32-bit floating point number.
AST_Expression::AST_Expression (float fv)
- : pd_ec (EC_none),
- pd_ev (0),
- pd_v1 (0),
- pd_v2 (0),
- pd_n (0)
+ : pd_ec (EC_none),
+ pd_ev (0),
+ pd_v1 (0),
+ pd_v2 (0),
+ pd_n (0)
{
this->fill_definition_details ();
@@ -236,11 +244,11 @@ AST_Expression::AST_Expression (float fv)
// An AST_Expression denoting a 64-bit floating point number.
AST_Expression::AST_Expression (double dv)
- : pd_ec (EC_none),
- pd_ev (0),
- pd_v1 (0),
- pd_v2 (NULL),
- pd_n (0)
+ : pd_ec (EC_none),
+ pd_ev (0),
+ pd_v1 (0),
+ pd_v2 (NULL),
+ pd_n (0)
{
this->fill_definition_details ();
@@ -253,11 +261,11 @@ AST_Expression::AST_Expression (double dv)
// An AST_Expression denoting a character.
AST_Expression::AST_Expression (char cv)
- : pd_ec (EC_none),
- pd_ev (0),
- pd_v1 (0),
- pd_v2 (0),
- pd_n (0)
+ : pd_ec (EC_none),
+ pd_ev (0),
+ pd_v1 (0),
+ pd_v2 (0),
+ pd_n (0)
{
this->fill_definition_details ();
@@ -270,11 +278,11 @@ AST_Expression::AST_Expression (char cv)
// An AST_Expression denoting a wide character.
AST_Expression::AST_Expression (ACE_OutputCDR::from_wchar wcv)
- : pd_ec (EC_none),
- pd_ev (0),
- pd_v1 (0),
- pd_v2 (0),
- pd_n (0)
+ : pd_ec (EC_none),
+ pd_ev (0),
+ pd_v1 (0),
+ pd_v2 (0),
+ pd_n (0)
{
this->fill_definition_details ();
@@ -287,11 +295,11 @@ AST_Expression::AST_Expression (ACE_OutputCDR::from_wchar wcv)
// An AST_Expression denoting an octet (unsigned char).
AST_Expression::AST_Expression (unsigned char ov)
- : pd_ec (EC_none),
- pd_ev (0),
- pd_v1 (0),
- pd_v2 (0),
- pd_n (NULL)
+ : pd_ec (EC_none),
+ pd_ev (0),
+ pd_v1 (0),
+ pd_v2 (0),
+ pd_n (NULL)
{
this->fill_definition_details ();
@@ -304,11 +312,11 @@ AST_Expression::AST_Expression (unsigned char ov)
// An AST_Expression denoting a string (char * encapsulated as a String).
AST_Expression::AST_Expression (UTL_String *sv)
- : pd_ec (EC_none),
- pd_ev (0),
- pd_v1 (0),
- pd_v2 (0),
- pd_n (0)
+ : pd_ec (EC_none),
+ pd_ev (0),
+ pd_v1 (0),
+ pd_v2 (0),
+ pd_n (0)
{
this->fill_definition_details ();
@@ -321,11 +329,11 @@ AST_Expression::AST_Expression (UTL_String *sv)
// An AST_Expression denoting a wide string.
AST_Expression::AST_Expression (char *sv)
- : pd_ec (EC_none),
- pd_ev (0),
- pd_v1 (0),
- pd_v2 (0),
- pd_n (0)
+ : pd_ec (EC_none),
+ pd_ev (0),
+ pd_v1 (0),
+ pd_v2 (0),
+ pd_n (0)
{
this->fill_definition_details ();
@@ -459,7 +467,7 @@ coerce_value (AST_Expression::AST_ExprValue *ev,
case AST_Expression::EV_longdouble:
case AST_Expression::EV_string:
case AST_Expression::EV_wstring:
- case AST_Expression::EV_any:
+ case AST_Expression::EV_enum:
case AST_Expression::EV_void:
case AST_Expression::EV_none:
return 0;
@@ -568,7 +576,7 @@ coerce_value (AST_Expression::AST_ExprValue *ev,
case AST_Expression::EV_longdouble:
case AST_Expression::EV_wstring:
case AST_Expression::EV_string:
- case AST_Expression::EV_any:
+ case AST_Expression::EV_enum:
case AST_Expression::EV_void:
case AST_Expression::EV_none:
return 0;
@@ -660,7 +668,7 @@ coerce_value (AST_Expression::AST_ExprValue *ev,
case AST_Expression::EV_longdouble:
case AST_Expression::EV_wstring:
case AST_Expression::EV_string:
- case AST_Expression::EV_any:
+ case AST_Expression::EV_enum:
case AST_Expression::EV_void:
case AST_Expression::EV_none:
return 0;
@@ -762,7 +770,7 @@ coerce_value (AST_Expression::AST_ExprValue *ev,
case AST_Expression::EV_longdouble:
case AST_Expression::EV_wstring:
case AST_Expression::EV_string:
- case AST_Expression::EV_any:
+ case AST_Expression::EV_enum:
case AST_Expression::EV_void:
case AST_Expression::EV_none:
return 0;
@@ -837,7 +845,7 @@ coerce_value (AST_Expression::AST_ExprValue *ev,
case AST_Expression::EV_longdouble:
case AST_Expression::EV_wstring:
case AST_Expression::EV_string:
- case AST_Expression::EV_any:
+ case AST_Expression::EV_enum:
case AST_Expression::EV_void:
case AST_Expression::EV_none:
return 0;
@@ -930,7 +938,7 @@ coerce_value (AST_Expression::AST_ExprValue *ev,
case AST_Expression::EV_longdouble:
case AST_Expression::EV_wstring:
case AST_Expression::EV_string:
- case AST_Expression::EV_any:
+ case AST_Expression::EV_enum:
case AST_Expression::EV_void:
case AST_Expression::EV_none:
return 0;
@@ -998,7 +1006,7 @@ coerce_value (AST_Expression::AST_ExprValue *ev,
case AST_Expression::EV_longdouble:
case AST_Expression::EV_wstring:
case AST_Expression::EV_string:
- case AST_Expression::EV_any:
+ case AST_Expression::EV_enum:
case AST_Expression::EV_void:
case AST_Expression::EV_none:
return 0;
@@ -1082,7 +1090,7 @@ coerce_value (AST_Expression::AST_ExprValue *ev,
case AST_Expression::EV_longdouble:
case AST_Expression::EV_wstring:
case AST_Expression::EV_string:
- case AST_Expression::EV_any:
+ case AST_Expression::EV_enum:
case AST_Expression::EV_void:
case AST_Expression::EV_none:
return 0;
@@ -1154,7 +1162,7 @@ coerce_value (AST_Expression::AST_ExprValue *ev,
case AST_Expression::EV_longdouble:
case AST_Expression::EV_wstring:
case AST_Expression::EV_string:
- case AST_Expression::EV_any:
+ case AST_Expression::EV_enum:
case AST_Expression::EV_void:
case AST_Expression::EV_none:
return 0;
@@ -1274,7 +1282,7 @@ coerce_value (AST_Expression::AST_ExprValue *ev,
case AST_Expression::EV_longdouble:
case AST_Expression::EV_wstring:
case AST_Expression::EV_string:
- case AST_Expression::EV_any:
+ case AST_Expression::EV_enum:
case AST_Expression::EV_void:
case AST_Expression::EV_none:
return 0;
@@ -1383,7 +1391,7 @@ coerce_value (AST_Expression::AST_ExprValue *ev,
case AST_Expression::EV_longdouble:
case AST_Expression::EV_wstring:
case AST_Expression::EV_string:
- case AST_Expression::EV_any:
+ case AST_Expression::EV_enum:
case AST_Expression::EV_void:
case AST_Expression::EV_none:
return 0;
@@ -1503,15 +1511,16 @@ coerce_value (AST_Expression::AST_ExprValue *ev,
case AST_Expression::EV_longdouble:
case AST_Expression::EV_wstring:
case AST_Expression::EV_string:
- case AST_Expression::EV_any:
+ case AST_Expression::EV_enum:
case AST_Expression::EV_void:
case AST_Expression::EV_none:
return 0;
}
- case AST_Expression::EV_any:
+ case AST_Expression::EV_enum:
switch (ev->et)
{
- case AST_Expression::EV_any:
+ case AST_Expression::EV_enum:
+ case AST_Expression::EV_ulong:
return ev;
default:
return 0;
@@ -1542,6 +1551,62 @@ coerce_value (AST_Expression::AST_ExprValue *ev,
return 0;
}
+// Integer literals may not be assigned to floating point constants,
+// and vice versa.
+static idl_bool
+incompatible_types (AST_Expression::ExprType t1,
+ AST_Expression::ExprType t2)
+{
+ switch (t1)
+ {
+ case AST_Expression::EV_short:
+ case AST_Expression::EV_ushort:
+ case AST_Expression::EV_long:
+ case AST_Expression::EV_ulong:
+ case AST_Expression::EV_longlong:
+ case AST_Expression::EV_ulonglong:
+ case AST_Expression::EV_octet:
+ case AST_Expression::EV_bool:
+ switch (t2)
+ {
+ case AST_Expression::EV_short:
+ case AST_Expression::EV_ushort:
+ case AST_Expression::EV_long:
+ case AST_Expression::EV_ulong:
+ case AST_Expression::EV_longlong:
+ case AST_Expression::EV_ulonglong:
+ case AST_Expression::EV_octet:
+ case AST_Expression::EV_bool:
+ return 0;
+ default:
+ return 1;
+ }
+ case AST_Expression::EV_float:
+ case AST_Expression::EV_double:
+ case AST_Expression::EV_longdouble:
+ switch (t2)
+ {
+ case AST_Expression::EV_float:
+ case AST_Expression::EV_double:
+ case AST_Expression::EV_longdouble:
+ return 0;
+ default:
+ return 1;
+ }
+ case AST_Expression::EV_char:
+ case AST_Expression::EV_wchar:
+ case AST_Expression::EV_string:
+ case AST_Expression::EV_wstring:
+ case AST_Expression::EV_enum:
+ case AST_Expression::EV_any:
+ case AST_Expression::EV_object:
+ case AST_Expression::EV_void:
+ case AST_Expression::EV_none:
+ default:
+ return 0;
+ }
+}
+
// Evaluate the expression wrt the evaluation kind requested. Supported
// evaluation kinds are
// - EK_const: The expression must evaluate to a constant
@@ -1594,29 +1659,30 @@ AST_Expression::eval_bin_op (AST_Expression::EvalKind ek)
{
return 0;
}
-
+// @@@ (JP) See comment below.
+/*
this->pd_v1->set_ev (this->pd_v1->eval_internal (ek));
if (this->pd_v1->ev () == 0)
{
return 0;
}
-
+*/
this->pd_v1->set_ev (this->pd_v1->coerce (EV_double));
if (this->pd_v1->ev () == 0)
{
return 0;
}
-
+/*
this->pd_v2->set_ev (this->pd_v2->eval_internal (ek));
if (this->pd_v2->ev () == 0)
{
return 0;
}
-
- this->pd_v2->set_ev (this->pd_v2->coerce(EV_double));
+*/
+ this->pd_v2->set_ev (this->pd_v2->coerce (EV_double));
if (pd_v2->ev () == 0)
{
@@ -1659,12 +1725,21 @@ AST_Expression::eval_bin_op (AST_Expression::EvalKind ek)
}
retval->u.dval =
- this->pd_v1->ev ()->u.dval / this->pd_v2->ev ()->u.dval;
+ this->pd_v1->ev ()->u.dval / this->pd_v2->ev ()->u.dval;
break;
default:
return 0;
}
+ // @@@ (JP) CORBA 2.6 and earlier say that in a constant expression,
+ // each subexpression must fall within the range of the assigned type.
+ // However, this may be hard for the compiler in some cases (must
+ // evaluate all grouping possibilities). So there is an outstanding
+ // issue, #1139, and the best guess is that it will ultimately be
+ // decided that only the final value must fall within the range of
+ // the assigned type. So I've commented out the checks above, and
+ // added this final evaluation below. (02-06-25).
+// return eval_kind (retval, ek);
return retval;
}
@@ -1892,9 +1967,9 @@ AST_Expression::eval_symbol (AST_Expression::EvalKind ek)
}
// Get current scope for lookup.
- if (idl_global->scopes ()->depth() > 0)
+ if (idl_global->scopes ().depth () > 0)
{
- s = idl_global->scopes ()->top_non_null ();
+ s = idl_global->scopes ().top_non_null ();
}
if (s == 0)
@@ -1933,6 +2008,64 @@ AST_Expression::eval_symbol (AST_Expression::EvalKind ek)
return c->constant_value ()->eval_internal (ek);
}
+idl_bool
+AST_Expression::type_mismatch (AST_Expression::ExprType t)
+{
+ if (this->pd_ev != 0)
+ {
+ return incompatible_types (this->pd_ev->et, t);
+ }
+
+ idl_bool v1_mismatch = 0;
+ idl_bool v2_mismatch = 0;
+
+ if (this->pd_v1 != 0)
+ {
+ v1_mismatch = this->pd_v1->type_mismatch (t);
+ }
+
+ if (this->pd_v2 != 0)
+ {
+ v2_mismatch = this->pd_v2->type_mismatch (t);
+ }
+
+ return v1_mismatch | v2_mismatch;
+}
+
+// Coerce "this" to the ExprType required. Returns a copy of the
+// original ExprValue with the coercion applied, if successful, or
+// 0 if failed.
+AST_Expression::AST_ExprValue *
+AST_Expression::check_and_coerce (AST_Expression::ExprType t,
+ AST_Decl *d)
+{
+ if (d != 0)
+ {
+ AST_Decl *enum_val =
+ idl_global->scopes ().top_non_null ()->lookup_by_name (this->pd_n,
+ 1);
+
+ if (enum_val != 0)
+ {
+ AST_Decl *enum_decl = ScopeAsDecl (enum_val->defined_in ());
+
+ if (d != enum_decl)
+ {
+ idl_global->err ()->incompatible_type_error (this);
+ return 0;
+ }
+ }
+ }
+
+ if (this->type_mismatch (t))
+ {
+ idl_global->err ()->incompatible_type_error (this);
+ return 0;
+ }
+
+ return this->coerce (t);
+}
+
// Coerce "this" to the ExprType required. Returns a copy of the
// original ExprValue with the coercion applied, if successful, or
// 0 if failed.
@@ -1989,7 +2122,7 @@ AST_Expression::coerce (AST_Expression::ExprType t)
case EV_longdouble:
case EV_void:
case EV_none:
- case EV_any:
+ case EV_enum:
return 0;
case EV_short:
copy->u.sval = this->pd_ev->u.sval;
@@ -2206,7 +2339,7 @@ AST_Expression::operator== (AST_Expression *vc)
#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
case EV_longdouble:
case EV_wstring:
- case EV_any:
+ case EV_enum:
case EV_void:
case EV_none:
return I_FALSE;
@@ -2293,7 +2426,7 @@ AST_Expression::compare (AST_Expression *vc)
#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
case EV_longdouble:
case EV_wstring:
- case EV_any:
+ case EV_enum:
case EV_void:
case EV_none:
return I_FALSE;
@@ -2372,7 +2505,7 @@ dump_expr_val (ACE_OSTREAM_TYPE &o,
o << (ev->u.bval == I_TRUE ? "TRUE" : "FALSE");
break;
case AST_Expression::EV_string:
- if (ev->u.strval != NULL)
+ if (ev->u.strval != 0)
ev->u.strval->dump(o);
case AST_Expression::EV_longlong:
#if ! defined (ACE_LACKS_LONGLONG_T)
@@ -2386,7 +2519,7 @@ dump_expr_val (ACE_OSTREAM_TYPE &o,
break;
case AST_Expression::EV_longdouble:
case AST_Expression::EV_wstring:
- case AST_Expression::EV_any:
+ case AST_Expression::EV_enum:
case AST_Expression::EV_none:
case AST_Expression::EV_void:
break;
@@ -2504,6 +2637,13 @@ AST_Expression::ast_accept (ast_visitor *visitor)
return visitor->visit_expression (this);
}
+void
+AST_Expression::destroy (void)
+{
+// delete this->pd_ev;
+// this->pd_ev = 0;
+}
+
// Data accessors.
UTL_Scope *
diff --git a/TAO/TAO_IDL/ast/ast_factory.cpp b/TAO/TAO_IDL/ast/ast_factory.cpp
index 2d464a1da90..c689d40e33d 100644
--- a/TAO/TAO_IDL/ast/ast_factory.cpp
+++ b/TAO/TAO_IDL/ast/ast_factory.cpp
@@ -68,12 +68,16 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// AST_Factory is a subclass of AST_Decl (it is not a type!)
// and of UTL_Scope (the arguments are managed in a scope).
-#include "idl.h"
-#include "idl_extern.h"
+#include "ast_factory.h"
+#include "ast_argument.h"
+#include "ast_visitor.h"
+#include "global_extern.h"
+#include "utl_err.h"
+#include "utl_identifier.h"
-ACE_RCSID(ast, ast_factory, "$Id$")
-
-// Constructor(s) and destructor.
+ACE_RCSID (ast,
+ ast_factory,
+ "$Id$")
AST_Factory::AST_Factory (void)
: argument_count_ (-1),
@@ -217,14 +221,14 @@ void
AST_Factory::dump (ostream &o)
{
AST_Decl *d = 0;
- UTL_ScopeActiveIterator i (this,
- IK_decls);
o << "factory ";
this->local_name ()->dump (o);
o << "(";
- while (!i.is_done())
+ // Iterator must be explicitly advanced inside the loop.
+ for (UTL_ScopeActiveIterator i (this, IK_decls);
+ !i.is_done();)
{
d = i.item ();
d->dump (o);
diff --git a/TAO/TAO_IDL/ast/ast_field.cpp b/TAO/TAO_IDL/ast/ast_field.cpp
index 7d2c40dd351..cd63688e7c8 100644
--- a/TAO/TAO_IDL/ast/ast_field.cpp
+++ b/TAO/TAO_IDL/ast/ast_field.cpp
@@ -74,14 +74,13 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// AST_Field nodes, the other to be used in constructing AST_Argument
// nodes and AST_UnionBranch nodes.
-#include "idl.h"
-#include "idl_extern.h"
+#include "ast_field.h"
+#include "ast_type.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
-ACE_RCSID(ast, ast_field, "$Id$")
+ACE_RCSID (ast, ast_field, "$Id$")
-// Constructor(s) and destructor.
-
-// Default constructor.
AST_Field::AST_Field (void)
: pd_field_type (0),
pd_visibility (vis_NA)
@@ -115,8 +114,6 @@ AST_Field::~AST_Field (void)
{
}
-// Redefinition of inherited virtual operations.
-
// Dump this AST_Field node to the ostream o.
void
AST_Field::dump (ACE_OSTREAM_TYPE &o)
@@ -125,16 +122,20 @@ AST_Field::dump (ACE_OSTREAM_TYPE &o)
{
case vis_PRIVATE:
o << "private ";
+
break;
case vis_PUBLIC:
o << "public ";
+
break;
case vis_NA:
break;
}
this->pd_field_type->local_name ()->dump (o);
+
o << " ";
+
this->local_name ()->dump (o);
}
@@ -144,8 +145,6 @@ AST_Field::ast_accept (ast_visitor *visitor)
return visitor->visit_field (this);
}
-// Data accessors.
-
AST_Type *
AST_Field::field_type (void)
{
diff --git a/TAO/TAO_IDL/ast/ast_generator.cpp b/TAO/TAO_IDL/ast/ast_generator.cpp
index f3cbc233004..0c6b6318db1 100644
--- a/TAO/TAO_IDL/ast/ast_generator.cpp
+++ b/TAO/TAO_IDL/ast/ast_generator.cpp
@@ -70,16 +70,34 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// of the AST nodes. It contains an operation for every constructor
// of every AST class.
-#include "idl.h"
-#include "idl_extern.h"
+#include "ast_root.h"
+#include "ast_valuetype.h"
+#include "ast_valuetype_fwd.h"
+#include "ast_component.h"
+#include "ast_component_fwd.h"
+#include "ast_home.h"
+#include "ast_exception.h"
+#include "ast_enum.h"
+#include "ast_attribute.h"
+#include "ast_union.h"
+#include "ast_union_fwd.h"
+#include "ast_union_branch.h"
+#include "ast_enum_val.h"
+#include "ast_array.h"
+#include "ast_sequence.h"
+#include "ast_string.h"
+#include "ast_structure_fwd.h"
+#include "ast_native.h"
+#include "ast_factory.h"
+#include "utl_identifier.h"
+#include "nr_extern.h"
+
+#include "ast_generator.h"
+
+ACE_RCSID (ast,
+ ast_generator,
+ "$Id$")
-#include "ace/config-all.h"
-
-ACE_RCSID(ast, ast_generator, "$Id$")
-
-// Public operations.
-
-// Construct an AST_PredefinedType node (a predefined type).
AST_PredefinedType *
AST_Generator::create_predefined_type (AST_PredefinedType::PredefinedType t,
UTL_ScopedName *n)
@@ -93,12 +111,11 @@ AST_Generator::create_predefined_type (AST_PredefinedType::PredefinedType t,
return retval;
}
-// Construct an AST_Module node (a module).
AST_Module *
AST_Generator::create_module (UTL_Scope *s,
UTL_ScopedName *n)
{
- // We create this first so if we find a module with the
+ // We create this first so if we find a module with the
// same name from an included file, we can add its
// members to the new module's scope.
AST_Module *retval = 0;
@@ -171,7 +188,6 @@ AST_Generator::create_module (UTL_Scope *s,
return retval;
}
-// Construct an AST_Root node (a node representing the root of an AST).
AST_Root *
AST_Generator::create_root (UTL_ScopedName *n)
{
@@ -183,32 +199,29 @@ AST_Generator::create_root (UTL_ScopedName *n)
return retval;
}
-// Construct an AST_Interface node (an interface).
AST_Interface *
AST_Generator::create_interface (UTL_ScopedName *n,
- AST_Interface **ih,
- long nih,
- AST_Interface **ih_flat,
- long nih_flat,
- idl_bool l,
- idl_bool a)
+ AST_Interface **inherits,
+ long n_inherits,
+ AST_Interface **inherits_flat,
+ long n_inherits_flat,
+ idl_bool local,
+ idl_bool abstract)
{
AST_Interface *retval = 0;
ACE_NEW_RETURN (retval,
AST_Interface (n,
- ih,
- nih,
- ih_flat,
- nih_flat,
- l,
- a),
+ inherits,
+ n_inherits,
+ inherits_flat,
+ n_inherits_flat,
+ local,
+ abstract),
0);
return retval;
}
-// Construct an AST_InterfaceFwd node (a node representing the forward
-// declaration of an interface).
AST_InterfaceFwd *
AST_Generator::create_interface_fwd (UTL_ScopedName *n,
idl_bool local,
@@ -229,30 +242,34 @@ AST_Generator::create_interface_fwd (UTL_ScopedName *n,
return retval;
}
-// Create an AST_Interface node which is a valuetype.
-AST_Interface *
+AST_ValueType *
AST_Generator::create_valuetype (UTL_ScopedName *n,
- AST_Interface **ih,
- long nih)
-{
- AST_Interface *retval = 0;
- ACE_NEW_RETURN (retval,
- AST_Interface (n,
- ih,
- nih,
- 0,
- 0,
- 0,
- 0),
+ AST_Interface **inherits,
+ long n_inherits,
+ AST_ValueType *inherits_concrete,
+ AST_Interface **inherits_flat,
+ long n_inherits_flat,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface *supports_concrete,
+ idl_bool abstract,
+ idl_bool truncatable)
+{
+ AST_ValueType *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_ValueType (n,
+ inherits,
+ n_inherits,
+ inherits_concrete,
+ inherits_flat,
+ n_inherits_flat,
+ supports,
+ n_supports,
+ supports_concrete,
+ abstract,
+ truncatable),
0);
- // Valuetypes are represented as be_valuetype derived from be_interface,
- // which derives from AST_Interface. If you construct a backend which
- // utilizes only the AST_... classes, you must instantiate an object that
- // returns true from AST_Interface::is_valuetype().
- // (@@@ (JP) implemented 2000/10/4)
- retval->set_valuetype ();
-
// The following helps with OBV_ namespace generation.
AST_Module *m = AST_Module::narrow_from_scope (retval->defined_in ());
@@ -264,29 +281,96 @@ AST_Generator::create_valuetype (UTL_ScopedName *n,
return retval;
}
-// Create an AST_InterfaceFwd node whose full_definition
-// member is a valuetype.
-AST_InterfaceFwd *
-AST_Generator::create_valuetype_fwd (UTL_ScopedName *n)
+AST_ValueTypeFwd *
+AST_Generator::create_valuetype_fwd (UTL_ScopedName *n,
+ idl_bool abstract)
+{
+ AST_ValueType *dummy = this->create_valuetype (n,
+ 0,
+ -1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ abstract,
+ I_FALSE);
+
+ AST_ValueTypeFwd *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_ValueTypeFwd (dummy,
+ n),
+ 0);
+
+ return retval;
+}
+
+AST_Component *
+AST_Generator::create_component (UTL_ScopedName *n,
+ AST_Component *base_component,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface **supports_flat,
+ long n_supports_flat)
{
- // See note in create_valuetype().
- // Dummy placeholder must return true from is_valuetype().
+ AST_Component *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Component (n,
+ base_component,
+ supports,
+ n_supports,
+ supports_flat,
+ n_supports_flat),
+ 0);
+
+ return retval;
+}
- AST_Interface *dummy = this->create_valuetype (n,
+AST_ComponentFwd *
+AST_Generator::create_component_fwd (UTL_ScopedName *n)
+{
+ AST_Component *dummy = this->create_component (n,
+ 0,
+ 0,
+ -1,
0,
- -1);
+ 0);
- AST_InterfaceFwd *retval = 0;
+ AST_ComponentFwd *retval = 0;
ACE_NEW_RETURN (retval,
- AST_InterfaceFwd (dummy,
+ AST_ComponentFwd (dummy,
n),
0);
return retval;
}
+AST_Home *
+AST_Generator::create_home (UTL_ScopedName *n,
+ AST_Home *base_home,
+ AST_Component *managed_component,
+ AST_ValueType *primary_key,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface **supports_flat,
+ long n_supports_flat)
+{
+ AST_Home *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_Home (n,
+ base_home,
+ managed_component,
+ primary_key,
+ supports,
+ n_supports,
+ supports_flat,
+ n_supports_flat),
+ 0);
+
+ return retval;
+}
-// Construct an AST_Exception node (an exception).
AST_Exception *
AST_Generator::create_exception (UTL_ScopedName *n,
idl_bool local,
@@ -302,7 +386,6 @@ AST_Generator::create_exception (UTL_ScopedName *n,
return retval;
}
-// Construct an AST_Structure node (a struct).
AST_Structure *
AST_Generator::create_structure (UTL_ScopedName *n,
idl_bool local,
@@ -318,7 +401,17 @@ AST_Generator::create_structure (UTL_ScopedName *n,
return retval;
}
-// Construct an AST_Enum node (an enum).
+AST_StructureFwd *
+AST_Generator::create_structure_fwd (UTL_ScopedName *n)
+{
+ AST_StructureFwd *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_StructureFwd (n),
+ 0);
+
+ return retval;
+}
+
AST_Enum *
AST_Generator::create_enum (UTL_ScopedName *n,
idl_bool local,
@@ -334,7 +427,6 @@ AST_Generator::create_enum (UTL_ScopedName *n,
return retval;
}
-// Construct an AST_Operation node (an operation on an interface).
AST_Operation *
AST_Generator::create_operation (AST_Type *rt,
AST_Operation::Flags fl,
@@ -354,7 +446,6 @@ AST_Generator::create_operation (AST_Type *rt,
return retval;
}
-// Construct an AST_Field node (a field in a struct, union or exception).
AST_Field *
AST_Generator::create_field (AST_Type *ft,
UTL_ScopedName *n,
@@ -370,7 +461,6 @@ AST_Generator::create_field (AST_Type *ft,
return retval;
}
-// Construct an AST_Argument node (an argument to an operation).
AST_Argument *
AST_Generator::create_argument (AST_Argument::Direction d,
AST_Type *ft,
@@ -386,7 +476,6 @@ AST_Generator::create_argument (AST_Argument::Direction d,
return retval;
}
-// Construct an AST_Attribute node (an attribute).
AST_Attribute *
AST_Generator::create_attribute (idl_bool ro,
AST_Type *ft,
@@ -406,7 +495,6 @@ AST_Generator::create_attribute (idl_bool ro,
return retval;
}
-// Construct an AST_Union node (a union).
AST_Union *
AST_Generator::create_union (AST_ConcreteType *dt,
UTL_ScopedName *n,
@@ -424,7 +512,17 @@ AST_Generator::create_union (AST_ConcreteType *dt,
return retval;
}
-// Construct an AST_UnionBranch node (a branch in a union).
+AST_UnionFwd *
+AST_Generator::create_union_fwd (UTL_ScopedName *n)
+{
+ AST_UnionFwd *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_UnionFwd (n),
+ 0);
+
+ return retval;
+}
+
AST_UnionBranch *
AST_Generator::create_union_branch (UTL_LabelList *ll,
AST_Type *ft,
@@ -440,7 +538,6 @@ AST_Generator::create_union_branch (UTL_LabelList *ll,
return retval;
}
-// Construct an AST_UnionLabel node (a label in a union).
AST_UnionLabel *
AST_Generator::create_union_label (AST_UnionLabel::UnionLabel ul,
AST_Expression *v)
@@ -454,7 +551,6 @@ AST_Generator::create_union_label (AST_UnionLabel::UnionLabel ul,
return retval;
}
-// Construct an AST_Constant node (a constant).
AST_Constant *
AST_Generator::create_constant (AST_Expression::ExprType et,
AST_Expression *ev,
@@ -470,7 +566,6 @@ AST_Generator::create_constant (AST_Expression::ExprType et,
return retval;
}
-// Construct an AST_Expression node denoting a symbolic name.
AST_Expression *
AST_Generator::create_expr (UTL_ScopedName *n)
{
@@ -482,7 +577,6 @@ AST_Generator::create_expr (UTL_ScopedName *n)
return retval;
}
-// Construct an AST_Expression denoting a coercion.
AST_Expression *
AST_Generator::create_expr (AST_Expression *v,
AST_Expression::ExprType t)
@@ -496,8 +590,6 @@ AST_Generator::create_expr (AST_Expression *v,
return retval;
}
-// Construct an AST_Expression node denoting a binary combinator.
-// of two other AST_Expression nodes
AST_Expression *
AST_Generator::create_expr (AST_Expression::ExprComb c,
AST_Expression *v1,
@@ -513,7 +605,6 @@ AST_Generator::create_expr (AST_Expression::ExprComb c,
return retval;
}
-// Construct an AST_Expression node denoting a long integer.
AST_Expression *
AST_Generator::create_expr (long v)
{
@@ -525,8 +616,6 @@ AST_Generator::create_expr (long v)
return retval;
}
-// Construct an AST_Expression node denoting a long integer being used.
-// as a boolean
AST_Expression *
AST_Generator::create_expr (long v,
AST_Expression::ExprType t)
@@ -540,7 +629,6 @@ AST_Generator::create_expr (long v,
return retval;
}
-// Construct an AST_Expression node denoting an unsigned long integer.
AST_Expression *
AST_Generator::create_expr (unsigned long v)
{
@@ -552,8 +640,6 @@ AST_Generator::create_expr (unsigned long v)
return retval;
}
-// Construct an AST_Expression node denoting a string (a char *
-// encapsulated as String).
AST_Expression *
AST_Generator::create_expr (UTL_String *s)
{
@@ -565,7 +651,6 @@ AST_Generator::create_expr (UTL_String *s)
return retval;
}
-// Construct an AST_Expression node denoting a character.
AST_Expression *
AST_Generator::create_expr (char c)
{
@@ -577,7 +662,6 @@ AST_Generator::create_expr (char c)
return retval;
}
-// Construct an AST_Expression node denoting a wide character.
AST_Expression *
AST_Generator::create_expr (ACE_OutputCDR::from_wchar wc)
{
@@ -589,7 +673,6 @@ AST_Generator::create_expr (ACE_OutputCDR::from_wchar wc)
return retval;
}
-// Construct an AST_Expression node denoting a wide string.
AST_Expression *
AST_Generator::create_expr (char *s)
{
@@ -601,7 +684,6 @@ AST_Generator::create_expr (char *s)
return retval;
}
-// Construct an AST_Expression node denoting a 64-bit floating point number.
AST_Expression *
AST_Generator::create_expr (double d)
{
@@ -613,7 +695,6 @@ AST_Generator::create_expr (double d)
return retval;
}
-// Construct an AST_EnumVal node (an enumerator).
AST_EnumVal *
AST_Generator::create_enum_val (unsigned long v,
UTL_ScopedName *n)
@@ -627,7 +708,6 @@ AST_Generator::create_enum_val (unsigned long v,
return retval;
}
-// Construct an AST_Array node (an array type or field modifier).
AST_Array *
AST_Generator::create_array (UTL_ScopedName *n,
unsigned long ndims,
@@ -647,10 +727,10 @@ AST_Generator::create_array (UTL_ScopedName *n,
return retval;
}
-// Construct an AST_Sequence node (a sequence type definition).
AST_Sequence *
AST_Generator::create_sequence (AST_Expression *ms,
AST_Type *bt,
+ UTL_ScopedName *n,
idl_bool local,
idl_bool abstract)
{
@@ -658,6 +738,7 @@ AST_Generator::create_sequence (AST_Expression *ms,
ACE_NEW_RETURN (retval,
AST_Sequence (ms,
bt,
+ n,
local,
abstract),
0);
@@ -665,32 +746,46 @@ AST_Generator::create_sequence (AST_Expression *ms,
return retval;
}
-// Construct an AST_String node (a string type definition).
AST_String *
AST_Generator::create_string (AST_Expression *ms)
{
+ Identifier id ("string");
+ UTL_ScopedName n (&id,
+ 0);
+
AST_String *retval = 0;
ACE_NEW_RETURN (retval,
- AST_String (ms),
+ AST_String (AST_Decl::NT_string,
+ &n,
+ ms),
0);
return retval;
}
-// Construct an AST_String node denoting a wide string type definition.
AST_String *
AST_Generator::create_wstring (AST_Expression *ms)
{
+ Identifier id (sizeof (ACE_CDR::WChar) == 1
+ ? "string"
+ : "wstring");
+ UTL_ScopedName n (&id,
+ 0);
+ AST_Decl::NodeType nt = sizeof (ACE_CDR::WChar) == 1
+ ? AST_Decl::NT_string
+ : AST_Decl::NT_wstring;
+
AST_String *retval = 0;
ACE_NEW_RETURN (retval,
- AST_String (ms,
+ AST_String (nt,
+ &n,
+ ms,
sizeof (ACE_OS::WChar)),
0);
return retval;
}
-// Construct an AST_Typedef node (a typedef).
AST_Typedef *
AST_Generator::create_typedef (AST_Type *bt,
UTL_ScopedName *n,
@@ -708,7 +803,6 @@ AST_Generator::create_typedef (AST_Type *bt,
return retval;
}
-// Construct an AST_Native node.
AST_Native *
AST_Generator::create_native (UTL_ScopedName *n)
{
diff --git a/TAO/TAO_IDL/ast/ast_home.cpp b/TAO/TAO_IDL/ast/ast_home.cpp
new file mode 100644
index 00000000000..32cc57b1b88
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_home.cpp
@@ -0,0 +1,137 @@
+// $Id$
+
+#include "ast_home.h"
+#include "ast_component.h"
+#include "ast_valuetype.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
+#include "utl_indenter.h"
+#include "global_extern.h"
+
+ACE_RCSID (ast,
+ ast_home,
+ "$Id$")
+
+AST_Home::AST_Home (void)
+ : pd_base_home (0),
+ pd_managed_component (0),
+ pd_primary_key (0)
+{
+}
+
+AST_Home::AST_Home (UTL_ScopedName *n,
+ AST_Home *base_home,
+ AST_Component *managed_component,
+ AST_ValueType *primary_key,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface **supports_flat,
+ long n_supports_flat)
+ : AST_Interface (n,
+ supports,
+ n_supports,
+ supports_flat,
+ n_supports_flat,
+ I_FALSE,
+ I_FALSE),
+ AST_Type (AST_Decl::NT_home,
+ n),
+ AST_Decl (AST_Decl::NT_home,
+ n),
+ UTL_Scope (AST_Decl::NT_home),
+ COMMON_Base (I_FALSE,
+ I_FALSE),
+ pd_base_home (base_home),
+ pd_managed_component (managed_component),
+ pd_primary_key (primary_key)
+{
+}
+
+AST_Home::~AST_Home (void)
+{
+}
+
+AST_Home *
+AST_Home::base_home (void) const
+{
+ return this->pd_base_home;
+}
+
+AST_Component *
+AST_Home::managed_component (void) const
+{
+ return this->pd_managed_component;
+}
+
+AST_ValueType *
+AST_Home::primary_key (void) const
+{
+ return this->pd_primary_key;
+}
+
+ACE_Unbounded_Queue<AST_Operation *> &
+AST_Home::factories (void)
+{
+ return this->pd_factories;
+}
+
+ACE_Unbounded_Queue<AST_Operation *> &
+AST_Home::finders (void)
+{
+ return this->pd_finders;
+}
+
+void
+AST_Home::destroy (void)
+{
+ this->AST_Interface::destroy ();
+}
+
+void
+AST_Home::dump (ACE_OSTREAM_TYPE &o)
+{
+ o << "home ";
+
+ this->local_name ()->dump (o);
+
+ o << " ";
+
+ if (this->pd_base_home != 0)
+ {
+ o << ": ";
+ this->pd_base_home->local_name ()->dump (o);
+ }
+
+ if (this->pd_managed_component != 0)
+ {
+ o << "\n";
+ o << "manages ";
+ this->pd_managed_component->local_name ()->dump (o);
+ }
+
+ if (this->pd_primary_key != 0)
+ {
+ o << "\n";
+ o << "primary key ";
+ this->pd_primary_key->local_name ()->dump (o);
+ }
+
+ o << " {\n";
+
+ UTL_Scope::dump (o);
+ idl_global->indent ()->skip_to (o);
+
+ o << "}";
+}
+
+int
+AST_Home::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_home (this);
+}
+
+ // Narrowing.
+IMPL_NARROW_METHODS1(AST_Home, AST_Interface);
+IMPL_NARROW_FROM_DECL(AST_Home);
+IMPL_NARROW_FROM_SCOPE(AST_Home);
+
diff --git a/TAO/TAO_IDL/ast/ast_interface.cpp b/TAO/TAO_IDL/ast/ast_interface.cpp
index 4fade4b5971..257097fedbe 100644
--- a/TAO/TAO_IDL/ast/ast_interface.cpp
+++ b/TAO/TAO_IDL/ast/ast_interface.cpp
@@ -71,35 +71,55 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// represents the total number of unique (recursively) inherited
// interfaces.
-#include "idl.h"
-#include "idl_extern.h"
-
-ACE_RCSID(ast, ast_interface, "$Id$")
-
-// Constructor(s) and destructor.
+#include "ast_interface.h"
+#include "ast_interface_fwd.h"
+#include "ast_valuetype.h"
+#include "ast_component.h"
+#include "ast_constant.h"
+#include "ast_exception.h"
+#include "ast_attribute.h"
+#include "ast_operation.h"
+#include "ast_field.h"
+#include "ast_enum.h"
+#include "ast_enum_val.h"
+#include "ast_union.h"
+#include "ast_union_fwd.h"
+#include "ast_structure_fwd.h"
+#include "ast_native.h"
+#include "ast_visitor.h"
+#include "ast_extern.h"
+#include "utl_err.h"
+#include "utl_identifier.h"
+#include "utl_indenter.h"
+#include "global_extern.h"
+#include "nr_extern.h"
+
+ACE_RCSID (ast,
+ ast_interface,
+ "$Id$")
AST_Interface::AST_Interface (void)
- : is_valuetype_ (0),
- pd_inherits (0),
+ : pd_inherits (0),
pd_n_inherits (0),
pd_inherits_flat (0),
pd_n_inherits_flat (0)
{
}
-AST_Interface::AST_Interface(UTL_ScopedName *n,
- AST_Interface **ih,
- long nih,
- AST_Interface **ih_flat,
- long nih_flat,
- idl_bool local,
- idl_bool abstract)
- : AST_Decl (AST_Decl::NT_interface,
+AST_Interface::AST_Interface (UTL_ScopedName *n,
+ AST_Interface **ih,
+ long nih,
+ AST_Interface **ih_flat,
+ long nih_flat,
+ idl_bool local,
+ idl_bool abstract)
+ : AST_Type (AST_Decl::NT_interface,
+ n),
+ AST_Decl (AST_Decl::NT_interface,
n),
UTL_Scope (AST_Decl::NT_interface),
COMMON_Base (local,
abstract),
- is_valuetype_ (0),
pd_inherits (ih),
pd_n_inherits (nih),
pd_inherits_flat (ih_flat),
@@ -113,46 +133,21 @@ AST_Interface::~AST_Interface (void)
// Public operations.
-idl_bool
-AST_Interface::is_valuetype (void)
-{
- return this->is_valuetype_;
-}
-
-void
-AST_Interface::set_valuetype (void)
-{
- this->is_valuetype_ = 1;
-}
-
-idl_bool
-AST_Interface::is_abstract_valuetype (void)
-{
- return this->is_valuetype_ && this->is_abstract_;
-}
-
-void
-AST_Interface::set_abstract_valuetype (void)
-{
- this->is_valuetype_ = 1;
- this->is_abstract_ = 1;
-}
-
void
AST_Interface::be_replace_operation (AST_Decl *old_op,
AST_Decl *new_op)
{
- replace_scope (old_op,
- new_op);
+ this->replace_scope (old_op,
+ new_op);
- replace_referenced (old_op,
- new_op);
+ this->replace_referenced (old_op,
+ new_op);
}
void
AST_Interface::be_add_operation (AST_Operation *op)
{
- fe_add_operation (op);
+ this->fe_add_operation (op);
}
// Add an AST_Constant node (a constant declaration) to this scope.
@@ -370,7 +365,7 @@ AST_Interface::fe_add_field (AST_Field *t)
// Add an AST_Operation node (an operation declaration) to this scope.
AST_Operation *
-AST_Interface::fe_add_operation(AST_Operation *t)
+AST_Interface::fe_add_operation (AST_Operation *t)
{
AST_Decl *d = 0;
@@ -411,6 +406,17 @@ AST_Interface::fe_add_operation(AST_Operation *t)
return 0;
}
}
+ else if ((d = this->look_in_inherited (t->name (), I_FALSE)) != 0)
+ {
+ if (d->node_type () == AST_Decl::NT_op)
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ t,
+ this,
+ d);
+ return 0;
+ }
+ }
// Add it to scope.
this->add_to_scope (t);
@@ -427,42 +433,66 @@ AST_Interface::fe_add_operation(AST_Operation *t)
AST_Structure *
AST_Interface::fe_add_structure (AST_Structure *t)
{
- AST_Decl *d = 0;
+ AST_Decl *predef = 0;
+ AST_StructureFwd *fwd = 0;
- // Can't add to interface which was not yet defined.
- if (!this->is_defined ())
+ if ((predef = this->lookup_for_add (t, I_FALSE)) != 0)
{
- idl_global->err ()->error2 (UTL_Error::EIDL_DECL_NOT_DEFINED,
- this,
- t);
- return 0;
- }
+ // Treat fwd declared interfaces specially
+ if (predef->node_type () == AST_Decl::NT_struct_fwd)
+ {
+ fwd = AST_StructureFwd::narrow_from_decl (predef);
- // Already defined and cannot be redefined? Or already used?
- if ((d = this->lookup_for_add (t, I_FALSE)) != 0)
- {
- if (!can_be_redefined (d))
+ if (fwd == 0)
+ {
+ return 0;
+ }
+
+ // Forward declared and not defined yet.
+ if (!fwd->is_defined ())
+ {
+ if (fwd->defined_in () == this)
+ {
+ fwd->set_full_definition (t);
+ }
+ else
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_SCOPE_CONFLICT,
+ fwd,
+ t,
+ this);
+
+ return 0;
+ }
+ }
+ // OK, not illegal redef of forward declaration. Now check whether.
+ // it has been referenced already.
+ else if (this->referenced (predef, t->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ this,
+ predef);
+
+ return 0;
+ }
+ }
+ else if (!can_be_redefined (predef))
{
idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
t,
this,
- d);
+ predef);
+
return 0;
}
-
- if (this->referenced (d, t->local_name ()))
+ else if (referenced (predef, t->local_name ()) && !t->is_defined ())
{
idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
t,
this,
- d);
- return 0;
- }
+ predef);
- if (t->has_ancestor (d))
- {
- idl_global->err ()->redefinition_in_scope (t,
- d);
return 0;
}
}
@@ -478,6 +508,84 @@ AST_Interface::fe_add_structure (AST_Structure *t)
return t;
}
+// Add this AST_StructureFwd node (a forward declaration of an IDL
+// struct) to this scope.
+AST_StructureFwd *
+AST_Interface::fe_add_structure_fwd (AST_StructureFwd *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, I_FALSE)) != 0)
+ {
+ AST_Decl::NodeType nt = d->node_type ();
+
+ // There used to be another check here ANDed with the one below:
+ // d->defined_in () == this. But lookup_for_add() calls only
+ // lookup_by_name_local(), which does not bump up the scope.
+ if (nt == AST_Decl::NT_struct_fwd)
+ {
+ // It's legal to forward declare something more than once,
+ // but we need only one entry in the scope for lookup.
+ AST_StructureFwd *fd = AST_StructureFwd::narrow_from_decl (d);
+ t->destroy ();
+ delete t;
+ t = 0;
+ return fd;
+ }
+ else if (nt == AST_Decl::NT_struct)
+ {
+ AST_Structure *s = AST_Structure::narrow_from_decl (d);
+ t->set_full_definition (s);
+
+ if (t->added () == 0)
+ {
+ t->set_added (1);
+ this->add_to_scope (t);
+
+ // Must check later that all struct and union forward declarations
+ // are defined in the same IDL file.
+ AST_record_fwd_decl (t);
+ }
+
+ return t;
+ }
+ else
+ {
+ if (!can_be_redefined (d))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ t,
+ this,
+ d);
+ return 0;
+ }
+
+ if (this->referenced (d, t->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ this,
+ d);
+ return 0;
+ }
+ }
+ }
+
+ // Add it to scope
+ this->add_to_scope (t);
+
+ // Add it to set of locally referenced symbols
+ this->add_to_referenced (t,
+ I_FALSE,
+ t->local_name ());
+
+ // Must check later that all struct and union forward declarations
+ // are defined in the same IDL file.
+ AST_record_fwd_decl (t);
+ return t;
+}
+
// Add an AST_Enum node (an enum declaration) to this scope.
AST_Enum *
AST_Interface::fe_add_enum (AST_Enum *t)
@@ -537,42 +645,66 @@ AST_Interface::fe_add_enum (AST_Enum *t)
AST_Union *
AST_Interface::fe_add_union (AST_Union *t)
{
- AST_Decl *d = 0;
+ AST_Decl *predef = 0;
+ AST_UnionFwd *fwd = 0;
- // Can't add to interface which was not yet defined.
- if (!this->is_defined ())
+ if ((predef = this->lookup_for_add (t, I_FALSE)) != 0)
{
- idl_global->err ()->error2 (UTL_Error::EIDL_DECL_NOT_DEFINED,
- this,
- t);
- return 0;
- }
+ // Treat fwd declared interfaces specially
+ if (predef->node_type () == AST_Decl::NT_union_fwd)
+ {
+ fwd = AST_UnionFwd::narrow_from_decl (predef);
- // Already defined and cannot be redefined? Or already used?
- if ((d = this->lookup_for_add (t, I_FALSE)) != 0)
- {
- if (!can_be_redefined (d))
+ if (fwd == 0)
+ {
+ return 0;
+ }
+
+ // Forward declared and not defined yet.
+ if (!fwd->is_defined ())
+ {
+ if (fwd->defined_in () == this)
+ {
+ fwd->set_full_definition (t);
+ }
+ else
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_SCOPE_CONFLICT,
+ fwd,
+ t,
+ this);
+
+ return 0;
+ }
+ }
+ // OK, not illegal redef of forward declaration. Now check whether.
+ // it has been referenced already.
+ else if (this->referenced (predef, t->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ this,
+ predef);
+
+ return 0;
+ }
+ }
+ else if (!can_be_redefined (predef))
{
idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
t,
this,
- d);
+ predef);
+
return 0;
}
-
- if (this->referenced (d, t->local_name ()))
+ else if (referenced (predef, t->local_name ()) && !t->is_defined ())
{
idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
t,
this,
- d);
- return 0;
- }
+ predef);
- if (t->has_ancestor (d))
- {
- idl_global->err ()->redefinition_in_scope (t,
- d);
return 0;
}
}
@@ -588,67 +720,90 @@ AST_Interface::fe_add_union (AST_Union *t)
return t;
}
-// Add an AST_EnumVal node (an enumerator) to this scope.
-// This is done to conform to the C++ scoping rules which declare
-// enumerators in the enclosing scope (in addition to declaring them
-// in the enum itself).
-AST_EnumVal *
-AST_Interface::fe_add_enum_val (AST_EnumVal *t)
+// Add this AST_UnionFwd node (a forward declaration of an IDL
+// union) to this scope.
+AST_UnionFwd *
+AST_Interface::fe_add_union_fwd (AST_UnionFwd *t)
{
AST_Decl *d = 0;
- // Can't add to interface which was not yet defined.
- if (!this->is_defined ())
- {
- idl_global->err ()->error2 (UTL_Error::EIDL_DECL_NOT_DEFINED,
- this,
- t);
- return 0;
- }
-
// Already defined and cannot be redefined? Or already used?
if ((d = this->lookup_for_add (t, I_FALSE)) != 0)
{
- if (!can_be_redefined (d))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- t,
- this,
- d);
- return 0;
- }
+ AST_Decl::NodeType nt = d->node_type ();
- if (this->referenced (d, t->local_name ()))
+ // There used to be another check here ANDed with the one below:
+ // d->defined_in () == this. But lookup_for_add() calls only
+ // lookup_by_name_local(), which does not bump up the scope.
+ if (nt == AST_Decl::NT_union_fwd)
{
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- t,
- this,
- d);
- return 0;
+ // It's legal to forward declare something more than once,
+ // but we need only one entry in the scope for lookup.
+ AST_UnionFwd *fd = AST_UnionFwd::narrow_from_decl (d);
+ t->destroy ();
+ delete t;
+ t = 0;
+ return fd;
}
+ else if (nt == AST_Decl::NT_union)
+ {
+ AST_Union *s = AST_Union::narrow_from_decl (d);
+ t->set_full_definition (s);
- if (t->has_ancestor (d))
+ if (t->added () == 0)
+ {
+ t->set_added (1);
+ this->add_to_scope (t);
+
+ // Must check later that all struct and union forward declarations
+ // are defined in the same IDL file.
+ AST_record_fwd_decl (t);
+ }
+
+ return t;
+ }
+ else
{
- idl_global->err ()->redefinition_in_scope (t,
- d);
- return 0;
+ if (!can_be_redefined (d))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ t,
+ this,
+ d);
+ return 0;
+ }
+
+ if (this->referenced (d, t->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ this,
+ d);
+ return 0;
+ }
}
}
- // Add it to scope.
+ // Add it to scope
this->add_to_scope (t);
- // Add it to set of locally referenced symbols.
+ // Add it to set of locally referenced symbols
this->add_to_referenced (t,
I_FALSE,
t->local_name ());
+ // Must check later that all struct and union forward declarations
+ // are defined in the same IDL file.
+ AST_record_fwd_decl (t);
return t;
}
-// Add an AST_Typedef (a typedef) to the current scope.
-AST_Typedef *
-AST_Interface::fe_add_typedef (AST_Typedef *t)
+// Add an AST_EnumVal node (an enumerator) to this scope.
+// This is done to conform to the C++ scoping rules which declare
+// enumerators in the enclosing scope (in addition to declaring them
+// in the enum itself).
+AST_EnumVal *
+AST_Interface::fe_add_enum_val (AST_EnumVal *t)
{
AST_Decl *d = 0;
@@ -701,9 +856,9 @@ AST_Interface::fe_add_typedef (AST_Typedef *t)
return t;
}
-// Add an AST_Native (a native declaration) to this scope.
-AST_Native *
-AST_Interface::fe_add_native (AST_Native *t)
+// Add an AST_Typedef (a typedef) to the current scope.
+AST_Typedef *
+AST_Interface::fe_add_typedef (AST_Typedef *t)
{
AST_Decl *d = 0;
@@ -753,11 +908,24 @@ AST_Interface::fe_add_native (AST_Native *t)
I_FALSE,
t->local_name ());
+ AST_Type *bt = t->base_type ();
+ UTL_ScopedName *mru = bt->last_referenced_as ();
+
+ if (mru != 0)
+ {
+ this->add_to_referenced (
+ bt,
+ I_FALSE,
+ mru->first_component ()
+ );
+ }
+
return t;
}
-AST_Factory *
-AST_Interface::fe_add_factory (AST_Factory *f)
+// Add an AST_Native (a native declaration) to this scope.
+AST_Native *
+AST_Interface::fe_add_native (AST_Native *t)
{
AST_Decl *d = 0;
@@ -766,77 +934,65 @@ AST_Interface::fe_add_factory (AST_Factory *f)
{
idl_global->err ()->error2 (UTL_Error::EIDL_DECL_NOT_DEFINED,
this,
- f);
+ t);
return 0;
}
// Already defined and cannot be redefined? Or already used?
- if ((d = this->lookup_for_add (f, I_FALSE)) != 0)
+ if ((d = this->lookup_for_add (t, I_FALSE)) != 0)
{
if (!can_be_redefined (d))
{
idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- f,
+ t,
this,
d);
return 0;
}
- if (this->referenced (d, f->local_name ()))
+ if (this->referenced (d, t->local_name ()))
{
idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- f,
+ t,
this,
d);
return 0;
}
- if (f->has_ancestor (d))
+ if (t->has_ancestor (d))
{
- idl_global->err ()->redefinition_in_scope (f,
+ idl_global->err ()->redefinition_in_scope (t,
d);
return 0;
}
}
// Add it to scope.
- this->add_to_scope (f);
+ this->add_to_scope (t);
// Add it to set of locally referenced symbols.
- this->add_to_referenced (f,
+ this->add_to_referenced (t,
I_FALSE,
- f->local_name ());
+ t->local_name ());
- return f;
+ return t;
}
// Dump this AST_Interface node to the ostream o.
void
AST_Interface::dump (ACE_OSTREAM_TYPE &o)
{
- if (this->is_valuetype ())
+ if (this->is_abstract ())
{
- if (this->is_abstract_valuetype ())
- {
- o << "abstract ";
- }
-
- o << "valuetype ";
+ o << "abstract ";
}
- else
+ else if (this->is_local ())
{
- if (this->is_abstract ())
- {
- o << "abstract ";
- }
- else if (this->is_local ())
- {
- o << "local ";
- }
-
- o << "interface ";
+ o << "local ";
}
+ o << "interface ";
+
this->local_name ()->dump (o);
o << " ";
@@ -844,7 +1000,7 @@ AST_Interface::dump (ACE_OSTREAM_TYPE &o)
{
o << ": ";
- for (long i = 0; i < this->pd_n_inherits; i++)
+ for (long i = 0; i < this->pd_n_inherits; ++i)
{
this->pd_inherits[i]->local_name ()->dump (o);
@@ -856,11 +1012,14 @@ AST_Interface::dump (ACE_OSTREAM_TYPE &o)
}
o << " {\n";
+
UTL_Scope::dump (o);
idl_global->indent ()->skip_to (o);
+
o << "}";
}
+// This serves for both interfaces, valuetypes and components.
void
AST_Interface::fwd_redefinition_helper (AST_Interface *&i,
UTL_Scope *s)
@@ -888,10 +1047,14 @@ AST_Interface::fwd_redefinition_helper (AST_Interface *&i,
return;
}
+ AST_Decl::NodeType nt = d->node_type ();
+
// If this interface has been forward declared in a previous opening
// of the module it's defined in, the lookup will find the
// forward declaration.
- if (d->node_type () == AST_Decl::NT_interface_fwd)
+ if (nt == AST_Decl::NT_interface_fwd
+ || nt == AST_Decl::NT_valuetype_fwd
+ || nt == AST_Decl::NT_component_fwd)
{
AST_InterfaceFwd *fwd_def =
AST_InterfaceFwd::narrow_from_decl (d);
@@ -899,7 +1062,9 @@ AST_Interface::fwd_redefinition_helper (AST_Interface *&i,
fd = fwd_def->full_definition ();
}
// In all other cases, the lookup will find an interface node.
- else if (d->node_type () == AST_Decl::NT_interface)
+ else if (nt == AST_Decl::NT_interface
+ || nt == AST_Decl::NT_valuetype
+ || nt == AST_Decl::NT_component)
{
fd = AST_Interface::narrow_from_decl (d);
}
@@ -917,8 +1082,7 @@ AST_Interface::fwd_redefinition_helper (AST_Interface *&i,
// a new pointer in created, and the first term below will be
// true. In that case, the scoped names must be compared.
if (fd->defined_in () != s
- && !AST_Interface::compare_names (fd,
- i))
+ && i->name ()->compare (fd->name ()) != 0)
{
idl_global->err ()->error2 (UTL_Error::EIDL_SCOPE_CONFLICT,
i,
@@ -927,11 +1091,12 @@ AST_Interface::fwd_redefinition_helper (AST_Interface *&i,
// All OK, do the redefinition.
else
{
+ AST_Decl::NodeType fd_nt = fd->node_type ();
+ AST_Decl::NodeType i_nt = i->node_type ();
+
// Only redefinition of the same kind.
if (i->is_local () != fd->is_local ()
- || i->is_valuetype () != fd->is_valuetype ()
- || i->is_abstract_valuetype () !=
- fd->is_abstract_valuetype ()
+ || i_nt != fd_nt
|| i->is_abstract () != fd->is_abstract ()
)
{
@@ -951,8 +1116,108 @@ AST_Interface::fwd_redefinition_helper (AST_Interface *&i,
}
}
-// Data accessors.
+void
+AST_Interface::redef_clash_populate_r (AST_Interface *t)
+{
+ if (this->insert_non_dup (t) == 0)
+ {
+ return;
+ }
+
+ AST_Interface **parents = t->inherits ();
+ long n_parents = t->n_inherits ();
+ long i;
+
+ for (i = 0; i < n_parents; ++i)
+ {
+ this->redef_clash_populate_r (parents[i]);
+ }
+
+ AST_Decl::NodeType nt = t->node_type ();
+
+ if (nt == AST_Decl::NT_valuetype)
+ {
+ AST_ValueType *v = AST_ValueType::narrow_from_decl (t);
+ AST_Interface **supports = v->supports ();
+ long n_supports = v->n_supports ();
+
+ for (i = 0; i < n_supports; ++i)
+ {
+ this->redef_clash_populate_r (supports[i]);
+ }
+ }
+ else if (nt == AST_Decl::NT_component)
+ {
+ AST_Component *c = AST_Component::narrow_from_decl (t);
+ AST_Interface **supports = c->supports ();
+ long n_supports = c->n_supports ();
+ for (i = 0; i < n_supports; ++i)
+ {
+ this->redef_clash_populate_r (supports[i]);
+ }
+ }
+}
+
+int
+AST_Interface::insert_non_dup (AST_Interface *t)
+{
+ const char *full_name = t->full_name ();
+
+ // Initialize an iterator to search the queue for duplicates.
+ for (ACE_Unbounded_Queue_Iterator<AST_Interface *> q_iter (
+ this->insert_queue
+ );
+ !q_iter.done ();
+ (void) q_iter.advance ())
+ {
+ // Queue element.
+ AST_Interface **temp;
+
+ (void) q_iter.next (temp);
+
+ if (!ACE_OS::strcmp (full_name,
+ (*temp)->full_name ()))
+ {
+ // We exist in this queue and cannot be inserted.
+ return 0;
+ }
+ }
+
+ // Initialize an iterator to search the del_queue for duplicates.
+ for (ACE_Unbounded_Queue_Iterator<AST_Interface *> del_q_iter (
+ this->del_queue
+ );
+ !del_q_iter.done ();
+ (void) del_q_iter.advance ())
+ {
+ // Queue element.
+ AST_Interface **temp;
+
+ (void) del_q_iter.next (temp);
+
+ if (!ACE_OS::strcmp (full_name,
+ (*temp)->full_name ()))
+ {
+ // We exist in this del_queue and cannot be inserted.
+ return 0;
+ }
+ }
+
+ // Insert the parent in the queue.
+ if (this->insert_queue.enqueue_tail (t) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_interface::insert_non_dup - "
+ "enqueue failed\n"),
+ 0);
+ }
+
+ return 1;
+}
+
+// This serves only for interfaces. AST_ValueType has its
+// own redefine() function which calls this one.
void
AST_Interface::redefine (AST_Interface *from)
{
@@ -961,10 +1226,10 @@ AST_Interface::redefine (AST_Interface *from)
// definition, which may be in a different scope.
// Since 'this' will replace 'from' upon returning
// from here, we have to update the scope now.
- this->set_inherits (from->inherits ());
- this->set_n_inherits (from->n_inherits ());
- this->set_inherits_flat (from->inherits_flat ());
- this->set_n_inherits_flat (from->n_inherits_flat ());
+ this->pd_inherits = from->pd_inherits;
+ this->pd_n_inherits = from->pd_n_inherits;
+ this->pd_inherits_flat = from->pd_inherits_flat;
+ this->pd_n_inherits_flat = from->pd_n_inherits_flat;
// We've already checked for inconsistent prefixes.
this->prefix (ACE::strnew (from->prefix ()));
@@ -978,247 +1243,223 @@ AST_Interface::redefine (AST_Interface *from)
this->ifr_fwd_added_ = from->ifr_fwd_added_;
}
+// Data accessors.
+
AST_Interface **
-AST_Interface::inherits (void)
+AST_Interface::inherits (void) const
{
return this->pd_inherits;
}
-void
-AST_Interface::set_inherits (AST_Interface **i)
-{
- this->pd_inherits = i;
-}
-
long
-AST_Interface::n_inherits (void)
+AST_Interface::n_inherits (void) const
{
return this->pd_n_inherits;
}
-void
-AST_Interface::set_n_inherits (long i)
-{
- this->pd_n_inherits = i;
-}
-
AST_Interface **
-AST_Interface::inherits_flat (void)
+AST_Interface::inherits_flat (void) const
{
return this->pd_inherits_flat;
}
-void
-AST_Interface::set_inherits_flat (AST_Interface **i)
-{
- this->pd_inherits_flat = i;
-}
-
long
-AST_Interface::n_inherits_flat (void)
+AST_Interface::n_inherits_flat (void) const
{
return pd_n_inherits_flat;
}
-void
-AST_Interface::set_n_inherits_flat (long i)
-{
- this->pd_n_inherits_flat = i;
-}
-
-// Get the scoped names and, if they are the same
-// length, iterate over them, comparing each term.
idl_bool
-AST_Interface::compare_names (AST_Interface *that,
- AST_Interface *other)
-{
- UTL_ScopedName *that_name = that->name ();
- UTL_ScopedName *other_name = other->name ();
-
- long that_length = that_name->length ();
-
- if (that_length != other_name->length ())
+AST_Interface::redef_clash (void)
+{
+ this->insert_queue.reset ();
+ this->redef_clash_populate_r (this);
+
+ AST_Interface **group1_member = 0;
+ AST_Interface **group2_member = 0;
+ AST_Decl *group1_member_item = 0;
+ AST_Decl *group2_member_item = 0;
+
+ int i = 1;
+
+ // Now compare all pairs.
+ for (ACE_Unbounded_Queue_Iterator<AST_Interface *> group1_iter (
+ this->insert_queue
+ );
+ !group1_iter.done ();
+ (void) group1_iter.advance (), ++i)
{
- return I_FALSE;
- }
-
- Identifier *that_id = 0;
- Identifier *other_id = 0;
+ // Queue element.
+ (void) group1_iter.next (group1_member);
- for (UTL_IdListActiveIterator that_iter (that_name), other_iter (other_name);
- !that_iter.is_done ();
- that_iter.next (), other_iter.next ())
- {
- that_id = that_iter.item ();
- other_id = other_iter.item ();
-
- if (ACE_OS::strcmp (that_id->get_string (),
- other_id->get_string ()))
+ for (UTL_ScopeActiveIterator group1_member_items (
+ DeclAsScope (*group1_member),
+ UTL_Scope::IK_decls
+ );
+ !group1_member_items.is_done ();
+ group1_member_items.next ())
{
- return I_FALSE;
- }
- }
-
- return I_TRUE;
-}
-
-void
-AST_Interface::inherited_name_clash (void)
-{
- AST_Decl *my_member = 0;
- AST_Decl *parent1_member = 0;
- AST_Decl *parent2_member = 0;
+ group1_member_item = group1_member_items.item ();
+ AST_Decl::NodeType nt1 = group1_member_item->node_type ();
- // Compare our members with those of each parent.
+ // Only these member types may cause a clash because
+ // they can't be redefined.
+ if (nt1 != AST_Decl::NT_op && nt1 != AST_Decl::NT_attr)
+ {
+ continue;
+ }
- for (UTL_ScopeActiveIterator my_members (DeclAsScope (this), IK_decls);
- !my_members.is_done ();
- my_members.next ())
- {
- my_member = my_members.item ();
- Identifier *id = my_member->local_name ();
+ Identifier *pid1 = group1_member_item->local_name ();
+ int j = 0;
- for (int i = 0; i < this->pd_n_inherits_flat; ++i)
- {
- for (UTL_ScopeActiveIterator parent_members (
- DeclAsScope (this->pd_inherits_flat[i]),
- UTL_Scope::IK_decls
+ for (ACE_Unbounded_Queue_Iterator<AST_Interface *> group2_iter (
+ this->insert_queue
);
- !parent_members.is_done ();
- parent_members.next ())
+ !group2_iter.done ();
+ (void) group2_iter.advance ())
{
- parent1_member = parent_members.item ();
- AST_Decl::NodeType nt = parent1_member->node_type ();
+ // Since group1 and group2 are the same list, we can start this
+ // iterator from where the outer one is.
+ while (j++ < i)
+ {
+ group2_iter.advance ();
+ }
+
+ if (group2_iter.done ())
+ {
+ break;
+ }
+
+ // Queue element.
+ (void) group2_iter.next (group2_member);
- // All other member types but these may be redefined in
- // the child.
- if (nt == AST_Decl::NT_op || nt == AST_Decl::NT_attr)
+ for (UTL_ScopeActiveIterator group2_member_items (
+ DeclAsScope (*group2_member),
+ UTL_Scope::IK_decls
+ );
+ !group2_member_items.is_done ();
+ group2_member_items.next ())
{
- Identifier *pid = parent1_member->local_name ();
+ group2_member_item = group2_member_items.item ();
+ AST_Decl::NodeType nt2 = group2_member_item->node_type ();
- if (id->compare (pid) == I_TRUE)
+ // Only these member types may cause a clash
+ // with other parents' member of the same type.
+ if (nt2 != AST_Decl::NT_op && nt2 != AST_Decl::NT_attr)
{
- idl_global->err ()->error2 (UTL_Error::EIDL_REDEF,
- my_member,
- parent1_member);
+ continue;
}
- else if (id->case_compare_quiet (pid) == I_TRUE)
+
+ Identifier *pid2 = group2_member_item->local_name ();
+
+ if (pid1->compare (pid2) == I_TRUE)
+ {
+ idl_global->err ()->error3 (
+ UTL_Error::EIDL_REDEF,
+ *group1_member,
+ *group2_member,
+ group2_member_item
+ );
+ return 1;
+ }
+ else if (pid1->case_compare_quiet (pid2) == I_TRUE)
{
if (idl_global->case_diff_error ())
{
- idl_global->err ()->error2 (
+ idl_global->err ()->error3 (
UTL_Error::EIDL_NAME_CASE_ERROR,
- my_member,
- parent1_member
+ *group1_member,
+ group1_member_item,
+ group2_member_item
);
}
else
{
- idl_global->err ()->warning2 (
+ idl_global->err ()->warning3 (
UTL_Error::EIDL_NAME_CASE_WARNING,
- my_member,
- parent1_member
+ *group1_member,
+ group1_member_item,
+ group2_member_item
);
}
+
+ return 1;
}
- } // end of IF (nt == AST_Decl::NT_op ....)
- } // end of FOR (parent_members ...)
- } // end of FOR (i ...)
- } // end of FOR (my_members ...)
+ } // end of FOR (group2_member_items)
+ } // end of FOR (group2_iter)
+ } // end of FOR (group1_member_items)
+ } // end of FOR (group1_iter)
+
+ return 0;
+}
+
+AST_Decl *
+AST_Interface::lookup_for_add (AST_Decl *d,
+ idl_bool /* treat_as_ref */)
+{
+ if (d == 0)
+ {
+ return 0;
+ }
- // Now compare members of each parent with each other.
+ Identifier *id = d->local_name ();
+ AST_Decl *prev = 0;
+ AST_Decl::NodeType nt = NT_root;
+ long nis = -1;
+ AST_Interface **is = 0;
- for (int i = 0; i < this->pd_n_inherits_flat - 1; i++)
+ if (this->idl_keyword_clash (id) != 0)
{
- for (UTL_ScopeActiveIterator parent1_members (
- DeclAsScope (this->pd_inherits_flat[i]),
- UTL_Scope::IK_decls
- );
- !parent1_members.is_done ();
- parent1_members.next ())
+ return 0;
+ }
+
+ prev = this->lookup_by_name_local (id,
+ 0);
+
+ if (prev != 0)
+ {
+ nt = prev->node_type ();
+
+ if (nt == AST_Decl::NT_op || nt == AST_Decl::NT_attr)
{
- parent1_member = parent1_members.item ();
- AST_Decl::NodeType nt1 = parent1_member->node_type ();
+ return prev;
+ }
+ }
- // Only these member types may cause a clash with other
- // parents' member of the same type.
- if (nt1 == AST_Decl::NT_op || nt1 == AST_Decl::NT_attr)
- {
- Identifier *pid1 = parent1_member->local_name ();
+ for (nis = this->n_inherits_flat (), is = this->inherits_flat ();
+ nis > 0;
+ nis--, is++)
+ {
+ prev = (*is)->lookup_by_name_local (id,
+ 0);
- for (int j = i + 1; j < this->pd_n_inherits_flat; j++)
- {
- for (UTL_ScopeActiveIterator parent2_members (
- DeclAsScope (this->pd_inherits_flat[j]),
- UTL_Scope::IK_decls
- );
- !parent2_members.is_done ();
- parent2_members.next ())
- {
- parent2_member = parent2_members.item ();
- AST_Decl::NodeType nt2 =
- parent2_member->node_type ();
+ if (prev != 0)
+ {
+ nt = prev->node_type ();
- // Only these member types may cause a clash
- // with other parents' member of the same type.
- if (nt2 == AST_Decl::NT_op || nt2 == AST_Decl::NT_attr)
- {
- Identifier *pid2 = parent2_member->local_name ();
-
- if (pid1->compare (pid2) == I_TRUE)
- {
- idl_global->err ()->error3 (
- UTL_Error::EIDL_REDEF,
- this,
- parent1_member,
- parent2_member
- );
- }
- else if (pid1->case_compare_quiet (pid2) == I_TRUE)
- {
- if (idl_global->case_diff_error ())
- {
- idl_global->err ()->error3 (
- UTL_Error::EIDL_NAME_CASE_ERROR,
- this,
- parent1_member,
- parent2_member
- );
- }
- else
- {
- idl_global->err ()->warning3 (
- UTL_Error::EIDL_NAME_CASE_WARNING,
- this,
- parent1_member,
- parent2_member
- );
- }
- }
- } // end of IF (nt2 == AST_Decl::NT_op ...)
- } // end of FOR (parent2_members ...)
- } // end of FOR (j ...)
- } // end of IF (nt1 == AST_Decl::NT_op ..)
- } // end of FOR (parent1_members ...)
- } // end of FOR (i ...)
+ if (nt == AST_Decl::NT_op || nt == AST_Decl::NT_attr)
+ {
+ return prev;
+ }
+ }
+ }
+
+ return 0;
}
void
AST_Interface::destroy (void)
{
+ delete [] this->pd_inherits;
+ this->pd_inherits = 0;
+ delete [] this->pd_inherits_flat;
+ this->pd_inherits_flat = 0;
}
int
AST_Interface::ast_accept (ast_visitor *visitor)
{
- if (this->is_valuetype_)
- {
- return visitor->visit_valuetype (this);
- }
- else
- {
- return visitor->visit_interface (this);
- }
+ return visitor->visit_interface (this);
}
// Narrowing methods.
diff --git a/TAO/TAO_IDL/ast/ast_interface_fwd.cpp b/TAO/TAO_IDL/ast/ast_interface_fwd.cpp
index fe5e2f7bfe9..0b2fbb75a67 100644
--- a/TAO/TAO_IDL/ast/ast_interface_fwd.cpp
+++ b/TAO/TAO_IDL/ast/ast_interface_fwd.cpp
@@ -64,17 +64,20 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
*/
-// AST_InterfaceFwd nodes denote forward declarations of IDL interfaces
+// AST_InterfaceFwd nodes denote forward declarations of IDL interfaces.
// AST_InterfaceFwd nodes have a field containing the full declaration
// of the interface, which is initialized when that declaration is
// encountered.
-#include "idl.h"
-#include "idl_extern.h"
+#include "ast_interface_fwd.h"
+#include "ast_interface.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
-ACE_RCSID(ast, ast_interface_fwd, "$Id$")
+ACE_RCSID( ast,
+ ast_interface_fwd,
+ "$Id$")
-// Constructor(s) and destructor.
AST_InterfaceFwd::AST_InterfaceFwd (void)
: pd_full_definition (0)
{
@@ -82,13 +85,17 @@ AST_InterfaceFwd::AST_InterfaceFwd (void)
AST_InterfaceFwd::AST_InterfaceFwd (AST_Interface *dummy,
UTL_ScopedName *n)
- : AST_Decl (AST_Decl::NT_interface_fwd,
- n)
+ : AST_Type (AST_Decl::NT_interface_fwd,
+ n),
+ AST_Decl (AST_Decl::NT_interface_fwd,
+ n),
+ COMMON_Base (I_FALSE,
+ I_FALSE)
{
// Create a dummy placeholder for the forward declared interface. This
// interface node is not yet defined (n_inherits < 0), so some operations
// will fail.
- pd_full_definition = dummy;
+ this->pd_full_definition = dummy;
}
AST_InterfaceFwd::~AST_InterfaceFwd (void)
@@ -105,19 +112,14 @@ AST_InterfaceFwd::is_local (void)
idl_bool AST_InterfaceFwd::is_valuetype (void)
{
- return this->full_definition ()->is_valuetype ();
+ return this->full_definition ()->node_type () == AST_Decl::NT_valuetype;
}
idl_bool
AST_InterfaceFwd::is_abstract_valuetype (void)
{
- return this->full_definition ()->is_abstract_valuetype ();
-}
-
-void
-AST_InterfaceFwd::set_abstract_valuetype (void)
-{
- this->full_definition ()->set_abstract_valuetype ();
+ return (this->full_definition ()->is_abstract ()
+ && this->is_valuetype ());
}
// Redefinition of inherited virtual operations.
@@ -126,43 +128,24 @@ AST_InterfaceFwd::set_abstract_valuetype (void)
void
AST_InterfaceFwd::dump (ACE_OSTREAM_TYPE &o)
{
- if (this->is_valuetype ())
+ if (this->is_abstract ())
{
- if (this->is_abstract_valuetype ())
- {
- o << "abstract ";
- }
-
- o << "valuetype ";
+ o << "abstract ";
}
- else
+ else if (this->is_local ())
{
- if (this->is_abstract ())
- {
- o << "abstract ";
- }
- else if (this->is_local ())
- {
- o << "local ";
- }
-
- o << "interface ";
+ o << "local ";
}
+ o << "interface ";
+
this->local_name ()->dump (o);
}
int
AST_InterfaceFwd::ast_accept (ast_visitor *visitor)
{
- if (this->is_valuetype ())
- {
- return visitor->visit_valuetype_fwd (this);
- }
- else
- {
- return visitor->visit_interface_fwd (this);
- }
+ return visitor->visit_interface_fwd (this);
}
// Data accessors.
@@ -185,6 +168,14 @@ AST_InterfaceFwd::is_defined (void)
return this->pd_full_definition->is_defined ();
}
+void
+AST_InterfaceFwd::destroy (void)
+{
+// this->pd_full_definition->destroy ();
+// delete this->pd_full_definition;
+// this->pd_full_definition = 0;
+}
+
// Narrowing methods.
IMPL_NARROW_METHODS1 (AST_InterfaceFwd, AST_Type)
IMPL_NARROW_FROM_DECL (AST_InterfaceFwd)
diff --git a/TAO/TAO_IDL/ast/ast_module.cpp b/TAO/TAO_IDL/ast/ast_module.cpp
index 4373900c292..8deda7f4d69 100644
--- a/TAO/TAO_IDL/ast/ast_module.cpp
+++ b/TAO/TAO_IDL/ast/ast_module.cpp
@@ -64,20 +64,39 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
*/
-// Implementation of class AST_Module
-
// AST_Modules denote IDL module declarations
// AST_Modules are subclasses of AST_Decl (they are not a type!) and
// of UTL_Scope.
-#include "idl.h"
-#include "idl_extern.h"
-
-ACE_RCSID(ast, ast_module, "$Id$")
-
-// Constructor(s) and destructor.
-
-AST_Module::AST_Module ()
+#include "ast_module.h"
+#include "ast_predefined_type.h"
+#include "ast_valuetype.h"
+#include "ast_valuetype_fwd.h"
+#include "ast_component.h"
+#include "ast_component_fwd.h"
+#include "ast_home.h"
+#include "ast_constant.h"
+#include "ast_exception.h"
+#include "ast_union.h"
+#include "ast_union_fwd.h"
+#include "ast_structure_fwd.h"
+#include "ast_enum.h"
+#include "ast_enum_val.h"
+#include "ast_native.h"
+#include "ast_generator.h"
+#include "ast_visitor.h"
+#include "ast_extern.h"
+#include "utl_err.h"
+#include "utl_identifier.h"
+#include "utl_indenter.h"
+#include "global_extern.h"
+#include "nr_extern.h"
+
+ACE_RCSID (ast,
+ ast_module,
+ "$Id$")
+
+AST_Module::AST_Module (void)
{
}
@@ -221,6 +240,11 @@ AST_Module::fe_add_module (AST_Module *t)
AST_Interface *
AST_Module::fe_add_interface (AST_Interface *t)
{
+ if (t->redef_clash ())
+ {
+ return 0;
+ }
+
AST_Decl *predef = 0;
AST_Interface *fwd = 0;
@@ -299,6 +323,226 @@ AST_Module::fe_add_interface (AST_Interface *t)
return t;
}
+// Add this AST_ValueType node (a value type declaration) to this scope.
+AST_ValueType *
+AST_Module::fe_add_valuetype (AST_ValueType *t)
+{
+ if (t->redef_clash ())
+ {
+ return 0;
+ }
+
+ AST_Decl *predef = 0;
+ AST_ValueType *fwd = 0;
+
+ // Already defined?
+ if ((predef = this->lookup_for_add (t, I_FALSE)) != 0)
+ {
+ // Treat fwd declared interfaces specially
+ if (predef->node_type () == AST_Decl::NT_valuetype)
+ {
+ fwd = AST_ValueType::narrow_from_decl (predef);
+
+ if (fwd == 0)
+ {
+ return 0;
+ }
+
+ // Forward declared and not defined yet.
+ if (!fwd->is_defined ())
+ {
+ if (fwd->defined_in () != this)
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_SCOPE_CONFLICT,
+ fwd,
+ t,
+ this);
+
+ return 0;
+ }
+ }
+ // OK, not illegal redef of forward declaration. Now check whether.
+ // it has been referenced already.
+ else if (this->referenced (predef, t->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ this,
+ predef);
+
+ return 0;
+ }
+ }
+ else if (!can_be_redefined (predef))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ t,
+ this,
+ predef);
+
+ return 0;
+ }
+ else if (referenced (predef, t->local_name ()) && !t->is_defined ())
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ this,
+ predef);
+
+ return 0;
+ }
+ else if (t->has_ancestor (predef))
+ {
+ idl_global->err ()->redefinition_in_scope (t,
+ predef);
+
+ return 0;
+ }
+ }
+
+ // Add it to scope
+ this->add_to_scope (t);
+
+ // Add it to set of locally referenced symbols
+ this->add_to_referenced (t,
+ I_FALSE,
+ t->local_name ());
+ return t;
+}
+
+// Add this AST_Component node (a value type declaration) to this scope.
+AST_Component *
+AST_Module::fe_add_component (AST_Component *t)
+{
+ if (t->redef_clash ())
+ {
+ return 0;
+ }
+
+ AST_Decl *predef = 0;
+ AST_Component *fwd = 0;
+
+ // Already defined?
+ if ((predef = this->lookup_for_add (t, I_FALSE)) != 0)
+ {
+ // Treat fwd declared interfaces specially
+ if (predef->node_type () == AST_Decl::NT_component)
+ {
+ fwd = AST_Component::narrow_from_decl (predef);
+
+ if (fwd == 0)
+ {
+ return 0;
+ }
+
+ // Forward declared and not defined yet.
+ if (!fwd->is_defined ())
+ {
+ if (fwd->defined_in () != this)
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_SCOPE_CONFLICT,
+ fwd,
+ t,
+ this);
+
+ return 0;
+ }
+ }
+ // OK, not illegal redef of forward declaration. Now check whether.
+ // it has been referenced already.
+ else if (this->referenced (predef, t->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ this,
+ predef);
+
+ return 0;
+ }
+ }
+ else if (!can_be_redefined (predef))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ t,
+ this,
+ predef);
+
+ return 0;
+ }
+ else if (referenced (predef, t->local_name ()) && !t->is_defined ())
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ this,
+ predef);
+
+ return 0;
+ }
+ else if (t->has_ancestor (predef))
+ {
+ idl_global->err ()->redefinition_in_scope (t,
+ predef);
+
+ return 0;
+ }
+ }
+
+ // Add it to scope
+ this->add_to_scope (t);
+
+ // Add it to set of locally referenced symbols
+ this->add_to_referenced (t,
+ I_FALSE,
+ t->local_name ());
+ return t;
+}
+
+// Add this AST_Home node (a value type declaration) to this scope.
+AST_Home *
+AST_Module::fe_add_home (AST_Home *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, I_FALSE)) != 0)
+ {
+ if (!can_be_redefined (d))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ t,
+ this,
+ d);
+ return 0;
+ }
+
+ if (this->referenced (d, t->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ this,
+ d);
+ return 0;
+ }
+
+ if (t->has_ancestor (d))
+ {
+ idl_global->err ()->redefinition_in_scope (t,
+ d);
+ return 0;
+ }
+ }
+
+ // Add it to scope.
+ this->add_to_scope (t);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ I_FALSE,
+ t->local_name ());
+
+ return t;
+}
+
// Add this AST_InterfaceFwd node (a forward declaration of an IDL
// interface) to this scope.
AST_InterfaceFwd *
@@ -316,7 +560,7 @@ AST_Module::fe_add_interface_fwd (AST_InterfaceFwd *i)
// and look_in_previous() for modules. If look_in_previous()
// finds something, the scopes will NOT be the same pointer
// value, but the result is what we want.
- if (d->node_type () == AST_Decl::NT_interface)
+ if (d->node_type () == AST_Decl::NT_interface)
{
itf = AST_Interface::narrow_from_decl (d);
@@ -373,6 +617,154 @@ AST_Module::fe_add_interface_fwd (AST_InterfaceFwd *i)
return i;
}
+// Add this AST_ValueTypeFwd node (a forward declaration of an IDL
+// value type) to this scope.
+AST_ValueTypeFwd *
+AST_Module::fe_add_valuetype_fwd (AST_ValueTypeFwd *v)
+{
+ AST_Decl *d = 0;
+ AST_ValueType *vtf = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (v, I_FALSE)) != 0)
+ {
+ // There used to be another check here ANDed with the one below:
+ // d->defined_in () == this. But lookup_for_add calls only
+ // lookup_by_name_local(), which does not bump up the scope,
+ // and look_in_previous() for modules. If look_in_previous()
+ // finds something, the scopes will NOT be the same pointer
+ // value, but the result is what we want.
+ if (d->node_type () == AST_Decl::NT_valuetype)
+ {
+ vtf = AST_ValueType::narrow_from_decl (d);
+
+ if (vtf == 0)
+ {
+ return 0;
+ }
+
+ if (v->added () == 0)
+ {
+ v->set_added (1);
+ this->add_to_scope (v);
+ }
+
+ // @@ Redefinition of forward. Type check not implemented.
+ v->set_full_definition (vtf); // @@ Memory leak.
+ return v;
+ }
+
+ if (!can_be_redefined (d)) {
+
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ v,
+ this,
+ d);
+ return 0;
+ }
+
+ if (this->referenced (d, v->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ v,
+ this,
+ d);
+ return 0;
+ }
+
+ if (v->has_ancestor (d))
+ {
+ idl_global->err ()->redefinition_in_scope (v,
+ d);
+ return 0;
+ }
+ }
+
+ // Add it to scope
+ this->add_to_scope (v);
+
+ // Add it to set of locally referenced symbols
+ this->add_to_referenced (v,
+ I_FALSE,
+ v->local_name ());
+
+ return v;
+}
+
+// Add this AST_ComponentFwd node (a forward declaration of an IDL
+// value type) to this scope.
+AST_ComponentFwd *
+AST_Module::fe_add_component_fwd (AST_ComponentFwd *c)
+{
+ AST_Decl *d = 0;
+ AST_Component *cf = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (c, I_FALSE)) != 0)
+ {
+ // There used to be another check here ANDed with the one below:
+ // d->defined_in () == this. But lookup_for_add calls only
+ // lookup_by_name_local(), which does not bump up the scope,
+ // and look_in_previous() for modules. If look_in_previous()
+ // finds something, the scopes will NOT be the same pointer
+ // value, but the result is what we want.
+ if (d->node_type () == AST_Decl::NT_component)
+ {
+ cf = AST_Component::narrow_from_decl (d);
+
+ if (cf == 0)
+ {
+ return 0;
+ }
+
+ if (c->added () == 0)
+ {
+ c->set_added (1);
+ this->add_to_scope (c);
+ }
+
+ // @@ Redefinition of forward. Type check not implemented.
+ c->set_full_definition (cf); // @@ Memory leak.
+ return c;
+ }
+
+ if (!can_be_redefined (d)) {
+
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ c,
+ this,
+ d);
+ return 0;
+ }
+
+ if (this->referenced (d, c->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ c,
+ this,
+ d);
+ return 0;
+ }
+
+ if (c->has_ancestor (d))
+ {
+ idl_global->err ()->redefinition_in_scope (c,
+ d);
+ return 0;
+ }
+ }
+
+ // Add it to scope
+ this->add_to_scope (c);
+
+ // Add it to set of locally referenced symbols
+ this->add_to_referenced (c,
+ I_FALSE,
+ c->local_name ());
+
+ return c;
+}
+
// Add this AST_Constant node (a constant declaration) to this scope.
AST_Constant *
AST_Module::fe_add_constant (AST_Constant *t)
@@ -469,33 +861,70 @@ AST_Module::fe_add_exception (AST_Exception *t)
AST_Union *
AST_Module::fe_add_union (AST_Union *t)
{
- AST_Decl *d = 0;
+ AST_Decl *predef = 0;
+ AST_UnionFwd *fwd = 0;
- // Already defined and cannot be redefined? Or already used?
- if ((d = this->lookup_for_add (t, I_FALSE)) != 0)
+ if ((predef = this->lookup_for_add (t, I_FALSE)) != 0)
{
- if (!can_be_redefined (d))
+ // Treat fwd declared interfaces specially
+ if (predef->node_type () == AST_Decl::NT_union_fwd)
+ {
+ fwd = AST_UnionFwd::narrow_from_decl (predef);
+
+ if (fwd == 0)
+ {
+ return 0;
+ }
+
+ // Forward declared and not defined yet.
+ if (!fwd->is_defined ())
+ {
+ UTL_Scope *s = fwd->defined_in ();
+ UTL_ScopedName *sn = ScopeAsDecl (s)->name ();
+
+ if (fwd->defined_in () == this
+ || sn->compare (this->name ()) == 0)
+ {
+ fwd->set_full_definition (t);
+ }
+ else
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_SCOPE_CONFLICT,
+ fwd,
+ t,
+ this);
+
+ return 0;
+ }
+ }
+ // OK, not illegal redef of forward declaration. Now check whether.
+ // it has been referenced already.
+ else if (this->referenced (predef, t->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ this,
+ predef);
+
+ return 0;
+ }
+ }
+ else if (!can_be_redefined (predef))
{
idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
t,
this,
- d);
+ predef);
+
return 0;
}
-
- if (this->referenced (d, t->local_name ()))
+ else if (referenced (predef, t->local_name ()) && !t->is_defined ())
{
idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
t,
this,
- d);
- return 0;
- }
+ predef);
- if (t->has_ancestor (d))
- {
- idl_global->err ()->redefinition_in_scope (t,
- d);
return 0;
}
}
@@ -511,37 +940,155 @@ AST_Module::fe_add_union (AST_Union *t)
return t;
}
-// Add this AST_Structure node (a struct declaration) to this scope.
-AST_Structure *
-AST_Module::fe_add_structure (AST_Structure *t)
+// Add this AST_UnionFwd node (a forward declaration of an IDL
+// union) to this scope.
+AST_UnionFwd *
+AST_Module::fe_add_union_fwd (AST_UnionFwd *t)
{
AST_Decl *d = 0;
// Already defined and cannot be redefined? Or already used?
if ((d = this->lookup_for_add (t, I_FALSE)) != 0)
{
- if (!can_be_redefined (d))
+ AST_Decl::NodeType nt = d->node_type ();
+
+ // There used to be another check here ANDed with the one below:
+ // d->defined_in () == this. But lookup_for_add() calls only
+ // lookup_by_name_local(), which does not bump up the scope,
+ // and look_in_previous() for modules. If look_in_previous()
+ // finds something, the scopes will NOT be the same pointer
+ // value, but the result is what we want.
+ if (nt == AST_Decl::NT_union_fwd)
+ {
+ // It's legal to forward declare something more than once,
+ // but we need only one entry in the scope for lookup.
+ AST_UnionFwd *fd = AST_UnionFwd::narrow_from_decl (d);
+ t->destroy ();
+ delete t;
+ t = 0;
+ return fd;
+ }
+ else if (nt == AST_Decl::NT_union)
+ {
+ AST_Union *s = AST_Union::narrow_from_decl (d);
+ t->set_full_definition (s);
+
+ if (t->added () == 0)
+ {
+ t->set_added (1);
+ this->add_to_scope (t);
+
+ // Must check later that all struct and union forward declarations
+ // are defined in the same IDL file.
+ AST_record_fwd_decl (t);
+ }
+
+ return t;
+ }
+ else
+ {
+ if (!can_be_redefined (d))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ t,
+ this,
+ d);
+ return 0;
+ }
+
+ if (this->referenced (d, t->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ this,
+ d);
+ return 0;
+ }
+ }
+ }
+
+ // Add it to scope
+ this->add_to_scope (t);
+
+ // Add it to set of locally referenced symbols
+ this->add_to_referenced (t,
+ I_FALSE,
+ t->local_name ());
+
+ // Must check later that all struct and union forward declarations
+ // are defined in the same IDL file.
+ AST_record_fwd_decl (t);
+ return t;
+}
+
+// Add this AST_Structure node (a struct declaration) to this scope.
+AST_Structure *
+AST_Module::fe_add_structure (AST_Structure *t)
+{
+ AST_Decl *predef = 0;
+ AST_StructureFwd *fwd = 0;
+
+ if ((predef = this->lookup_for_add (t, I_FALSE)) != 0)
+ {
+ // Treat fwd declared interfaces specially
+ if (predef->node_type () == AST_Decl::NT_struct_fwd)
+ {
+ fwd = AST_StructureFwd::narrow_from_decl (predef);
+
+ if (fwd == 0)
+ {
+ return 0;
+ }
+
+ // Forward declared and not defined yet.
+ if (!fwd->is_defined ())
+ {
+ UTL_Scope *s = fwd->defined_in ();
+ UTL_ScopedName *sn = ScopeAsDecl (s)->name ();
+
+ if (fwd->defined_in () == this
+ || sn->compare (this->name ()) == 0)
+ {
+ fwd->set_full_definition (t);
+ }
+ else
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_SCOPE_CONFLICT,
+ fwd,
+ t,
+ this);
+
+ return 0;
+ }
+ }
+ // OK, not illegal redef of forward declaration. Now check whether.
+ // it has been referenced already.
+ else if (this->referenced (predef, t->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ this,
+ predef);
+
+ return 0;
+ }
+ }
+ else if (!can_be_redefined (predef))
{
idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
t,
this,
- d);
+ predef);
+
return 0;
}
-
- if (this->referenced(d, t->local_name ()))
+ else if (referenced (predef, t->local_name ()) && !t->is_defined ())
{
idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
t,
this,
- d);
- return 0;
- }
+ predef);
- if (t->has_ancestor(d))
- {
- idl_global->err ()->redefinition_in_scope (t,
- d);
return 0;
}
}
@@ -557,6 +1104,87 @@ AST_Module::fe_add_structure (AST_Structure *t)
return t;
}
+// Add this AST_StructureFwd node (a forward declaration of an IDL
+// struct) to this scope.
+AST_StructureFwd *
+AST_Module::fe_add_structure_fwd (AST_StructureFwd *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, I_FALSE)) != 0)
+ {
+ AST_Decl::NodeType nt = d->node_type ();
+
+ // There used to be another check here ANDed with the one below:
+ // d->defined_in () == this. But lookup_for_add() calls only
+ // lookup_by_name_local(), which does not bump up the scope,
+ // and look_in_previous() for modules. If look_in_previous()
+ // finds something, the scopes will NOT be the same pointer
+ // value, but the result is what we want.
+ if (nt == AST_Decl::NT_struct_fwd)
+ {
+ // It's legal to forward declare something more than once,
+ // but we need only one entry in the scope for lookup.
+ AST_StructureFwd *fd = AST_StructureFwd::narrow_from_decl (d);
+ t->destroy ();
+ delete t;
+ t = 0;
+ return fd;
+ }
+ else if (nt == AST_Decl::NT_struct)
+ {
+ AST_Structure *s = AST_Structure::narrow_from_decl (d);
+ t->set_full_definition (s);
+
+ if (t->added () == 0)
+ {
+ t->set_added (1);
+ this->add_to_scope (t);
+
+ // Must check later that all struct and union forward declarations
+ // are defined in the same IDL file.
+ AST_record_fwd_decl (t);
+ }
+
+ return t;
+ }
+ else
+ {
+ if (!can_be_redefined (d))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ t,
+ this,
+ d);
+ return 0;
+ }
+
+ if (this->referenced (d, t->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ this,
+ d);
+ return 0;
+ }
+ }
+ }
+
+ // Add it to scope
+ this->add_to_scope (t);
+
+ // Add it to set of locally referenced symbols
+ this->add_to_referenced (t,
+ I_FALSE,
+ t->local_name ());
+
+ // Must check later that all struct and union forward declarations
+ // are defined in the same IDL file.
+ AST_record_fwd_decl (t);
+ return t;
+}
+
// Add this AST_Enum node (an enum declaration) to this scope.
AST_Enum *
AST_Module::fe_add_enum (AST_Enum *t)
@@ -695,6 +1323,16 @@ AST_Module::fe_add_typedef (AST_Typedef *t)
I_FALSE,
t->local_name ());
+ AST_Type *bt = t->base_type ();
+ UTL_ScopedName *mru = bt->last_referenced_as ();
+
+ if (mru != 0)
+ {
+ this->add_to_referenced (bt,
+ I_FALSE,
+ mru->first_component ());
+ }
+
return t;
}
@@ -802,7 +1440,7 @@ AST_Module::be_add_interface (AST_Interface *i,
void
AST_Module::add_CORBA_members (void)
{
- UTL_ScopedName *sn = 0;
+ UTL_ScopedName *sn = 0;
Identifier *id = 0;
ACE_NEW (id,
@@ -895,6 +1533,7 @@ AST_Module::look_in_previous (Identifier *e)
void
AST_Module::destroy (void)
{
+ this->AST_Decl::destroy ();
}
int
diff --git a/TAO/TAO_IDL/ast/ast_native.cpp b/TAO/TAO_IDL/ast/ast_native.cpp
index d62ac7a5d38..cee1a59b5e1 100644
--- a/TAO/TAO_IDL/ast/ast_native.cpp
+++ b/TAO/TAO_IDL/ast/ast_native.cpp
@@ -1,26 +1,22 @@
// $Id$
+#include "ast_native.h"
+#include "ast_visitor.h"
-// AST_Native: New IDL type added by the POA spec
-
-#include "idl.h"
-#include "idl_extern.h"
-
-ACE_RCSID(ast, ast_native, "$Id$")
-
-// Constructor(s).
+ACE_RCSID (ast,
+ ast_native,
+ "$Id$")
AST_Native::AST_Native (void)
{
}
-AST_Native::AST_Native(UTL_ScopedName *n)
+AST_Native::AST_Native (UTL_ScopedName *n)
: AST_Decl (AST_Decl::NT_native,
n)
{
}
-// Destructor.
AST_Native::~AST_Native (void)
{
}
diff --git a/TAO/TAO_IDL/ast/ast_operation.cpp b/TAO/TAO_IDL/ast/ast_operation.cpp
index 8d058ee36ee..723088fbd17 100644
--- a/TAO/TAO_IDL/ast/ast_operation.cpp
+++ b/TAO/TAO_IDL/ast/ast_operation.cpp
@@ -74,12 +74,22 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// (implemented as a list of Strings, a UTL_StrList), and a raises
// clause (implemented as an array of AST_Exceptions).
-#include "idl.h"
-#include "idl_extern.h"
-
-ACE_RCSID(ast, ast_operation, "$Id$")
-
-// Constructor(s) and destructor.
+#include "ast_operation.h"
+#include "ast_predefined_type.h"
+#include "ast_argument.h"
+#include "ast_exception.h"
+#include "ast_visitor.h"
+#include "utl_err.h"
+#include "utl_namelist.h"
+#include "utl_exceptlist.h"
+#include "utl_identifier.h"
+#include "utl_string.h"
+#include "utl_strlist.h"
+#include "global_extern.h"
+
+ACE_RCSID (ast,
+ ast_operation,
+ "$Id$")
AST_Operation::AST_Operation (void)
: pd_return_type (0),
@@ -137,6 +147,23 @@ AST_Operation::~AST_Operation (void)
// Public operations.
+int
+AST_Operation::void_return_type (void)
+{
+ AST_Type* type = this->return_type ();
+
+ if (type->node_type () == AST_Decl::NT_pre_defined
+ && (AST_PredefinedType::narrow_from_decl (type)->pt ()
+ == AST_PredefinedType::PT_void))
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
// Return the member count.
int
AST_Operation::argument_count (void)
@@ -203,16 +230,12 @@ AST_Operation::compute_argument_attr (void)
if (this->nmembers () > 0)
{
// Instantiate a scope iterator.
- UTL_ScopeActiveIterator *si = 0;
- ACE_NEW_RETURN (si,
- UTL_ScopeActiveIterator (this,
- UTL_Scope::IK_decls),
- -1);
-
- while (!si->is_done ())
+ for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
{
// Get the next AST decl node.
- d = si->item ();
+ d = si.item ();
if (d->node_type () == AST_Decl::NT_argument)
{
@@ -227,11 +250,7 @@ AST_Operation::compute_argument_attr (void)
this->has_native_ = 1;
}
}
-
- si->next ();
}
-
- delete si;
}
type = AST_Type::narrow_from_decl (this->return_type ());
@@ -269,6 +288,16 @@ AST_Operation::be_add_exceptions (UTL_ExceptList *t)
return this->pd_exceptions;
}
+AST_Argument *
+AST_Operation::be_add_argument (AST_Argument *arg)
+{
+ this->add_to_scope (arg);
+ this->add_to_referenced (arg,
+ 0,
+ 0);
+ return arg;
+}
+
// Add these exceptions (identified by name) to this scope.
// This looks up each name to resolve it to the name of a known
// exception, and then adds the referenced exception to the list
diff --git a/TAO/TAO_IDL/ast/ast_predefined_type.cpp b/TAO/TAO_IDL/ast/ast_predefined_type.cpp
index 2db404de631..33a39e4739a 100644
--- a/TAO/TAO_IDL/ast/ast_predefined_type.cpp
+++ b/TAO/TAO_IDL/ast/ast_predefined_type.cpp
@@ -71,24 +71,132 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// type that this node represents. There is only one node in the entire
// AST which represents each predefined type, such as long etc.
-#include "idl.h"
-#include "idl_extern.h"
+#include "ast_predefined_type.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
+#include "global_extern.h"
+#include "ace/Log_Msg.h"
-ACE_RCSID(ast, ast_predefined_type, "$Id$")
+ACE_RCSID (ast,
+ ast_predefined_type,
+ "$Id$")
-// Constructor(s).
AST_PredefinedType::AST_PredefinedType (void)
- : pd_pt (PT_long)
+ : pd_pt (PT_long)
{
}
AST_PredefinedType::AST_PredefinedType (PredefinedType t,
UTL_ScopedName *n)
- : AST_Decl (AST_Decl::NT_pre_defined,
- n,
- I_TRUE),
- pd_pt (t)
+ : AST_Decl (AST_Decl::NT_pre_defined,
+ n,
+ I_TRUE),
+ pd_pt (t)
{
+ UTL_ScopedName *new_name = 0;
+ Identifier *id = 0;
+
+ // Generate a new Scoped Name for us such that we belong to the CORBA
+ // namespace.
+ if (t == AST_PredefinedType::PT_void)
+ {
+ ACE_NEW (id,
+ Identifier (n->last_component ()->get_string ()));
+
+ ACE_NEW (new_name,
+ UTL_ScopedName (id,
+ 0));
+ }
+ else
+ {
+ ACE_NEW (id,
+ Identifier (idl_global->nest_orb () ? "NORB" : "CORBA"));
+
+ ACE_NEW (new_name,
+ UTL_ScopedName (id,
+ 0));
+
+ UTL_ScopedName *conc_name = 0;
+
+ switch (this->pt ())
+ {
+ case AST_PredefinedType::PT_long:
+ ACE_NEW (id,
+ Identifier ("Long"));
+ break;
+ case AST_PredefinedType::PT_ulong:
+ ACE_NEW (id,
+ Identifier ("ULong"));
+ break;
+ case AST_PredefinedType::PT_short:
+ ACE_NEW (id,
+ Identifier ("Short"));
+ break;
+ case AST_PredefinedType::PT_ushort:
+ ACE_NEW (id,
+ Identifier ("UShort"));
+ break;
+ case AST_PredefinedType::PT_float:
+ ACE_NEW (id,
+ Identifier ("Float"));
+ break;
+ case AST_PredefinedType::PT_double:
+ ACE_NEW (id,
+ Identifier ("Double"));
+ break;
+ case AST_PredefinedType::PT_char:
+ ACE_NEW (id,
+ Identifier ("Char"));
+ break;
+ case AST_PredefinedType::PT_octet:
+ ACE_NEW (id,
+ Identifier ("Octet"));
+ break;
+ case AST_PredefinedType::PT_wchar:
+ ACE_NEW (id,
+ Identifier ("WChar"));
+ break;
+ case AST_PredefinedType::PT_boolean:
+ ACE_NEW (id,
+ Identifier ("Boolean"));
+ break;
+ case AST_PredefinedType::PT_longlong:
+ ACE_NEW (id,
+ Identifier ("LongLong"));
+ break;
+ case AST_PredefinedType::PT_ulonglong:
+ ACE_NEW (id,
+ Identifier ("ULongLong"));
+ break;
+ case AST_PredefinedType::PT_longdouble:
+ ACE_NEW (id,
+ Identifier ("LongDouble"));
+ break;
+ case AST_PredefinedType::PT_any:
+ ACE_NEW (id,
+ Identifier ("Any"));
+ break;
+ case AST_PredefinedType::PT_object:
+ ACE_NEW (id,
+ Identifier ("Object"));
+ break;
+ case AST_PredefinedType::PT_pseudo:
+ ACE_NEW (id,
+ Identifier (n->last_component ()->get_string ()));
+ break;
+ default:
+ ACE_ERROR ((LM_ERROR,
+ "AST_PredefinedType - bad enum value\n"));
+ }
+
+ ACE_NEW (conc_name,
+ UTL_ScopedName (id,
+ 0));
+
+ new_name->nconc (conc_name);
+ }
+
+ this->set_name (new_name);
}
AST_PredefinedType::~AST_PredefinedType (void)
@@ -104,12 +212,35 @@ AST_PredefinedType::dump (ACE_OSTREAM_TYPE &o)
AST_Decl::dump (o);
}
+// Compute the size type of the node in question.
+int
+AST_PredefinedType::compute_size_type (void)
+{
+ if (this->pt () == AST_PredefinedType::PT_any
+ || this->pt () == AST_PredefinedType::PT_pseudo)
+ {
+ this->size_type (AST_Type::VARIABLE);
+ }
+ else
+ {
+ this->size_type (AST_Type::FIXED);
+ }
+
+ return 0;
+}
+
int
AST_PredefinedType::ast_accept (ast_visitor *visitor)
{
return visitor->visit_predefined_type (this);
}
+void
+AST_PredefinedType::destroy (void)
+{
+ this->AST_Type::destroy ();
+}
+
// Data accessors.
AST_PredefinedType::PredefinedType
diff --git a/TAO/TAO_IDL/ast/ast_recursive.cpp b/TAO/TAO_IDL/ast/ast_recursive.cpp
index cf8b2aa80ea..eb6247fe23f 100644
--- a/TAO/TAO_IDL/ast/ast_recursive.cpp
+++ b/TAO/TAO_IDL/ast/ast_recursive.cpp
@@ -79,10 +79,13 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// since it was not bracketed by a sequence). If we don't find the base
// type nor a sequence, return FALSE (legal use, since we're not nested).
-#include "idl.h"
-#include "idl_extern.h"
+#include "ast_union.h"
+#include "utl_stack.h"
+#include "global_extern.h"
-ACE_RCSID(ast, ast_recursive, "$Id$")
+ACE_RCSID (ast,
+ ast_recursive,
+ "$Id$")
idl_bool
AST_illegal_recursive_type (AST_Decl *t)
diff --git a/TAO/TAO_IDL/ast/ast_redef.cpp b/TAO/TAO_IDL/ast/ast_redef.cpp
index 433ff34d957..ce59b52ea0c 100644
--- a/TAO/TAO_IDL/ast/ast_redef.cpp
+++ b/TAO/TAO_IDL/ast/ast_redef.cpp
@@ -64,10 +64,11 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
*/
-#include "idl.h"
-#include "idl_extern.h"
+#include "ast_decl.h"
-ACE_RCSID(ast, ast_redef, "$Id$")
+ACE_RCSID (ast,
+ ast_redef,
+ "$Id$")
// Return TRUE if the node d represents an IDL construct whose name
// can be redefined.
@@ -79,6 +80,11 @@ can_be_redefined (AST_Decl *d)
case AST_Decl::NT_module:
case AST_Decl::NT_interface:
case AST_Decl::NT_interface_fwd:
+ case AST_Decl::NT_valuetype:
+ case AST_Decl::NT_valuetype_fwd:
+ case AST_Decl::NT_component:
+ case AST_Decl::NT_component_fwd:
+ case AST_Decl::NT_home:
case AST_Decl::NT_const:
case AST_Decl::NT_except:
case AST_Decl::NT_argument:
@@ -88,7 +94,9 @@ can_be_redefined (AST_Decl *d)
case AST_Decl::NT_array:
case AST_Decl::NT_sequence:
case AST_Decl::NT_union:
+ case AST_Decl::NT_union_fwd:
case AST_Decl::NT_struct:
+ case AST_Decl::NT_struct_fwd:
case AST_Decl::NT_enum:
case AST_Decl::NT_typedef:
return I_TRUE;
diff --git a/TAO/TAO_IDL/ast/ast_root.cpp b/TAO/TAO_IDL/ast/ast_root.cpp
index 7146dfb2baf..86daa23670d 100644
--- a/TAO/TAO_IDL/ast/ast_root.cpp
+++ b/TAO/TAO_IDL/ast/ast_root.cpp
@@ -69,20 +69,26 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// to subclass it to associate their own information with an entire
// AST.
-#include "idl.h"
-#include "idl_extern.h"
+#include "ast_root.h"
+#include "ast_sequence.h"
+#include "ast_string.h"
+#include "ast_array.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
-ACE_RCSID(ast, ast_root, "$Id$")
+ACE_RCSID (ast,
+ ast_root,
+ "$Id$")
-// Constructor(s) and destructor.
AST_Root::AST_Root (void)
{
}
AST_Root::AST_Root (UTL_ScopedName *n)
- : AST_Decl (AST_Decl::NT_module,
+ : AST_Module (n),
+ AST_Decl (AST_Decl::NT_root,
n),
- UTL_Scope (AST_Decl::NT_module)
+ UTL_Scope (AST_Decl::NT_root)
{
}
@@ -90,8 +96,6 @@ AST_Root::~AST_Root (void)
{
}
-// Add protocol.
-
// Add this AST_Sequence to the locally defined types in this scope.
AST_Sequence *
AST_Root::fe_add_sequence (AST_Sequence *t)
@@ -182,6 +186,12 @@ AST_Root::ast_accept (ast_visitor *visitor)
return visitor->visit_root (this);
}
+void
+AST_Root::destroy ()
+{
+ this->AST_Decl::destroy ();
+}
+
// Narrowing methods.
IMPL_NARROW_METHODS1(AST_Root, AST_Module)
IMPL_NARROW_FROM_DECL(AST_Root)
diff --git a/TAO/TAO_IDL/ast/ast_sequence.cpp b/TAO/TAO_IDL/ast/ast_sequence.cpp
index 456767c6e3a..99f5fbdf6d9 100644
--- a/TAO/TAO_IDL/ast/ast_sequence.cpp
+++ b/TAO/TAO_IDL/ast/ast_sequence.cpp
@@ -70,26 +70,31 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// must evaluate to a positive integer) and a base type (a subclass
// of AST_Type).
-#include "idl.h"
-#include "idl_extern.h"
+#include "ast_sequence.h"
+#include "ast_expression.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
-ACE_RCSID(ast, ast_sequence, "$Id$")
+ACE_RCSID (ast,
+ ast_sequence,
+ "$Id$")
-// Constructor(s) and destructor.
AST_Sequence::AST_Sequence (void)
: pd_max_size (0),
pd_base_type (0)
{
+ // A sequence data type is always VARIABLE.
+ this->size_type (AST_Type::VARIABLE);
}
AST_Sequence::AST_Sequence (AST_Expression *ms,
AST_Type *bt,
+ UTL_ScopedName *n,
idl_bool local,
idl_bool abstract)
- : AST_Decl(AST_Decl::NT_sequence,
- new UTL_ScopedName (new Identifier ("sequence"),
- 0),
- I_TRUE),
+ : AST_Decl (AST_Decl::NT_sequence,
+ n,
+ I_TRUE),
COMMON_Base (bt->is_local () || local,
abstract),
pd_max_size (ms),
@@ -105,6 +110,9 @@ AST_Sequence::AST_Sequence (AST_Expression *ms,
{
this->unbounded_ = I_FALSE;
}
+
+ // A sequence data type is always VARIABLE.
+ this->size_type (AST_Type::VARIABLE);
}
AST_Sequence::~AST_Sequence (void)
diff --git a/TAO/TAO_IDL/ast/ast_string.cpp b/TAO/TAO_IDL/ast/ast_string.cpp
index c71af9dc02d..0c16a6a5e02 100644
--- a/TAO/TAO_IDL/ast/ast_string.cpp
+++ b/TAO/TAO_IDL/ast/ast_string.cpp
@@ -69,39 +69,27 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// AST_String nodes have a maximum size (an AST_Expression which must
// evaluate to a positive integer).
-#include "idl.h"
-#include "idl_extern.h"
+#include "ast_string.h"
+#include "ast_expression.h"
+#include "ast_visitor.h"
+
+ACE_RCSID (ast,
+ ast_string,
+ "$Id$")
-ACE_RCSID(ast, ast_string, "$Id$")
-// Constructor(s) and destructor.
AST_String::AST_String (void)
: pd_max_size (0),
pd_width (sizeof (char))
{
}
-AST_String::AST_String (AST_Expression *ms)
- : AST_Decl (AST_Decl::NT_string,
- new UTL_ScopedName (new Identifier ("string"),
- 0),
- I_TRUE),
- pd_max_size (ms),
- pd_width (sizeof (char))
-{
-}
-
-AST_String::AST_String (AST_Expression *ms,
+AST_String::AST_String (AST_Decl::NodeType nt,
+ UTL_ScopedName *n,
+ AST_Expression *ms,
long wide)
- : AST_Decl
- (
- wide == (long) sizeof (char) ? AST_Decl::NT_string : AST_Decl::NT_wstring,
- new UTL_ScopedName
- (
- new Identifier ((wide == (long) sizeof (char)) ? "string" : "wstring"),
- 0
- ),
- I_TRUE
- ),
+ : AST_Decl (nt,
+ n,
+ I_TRUE),
pd_max_size (ms),
pd_width (wide)
{
@@ -115,7 +103,7 @@ AST_String::~AST_String (void)
// Dump this AST_String node to the ostream o.
void
-AST_String::dump(ACE_OSTREAM_TYPE &o)
+AST_String::dump (ACE_OSTREAM_TYPE &o)
{
o << "string <";
this->pd_max_size->dump (o);
@@ -128,6 +116,16 @@ AST_String::ast_accept (ast_visitor *visitor)
return visitor->visit_string (this);
}
+void
+AST_String::destroy (void)
+{
+ this->pd_max_size->destroy ();
+ delete this->pd_max_size;
+ this->pd_max_size = 0;
+
+ this->AST_Decl::destroy ();
+}
+
// Data accessors.
AST_Expression *
diff --git a/TAO/TAO_IDL/ast/ast_structure.cpp b/TAO/TAO_IDL/ast/ast_structure.cpp
index bea188fa9bd..7d802ac1e98 100644
--- a/TAO/TAO_IDL/ast/ast_structure.cpp
+++ b/TAO/TAO_IDL/ast/ast_structure.cpp
@@ -68,12 +68,18 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// AST_Structure is a subclass of AST_ConcreteType and of UTL_Scope (the
// structure's fields are managed in a scope).
-#include "idl.h"
-#include "idl_extern.h"
+#include "ast_union.h"
+#include "ast_field.h"
+#include "ast_enum.h"
+#include "ast_enum_val.h"
+#include "ast_visitor.h"
+#include "utl_err.h"
+#include "utl_indenter.h"
+
+ACE_RCSID (ast,
+ ast_structure,
+ "$Id$")
-ACE_RCSID(ast, ast_structure, "$Id$")
-
-// Constructor(s) and destructor.
AST_Structure::AST_Structure (void)
: member_count_ (-1),
local_struct_ (-1)
@@ -265,6 +271,16 @@ AST_Structure::fe_add_field (AST_Field *t)
I_FALSE,
t->local_name ());
+ AST_Type *ft = t->field_type ();
+ UTL_ScopedName *mru = ft->last_referenced_as ();
+
+ if (mru != 0)
+ {
+ this->add_to_referenced (ft,
+ I_FALSE,
+ mru->first_component ());
+ }
+
this->fields_.enqueue_tail (t);
return t;
@@ -486,10 +502,6 @@ AST_Structure::dump (ACE_OSTREAM_TYPE &o)
{
o << "(local) ";
}
- else
- {
- o << "(abstract) ";
- }
o << "struct ";
AST_Decl::dump (o);
@@ -499,6 +511,43 @@ AST_Structure::dump (ACE_OSTREAM_TYPE &o)
o << "}";
}
+// Compute the size type of the node in question.
+int
+AST_Structure::compute_size_type (void)
+{
+ for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ // Get the next AST decl node.
+ AST_Decl *d = si.item ();
+
+ if (d->node_type () == AST_Decl::NT_enum_val)
+ {
+ continue;
+ }
+
+ AST_Field *f = AST_Field::narrow_from_decl (d);
+ AST_Type *t = f->field_type ();
+
+ if (t != 0)
+ {
+ this->size_type (t->size_type ());
+
+ // While we're iterating, we might as well do this one too.
+ this->has_constructor (t->has_constructor ());
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "WARNING (%N:%l) be_structure::compute_size_type - "
+ "narrow_from_decl returned 0\n"));
+ }
+ }
+
+ return 0;
+}
+
int
AST_Structure::ast_accept (ast_visitor *visitor)
{
diff --git a/TAO/TAO_IDL/ast/ast_structure_fwd.cpp b/TAO/TAO_IDL/ast/ast_structure_fwd.cpp
new file mode 100644
index 00000000000..4f64a401516
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_structure_fwd.cpp
@@ -0,0 +1,76 @@
+// $Id$
+
+// AST_StructureFwd nodes denote forward declarations of IDL structs.
+// AST_StructureFwd nodes have a field containing the full declaration
+// of the struct, which is initialized when that declaration is
+// encountered.
+
+#include "ast_structure_fwd.h"
+#include "ast_structure.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
+
+ACE_RCSID( ast,
+ ast_structure_fwd,
+ "$Id$")
+
+AST_StructureFwd::AST_StructureFwd (void)
+ : pd_full_definition (0)
+{
+}
+
+AST_StructureFwd::AST_StructureFwd (UTL_ScopedName *n)
+ : AST_Decl (AST_Decl::NT_struct_fwd,
+ n),
+ pd_full_definition (0)
+{
+}
+
+AST_StructureFwd::~AST_StructureFwd (void)
+{
+}
+
+// Redefinition of inherited virtual operations.
+
+// Dump this AST_StructureFwd node to the ostream o.
+void
+AST_StructureFwd::dump (ACE_OSTREAM_TYPE &o)
+{
+ o << "struct ";
+ this->local_name ()->dump (o);
+}
+
+int
+AST_StructureFwd::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_structure_fwd (this);
+}
+
+// Data accessors.
+
+AST_Structure *
+AST_StructureFwd::full_definition (void)
+{
+ return this->pd_full_definition;
+}
+
+void
+AST_StructureFwd::set_full_definition (AST_Structure *nfd)
+{
+ this->pd_full_definition = nfd;
+}
+
+idl_bool
+AST_StructureFwd::is_defined (void)
+{
+ return (this->pd_full_definition != 0);
+}
+
+void
+AST_StructureFwd::destroy (void)
+{
+}
+
+// Narrowing methods.
+IMPL_NARROW_METHODS1 (AST_StructureFwd, AST_Type)
+IMPL_NARROW_FROM_DECL (AST_StructureFwd)
diff --git a/TAO/TAO_IDL/ast/ast_type.cpp b/TAO/TAO_IDL/ast/ast_type.cpp
index 63d6d727f72..a9014341a49 100644
--- a/TAO/TAO_IDL/ast/ast_type.cpp
+++ b/TAO/TAO_IDL/ast/ast_type.cpp
@@ -67,15 +67,23 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// AST_Type is the base class for all AST classes which represent
// IDL type constructs.
-#include "idl.h"
-#include "idl_extern.h"
+#include "ast_type.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
+#include "idl_defines.h"
+#include "nr_extern.h"
+#include "ace/Log_Msg.h"
-ACE_RCSID(ast, ast_type, "$Id$")
+ACE_RCSID (ast,
+ ast_type,
+ "$Id$")
-// Constructor(s) and destructor.
AST_Type::AST_Type (void)
: ifr_added_ (0),
- ifr_fwd_added_ (0)
+ ifr_fwd_added_ (0),
+ size_type_ (AST_Type::SIZE_UNKNOWN),
+ has_constructor_ (0),
+ nested_type_name_ (0)
{
}
@@ -84,7 +92,10 @@ AST_Type::AST_Type (AST_Decl::NodeType nt,
: AST_Decl (nt,
n),
ifr_added_ (0),
- ifr_fwd_added_ (0)
+ ifr_fwd_added_ (0),
+ size_type_ (AST_Type::SIZE_UNKNOWN),
+ has_constructor_ (0),
+ nested_type_name_ (0)
{
}
@@ -94,6 +105,47 @@ AST_Type::~AST_Type (void)
// Public operations.
+// Return our size type.
+AST_Type::SIZE_TYPE
+AST_Type::size_type (void)
+{
+ if (this->size_type_ == AST_Type::SIZE_UNKNOWN)
+ {
+ (void) this->compute_size_type ();
+ }
+
+ return this->size_type_;
+}
+
+// Set our size type and that of all our ancestors.
+void
+AST_Type::size_type (AST_Type::SIZE_TYPE st)
+{
+ // Precondition - you cannot set somebody's sizetype to unknown.
+ ACE_ASSERT (st != AST_Type::SIZE_UNKNOWN);
+
+ // Size type can be VARIABLE or FIXED.
+ if (this->size_type_ == AST_Type::SIZE_UNKNOWN) // not set yet
+ {
+ this->size_type_ = st; // set it
+ }
+ else if ((this->size_type_ == AST_Type::FIXED)
+ && (st == AST_Type::VARIABLE))
+ {
+ // Once we are VARIABLE, we cannot be FIXED. But if we were FIXED and then
+ // get overwritten to VARIABLE, it is fine. Such a situation occurs only
+ // when setting the sizes of structures and unions.
+ this->size_type_ = st;
+ }
+}
+
+// Compute the size type of the node in question
+int
+AST_Type::compute_size_type (void)
+{
+ return 0;
+}
+
idl_bool
AST_Type::in_recursion (AST_Type *)
{
@@ -133,12 +185,328 @@ AST_Type::ifr_fwd_added (idl_bool val)
this->ifr_fwd_added_ = val;
}
+idl_bool
+AST_Type::has_constructor (void)
+{
+ return this->has_constructor_;
+}
+
+void
+AST_Type::has_constructor (idl_bool value)
+{
+ // Similarly to be_decl::size_type_, once this
+ // gets set to I_TRUE, we don't want it to
+ // change back.
+ if (this->has_constructor_ == 0)
+ {
+ this->has_constructor_ = value;
+ }
+}
+
+// This code works. However, whether we should generate the
+// ACE_NESTED_CLASS macro or not should be based on an option to the
+// compiler. The previous version generated a relative path.
+// This version always generates ACE_NESTED_CLASS, (leave ace/ACE.h and friends
+// do the porting)
+//
+// Caution: returns the same buffer pointer even if the contents may change
+// in the next call. (return std::string anyone?)
+//
+// Return the type name using the ACE_NESTED_CLASS macro
+
+const char *
+AST_Type::nested_type_name (AST_Decl *use_scope,
+ const char *suffix,
+ const char *prefix)
+{
+ return this->nested_name (this->local_name ()->get_string (),
+ this->full_name (),
+ use_scope,
+ suffix,
+ prefix);
+}
+
+// This is the real thing used by the method above.
+const char *
+AST_Type::nested_name (const char* local_name,
+ const char* full_name,
+ AST_Decl *use_scope,
+ const char *suffix,
+ const char *prefix)
+{
+ // Some compilers do not like generating a fully scoped name for a type that
+ // was defined in the same enclosing scope in which it was defined. For such,
+ // we emit a macro defined in the ACE library.
+ //
+
+ // The tricky part here is that it is not enough to check if the
+ // typename we are using was defined in the current scope. But we
+ // need to ensure that it was not defined in any of our ancestor
+ // scopes as well. If that is the case, then we can generate a fully
+ // scoped name for that type, else we use the ACE_NESTED_CLASS macro.
+
+ // Thus we need some sort of relative name to be generated.
+
+ if (this->nested_type_name_ == 0)
+ {
+ ACE_NEW_RETURN (this->nested_type_name_,
+ char[NAMEBUFSIZE],
+ 0);
+ }
+
+ // Our defining scope.
+ AST_Decl *def_scope = 0;
+
+ // Hold the fully scoped name.
+ char def_name [NAMEBUFSIZE];
+ char use_name [NAMEBUFSIZE];
+
+ // These point to the prev, curr and next component in the scope.
+ char *def_curr = def_name;
+ char *def_next = 0;
+ char *use_curr = use_name;
+ char *use_next = 0;
+
+ // How many chars to compare.
+ int len_to_match = 0;
+
+ // Initialize the buffers.
+ ACE_OS::memset (this->nested_type_name_,
+ '\0',
+ NAMEBUFSIZE);
+
+ ACE_OS::memset (def_name,
+ '\0',
+ NAMEBUFSIZE);
+
+ ACE_OS::memset (use_name,
+ '\0',
+ NAMEBUFSIZE);
+
+ // Traverse every component of the def_scope and use_scope beginning at the
+ // root and proceeding towards the leaf trying to see if the components
+ // match. Continue until there is a match and keep accumulating the path
+ // traversed. This forms the first argument to the ACE_NESTED_CLASS
+ // macro. Whenever there is no match, the remaining components of the
+ // def_scope form the second argument.
+
+ UTL_Scope *s = this->defined_in ();
+
+ def_scope = s ? ScopeAsDecl (s) : 0;
+
+ if (def_scope
+ && def_scope->node_type () != AST_Decl::NT_root
+ && use_scope)
+ // If both scopes exist and that we are not in the root scope.
+ {
+ ACE_OS::strcpy (def_name,
+ def_scope->full_name ());
+
+ ACE_OS::strcpy (use_name,
+ use_scope->full_name ());
+
+ // Find the first occurrence of a :: and advance
+ // the next pointers accordingly.
+ def_next = ACE_OS::strstr (def_curr, "::");
+ use_next = ACE_OS::strstr (use_curr, "::");
+
+ // If the scopes are identical, don't supply them.
+ if (ACE_OS::strcmp (def_name,
+ use_name)
+ == 0)
+ {
+ if (prefix != 0)
+ {
+ ACE_OS::strcat (this->nested_type_name_,
+ prefix);
+ }
+
+ ACE_OS::strcat (this->nested_type_name_,
+ local_name);
+ if (suffix != 0)
+ {
+ ACE_OS::strcat (this->nested_type_name_,
+ suffix);
+ }
+
+ return this->nested_type_name_;
+ }
+
+ if (def_next != 0)
+ {
+ len_to_match =
+ ACE_OS::strlen (def_curr) - ACE_OS::strlen (def_next);
+ }
+ else
+ {
+ len_to_match = ACE_OS::strlen (def_curr);
+ }
+
+ if (use_next != 0)
+ {
+ int len =
+ ACE_OS::strlen (use_curr) - ACE_OS::strlen (use_next);
+
+ if (len > len_to_match)
+ {
+ len_to_match = len;
+ }
+ }
+ else
+ {
+ int len = ACE_OS::strlen (use_curr);
+
+ if (len > len_to_match)
+ {
+ len_to_match = len;
+ }
+ }
+
+ if (ACE_OS::strncmp (def_curr,
+ use_curr,
+ len_to_match)
+ == 0)
+ {
+ // Initial prefix matches i.e., they have a common root.
+ // Start by initializing the macro.
+ ACE_OS::sprintf (this->nested_type_name_,
+ "ACE_NESTED_CLASS (");
+
+ // Initialize the first argument.
+ ACE_OS::strncat (this->nested_type_name_,
+ def_curr,
+ len_to_match);
+
+ // Shift the current scopes to the next level.
+ def_curr = (def_next ? (def_next + 2) : 0); // Skip the ::
+ use_curr = (use_next ? (use_next + 2) : 0); // Skip the ::
+
+ while (def_curr && use_curr)
+ {
+ // Find the first occurrence of a :: and advance the
+ // next pointers accordingly.
+ def_next = ACE_OS::strstr (def_curr, "::");
+ use_next = ACE_OS::strstr (use_curr, "::");
+
+ if (def_next != 0)
+ {
+ len_to_match =
+ ACE_OS::strlen (def_curr) - ACE_OS::strlen (def_next);
+ }
+ else
+ {
+ len_to_match = ACE_OS::strlen (def_curr);
+ }
+
+ if (use_next != 0)
+ {
+ int len =
+ ACE_OS::strlen (use_curr) - ACE_OS::strlen (use_next);
+
+ if (len > len_to_match)
+ {
+ len_to_match = len;
+ }
+ }
+ else
+ {
+ int len = ACE_OS::strlen (use_curr);
+
+ if (len > len_to_match)
+ {
+ len_to_match = len;
+ }
+ }
+
+ if (ACE_OS::strncmp (def_curr,
+ use_curr,
+ len_to_match)
+ == 0)
+ {
+ // They have same prefix, append to arg1.
+ ACE_OS::strcat (this->nested_type_name_,
+ "::");
+
+ ACE_OS::strncat (this->nested_type_name_,
+ def_curr,
+ len_to_match);
+
+ def_curr = (def_next ? (def_next + 2) : 0); // Skip the ::
+ use_curr = (use_next ? (use_next + 2) : 0); // Skip the ::
+ }
+ else
+ {
+ // No match. This is the end of the first argument. Get out
+ // of the loop as no more comparisons are necessary.
+ break;
+ }
+ }
+
+ // Start the 2nd argument of the macro.
+ ACE_OS::strcat (this->nested_type_name_, ", ");
+
+ // Copy the remaining def_name (if any are left).
+ if (def_curr != 0)
+ {
+ ACE_OS::strcat (this->nested_type_name_,
+ def_curr);
+
+ ACE_OS::strcat (this->nested_type_name_,
+ "::");
+ }
+
+ // Append our local name.
+ if (prefix != 0)
+ {
+ ACE_OS::strcat (this->nested_type_name_, prefix);
+ }
+
+ ACE_OS::strcat (this->nested_type_name_,
+ local_name);
+
+ if (suffix != 0)
+ {
+ ACE_OS::strcat (this->nested_type_name_,
+ suffix);
+ }
+
+ ACE_OS::strcat (this->nested_type_name_,
+ ")");
+
+ return this->nested_type_name_;
+ } // End of if the root prefixes match.
+ }
+
+ // Otherwise just emit our full_name.
+ if (prefix != 0)
+ {
+ ACE_OS::strcat (this->nested_type_name_, prefix);
+ }
+
+ ACE_OS::strcat (this->nested_type_name_,
+ full_name);
+
+ if (suffix != 0)
+ {
+ ACE_OS::strcat (this->nested_type_name_,
+ suffix);
+ }
+
+ return this->nested_type_name_;
+}
+
int
AST_Type::ast_accept (ast_visitor *visitor)
{
return visitor->visit_type (this);
}
+void
+AST_Type::destroy (void)
+{
+ this->AST_Decl::destroy ();
+}
+
// Narrowing.
IMPL_NARROW_METHODS1(AST_Type, AST_Decl)
IMPL_NARROW_FROM_DECL(AST_Type)
diff --git a/TAO/TAO_IDL/ast/ast_typedef.cpp b/TAO/TAO_IDL/ast/ast_typedef.cpp
index 67e5601dc97..158f88b15ed 100644
--- a/TAO/TAO_IDL/ast/ast_typedef.cpp
+++ b/TAO/TAO_IDL/ast/ast_typedef.cpp
@@ -70,12 +70,16 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// AST_Typedef nodes have a base type (a subclass of AST_Type)
// and a name (an UTL_ScopedName).
-#include "idl.h"
-#include "idl_extern.h"
+#include "ast_typedef.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
-ACE_RCSID(ast, ast_typedef, "$Id$")
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (ast,
+ ast_typedef,
+ "$Id$")
-// Constructor(s) and destructor.
AST_Typedef::AST_Typedef (void)
: pd_base_type (0)
{
@@ -137,12 +141,40 @@ AST_Typedef::dump (ACE_OSTREAM_TYPE&o)
this->local_name ()->dump (o);
}
+// Compute the size type of the node in question.
+int
+AST_Typedef::compute_size_type (void)
+{
+ AST_Type *type = this->base_type ();
+
+ if (type == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_typedef::compute_size_type - "
+ "bad base type\n"),
+ -1);
+ }
+
+ // Our size type is the same as our type.
+ this->size_type (type->size_type ());
+
+ // While we're here, take care of has_constructor.
+ this->has_constructor (type->has_constructor ());
+
+ return 0;
+}
+
int
AST_Typedef::ast_accept (ast_visitor *visitor)
{
return visitor->visit_typedef (this);
}
+void
+AST_Typedef::destroy (void)
+{
+}
+
// Data accessors.
AST_Type *
diff --git a/TAO/TAO_IDL/ast/ast_union.cpp b/TAO/TAO_IDL/ast/ast_union.cpp
index f503197aaff..d9a6e4aaa1e 100644
--- a/TAO/TAO_IDL/ast/ast_union.cpp
+++ b/TAO/TAO_IDL/ast/ast_union.cpp
@@ -73,12 +73,23 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// AST_Expression::ExprType and serves as a cache). This field is used
// to compute coercions for labels based on the expected discriminator type.
-#include "idl.h"
-#include "idl_extern.h"
+#include "ast_union.h"
+#include "ast_union_branch.h"
+#include "ast_union_label.h"
+#include "ast_field.h"
+#include "ast_predefined_type.h"
+#include "ast_enum.h"
+#include "ast_enum_val.h"
+#include "ast_visitor.h"
+#include "utl_err.h"
+#include "utl_identifier.h"
+#include "utl_indenter.h"
+#include "global_extern.h"
+
+ACE_RCSID (ast,
+ ast_union,
+ "$Id$")
-ACE_RCSID(ast, ast_union, "$Id$")
-
-// Constructor(s) and destructor.
AST_Union::AST_Union (void)
{
}
@@ -155,7 +166,7 @@ AST_Union::AST_Union (AST_ConcreteType *dt,
}
else if (dt->node_type() == AST_Decl::NT_enum)
{
- this->pd_udisc_type = AST_Expression::EV_any;
+ this->pd_udisc_type = AST_Expression::EV_enum;
this->pd_disc_type = dt;
}
else
@@ -425,7 +436,7 @@ AST_Union::lookup_branch (AST_UnionBranch *branch)
return lookup_default ();
}
- if (this->pd_udisc_type == AST_Expression::EV_any)
+ if (this->pd_udisc_type == AST_Expression::EV_enum)
{
// CONVENTION: indicates enum discriminant.
return lookup_enum (branch);
@@ -551,7 +562,7 @@ AST_Union::compute_default_value (void)
}
break;
- case AST_Expression::EV_any:
+ case AST_Expression::EV_enum:
// Has to be enum.
{
AST_Decl *d = AST_Decl::narrow_from_decl (this->disc_type ());
@@ -647,7 +658,7 @@ AST_Union::compute_default_value (void)
case AST_Expression::EV_bool:
this->default_value_.u.bool_val = 0;
break;
- case AST_Expression::EV_any:
+ case AST_Expression::EV_enum:
this->default_value_.u.enum_val = 0;
break;
case AST_Expression::EV_longlong:
@@ -766,7 +777,7 @@ AST_Union::compute_default_value (void)
}
break;
- case AST_Expression::EV_any:
+ case AST_Expression::EV_enum:
// this is the case of enums. We maintain
// evaluated values which always start with 0
if (this->default_value_.u.enum_val
@@ -826,6 +837,13 @@ AST_Union::compute_default_index (void)
// Get the next AST decl node.
d = si.item ();
+ // If an enum is declared in our scope, its members are
+ // added to our scope as well, to detect clashes.
+ if (d->node_type () == AST_Decl::NT_enum_val)
+ {
+ continue;
+ }
+
if (!d->imported ())
{
ub = AST_UnionBranch::narrow_from_decl (d);
@@ -913,6 +931,16 @@ AST_Union::fe_add_union_branch (AST_UnionBranch *t)
I_FALSE,
t->local_name ());
+ AST_Type *ft = t->field_type ();
+ UTL_ScopedName *mru = ft->last_referenced_as ();
+
+ if (mru != 0)
+ {
+ this->add_to_referenced (ft,
+ I_FALSE,
+ mru->first_component ());
+ }
+
this->fields_.enqueue_tail (t);
return t;
@@ -1119,6 +1147,44 @@ AST_Union::dump (ACE_OSTREAM_TYPE &o)
o << "}";
}
+// Compute the size type of the node in question.
+int
+AST_Union::compute_size_type (void)
+{
+ for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ // Get the next AST decl node.
+ AST_Decl *d = si.item ();
+
+ if (d->node_type () == AST_Decl::NT_enum_val)
+ {
+ continue;
+ }
+
+ AST_Field *f = AST_Field::narrow_from_decl (d);
+
+ if (f != 0)
+ {
+ AST_Type *t = f->field_type ();
+ // Our sizetype depends on the sizetype of our members. Although
+ // previous value of sizetype may get overwritten, we are
+ // guaranteed by the "size_type" call that once the value reached
+ // be_decl::VARIABLE, nothing else can overwrite it.
+ this->size_type (t->size_type ());
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "WARNING (%N:%l) be_union::compute_size_type - "
+ "narrow_from_decl returned 0\n"));
+ }
+ }
+
+ return 0;
+}
+
int
AST_Union::ast_accept (ast_visitor *visitor)
{
diff --git a/TAO/TAO_IDL/ast/ast_union_branch.cpp b/TAO/TAO_IDL/ast/ast_union_branch.cpp
index a8f4a10a3eb..0c92a48ebd4 100644
--- a/TAO/TAO_IDL/ast/ast_union_branch.cpp
+++ b/TAO/TAO_IDL/ast/ast_union_branch.cpp
@@ -69,12 +69,13 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// AST_UnionBranch is a subclass of AST_Field, adding a label (which
// is a subclass of AST_UnionLabel).
-#include "idl.h"
-#include "idl_extern.h"
+#include "ast_union_branch.h"
+#include "ast_union_label.h"
+#include "ast_visitor.h"
+#include "utl_labellist.h"
ACE_RCSID(ast, ast_union_branch, "$Id$")
-// Constructor(s) and destructor.
AST_UnionBranch::AST_UnionBranch (void)
: pd_ll (0)
{
@@ -105,8 +106,10 @@ AST_UnionBranch::dump (ACE_OSTREAM_TYPE &o)
for (unsigned long i = 0; i < this->label_list_length (); ++i)
{
o << "case ";
+
AST_UnionLabel *ul = this->label (i);
ul->dump (o);
+
o << ": \n";
}
diff --git a/TAO/TAO_IDL/ast/ast_union_fwd.cpp b/TAO/TAO_IDL/ast/ast_union_fwd.cpp
new file mode 100644
index 00000000000..b24676a653d
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_union_fwd.cpp
@@ -0,0 +1,76 @@
+// $Id$
+
+// AST_UnionFwd nodes denote forward declarations of IDL union.
+// AST_UnionFwd nodes have a field containing the full declaration
+// of the union, which is initialized when that declaration is
+// encountered.
+
+#include "ast_union_fwd.h"
+#include "ast_union.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
+
+ACE_RCSID( ast,
+ ast_union_fwd,
+ "$Id$")
+
+AST_UnionFwd::AST_UnionFwd (void)
+ : pd_full_definition (0)
+{
+}
+
+AST_UnionFwd::AST_UnionFwd (UTL_ScopedName *n)
+ : AST_Decl (AST_Decl::NT_union_fwd,
+ n),
+ pd_full_definition (0)
+{
+}
+
+AST_UnionFwd::~AST_UnionFwd (void)
+{
+}
+
+// Redefinition of inherited virtual operations.
+
+// Dump this AST_StructureFwd node to the ostream o.
+void
+AST_UnionFwd::dump (ACE_OSTREAM_TYPE &o)
+{
+ o << "union ";
+ this->local_name ()->dump (o);
+}
+
+int
+AST_UnionFwd::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_union_fwd (this);
+}
+
+// Data accessors.
+
+AST_Union *
+AST_UnionFwd::full_definition (void)
+{
+ return this->pd_full_definition;
+}
+
+void
+AST_UnionFwd::set_full_definition (AST_Union *nfd)
+{
+ this->pd_full_definition = nfd;
+}
+
+idl_bool
+AST_UnionFwd::is_defined (void)
+{
+ return (this->pd_full_definition != 0);
+}
+
+void
+AST_UnionFwd::destroy (void)
+{
+}
+
+// Narrowing methods.
+IMPL_NARROW_METHODS1 (AST_UnionFwd, AST_Type)
+IMPL_NARROW_FROM_DECL (AST_UnionFwd)
diff --git a/TAO/TAO_IDL/ast/ast_union_label.cpp b/TAO/TAO_IDL/ast/ast_union_label.cpp
index a92efbf176f..388528b3cc0 100644
--- a/TAO/TAO_IDL/ast/ast_union_label.cpp
+++ b/TAO/TAO_IDL/ast/ast_union_label.cpp
@@ -69,12 +69,13 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// enum AST_UnionLabel::LabelKind) and a label value (which is a
// subclass of AST_Expression).
-#include "idl.h"
-#include "idl_extern.h"
+#include "ast_union_label.h"
+#include "ast_expression.h"
+#include "ast_visitor.h"
-ACE_RCSID(ast, ast_union_label, "$Id$")
-
-// Constructor(s) and destructor.
+ACE_RCSID (ast,
+ ast_union_label,
+ "$Id$")
AST_UnionLabel::AST_UnionLabel (void)
: pd_label_kind (UL_default),
diff --git a/TAO/TAO_IDL/ast/ast_valuetype.cpp b/TAO/TAO_IDL/ast/ast_valuetype.cpp
new file mode 100644
index 00000000000..f77b423da07
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_valuetype.cpp
@@ -0,0 +1,241 @@
+// This may look like C, but it's really -*- C++ -*-
+// $Id$
+
+#include "ast_valuetype.h"
+#include "ast_factory.h"
+#include "ast_visitor.h"
+#include "ast_extern.h"
+#include "utl_err.h"
+#include "utl_identifier.h"
+#include "utl_indenter.h"
+#include "global_extern.h"
+#include "nr_extern.h"
+
+ACE_RCSID (ast,
+ ast_valuetype,
+ "$Id$")
+
+AST_ValueType::AST_ValueType (void)
+ : pd_supports (0),
+ pd_n_supports (0),
+ pd_inherits_concrete (0),
+ pd_supports_concrete (0),
+ pd_truncatable (I_FALSE)
+{
+}
+
+AST_ValueType::AST_ValueType (UTL_ScopedName *n,
+ AST_Interface **inherits,
+ long n_inherits,
+ AST_ValueType *inherits_concrete,
+ AST_Interface **inherits_flat,
+ long n_inherits_flat,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface *supports_concrete,
+ idl_bool abstract,
+ idl_bool truncatable)
+ : AST_Interface (n,
+ inherits,
+ n_inherits,
+ inherits_flat,
+ n_inherits_flat,
+ I_FALSE,
+ abstract),
+ AST_Type (AST_Decl::NT_valuetype,
+ n),
+ AST_Decl (AST_Decl::NT_valuetype,
+ n),
+ UTL_Scope (AST_Decl::NT_valuetype),
+ COMMON_Base (I_FALSE,
+ abstract),
+ pd_supports (supports),
+ pd_n_supports (n_supports),
+ pd_inherits_concrete (inherits_concrete),
+ pd_supports_concrete (supports_concrete),
+ pd_truncatable (truncatable)
+{
+}
+
+AST_ValueType::~AST_ValueType (void)
+{
+}
+
+void
+AST_ValueType::redefine (AST_Interface *from)
+{
+ AST_ValueType *vt = AST_ValueType::narrow_from_decl (from);
+
+ if (vt == 0)
+ {
+ idl_global->err ()->redef_error (from->local_name ()->get_string (),
+ this->local_name ()->get_string ());
+ return;
+ }
+
+ // Copy over all the base class members.
+ this->AST_Interface::redefine (from);
+
+ this->pd_inherits_concrete = vt->pd_inherits_concrete;
+ this->pd_supports_concrete = vt->pd_supports_concrete;
+ this->pd_truncatable = vt->pd_truncatable;
+}
+
+AST_Interface **
+AST_ValueType::supports (void) const
+{
+ return this->pd_supports;
+}
+
+long
+AST_ValueType::n_supports (void) const
+{
+ return this->pd_n_supports;
+}
+
+AST_ValueType *
+AST_ValueType::inherits_concrete (void) const
+{
+ return this->pd_inherits_concrete;
+}
+
+AST_Interface *
+AST_ValueType::supports_concrete (void) const
+{
+ return this->pd_supports_concrete;
+}
+
+idl_bool
+AST_ValueType::truncatable (void) const
+{
+ return this->pd_truncatable;
+}
+
+void
+AST_ValueType::destroy (void)
+{
+ this->AST_Interface::destroy ();
+}
+
+void
+AST_ValueType::dump (ACE_OSTREAM_TYPE &o)
+{
+ if (this->is_abstract ())
+ {
+ o << "abstract ";
+ }
+ else if (this->pd_truncatable)
+ {
+ o << "truncatable ";
+ }
+
+ o << "valuetype ";
+
+ this->local_name ()->dump (o);
+ o << " ";
+
+ if (this->pd_n_inherits > 0)
+ {
+ o << ": ";
+
+ for (long i = 0; i < this->pd_n_inherits; ++i)
+ {
+ this->pd_inherits[i]->local_name ()->dump (o);
+
+ if (i < this->pd_n_inherits - 1)
+ {
+ o << ", ";
+ }
+ }
+ }
+
+ o << "\n\n";
+
+ if (this->pd_n_supports > 0)
+ {
+ o << "supports ";
+
+ for (long i = 0; i < this->pd_n_supports; ++i)
+ {
+ this->pd_supports[i]->local_name ()->dump (o);
+
+ if (i < this->pd_n_supports - 1)
+ {
+ o << ", ";
+ }
+ }
+ }
+
+ o << " {\n";
+
+ UTL_Scope::dump (o);
+ idl_global->indent ()->skip_to (o);
+
+ o << "}";
+}
+
+int
+AST_ValueType::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_valuetype (this);
+}
+
+AST_Factory *
+AST_ValueType::fe_add_factory (AST_Factory *f)
+{
+ AST_Decl *d = 0;
+
+ // Can't add to interface which was not yet defined.
+ if (!this->is_defined ())
+ {
+ idl_global->err ()->error2 (UTL_Error::EIDL_DECL_NOT_DEFINED,
+ this,
+ f);
+ return 0;
+ }
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (f, I_FALSE)) != 0)
+ {
+ if (!can_be_redefined (d))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ f,
+ this,
+ d);
+ return 0;
+ }
+
+ if (this->referenced (d, f->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ f,
+ this,
+ d);
+ return 0;
+ }
+
+ if (f->has_ancestor (d))
+ {
+ idl_global->err ()->redefinition_in_scope (f,
+ d);
+ return 0;
+ }
+ }
+
+ // Add it to scope.
+ this->add_to_scope (f);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (f,
+ I_FALSE,
+ f->local_name ());
+
+ return f;
+}
+
+ // Narrowing.
+IMPL_NARROW_METHODS1(AST_ValueType, AST_Interface);
+IMPL_NARROW_FROM_DECL(AST_ValueType);
+IMPL_NARROW_FROM_SCOPE(AST_ValueType);
+
diff --git a/TAO/TAO_IDL/ast/ast_valuetype_fwd.cpp b/TAO/TAO_IDL/ast/ast_valuetype_fwd.cpp
new file mode 100644
index 00000000000..95e1e633dae
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_valuetype_fwd.cpp
@@ -0,0 +1,61 @@
+// $Id$
+
+#include "ast_valuetype_fwd.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
+
+ACE_RCSID( ast,
+ ast_valuetype_fwd,
+ "$Id$")
+
+AST_ValueTypeFwd::AST_ValueTypeFwd (void)
+{
+}
+
+AST_ValueTypeFwd::AST_ValueTypeFwd (AST_Interface *dummy,
+ UTL_ScopedName *n)
+ : AST_InterfaceFwd (dummy,
+ n),
+ AST_Type (AST_Decl::NT_valuetype_fwd,
+ n),
+ AST_Decl (AST_Decl::NT_valuetype_fwd,
+ n),
+ COMMON_Base (I_FALSE,
+ I_FALSE)
+{
+}
+
+AST_ValueTypeFwd::~AST_ValueTypeFwd (void)
+{
+}
+
+// Redefinition of inherited virtual operations.
+
+// Dump this AST_InterfaceFwd node to the ostream o.
+void
+AST_ValueTypeFwd::dump (ACE_OSTREAM_TYPE &o)
+{
+ if (this->is_abstract ())
+ {
+ o << "abstract ";
+ }
+
+ o << "valuetype ";
+
+ this->local_name ()->dump (o);
+}
+
+int
+AST_ValueTypeFwd::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_valuetype_fwd (this);
+}
+
+void
+AST_ValueTypeFwd::destroy (void)
+{
+}
+
+// Narrowing methods.
+IMPL_NARROW_METHODS1 (AST_ValueTypeFwd, AST_InterfaceFwd)
+IMPL_NARROW_FROM_DECL (AST_ValueTypeFwd)
diff --git a/TAO/TAO_IDL/ast/ast_visitor.cpp b/TAO/TAO_IDL/ast/ast_visitor.cpp
index 37eacf4542f..35c8f8566f6 100644
--- a/TAO/TAO_IDL/ast/ast_visitor.cpp
+++ b/TAO/TAO_IDL/ast/ast_visitor.cpp
@@ -1,9 +1,11 @@
// $Id$
#include "ast_visitor.h"
-#include "ace/ACE.h"
+#include "ace/config-all.h"
-ACE_RCSID(ast, ast_visitor, "$Id$")
+ACE_RCSID (ast,
+ ast_visitor,
+ "$Id$")
ast_visitor::ast_visitor (void)
{
diff --git a/TAO/TAO_IDL/be/Makefile.am b/TAO/TAO_IDL/be/Makefile.am
index 39e7c1f3b71..cf8ebeea9ae 100644
--- a/TAO/TAO_IDL/be/Makefile.am
+++ b/TAO/TAO_IDL/be/Makefile.am
@@ -24,6 +24,8 @@ libbe_la_SOURCES = \
be_array.cpp \
be_attribute.cpp \
be_codegen.cpp \
+ be_component.cpp \
+ be_component_fwd.cpp \
be_constant.cpp \
be_decl.cpp \
be_enum.cpp \
@@ -33,6 +35,7 @@ libbe_la_SOURCES = \
be_field.cpp \
be_generator.cpp \
be_helper.cpp \
+ be_home.cpp \
be_init.cpp \
be_interface.cpp \
be_interface_fwd.cpp \
@@ -49,10 +52,12 @@ libbe_la_SOURCES = \
be_stream_factory.cpp \
be_string.cpp \
be_structure.cpp \
+ be_structure_fwd.cpp \
be_sunsoft.cpp \
be_type.cpp \
be_typedef.cpp \
be_union.cpp \
+ be_union_fwd.cpp \
be_union_branch.cpp \
be_union_label.cpp \
be_valuetype.cpp \
@@ -62,6 +67,8 @@ libbe_la_SOURCES = \
be_visitor_argument.cpp \
be_visitor_array.cpp \
be_visitor_attribute.cpp \
+ be_visitor_component.cpp \
+ be_visitor_component_fwd.cpp \
be_visitor_constant.cpp \
be_visitor_context.cpp \
be_visitor_decl.cpp \
@@ -69,6 +76,7 @@ libbe_la_SOURCES = \
be_visitor_exception.cpp \
be_visitor_factory.cpp \
be_visitor_field.cpp \
+ be_visitor_home.cpp \
be_visitor_interface.cpp \
be_visitor_interface_fwd.cpp \
be_visitor_module.cpp \
diff --git a/TAO/TAO_IDL/be/be_argument.cpp b/TAO/TAO_IDL/be/be_argument.cpp
index 82c9d2e64d1..0a4fc22ffc5 100644
--- a/TAO/TAO_IDL/be/be_argument.cpp
+++ b/TAO/TAO_IDL/be/be_argument.cpp
@@ -19,11 +19,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_argument.h"
+#include "be_visitor.h"
-ACE_RCSID(be, be_argument, "$Id$")
+ACE_RCSID (be,
+ be_argument,
+ "$Id$")
be_argument::be_argument (void)
{
diff --git a/TAO/TAO_IDL/be/be_array.cpp b/TAO/TAO_IDL/be/be_array.cpp
index bc25a29ce0f..e598750ab63 100644
--- a/TAO/TAO_IDL/be/be_array.cpp
+++ b/TAO/TAO_IDL/be/be_array.cpp
@@ -19,14 +19,19 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-ACE_RCSID(be, be_array, "$Id$")
+#include "be_array.h"
+#include "be_codegen.h"
+#include "be_scope.h"
+#include "be_helper.h"
+#include "be_visitor.h"
+#include "utl_identifier.h"
+#include "idl_defines.h"
+
+ACE_RCSID (be,
+ be_array,
+ "$Id$")
be_array::be_array (void)
- : tao_name_ (0)
{
}
@@ -48,76 +53,12 @@ be_array::be_array (UTL_ScopedName *n,
n,
I_TRUE),
COMMON_Base (local,
- abstract),
- tao_name_ (0)
+ abstract)
{
}
be_array::~be_array (void)
{
- if (this->tao_name_ == 0)
- delete [] tao_name_;
-}
-
-// Create a name for ourselves.
-const char*
-be_array::tao_name (void)
-{
- if (this->tao_name_ != 0)
- return this->tao_name_;
-
- be_type *bt = be_type::narrow_from_decl (this->base_type ());
-
- if (!bt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_array::"
- "tao_name - "
- "bad base type\n"),
- 0);
- }
-
- const char prefix[] = "_tc_tao_array_";
-
- int l = (ACE_OS::strlen (bt->local_name ()->get_string ())
- + ACE_OS::strlen (this->local_name ()->get_string ()) + 1
- + sizeof (prefix)
- + 5 * this->n_dims ());
-
- ACE_NEW_RETURN (this->tao_name_, char[l], 0);
-
- ACE_OS::sprintf (this->tao_name_, "%s%s_%s",
- prefix, this->local_name ()->get_string (),
- bt->local_name ()->get_string());
-
- for (unsigned int i = 0; i < this->n_dims (); ++i)
- {
- AST_Expression *expr = this->dims ()[i]; // retrieve the ith
-
- // Dimension value.
- if ((expr == 0) || ((expr != 0) && (expr->ev () == 0)))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_array::"
- "tao_name - "
- "bad array dimension\n"),
- 0);
- }
-
- if (expr->ev ()->et != AST_Expression::EV_ulong)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_array::"
- "tao_name - "
- "bad dimension value\n"),
- 0);
- }
-
- char buf[16];
- ACE_OS::sprintf (buf, "_%4.4x", ((int) expr->ev ()->u.ulval));
- ACE_OS::strcat (this->tao_name_, buf);
- }
- return this->tao_name_;
}
int
@@ -128,7 +69,9 @@ be_array::create_name (void)
UTL_ScopedName *n = 0;
be_decl *scope;
- ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
+ ACE_OS::memset (namebuf,
+ '\0',
+ NAMEBUFSIZE);
// Retrieve the base type.
// The name always starts this way.
be_type *bt = be_type::narrow_from_decl (this->base_type ());
@@ -142,12 +85,14 @@ be_array::create_name (void)
0);
}
- ACE_OS::sprintf (namebuf, "_tao_array_%s", bt->local_name ()->get_string ());
+ ACE_OS::sprintf (namebuf,
+ "_tao_array_%s",
+ bt->local_name ()->get_string ());
// Now append dimensions.
- for (i = 0; i < this->n_dims (); i++)
+ for (i = 0; i < this->n_dims (); ++i)
{
- AST_Expression *expr = this->dims ()[i]; // retrieve the ith
+ AST_Expression *expr = this->dims ()[i];
// Dimension value.
if ((expr == 0) || ((expr != 0) && (expr->ev () == 0)))
@@ -160,7 +105,10 @@ be_array::create_name (void)
}
if (expr->ev ()->et == AST_Expression::EV_ulong)
{
- ACE_OS::sprintf (namebuf, "%s_%d", namebuf, ((int)expr->ev ()->u.ulval));
+ ACE_OS::sprintf (namebuf,
+ "%s_%d",
+ namebuf,
+ ((int)expr->ev ()->u.ulval));
}
else
{
@@ -174,21 +122,32 @@ be_array::create_name (void)
// Now see if we have a fully scoped name and if so, generate one.
scope = be_scope::narrow_from_scope (this->defined_in ())->decl ();
+
if (scope)
{
// Make a copy of the enclosing scope's name.
- n = (UTL_ScopedName *)scope->name ()->copy () ;
+ n = (UTL_ScopedName *)scope->name ()->copy ();
+
+ Identifier *id = 0;
+ ACE_NEW_RETURN (id,
+ Identifier (ACE_OS::strdup (namebuf)),
+ -1);
+
+ UTL_ScopedName *sn = 0;
+ ACE_NEW_RETURN (sn,
+ UTL_ScopedName (id,
+ 0),
+ -1);
// Add our local name as the last component.
- n->nconc (new UTL_ScopedName (new Identifier (ACE_OS::strdup (namebuf)),
- 0));
+ n->nconc (sn);
// Set the fully scoped name.
this->set_name (n);
}
else
{
// We better be not here because we must be inside some scope,
- // atleast the ROOT scope.
+ // at least the ROOT scope.
return -1;
}
@@ -205,13 +164,13 @@ be_array::gen_dimensions (TAO_OutStream *os,
unsigned long i;
// Print our dimensions.
- for (i = (slice ? 1 : 0); i < this->n_dims (); i++)
+ for (i = (slice ? 1 : 0); i < this->n_dims (); ++i)
{
// Retrieve the ith.
AST_Expression *expr = this->dims ()[i];
// Dimension value.
- if ((expr == NULL) || ((expr != NULL) && (expr->ev () == NULL)))
+ if ((expr == 0) || ((expr != 0) && (expr->ev () == 0)))
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_array::"
@@ -237,26 +196,6 @@ be_array::gen_dimensions (TAO_OutStream *os,
return 0;
}
-// Compute the size type of the node in question.
-int
-be_array::compute_size_type (void)
-{
- be_type *type = be_type::narrow_from_decl (this->base_type ());
-
- if (!type)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_array::compute_size_type - "
- "bad base type\n"),
- -1);
- }
-
- // Our size type is the same as our type.
- this->size_type (type->size_type ());
-
- return 0;
-}
-
int
be_array::accept (be_visitor *visitor)
{
diff --git a/TAO/TAO_IDL/be/be_attribute.cpp b/TAO/TAO_IDL/be/be_attribute.cpp
index fe7f4e604bf..e13b6947ebd 100644
--- a/TAO/TAO_IDL/be/be_attribute.cpp
+++ b/TAO/TAO_IDL/be/be_attribute.cpp
@@ -19,11 +19,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_attribute.h"
+#include "be_visitor.h"
-ACE_RCSID(be, be_attribute, "$Id$")
+ACE_RCSID (be,
+ be_attribute,
+ "$Id$")
be_attribute::be_attribute (void)
{
diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp
index 4d4cd300709..7100402a37f 100644
--- a/TAO/TAO_IDL/be/be_codegen.cpp
+++ b/TAO/TAO_IDL/be/be_codegen.cpp
@@ -16,11 +16,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-ACE_RCSID(be, be_codegen, "$Id$")
+#include "be_codegen.h"
+#include "be_helper.h"
+#include "be_visitor_factory.h"
+#include "be_stream_factory.h"
+#include "be_extern.h"
+#include "global_extern.h"
+#include "utl_string.h"
+#include "idl_defines.h"
+
+ACE_RCSID (be,
+ be_codegen,
+ "$Id$")
TAO_IDL_BE_Export TAO_CodeGen *tao_cg = 0;
@@ -57,6 +64,11 @@ TAO_CodeGen::~TAO_CodeGen (void)
delete this->client_inline_;
delete this->server_inline_;
delete this->server_template_inline_;
+#if !defined (linux) && !defined (__QNX__)
+ // This causes a seg fault on Linux RH 5.1. Let it leak . . .
+ delete this->gperf_input_stream_;
+#endif /* ! linux */
+ delete [] this->gperf_input_filename_;
this->curr_os_ = 0;
// delete this->visitor_factory_;
}
@@ -135,6 +147,10 @@ TAO_CodeGen::start_client_header (const char *fname)
}
else
{
+ *this->client_header_ << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__
+ << be_nl << be_nl;
+
// Generate the #ident string, if any.
this->gen_ident_string (this->client_header_);
@@ -295,6 +311,10 @@ TAO_CodeGen::start_client_stubs (const char *fname)
return -1;
}
+ *this->client_stubs_ << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__
+ << be_nl << be_nl;
+
// Generate the ident string, if any.
this->gen_ident_string (this->client_stubs_);
@@ -409,6 +429,10 @@ TAO_CodeGen::start_server_header (const char *fname)
}
else
{
+ *this->server_header_ << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__
+ << be_nl << be_nl;
+
// Generate the ident string, if any.
this->gen_ident_string (this->server_header_);
@@ -568,6 +592,11 @@ TAO_CodeGen::start_server_template_header (const char *fname)
}
else
{
+ *this->server_template_header_ << be_nl << "// TAO_IDL - Generated from"
+ << be_nl
+ << "// " << __FILE__ << ":" << __LINE__
+ << be_nl << be_nl;
+
// Generate the ident string, if any.
this->gen_ident_string (this->server_template_header_);
@@ -630,6 +659,10 @@ TAO_CodeGen::start_server_skeletons (const char *fname)
return -1;
}
+ *this->server_skeletons_ << be_nl << "// TAO_IDL - Generated from "
+ << be_nl << "// " << __FILE__ << ":" << __LINE__
+ << be_nl << be_nl;
+
// Generate the ident string, if any.
this->gen_ident_string (this->server_skeletons_);
@@ -732,6 +765,11 @@ TAO_CodeGen::start_server_template_skeletons (const char *fname)
}
else
{
+ *this->server_template_skeletons_ << be_nl << "// TAO_IDL - Generated from "
+ << be_nl << "// "
+ << __FILE__ << ":" << __LINE__
+ << be_nl << be_nl;
+
// Generate the ident string, if any.
this->gen_ident_string (this->server_template_skeletons_);
@@ -865,6 +903,11 @@ TAO_CodeGen::start_implementation_header (const char *fname)
}
else
{
+ *this->implementation_header_ << be_nl << "// TAO_IDL - Generated from "
+ << be_nl << "// "
+ << __FILE__ << ":" << __LINE__
+ << be_nl << be_nl;
+
// Generate the ident string, if any.
this->gen_ident_string (this->implementation_header_);
@@ -923,6 +966,11 @@ TAO_CodeGen::start_implementation_skeleton (const char *fname)
}
else
{
+ *this->implementation_skeleton_ << be_nl << "// TAO_IDL - Generated from "
+ << be_nl << "// "
+ << __FILE__ << ":" << __LINE__
+ << be_nl << be_nl;
+
// Generate the ident string, if any.
this->gen_ident_string (this->implementation_skeleton_);
@@ -950,6 +998,10 @@ TAO_CodeGen::end_client_header (void)
{
// Generate the <<= and >>= operators here.
+ *this->client_header_ << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__
+ << be_nl;
+
// Insert the code to include the inline file.
*this->client_header_ << "\n#if defined (__ACE_INLINE__)\n";
*this->client_header_ << "#include \""
@@ -982,6 +1034,10 @@ TAO_CodeGen::end_client_header (void)
int
TAO_CodeGen::end_server_header (void)
{
+ *this->server_header_ << be_nl << "// TAO_IDL - Generated from "
+ << be_nl << "// " << __FILE__ << ":" << __LINE__
+ << be_nl << be_nl;
+
// Insert the template header.
if (be_global->gen_tie_classes ())
{
@@ -1074,6 +1130,11 @@ TAO_CodeGen::end_implementation_header (const char *fname)
int
TAO_CodeGen::end_server_template_header (void)
{
+ *this->server_template_header_ << be_nl << "// TAO_IDL - Generated from "
+ << be_nl << "// "
+ << __FILE__ << ":" << __LINE__
+ << be_nl << be_nl;
+
// Insert the code to include the inline file.
*this->server_template_header_ << "\n#if defined (__ACE_INLINE__)\n";
*this->server_template_header_
@@ -1166,8 +1227,8 @@ TAO_CodeGen::gperf_input_stream (void)
void
TAO_CodeGen::gperf_input_filename (char *filename)
{
- delete [] this->gperf_input_filename_;
- this->gperf_input_filename_ = ACE::strnew (filename);
+ delete [] this->gperf_input_filename_;
+ this->gperf_input_filename_ = filename;
}
char *
@@ -1203,9 +1264,7 @@ TAO_CodeGen::node (void)
void
TAO_CodeGen::config_visitor_factory (void)
{
- // We have removed interpreted marshaling from TAO, so
- // TAO_INTERPRETIVE_VISITOR_FACTORY is no more.
- this->visitor_factory_ = TAO_COMPILED_VISITOR_FACTORY::instance ();
+ this->visitor_factory_ = TAO_VISITOR_FACTORY::instance ();
}
void
@@ -1292,3 +1351,4 @@ TAO_CodeGen::gen_standard_include (TAO_OutStream *stream,
<< included_file
<< end_delimiter << "\n";
}
+
diff --git a/TAO/TAO_IDL/be/be_component.cpp b/TAO/TAO_IDL/be/be_component.cpp
new file mode 100644
index 00000000000..96d6ee8ebcf
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_component.cpp
@@ -0,0 +1,91 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_component.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Component that provides additional means for C++
+// mapping of an interface.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#include "be_component.h"
+#include "be_visitor.h"
+
+ACE_RCSID (be,
+ be_component,
+ "$Id$")
+
+be_component::be_component (void)
+{
+ this->size_type (AST_Type::VARIABLE);
+ this->has_constructor (I_TRUE);
+}
+
+be_component::be_component (UTL_ScopedName *n,
+ AST_Component *base_component,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface **supports_flat,
+ long n_supports_flat)
+ : be_interface (n,
+ supports,
+ n_supports,
+ supports_flat,
+ n_supports_flat,
+ I_TRUE,
+ I_FALSE),
+ AST_Component (n,
+ base_component,
+ supports,
+ n_supports,
+ supports_flat,
+ n_supports_flat),
+ AST_Interface (n,
+ supports,
+ n_supports,
+ supports_flat,
+ n_supports_flat,
+ I_TRUE,
+ I_FALSE),
+ AST_Type (AST_Decl::NT_component,
+ n),
+ AST_Decl (AST_Decl::NT_component,
+ n),
+ UTL_Scope (AST_Decl::NT_component),
+ COMMON_Base (I_TRUE,
+ I_FALSE)
+{
+ this->size_type (AST_Type::VARIABLE);
+ this->has_constructor (I_TRUE);
+}
+
+be_component::~be_component (void)
+{
+}
+
+void
+be_component::destroy ()
+{
+ this->be_interface::destroy ();
+ this->AST_Component::destroy ();
+}
+
+int
+be_component::accept (be_visitor *visitor)
+{
+ return visitor->visit_component (this);
+}
+
+// Narrowing.
+IMPL_NARROW_METHODS2 (be_component, be_interface, AST_Component);
+IMPL_NARROW_FROM_DECL (be_component);
+IMPL_NARROW_FROM_SCOPE (be_component);
diff --git a/TAO/TAO_IDL/be/be_component_fwd.cpp b/TAO/TAO_IDL/be/be_component_fwd.cpp
new file mode 100644
index 00000000000..4b0f4b289b0
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_component_fwd.cpp
@@ -0,0 +1,64 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_component_fwd.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_ComponentFwd that provides additional means for C++
+// mapping of a forward declared component.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#include "be_component_fwd.h"
+#include "be_visitor.h"
+
+ACE_RCSID (be,
+ be_component_fwd,
+ "$Id$")
+
+be_component_fwd::be_component_fwd (void)
+{
+ this->size_type (AST_Type::VARIABLE);
+}
+
+be_component_fwd::be_component_fwd (AST_Interface *dummy,
+ UTL_ScopedName *n)
+ : be_interface_fwd (dummy,
+ n),
+ AST_ComponentFwd (dummy,
+ n),
+ AST_InterfaceFwd (dummy,
+ n),
+ AST_Decl (AST_Decl::NT_component_fwd,
+ n)
+{
+ this->size_type (AST_Type::VARIABLE);
+}
+
+be_component_fwd::~be_component_fwd (void)
+{
+}
+
+void
+be_component_fwd::destroy (void)
+{
+ this->AST_ComponentFwd::destroy ();
+}
+
+int
+be_component_fwd::accept (be_visitor *visitor)
+{
+ return visitor->visit_component_fwd (this);
+}
+
+// Narrowing
+IMPL_NARROW_METHODS2 (be_component_fwd, AST_ComponentFwd, be_interface_fwd)
+IMPL_NARROW_FROM_DECL (be_component_fwd)
diff --git a/TAO/TAO_IDL/be/be_constant.cpp b/TAO/TAO_IDL/be/be_constant.cpp
index 96bf7c9c6ad..ef6b810c35e 100644
--- a/TAO/TAO_IDL/be/be_constant.cpp
+++ b/TAO/TAO_IDL/be/be_constant.cpp
@@ -19,15 +19,17 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_constant.h"
+#include "be_visitor.h"
+#include "utl_scope.h"
+#include "nr_extern.h"
-ACE_RCSID(be, be_constant, "$Id$")
+ACE_RCSID (be,
+ be_constant,
+ "$Id$")
be_constant::be_constant (void)
{
- this->size_type (be_decl::FIXED);
}
be_constant::be_constant (AST_Expression::ExprType et,
@@ -39,52 +41,6 @@ be_constant::be_constant (AST_Expression::ExprType et,
AST_Decl (AST_Decl::NT_const,
n)
{
- this->size_type (be_decl::FIXED);
-}
-
-const char *
-be_constant::exprtype_to_string (void)
-{
- switch (this->et ())
- {
- case AST_Expression::EV_short:
- return "CORBA::Short";
- case AST_Expression::EV_ushort:
- return "CORBA::UShort";
- case AST_Expression::EV_long:
- return "CORBA::Long";
- case AST_Expression::EV_ulong:
- return "CORBA::ULong";
- case AST_Expression::EV_float:
- return "CORBA::Float";
- case AST_Expression::EV_double:
- return "CORBA::Double";
- case AST_Expression::EV_char:
- return "CORBA::Char";
- case AST_Expression::EV_octet:
- return "CORBA::Octet";
- case AST_Expression::EV_bool:
- return "CORBA::Boolean";
- case AST_Expression::EV_string:
- return "char *const";
- case AST_Expression::EV_any:
- return "CORBA::Any";
- case AST_Expression::EV_void:
- return "void";
- case AST_Expression::EV_none:
- return "none";
- case AST_Expression::EV_longlong:
- return "CORBA::LongLong";
- case AST_Expression::EV_ulonglong:
- return "CORBA::ULongLong";
- case AST_Expression::EV_wchar:
- return "CORBA::WChar";
- case AST_Expression::EV_wstring:
- return "CORBA::WChar *const";
- case AST_Expression::EV_longdouble:
- return NULL;
- }
- return NULL;
}
int
@@ -93,6 +49,13 @@ be_constant::accept (be_visitor *visitor)
return visitor->visit_constant (this);
}
+void
+be_constant::destroy (void)
+{
+ this->AST_Constant::destroy ();
+ this->be_decl::destroy ();
+}
+
// Narrowing
IMPL_NARROW_METHODS2 (be_constant, AST_Constant, be_decl)
IMPL_NARROW_FROM_DECL (be_constant)
diff --git a/TAO/TAO_IDL/be/be_decl.cpp b/TAO/TAO_IDL/be/be_decl.cpp
index 99411cd454a..93c29cf2de7 100644
--- a/TAO/TAO_IDL/be/be_decl.cpp
+++ b/TAO/TAO_IDL/be/be_decl.cpp
@@ -19,11 +19,25 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-ACE_RCSID(be, be_decl, "$Id$")
+#include "be_decl.h"
+#include "be_scope.h"
+#include "be_interface.h"
+#include "be_interface_fwd.h"
+#include "be_module.h"
+#include "be_root.h"
+#include "be_exception.h"
+#include "be_structure.h"
+#include "be_union.h"
+#include "be_enum.h"
+#include "be_operation.h"
+#include "be_factory.h"
+#include "be_sequence.h"
+#include "be_visitor.h"
+#include "utl_identifier.h"
+
+ACE_RCSID (be,
+ be_decl,
+ "$Id$")
// Default Constructor
be_decl::be_decl (void)
@@ -39,11 +53,7 @@ be_decl::be_decl (void)
cli_stub_any_op_gen_ (I_FALSE),
cli_hdr_cdr_op_gen_ (I_FALSE),
cli_stub_cdr_op_gen_ (I_FALSE),
- cli_inline_cdr_op_gen_ (I_FALSE),
- cli_inline_cdr_decl_gen_ (I_FALSE),
- flat_name_ (0),
- size_type_ (be_decl::SIZE_UNKNOWN),
- has_constructor_ (I_FALSE)
+ cli_inline_cdr_op_gen_ (I_FALSE)
{
}
@@ -64,10 +74,7 @@ be_decl::be_decl (AST_Decl::NodeType type,
cli_stub_any_op_gen_ (I_FALSE),
cli_hdr_cdr_op_gen_ (I_FALSE),
cli_stub_cdr_op_gen_ (I_FALSE),
- cli_inline_cdr_op_gen_ (I_FALSE),
- flat_name_ (0),
- size_type_ (be_decl::SIZE_UNKNOWN),
- has_constructor_ (I_FALSE)
+ cli_inline_cdr_op_gen_ (I_FALSE)
{
}
@@ -76,40 +83,6 @@ be_decl::~be_decl (void)
{
}
-// Return our size type.
-be_decl::SIZE_TYPE
-be_decl::size_type (void)
-{
- if (this->size_type_ == be_decl::SIZE_UNKNOWN)
- {
- (void) this->compute_size_type ();
- }
-
- return this->size_type_;
-}
-
-// Set our size type and that of all our ancestors.
-void
-be_decl::size_type (be_decl::SIZE_TYPE st)
-{
- // Precondition - you cannot set somebody's sizetype to unknown.
- ACE_ASSERT (st != be_decl::SIZE_UNKNOWN);
-
- // Size type can be VARIABLE or FIXED.
- if (this->size_type_ == be_decl::SIZE_UNKNOWN) // not set yet
- {
- this->size_type_ = st; // set it
- }
- else if ((this->size_type_ == be_decl::FIXED)
- && (st == be_decl::VARIABLE))
- {
- // Once we are VARIABLE, we cannot be FIXED. But if we were FIXED and then
- // get overwritten to VARIABLE, it is fine. Such a situation occurs only
- // when setting the sizes of structures and unions.
- this->size_type_ = st;
- }
-}
-
void
be_decl::compute_full_name (const char *prefix,
const char *suffix,
@@ -169,108 +142,6 @@ be_decl::compute_full_name (const char *prefix,
name = result_str.rep ();
}
-
-const char*
-be_decl::flat_name (void)
-{
- if (!this->flat_name_)
- {
- this->compute_flat_name ();
- }
-
- return this->flat_name_;
-}
-
-
-// Compute stringified flattened fully scoped name.
-void
-be_decl::compute_flat_name (void)
-{
- if (this->flat_name_ != 0)
- {
- return;
- }
- else
- {
- long namelen = 0;
- long first = I_TRUE;
- long second = I_FALSE;
- char *item_name = 0;
-
- // In the first loop, compute the total length.
- for (UTL_IdListActiveIterator i (this->name ());
- !i.is_done ();
- i.next ())
- {
- if (!first)
- {
- namelen += 1; // for "_"
- }
- else if (second)
- {
- first = second = I_FALSE;
- }
-
- // Print the identifier.
- item_name = i.item ()->get_string ();
- namelen += ACE_OS::strlen (item_name);
-
- if (first)
- {
- if (ACE_OS::strcmp (item_name, "") != 0)
- {
- // Does not start with a "".
- first = I_FALSE;
- }
- else
- {
- second = I_TRUE;
- }
- }
- }
-
- ACE_NEW (this->flat_name_,
- char[namelen + 1]);
-
- this->flat_name_[0] = '\0';
- first = I_TRUE;
- second = I_FALSE;
-
- for (UTL_IdListActiveIterator j (this->name ());
- !j.is_done ();
- j.next ())
- {
- if (!first)
- {
- ACE_OS::strcat (this->flat_name_, "_");
- }
- else if (second)
- {
- first = second = I_FALSE;
- }
-
- // Print the identifier.
- item_name = j.item ()->get_string ();
- ACE_OS::strcat (this->flat_name_, item_name);
-
- if (first)
- {
- if (ACE_OS::strcmp (item_name, "") != 0)
- {
- // Does not start with a "".
- first = I_FALSE;
- }
- else
- {
- second = I_TRUE;
- }
- }
- }
- }
-}
-
-
-
void
be_decl::compute_flat_name (const char *prefix,
const char *suffix,
@@ -336,35 +207,7 @@ be_decl::compute_flat_name (const char *prefix,
void
be_decl::destroy (void)
{
- if (this->flat_name_ != 0)
- {
- delete [] this->flat_name_;
- this->flat_name_ = 0;
- }
-}
-
-idl_bool
-be_decl::is_nested (void)
-{
- be_decl *d;
-
- d = be_scope::narrow_from_scope (this->defined_in ())->decl ();
-
- // If we have an outermost scope and if that scope is not that of the Root,
- // then we are defined at some nesting level.
- if (d != 0 && d->node_type () != AST_Decl::NT_root)
- {
- return I_TRUE;
- }
-
- return I_FALSE;
-}
-
-// Compute the size type of the node in question
-int
-be_decl::compute_size_type (void)
-{
- return 0;
+ this->AST_Decl::destroy ();
}
// Return the scope created by this node (if one exists, else NULL).
@@ -579,24 +422,6 @@ be_decl::accept (be_visitor *visitor)
return visitor->visit_decl (this);
}
-idl_bool
-be_decl::has_constructor (void)
-{
- return this->has_constructor_;
-}
-
-void
-be_decl::has_constructor (idl_bool value)
-{
- // Similarly to be_decl::size_type_, once this
- // gets set to I_TRUE, we don't want it to
- // change back.
- if (this->has_constructor_ == 0)
- {
- this->has_constructor_ = value;
- }
-}
-
// Narrowing methods.
IMPL_NARROW_METHODS1 (be_decl, AST_Decl)
IMPL_NARROW_FROM_DECL (be_decl)
diff --git a/TAO/TAO_IDL/be/be_enum.cpp b/TAO/TAO_IDL/be/be_enum.cpp
index 51b02972995..93adad15665 100644
--- a/TAO/TAO_IDL/be/be_enum.cpp
+++ b/TAO/TAO_IDL/be/be_enum.cpp
@@ -19,15 +19,16 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_enum.h"
+#include "be_visitor.h"
-ACE_RCSID(be, be_enum, "$Id$")
+ACE_RCSID (be,
+ be_enum,
+ "$Id$")
be_enum::be_enum (void)
{
- this->size_type (be_decl::FIXED);
+ this->size_type (AST_Type::FIXED);
}
be_enum::be_enum (UTL_ScopedName *n,
@@ -42,15 +43,17 @@ be_enum::be_enum (UTL_ScopedName *n,
COMMON_Base (local,
abstract)
{
- this->size_type (be_decl::FIXED);
+ this->size_type (AST_Type::FIXED);
}
void
be_enum::destroy (void)
{
// Call the destroy methods of our base classes.
- be_scope::destroy ();
-// be_type::destroy ();
+ // No need to call be_scope::destroy(). It has no
+ // allocated members, and AST_Enum::destroy() will
+ // call UTL_Scope::destroy().
+ this->AST_Enum::destroy ();
}
int
diff --git a/TAO/TAO_IDL/be/be_enum_val.cpp b/TAO/TAO_IDL/be/be_enum_val.cpp
index 84f0b1b7953..a0fe6574b54 100644
--- a/TAO/TAO_IDL/be/be_enum_val.cpp
+++ b/TAO/TAO_IDL/be/be_enum_val.cpp
@@ -19,11 +19,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_enum_val.h"
+#include "be_visitor.h"
-ACE_RCSID(be, be_enum_val, "$Id$")
+ACE_RCSID (be,
+ be_enum_val,
+ "$Id$")
be_enum_val::be_enum_val (void)
{
@@ -33,7 +34,7 @@ be_enum_val::be_enum_val (unsigned long v,
UTL_ScopedName *n)
: AST_Constant (AST_Expression::EV_ulong,
AST_Decl::NT_enum_val,
- new AST_Expression(v),
+ new AST_Expression (v),
n),
AST_Decl (AST_Decl::NT_enum_val,
n)
@@ -46,11 +47,11 @@ be_enum_val::accept (be_visitor *visitor)
return visitor->visit_enum_val (this);
}
-int
-be_enum_val::compute_size_type (void)
+void
+be_enum_val::destroy (void)
{
- this->size_type_ = be_decl::FIXED;
- return 0;
+ this->AST_EnumVal::destroy ();
+ this->be_decl::destroy ();
}
// Narrowing
diff --git a/TAO/TAO_IDL/be/be_exception.cpp b/TAO/TAO_IDL/be/be_exception.cpp
index 1df3a76eeec..ebd3592ea33 100644
--- a/TAO/TAO_IDL/be/be_exception.cpp
+++ b/TAO/TAO_IDL/be/be_exception.cpp
@@ -20,15 +20,16 @@
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_exception.h"
+#include "be_visitor.h"
-ACE_RCSID(be, be_exception, "$Id$")
+ACE_RCSID (be,
+ be_exception,
+ "$Id$")
be_exception::be_exception (void)
{
- this->size_type (be_decl::VARIABLE); // always the case
+ this->size_type (AST_Type::VARIABLE); // always the case
}
be_exception::be_exception (UTL_ScopedName *n,
@@ -45,7 +46,7 @@ be_exception::be_exception (UTL_ScopedName *n,
abstract)
{
// Always the case.
- this->size_type (be_decl::VARIABLE);
+ this->size_type (AST_Type::VARIABLE);
}
void
diff --git a/TAO/TAO_IDL/be/be_expression.cpp b/TAO/TAO_IDL/be/be_expression.cpp
index 1510eb257cf..a8b7838099f 100644
--- a/TAO/TAO_IDL/be/be_expression.cpp
+++ b/TAO/TAO_IDL/be/be_expression.cpp
@@ -19,11 +19,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_expression.h"
+#include "be_visitor.h"
-ACE_RCSID(be, be_expression, "$Id$")
+ACE_RCSID (be,
+ be_expression,
+ "$Id$")
be_expression::be_expression (UTL_ScopedName *n)
: AST_Expression (n)
diff --git a/TAO/TAO_IDL/be/be_factory.cpp b/TAO/TAO_IDL/be/be_factory.cpp
index 0729b1872eb..d09510860f6 100644
--- a/TAO/TAO_IDL/be/be_factory.cpp
+++ b/TAO/TAO_IDL/be/be_factory.cpp
@@ -19,11 +19,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_factory.h"
+#include "be_visitor.h"
-ACE_RCSID(be, be_factory, "$Id$")
+ACE_RCSID (be,
+ be_factory,
+ "$Id$")
be_factory::be_factory (void)
{
diff --git a/TAO/TAO_IDL/be/be_field.cpp b/TAO/TAO_IDL/be/be_field.cpp
index 2eeaaba83ff..76b8aece9f0 100644
--- a/TAO/TAO_IDL/be/be_field.cpp
+++ b/TAO/TAO_IDL/be/be_field.cpp
@@ -19,11 +19,14 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_field.h"
+#include "be_visitor.h"
+#include "be_type.h"
+#include "ace/Log_Msg.h"
-ACE_RCSID(be, be_field, "$Id$")
+ACE_RCSID (be,
+ be_field,
+ "$Id$")
be_field::be_field (void)
{
@@ -42,29 +45,6 @@ be_field::be_field (AST_Type *ft,
{
}
-// Compute the size type of the node in question.
-int
-be_field::compute_size_type (void)
-{
- be_type *type = be_type::narrow_from_decl (this->field_type ());
-
- if (type == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_field::compute_size_type - "
- "bad field type\n"), -1);
- }
-
- // Our size type is the same as our type.
- this->size_type (type->size_type ()); // As a side effect, will also update
- // the size type of parent.
-
- // While we're here, take care of has_constructor.
- this->has_constructor (type->has_constructor ());
-
- return 0;
-}
-
int
be_field::accept (be_visitor *visitor)
{
diff --git a/TAO/TAO_IDL/be/be_generator.cpp b/TAO/TAO_IDL/be/be_generator.cpp
index 787cfa85bdb..9d9cf6cfce4 100644
--- a/TAO/TAO_IDL/be/be_generator.cpp
+++ b/TAO/TAO_IDL/be/be_generator.cpp
@@ -69,12 +69,43 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// This implements the same protocol as AST_Generator but creates instances
// of the BE-subclassed classes instead of of AST classes.
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_generator.h"
+#include "be_root.h"
+#include "be_predefined_type.h"
+#include "be_module.h"
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
+#include "be_component.h"
+#include "be_component_fwd.h"
+#include "be_home.h"
+#include "be_union.h"
+#include "be_union_fwd.h"
+#include "be_structure.h"
+#include "be_structure_fwd.h"
+#include "be_exception.h"
+#include "be_operation.h"
+#include "be_enum.h"
+#include "be_field.h"
+#include "be_argument.h"
+#include "be_attribute.h"
+#include "be_union_branch.h"
+#include "be_union_label.h"
+#include "be_constant.h"
+#include "be_expression.h"
+#include "be_enum_val.h"
+#include "be_array.h"
+#include "be_sequence.h"
+#include "be_string.h"
+#include "be_typedef.h"
+#include "be_native.h"
+#include "be_factory.h"
+#include "utl_identifier.h"
+#include "nr_extern.h"
#include "ace/config-all.h"
-ACE_RCSID(be, be_generator, "$Id$")
+ACE_RCSID (be,
+ be_generator,
+ "$Id$")
AST_Root *
be_generator::create_root (UTL_ScopedName *n)
@@ -200,50 +231,144 @@ be_generator::create_interface_fwd (UTL_ScopedName *n,
idl_bool local,
idl_bool abstract)
{
+ AST_Interface *dummy = this->create_interface (n,
+ 0,
+ -1,
+ 0,
+ 0,
+ local,
+ abstract);
+
be_interface_fwd *retval = 0;
ACE_NEW_RETURN (retval,
- be_interface_fwd (this->create_interface (n,
- 0,
- -1,
- 0,
- 0,
- local,
- abstract),
+ be_interface_fwd (dummy,
n),
0);
return retval;
}
-AST_Interface *
+AST_ValueType *
be_generator::create_valuetype (UTL_ScopedName *n,
- AST_Interface **ih,
- long nih)
+ AST_Interface **inherits,
+ long n_inherits,
+ AST_ValueType *inherits_concrete,
+ AST_Interface **inherits_flat,
+ long n_inherits_flat,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface *supports_concrete,
+ idl_bool abstract,
+ idl_bool truncatable)
{
be_valuetype *retval = 0;
ACE_NEW_RETURN (retval,
be_valuetype (n,
- ih,
- nih),
+ inherits,
+ n_inherits,
+ inherits_concrete,
+ inherits_flat,
+ n_inherits_flat,
+ supports,
+ n_supports,
+ supports_concrete,
+ abstract,
+ truncatable),
0);
return retval;
}
-AST_InterfaceFwd *
-be_generator::create_valuetype_fwd (UTL_ScopedName *n)
+AST_ValueTypeFwd *
+be_generator::create_valuetype_fwd (UTL_ScopedName *n,
+ idl_bool abstract)
{
+ AST_ValueType *dummy = this->create_valuetype (n,
+ 0,
+ -1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ abstract,
+ 0);
+
be_valuetype_fwd *retval = 0;
ACE_NEW_RETURN (retval,
- be_valuetype_fwd (this->create_valuetype (n,
- 0,
- -1),
+ be_valuetype_fwd (dummy,
+ n),
+ 0);
+
+ return retval;
+}
+
+AST_Component *
+be_generator::create_component (UTL_ScopedName *n,
+ AST_Component *base_component,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface **supports_flat,
+ long n_supports_flat)
+{
+ be_component *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_component (n,
+ base_component,
+ supports,
+ n_supports,
+ supports_flat,
+ n_supports_flat),
+ 0);
+
+ return retval;
+}
+
+AST_ComponentFwd *
+be_generator::create_component_fwd (UTL_ScopedName *n)
+{
+ AST_Component *dummy = this->create_component (n,
+ 0,
+ 0,
+ -1,
+ 0,
+ 0);
+
+ be_component_fwd *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_component_fwd (dummy,
n),
0);
return retval;
}
+AST_Home *
+be_generator::create_home (UTL_ScopedName *n,
+ AST_Home *base_home,
+ AST_Component *managed_component,
+ AST_ValueType *primary_key,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface **supports_flat,
+ long n_supports_flat)
+{
+ be_home *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_home (n,
+ base_home,
+ managed_component,
+ primary_key,
+ supports,
+ n_supports,
+ supports_flat,
+ n_supports_flat),
+ 0);
+
+ return retval;
+}
+
AST_Exception *
be_generator::create_exception (UTL_ScopedName *n,
idl_bool local,
@@ -274,6 +399,17 @@ be_generator::create_structure (UTL_ScopedName *n,
return retval;
}
+AST_StructureFwd *
+be_generator::create_structure_fwd (UTL_ScopedName *n)
+{
+ be_structure_fwd *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_structure_fwd (n),
+ 0);
+
+ return retval;
+}
+
AST_Enum *
be_generator::create_enum (UTL_ScopedName *n,
idl_bool local,
@@ -374,6 +510,17 @@ be_generator::create_union (AST_ConcreteType *dt,
return retval;
}
+AST_UnionFwd *
+be_generator::create_union_fwd (UTL_ScopedName *n)
+{
+ be_union_fwd *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_union_fwd (n),
+ 0);
+
+ return retval;
+}
+
AST_UnionBranch *
be_generator::create_union_branch (UTL_LabelList *ll,
AST_Type *ft,
@@ -581,6 +728,7 @@ be_generator::create_array (UTL_ScopedName *n,
AST_Sequence *
be_generator::create_sequence (AST_Expression *v,
AST_Type *bt,
+ UTL_ScopedName *n,
idl_bool local,
idl_bool abstract)
{
@@ -588,6 +736,7 @@ be_generator::create_sequence (AST_Expression *v,
ACE_NEW_RETURN (retval,
be_sequence (v,
bt,
+ n,
local,
abstract),
0);
@@ -598,9 +747,16 @@ be_generator::create_sequence (AST_Expression *v,
AST_String *
be_generator::create_string (AST_Expression *v)
{
+ Identifier id ("string");
+ UTL_ScopedName n (&id,
+ 0);
+
be_string *retval = 0;
ACE_NEW_RETURN (retval,
- be_string (v),
+ be_string (AST_Decl::NT_string,
+ &n,
+ v,
+ 1),
0);
return retval;
@@ -609,9 +765,20 @@ be_generator::create_string (AST_Expression *v)
AST_String *
be_generator::create_wstring (AST_Expression *v)
{
+ Identifier id (sizeof (ACE_CDR::WChar) == 1
+ ? "string"
+ : "wstring");
+ UTL_ScopedName n (&id,
+ 0);
+ AST_Decl::NodeType nt = sizeof (ACE_CDR::WChar) == 1
+ ? AST_Decl::NT_string
+ : AST_Decl::NT_wstring;
+
be_string *retval = 0;
ACE_NEW_RETURN (retval,
- be_string (v,
+ be_string (nt,
+ &n,
+ v,
sizeof (ACE_CDR::WChar)),
0);
diff --git a/TAO/TAO_IDL/be/be_global.cpp b/TAO/TAO_IDL/be/be_global.cpp
index 5db3572a94c..4e3730d6030 100644
--- a/TAO/TAO_IDL/be/be_global.cpp
+++ b/TAO/TAO_IDL/be/be_global.cpp
@@ -17,62 +17,92 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_global.h"
+#include "utl_string.h"
+#include "global_extern.h"
+#include "ace/ACE.h"
-ACE_RCSID(be, be_global, "$Id$")
+ACE_RCSID (be,
+ be_global,
+ "$Id$")
TAO_IDL_BE_Export BE_GlobalData *be_global = 0;
BE_GlobalData::BE_GlobalData (void)
- : changing_standard_include_files_ (1),
- skel_export_macro_ (0),
- skel_export_include_ (0),
- stub_export_macro_ (0),
- stub_export_include_ (0),
- pch_include_ (0),
- pre_include_ (0),
- post_include_ (0),
- client_hdr_ending_ (ACE::strnew ("C.h")),
- client_stub_ending_ (ACE::strnew ("C.cpp")),
- client_inline_ending_ (ACE::strnew ("C.i")),
- server_hdr_ending_ (ACE::strnew ("S.h")),
- implementation_hdr_ending_ (ACE::strnew ("I.h")),
- implementation_skel_ending_ (ACE::strnew ("I.cpp")),
- impl_class_prefix_ (ACE::strnew ("")),
- impl_class_suffix_ (ACE::strnew ("_i")),
- server_template_hdr_ending_ (ACE::strnew ("S_T.h")),
- server_skeleton_ending_ (ACE::strnew ("S.cpp")),
- server_template_skeleton_ending_ (ACE::strnew ("S_T.cpp")),
- server_inline_ending_ (ACE::strnew ("S.i")),
- server_template_inline_ending_ (ACE::strnew ("S_T.i")),
- output_dir_ (0),
- any_support_ (I_TRUE),
- tc_support_ (I_TRUE),
- obv_opt_accessor_ (0),
- gen_impl_files_ (I_FALSE),
- gen_copy_ctor_ (I_FALSE),
- gen_assign_op_ (I_FALSE),
- gen_thru_poa_collocation_ (I_TRUE), // Default is thru_poa.
- gen_direct_collocation_ (I_FALSE),
+ : changing_standard_include_files_ (1),
+ skel_export_macro_ (0),
+ skel_export_include_ (0),
+ stub_export_macro_ (0),
+ stub_export_include_ (0),
+ pch_include_ (0),
+ pre_include_ (0),
+ post_include_ (0),
+ client_hdr_ending_ (ACE::strnew ("C.h")),
+ client_stub_ending_ (ACE::strnew ("C.cpp")),
+ client_inline_ending_ (ACE::strnew ("C.i")),
+ server_hdr_ending_ (ACE::strnew ("S.h")),
+ implementation_hdr_ending_ (ACE::strnew ("I.h")),
+ implementation_skel_ending_ (ACE::strnew ("I.cpp")),
+ impl_class_prefix_ (ACE::strnew ("")),
+ impl_class_suffix_ (ACE::strnew ("_i")),
+ server_template_hdr_ending_ (ACE::strnew ("S_T.h")),
+ server_skeleton_ending_ (ACE::strnew ("S.cpp")),
+ server_template_skeleton_ending_ (ACE::strnew ("S_T.cpp")),
+ server_inline_ending_ (ACE::strnew ("S.i")),
+ server_template_inline_ending_ (ACE::strnew ("S_T.i")),
+ output_dir_ (0),
+ any_support_ (I_TRUE),
+ tc_support_ (I_TRUE),
+ obv_opt_accessor_ (0),
+ gen_impl_files_ (I_FALSE),
+ gen_copy_ctor_ (I_FALSE),
+ gen_assign_op_ (I_FALSE),
+ gen_thru_poa_collocation_ (I_TRUE), // Default is thru_poa.
+ gen_direct_collocation_ (I_FALSE),
#ifdef ACE_HAS_EXCEPTIONS
- exception_support_ (I_TRUE),
+ exception_support_ (I_TRUE),
#else
- exception_support_ (I_FALSE),
+ exception_support_ (I_FALSE),
#endif /* ACE_HAS_EXCEPTIONS */
- use_raw_throw_ (I_FALSE),
- opt_tc_ (I_FALSE),
- ami_call_back_ (I_FALSE),
- gen_amh_classes_ (I_FALSE),
- gen_tie_classes_ (I_TRUE),
- gen_smart_proxies_ (I_FALSE),
- lookup_strategy_ (TAO_PERFECT_HASH)
+ use_raw_throw_ (I_FALSE),
+ opt_tc_ (I_FALSE),
+ ami_call_back_ (I_FALSE),
+ gen_amh_classes_ (I_FALSE),
+ gen_tie_classes_ (I_TRUE),
+ gen_smart_proxies_ (I_FALSE),
+ gen_inline_constants_ (I_FALSE),
+ lookup_strategy_ (TAO_PERFECT_HASH)
{
}
BE_GlobalData::~BE_GlobalData (void)
{
+ delete this->client_hdr_ending_;
+ this->client_hdr_ending_ = 0;
+ delete this->client_stub_ending_;
+ this->client_stub_ending_ = 0;
+ delete this->client_inline_ending_;
+ this->client_inline_ending_ = 0;
+ delete this->server_hdr_ending_;
+ this->server_hdr_ending_ = 0;
+ delete this->implementation_hdr_ending_;
+ this->implementation_hdr_ending_ = 0;
+ delete this->implementation_skel_ending_;
+ this->implementation_skel_ending_ = 0;
+ delete this->impl_class_prefix_;
+ this->impl_class_prefix_ = 0;
+ delete this->impl_class_suffix_;
+ this->impl_class_suffix_ = 0;
+ delete this->server_template_hdr_ending_;
+ this->server_template_hdr_ending_ = 0;
+ delete this->server_skeleton_ending_;
+ this->server_skeleton_ending_ = 0;
+ delete this->server_template_skeleton_ending_;
+ this->server_template_skeleton_ending_ = 0;
+ delete this->server_inline_ending_;
+ this->server_inline_ending_ = 0;
+ delete this->server_template_inline_ending_;
+ this->server_template_inline_ending_ = 0;
}
// To switch between changing or non-changing standard include files
@@ -301,7 +331,6 @@ BE_GlobalData::be_get_implementation_skel_fname (int base_name_only)
base_name_only);
}
-
const char *
BE_GlobalData::be_get_server_template_hdr_fname (int base_name_only)
{
@@ -315,21 +344,12 @@ BE_GlobalData::be_get_server_skeleton_fname ()
return be_get_server_skeleton (idl_global->stripped_filename ());
}
-/*
-const char *
-BE_GlobalData::be_get_implementation_hdr_fname ()
-{
- return be_get_implementation_hdr (idl_global->stripped_filename ());
-}
-*/
-
const char *
BE_GlobalData::be_get_implementation_skeleton_fname ()
{
return be_get_implementation_skel (idl_global->stripped_filename ());
}
-
const char *
BE_GlobalData::be_get_server_template_skeleton_fname (int base_name_only)
{
@@ -508,7 +528,6 @@ BE_GlobalData::implementation_skel_ending (const char* s)
this->implementation_skel_ending_ = ACE::strnew (s);
}
-
void
BE_GlobalData::impl_class_prefix (const char* s)
{
@@ -535,7 +554,6 @@ BE_GlobalData::implementation_hdr_ending (void) const
return this->implementation_hdr_ending_;
}
-
const char*
BE_GlobalData::impl_class_suffix (void) const
{
@@ -548,8 +566,6 @@ BE_GlobalData::implementation_skel_ending (void) const
return this->implementation_skel_ending_;
}
-
-
void
BE_GlobalData::server_template_hdr_ending (const char* s)
{
@@ -635,7 +651,7 @@ BE_GlobalData::any_support (idl_bool val)
}
idl_bool
-BE_GlobalData::any_support (void)
+BE_GlobalData::any_support (void) const
{
return this->any_support_;
}
@@ -647,7 +663,7 @@ BE_GlobalData::tc_support (idl_bool val)
}
idl_bool
-BE_GlobalData::tc_support (void)
+BE_GlobalData::tc_support (void) const
{
return this->tc_support_;
}
@@ -659,7 +675,7 @@ BE_GlobalData::obv_opt_accessor (idl_bool val)
}
idl_bool
-BE_GlobalData::obv_opt_accessor (void)
+BE_GlobalData::obv_opt_accessor (void) const
{
return this->obv_opt_accessor_;
}
@@ -671,7 +687,7 @@ BE_GlobalData::gen_impl_files (idl_bool val)
}
idl_bool
-BE_GlobalData::gen_impl_files (void)
+BE_GlobalData::gen_impl_files (void) const
{
return this->gen_impl_files_;
}
@@ -683,7 +699,7 @@ BE_GlobalData::gen_copy_ctor (idl_bool val)
}
idl_bool
-BE_GlobalData::gen_copy_ctor (void)
+BE_GlobalData::gen_copy_ctor (void) const
{
return this->gen_copy_ctor_;
}
@@ -695,7 +711,7 @@ BE_GlobalData::gen_assign_op (idl_bool val)
}
idl_bool
-BE_GlobalData::gen_assign_op (void)
+BE_GlobalData::gen_assign_op (void) const
{
return this->gen_assign_op_;
}
@@ -707,7 +723,7 @@ BE_GlobalData::gen_thru_poa_collocation (idl_bool val)
}
idl_bool
-BE_GlobalData::gen_thru_poa_collocation (void)
+BE_GlobalData::gen_thru_poa_collocation (void) const
{
return this->gen_thru_poa_collocation_;
}
@@ -719,7 +735,7 @@ BE_GlobalData::gen_direct_collocation (idl_bool val)
}
idl_bool
-BE_GlobalData::gen_direct_collocation (void)
+BE_GlobalData::gen_direct_collocation (void) const
{
return this->gen_direct_collocation_;
}
@@ -731,7 +747,7 @@ BE_GlobalData::exception_support (idl_bool val)
}
idl_bool
-BE_GlobalData::exception_support (void)
+BE_GlobalData::exception_support (void) const
{
return this->exception_support_;
}
@@ -743,7 +759,7 @@ BE_GlobalData::use_raw_throw (idl_bool val)
}
idl_bool
-BE_GlobalData::use_raw_throw (void)
+BE_GlobalData::use_raw_throw (void) const
{
return this->use_raw_throw_;
}
@@ -755,7 +771,7 @@ BE_GlobalData::opt_tc (idl_bool val)
}
idl_bool
-BE_GlobalData::opt_tc (void)
+BE_GlobalData::opt_tc (void) const
{
return this->opt_tc_;
}
@@ -767,7 +783,7 @@ BE_GlobalData::ami_call_back (idl_bool val)
}
idl_bool
-BE_GlobalData::ami_call_back (void)
+BE_GlobalData::ami_call_back (void) const
{
return this->ami_call_back_;
}
@@ -779,7 +795,7 @@ BE_GlobalData::gen_amh_classes (idl_bool val)
}
idl_bool
-BE_GlobalData::gen_amh_classes (void)
+BE_GlobalData::gen_amh_classes (void) const
{
return this->gen_amh_classes_;
}
@@ -791,7 +807,7 @@ BE_GlobalData::gen_tie_classes (idl_bool val)
}
idl_bool
-BE_GlobalData::gen_tie_classes (void)
+BE_GlobalData::gen_tie_classes (void) const
{
return this->gen_tie_classes_;
}
@@ -803,12 +819,24 @@ BE_GlobalData::gen_smart_proxies (idl_bool val)
}
idl_bool
-BE_GlobalData::gen_smart_proxies (void)
+BE_GlobalData::gen_smart_proxies (void) const
{
return this->gen_smart_proxies_;
}
void
+BE_GlobalData::gen_inline_constants (idl_bool val)
+{
+ this->gen_inline_constants_ = val;
+}
+
+idl_bool
+BE_GlobalData::gen_inline_constants (void) const
+{
+ return this->gen_inline_constants_;
+}
+
+void
BE_GlobalData::lookup_strategy (LOOKUP_STRATEGY s)
{
this->lookup_strategy_ = s;
diff --git a/TAO/TAO_IDL/be/be_helper.cpp b/TAO/TAO_IDL/be/be_helper.cpp
index 8a853af2476..3c523bcb806 100644
--- a/TAO/TAO_IDL/be/be_helper.cpp
+++ b/TAO/TAO_IDL/be/be_helper.cpp
@@ -19,11 +19,13 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_helper.h"
+#include "be_codegen.h"
+#include "idl_defines.h"
-ACE_RCSID(be, be_helper, "$Id$")
+ACE_RCSID (be,
+ be_helper,
+ "$Id$")
static const char copyright[] =
"// -*- C++ -*-\n"
@@ -69,7 +71,7 @@ const TAO_UNINDENT be_uidt_nl (1);
// Methods of the TAO_OutStream class.
TAO_OutStream::TAO_OutStream (void)
- : fp_ (NULL),
+ : fp_ (0),
indent_level_ (0)
{
}
@@ -122,7 +124,7 @@ TAO_OutStream::open (const char *fname,
}
}
-// set and get the stream type
+// Set and get the stream type.
void
TAO_OutStream::stream_type (TAO_OutStream::STREAM_TYPE st)
{
diff --git a/TAO/TAO_IDL/be/be_home.cpp b/TAO/TAO_IDL/be/be_home.cpp
new file mode 100644
index 00000000000..516ef8c6573
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_home.cpp
@@ -0,0 +1,93 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_home.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Home that provides additional means for C++
+// mapping of a component home.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#include "be_home.h"
+#include "be_visitor.h"
+
+ACE_RCSID (be,
+ be_home,
+ "$Id$")
+
+be_home::be_home (void)
+{
+ this->size_type (AST_Type::VARIABLE);
+}
+
+be_home::be_home (UTL_ScopedName *n,
+ AST_Home *base_home,
+ AST_Component *managed_component,
+ AST_ValueType *primary_key,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface **supports_flat,
+ long n_supports_flat)
+ : be_interface (n,
+ supports,
+ n_supports,
+ supports_flat,
+ n_supports_flat,
+ I_FALSE,
+ I_FALSE),
+ AST_Home (n,
+ base_home,
+ managed_component,
+ primary_key,
+ supports,
+ n_supports,
+ supports_flat,
+ n_supports_flat),
+ AST_Interface (n,
+ supports,
+ n_supports,
+ supports_flat,
+ n_supports_flat,
+ I_FALSE,
+ I_FALSE),
+ AST_Type (AST_Decl::NT_home,
+ n),
+ AST_Decl (AST_Decl::NT_home,
+ n),
+ UTL_Scope (AST_Decl::NT_home),
+ COMMON_Base (I_FALSE,
+ I_FALSE)
+{
+ this->size_type (AST_Type::VARIABLE);
+}
+
+be_home::~be_home (void)
+{
+}
+
+void
+be_home::destroy (void)
+{
+ this->be_interface::destroy ();
+ this->AST_Home::destroy ();
+}
+
+int
+be_home::accept (be_visitor *visitor)
+{
+ return visitor->visit_home (this);
+}
+
+// Narrowing
+IMPL_NARROW_METHODS2 (be_home, be_interface, AST_Home);
+IMPL_NARROW_FROM_DECL (be_home);
+IMPL_NARROW_FROM_SCOPE (be_home);
diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp
index 8828a82244b..b8b9b898df5 100644
--- a/TAO/TAO_IDL/be/be_interface.cpp
+++ b/TAO/TAO_IDL/be/be_interface.cpp
@@ -20,23 +20,35 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be_visitor_interface.h"
-#include "be.h"
+#include "be_interface.h"
#include "be_interface_strategy.h"
-
-ACE_RCSID(be, be_interface, "$Id$")
+#include "be_attribute.h"
+#include "be_operation.h"
+#include "be_visitor.h"
+#include "be_helper.h"
+#include "be_stream_factory.h"
+#include "be_extern.h"
+#include "utl_identifier.h"
+#include "ast_generator.h"
+#include "global_extern.h"
+#include "idl_defines.h"
+#include "nr_extern.h"
+#include "ace/Process.h"
+
+ACE_RCSID (be,
+ be_interface,
+ "$Id$")
// Default constructor.
be_interface::be_interface (void)
: skel_count_ (0),
in_mult_inheritance_ (-1),
- original_interface_ (0)
+ original_interface_ (0),
+ has_mixed_parentage_ (I_FALSE)
{
ACE_NEW (this->strategy_,
be_interface_default_strategy (this));
- this->size_type (be_decl::VARIABLE); // Always the case.
+ this->size_type (AST_Type::VARIABLE); // Always the case.
this->has_constructor (I_TRUE); // Always the case.
}
@@ -62,12 +74,19 @@ be_interface::be_interface (UTL_ScopedName *n,
abstract),
skel_count_ (0),
in_mult_inheritance_ (-1),
- original_interface_ (0)
+ original_interface_ (0),
+ has_mixed_parentage_ (I_FALSE)
{
ACE_NEW (this->strategy_,
be_interface_default_strategy (this));
- this->size_type (be_decl::VARIABLE); // always the case
+ this->size_type (AST_Type::VARIABLE); // always the case
this->has_constructor (I_TRUE); // always the case
+
+ if (! abstract && this->node_type () == AST_Decl::NT_interface)
+ {
+ this->analyze_parentage (ih,
+ nih);
+ }
}
be_interface::~be_interface (void)
@@ -443,9 +462,9 @@ be_interface::gen_def_ctors_helper (be_interface* node,
static int first = 0;
- if(node != base)
+ if (node != base)
{
- if(first)
+ if (first)
{
*os << be_global->impl_class_prefix () << base->flat_name ()
<< be_global->impl_class_suffix () << " ()";
@@ -481,13 +500,43 @@ be_interface::gen_stub_ctor (TAO_OutStream *os)
<< "TAO_Stub *objref," << be_nl
<< "CORBA::Boolean _tao_collocated," << be_nl
<< "TAO_Abstract_ServantBase *servant" << be_uidt_nl
- << ")" // constructor
+ << ")"
<< be_nl;
- *os << ": CORBA_Object (objref, _tao_collocated, servant)" << be_uidt_nl;
- *os << "{" << be_idt_nl
+ *os << ": CORBA_Object (objref, _tao_collocated, servant)";
+
+ if (this->has_mixed_parentage_)
+ {
+ *os << be_idt;
+
+ int status =
+ this->traverse_inheritance_graph (
+ be_interface::gen_abstract_init_helper,
+ os,
+ I_TRUE
+ );
+
+ if (status == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "be_interface::gen_stub_ctor - "
+ "inheritance graph traversal failed\n"));
+ }
+
+ *os << "," << be_nl
+ << "CORBA_AbstractBase (objref, _tao_collocated, servant)"
+ << be_uidt << be_uidt;
+ }
+ else
+ {
+ *os << be_uidt;
+ }
+
+ *os << be_nl << "{" << be_idt_nl
<< "this->" << this->flat_name ()
- << "_setup_collocation (_tao_collocated);" << be_uidt_nl;
- *os << "}" << be_nl << be_nl;
+ << "_setup_collocation (_tao_collocated);";
+
+ *os << be_uidt_nl
+ << "}" << be_nl << be_nl;
}
}
@@ -520,6 +569,9 @@ be_interface::gen_var_defn (char *interface_name)
// Depending upon the data type, there are some differences which we account
// for over here.
+ *ch << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
*ch << "class " << be_global->stub_export_macro ()
<< " " << namebuf
<< " : public TAO_Base_var" << be_nl;
@@ -583,12 +635,30 @@ be_interface::gen_var_defn (char *interface_name)
<< "static " << interface_name
<< "_ptr tao_nil (void);" << be_nl
<< "static " << interface_name
- << "_ptr tao_narrow (" << be_idt << be_idt_nl
- << "CORBA::Object *" << be_nl
- << "ACE_ENV_ARG_DECL_NOT_USED" << be_uidt_nl
- << ");" << be_uidt_nl
- << "static CORBA::Object * tao_upcast (void *);"
- << be_uidt_nl << be_nl;
+ << "_ptr tao_narrow (" << be_idt << be_idt_nl;
+
+ if (this->is_abstract ())
+ {
+ *ch << "CORBA::AbstractBase *" << be_nl;
+ }
+ else
+ {
+ *ch << "CORBA::Object *" << be_nl;
+ }
+
+ *ch << "ACE_ENV_ARG_DECL_NOT_USED" << be_uidt_nl
+ << ");" << be_uidt_nl;
+
+ if (this->is_abstract ())
+ {
+ *ch << "static CORBA::AbstractBase * tao_upcast (void *);";
+ }
+ else
+ {
+ *ch << "static CORBA::Object * tao_upcast (void *);";
+ }
+
+ *ch << be_uidt_nl << be_nl;
// Private.
*ch << "private:" << be_idt_nl;
@@ -772,7 +842,8 @@ be_interface::gen_var_impl (char *interface_local_name,
*cs << "return val;" << be_uidt_nl;
*cs << "}" << be_nl << be_nl;
- // Hooks for the global static functions used by non-defined interfaces.
+ // Hooks for the flat name global functions used by references to
+ // non-defined interfaces.
*cs << "::" << interface_full_name
<< "_ptr" << be_nl
<< fname << "::tao_duplicate ("
@@ -798,9 +869,18 @@ be_interface::gen_var_impl (char *interface_local_name,
<< "}" << be_nl << be_nl;
*cs << "::" << interface_full_name << "_ptr" << be_nl
- << fname << "::tao_narrow (" << be_idt << be_idt_nl
- << "CORBA::Object *p" << be_nl
- << "ACE_ENV_ARG_DECL" << be_uidt_nl
+ << fname << "::tao_narrow (" << be_idt << be_idt_nl;
+
+ if (this->is_abstract ())
+ {
+ *cs << "CORBA::AbstractBase *p" << be_nl;
+ }
+ else
+ {
+ *cs << "CORBA::Object *p" << be_nl;
+ }
+
+ *cs << "ACE_ENV_ARG_DECL" << be_uidt_nl
<< ")" << be_uidt_nl
<< "{" << be_idt_nl
<< "return ::" << interface_full_name
@@ -808,8 +888,16 @@ be_interface::gen_var_impl (char *interface_local_name,
<< be_uidt_nl
<< "}" << be_nl << be_nl;
- *cs << "CORBA::Object *" << be_nl
- << fname << "::tao_upcast (void *src)" << be_nl
+ if (this->is_abstract ())
+ {
+ *cs << "CORBA::AbstractBase *" << be_nl;
+ }
+ else
+ {
+ *cs << "CORBA::Object *" << be_nl;
+ }
+
+ *cs << fname << "::tao_upcast (void *src)" << be_nl
<< "{" << be_idt_nl
<< interface_local_name << " **tmp =" << be_idt_nl
<< "ACE_static_cast (" << interface_local_name
@@ -841,6 +929,9 @@ be_interface::gen_out_defn (char *interface_name)
TAO_OutStream *ch = tao_cg->client_header ();
+ *ch << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Generate the out definition (always in the client header)
*ch << "class " << be_global->stub_export_macro ()
<< " " << namebuf << be_nl;
@@ -1013,13 +1104,22 @@ be_interface::gen_out_impl (char *interface_local_name,
*cs << fname << "::operator-> (void)" << be_nl;
*cs << "{" << be_idt_nl;
*cs << "return this->ptr_;" << be_uidt_nl;
- *cs << "}\n\n";
+ *cs << "}" << be_nl << be_nl;
+
+ *cs << "// *************************************************************"
+ << "\n\n";
return 0;
}
// ****************************************************************
+TAO_IDL_Inheritance_Hierarchy_Worker::~TAO_IDL_Inheritance_Hierarchy_Worker (
+ void
+ )
+{
+}
+
class TAO_IDL_Gen_OpTable_Worker : public TAO_IDL_Inheritance_Hierarchy_Worker
{
public:
@@ -1046,7 +1146,8 @@ TAO_IDL_Gen_OpTable_Worker::emit (be_interface * /* derived_interface */,
{
// Generate entries for the derived class using the properties of its
// ancestors.
- return base_interface->gen_optable_entries (this->skeleton_name_, os);
+ be_interface *bi = be_interface::narrow_from_decl (base_interface);
+ return bi->gen_optable_entries (this->skeleton_name_, os);
}
int
@@ -1059,19 +1160,33 @@ be_interface::gen_operation_table (const char *flat_name,
case BE_GlobalData::TAO_DYNAMIC_HASH:
{
// Init the outstream appropriately.
- TAO_OutStream *os =
- this->strategy_->get_out_stream ();
+ TAO_OutStream *os = this->strategy_->get_out_stream ();
// Start from current indentation level.
os->indent ();
// Start the table generation.
*os << "static const TAO_operation_db_entry " << flat_name <<
- "_operations [] = {\n";
+ "_operations [] = {" << be_nl;
+
os->incr_indent (0);
+ // Make sure the queues are empty.
+ this->insert_queue.reset ();
+ this->del_queue.reset ();
+
+ // Insert ourselves in the queue.
+ if (insert_queue.enqueue_tail (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_interface::gen_operation_table - "
+ "error generating entries\n"),
+ -1);
+ }
+
// Traverse the graph.
TAO_IDL_Gen_OpTable_Worker worker (skeleton_class_name);
+
if (this->traverse_inheritance_graph (worker, os) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -1080,24 +1195,22 @@ be_interface::gen_operation_table (const char *flat_name,
}
// Generate the skeleton for the is_a method.
- os->indent ();
*os << "{\"_is_a\", &" << skeleton_class_name
- << "::_is_a_skel},\n";
+ << "::_is_a_skel}," << be_nl;
+
this->skel_count_++;
- os->indent ();
*os << "{\"_non_existent\", &" << skeleton_class_name
- << "::_non_existent_skel},\n";
+ << "::_non_existent_skel}," << be_nl;
+
this->skel_count_++;
- os->indent ();
*os << "{\"_interface\", &" << skeleton_class_name
- << "::_interface_skel}\n";
+ << "::_interface_skel}" << be_uidt_nl;
+
this->skel_count_++;
- os->decr_indent ();
*os << "};\n" << be_nl;
-
*os << "static const CORBA::Long _tao_" << flat_name
<< "_optable_size = sizeof (ACE_Hash_Map_Entry<const char *,"
<< " TAO_Skeleton>) * (" << (3 * this->skel_count_)
@@ -1130,9 +1243,10 @@ be_interface::gen_operation_table (const char *flat_name,
// Temp file name.
char *temp_file = 0;
ACE_NEW_RETURN (temp_file,
- char [ACE_OS::strlen (idl_global->temp_dir ()) +
- ACE_OS::strlen (flat_name) +
- ACE_OS::strlen (".gperf") + 1],
+ char [ACE_OS::strlen (idl_global->temp_dir ())
+ + ACE_OS::strlen (flat_name)
+ + ACE_OS::strlen (".gperf")
+ + 1],
-1);
ACE_OS::sprintf (temp_file,
@@ -1158,8 +1272,7 @@ be_interface::gen_operation_table (const char *flat_name,
// interface.
// Retrieve the singleton instance to the outstream factory.
- TAO_OutStream_Factory *factory =
- TAO_OUTSTREAM_FACTORY::instance ();
+ TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
// Get a new instance for the temp file.
TAO_OutStream *os = factory->make_outstream ();
@@ -1192,8 +1305,22 @@ be_interface::gen_operation_table (const char *flat_name,
// Add the gperf input header.
this->gen_gperf_input_header (os);
+ // Make sure the queues are empty.
+ this->insert_queue.reset ();
+ this->del_queue.reset ();
+
+ // Insert ourselves in the queue.
+ if (insert_queue.enqueue_tail (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_interface::gen_operation_table - "
+ "error generating entries\n"),
+ -1);
+ }
+
// Traverse the graph.
TAO_IDL_Gen_OpTable_Worker worker (skeleton_class_name);
+
if (this->traverse_inheritance_graph (worker, os) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -1204,27 +1331,28 @@ be_interface::gen_operation_table (const char *flat_name,
// Generate the skeleton for the is_a method.
os->indent ();
+
*os << "_is_a, &"
<< skeleton_class_name
- << "::_is_a_skel\n";
+ << "::_is_a_skel" << be_nl;
+
this->skel_count_++;
- os->indent ();
*os << "_non_existent, &"
<< skeleton_class_name
- << "::_non_existent_skel\n";
+ << "::_non_existent_skel" << be_nl;
+
this->skel_count_++;
- os->indent ();
*os << "_component, &"
<< skeleton_class_name
- << "::_component_skel\n";
+ << "::_component_skel" << be_nl;
this->skel_count_++;
- os->indent ();
*os << "_interface, &"
<< skeleton_class_name
- << "::_interface_skel\n";
+ << "::_interface_skel" << be_nl;
+
this->skel_count_++;
// Input to the gperf is ready. Run gperf and get things
@@ -1412,20 +1540,26 @@ be_interface::gen_optable_entries (const char *full_skeleton_name,
return 0;
}
-// ****************************************************************
-
-class be_code_emitter_wrapper : public TAO_IDL_Inheritance_Hierarchy_Worker
+void
+be_interface::analyze_parentage (AST_Interface **parents,
+ long n_parents)
{
-public:
- be_code_emitter_wrapper (be_interface::tao_code_emitter emitter);
+ for (long i = 0; i < n_parents; ++i)
+ {
+ if (parents[i]->is_abstract ())
+ {
+ this->has_mixed_parentage_ = I_TRUE;
+ break;
+ }
+ }
- virtual int emit (be_interface *derived_interface,
- TAO_OutStream *output_stream,
- be_interface *base_interface);
+ if (this->has_mixed_parentage_)
+ {
+ be_global->mixed_parentage_interfaces.enqueue_tail (this);
+ }
+}
-private:
- be_interface::tao_code_emitter emitter_;
-};
+// ****************************************************************
be_code_emitter_wrapper::
be_code_emitter_wrapper (be_interface::tao_code_emitter emitter)
@@ -1448,34 +1582,15 @@ be_code_emitter_wrapper::emit (be_interface *derived_interface,
// out by the function passed as argument.
int
be_interface::traverse_inheritance_graph (be_interface::tao_code_emitter gen,
- TAO_OutStream *os)
+ TAO_OutStream *os,
+ idl_bool abstract_paths_only)
{
- be_code_emitter_wrapper wrapper (gen);
-
- return this->traverse_inheritance_graph (wrapper, os);
-}
-
-int
-be_interface::traverse_inheritance_graph (TAO_IDL_Inheritance_Hierarchy_Worker &worker,
- TAO_OutStream *os)
-{
- // Queue data structure needed for breadth-first traversal of
- // inheritance tree.
- ACE_Unbounded_Queue <be_interface*> queue;
-
- // For a special case of a deeply nested inheritance graph and one specific
- // way of inheritance in which a node that was already visited,
- // but is not present in
- // the queue, gets inserted at the tail. This situation arises when a node
- // multiply inherits from two or more interfaces in which the first parent is
- // higher up in the tree than the second parent. In addition, if the second
- // parent turns out to be a child of the first .
-
- // Queue of dequeued nodes to be searched for the above case.
- ACE_Unbounded_Queue <be_interface*> del_queue;
+ // Make sure the queues are empty.
+ this->insert_queue.reset ();
+ this->del_queue.reset ();
// Insert ourselves in the queue.
- if (queue.enqueue_tail (this) == -1)
+ if (insert_queue.enqueue_tail (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_interface::traverse_inheritance_graph - "
@@ -1483,19 +1598,33 @@ be_interface::traverse_inheritance_graph (TAO_IDL_Inheritance_Hierarchy_Worker &
-1);
}
+ be_code_emitter_wrapper wrapper (gen);
+
+ return this->traverse_inheritance_graph (wrapper,
+ os,
+ abstract_paths_only);
+}
+
+int
+be_interface::traverse_inheritance_graph (
+ TAO_IDL_Inheritance_Hierarchy_Worker &worker,
+ TAO_OutStream *os,
+ idl_bool abstract_paths_only
+ )
+{
// Do until queue is empty.
- while (!queue.is_empty ())
+ while (!this->insert_queue.is_empty ())
{
- be_interface *bi; // element inside the queue
+ AST_Interface *intf; // element inside the queue
// Use breadth-first strategy i.e., first generate entries for ourselves,
// followed by nodes that we immediately inherit from, and so on. In the
// process make sure that we do not generate code for the same node more
- // than once. Such a case may arise due to multiple inheritance forming a
- // diamond like inheritance graph.
+ // than once. Such a case may arise due to multiple inheritance forming
+ // a diamond-like inheritance graph.
// Dequeue the element at the head of the queue.
- if (queue.dequeue_head (bi))
+ if (this->insert_queue.dequeue_head (intf))
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_interface::traverse_graph - "
@@ -1504,7 +1633,7 @@ be_interface::traverse_inheritance_graph (TAO_IDL_Inheritance_Hierarchy_Worker &
}
// Insert the dequeued element in the del_queue.
- if (del_queue.enqueue_tail (bi) == -1)
+ if (this->del_queue.enqueue_tail (intf) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_interface::traverse_graph - "
@@ -1512,6 +1641,8 @@ be_interface::traverse_inheritance_graph (TAO_IDL_Inheritance_Hierarchy_Worker &
-1);
}
+ be_interface *bi = be_interface::narrow_from_decl (intf);
+
// Use the helper method to generate code for ourself using the
// properties of the element dequeued. For the first iteration, the
// element dequeued and "this" will be the same i.e., ourselves.
@@ -1523,83 +1654,29 @@ be_interface::traverse_inheritance_graph (TAO_IDL_Inheritance_Hierarchy_Worker &
-1);
}
+ long i;
+
// Now check if the dequeued element has any ancestors. If yes, insert
// them inside the queue making sure that there are no duplicates.
- for (long i = 0; i < bi->n_inherits (); i++)
+ for (i = 0; i < bi->n_inherits (); ++i)
{
// Retrieve the next parent from which the dequeued element inherits.
- be_interface *parent =
- be_interface::narrow_from_decl (bi->inherits ()[i]);
+ AST_Interface *parent = bi->inherits ()[i];
if (parent == 0)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_interface::gen_server_skeletons -"
+ "(%N:%l) be_interface::traverse_graph -"
" bad inherited interface\n"),
-1);
}
- // Now insert this node at the tail of the queue, but make sure that
- // it doesn't already exist in the queue.
- int found = 0;
-
- // Initialize an iterator to search the queue for duplicates.
- for (ACE_Unbounded_Queue_Iterator<be_interface*> q_iter (queue);
- !q_iter.done ();
- (void) q_iter.advance ())
- {
- // Queue element.
- be_interface **temp;
-
- (void) q_iter.next (temp);
- if (!ACE_OS::strcmp (parent->full_name (),
- (*temp)->full_name ()))
- {
- // We exist in this queue and cannot be inserted.
- found = 1;
- }
- if (found)
- {
- break;
- }
- }
-
- // Initialize an iterator to search the del_queue for duplicates.
- for (ACE_Unbounded_Queue_Iterator<be_interface*> del_q_iter (
- del_queue
- );
- !found && !del_q_iter.done ();
- (void) del_q_iter.advance ())
+ if (abstract_paths_only && ! parent->is_abstract ())
{
- // Queue element.
- be_interface **temp;
-
- (void) del_q_iter.next (temp);
-
- if (!ACE_OS::strcmp (parent->full_name (),
- (*temp)->full_name ()))
- {
- // We exist in this del_queue and cannot be inserted.
- found = 1;
- }
-
- if (found)
- {
- break;
- }
+ continue;
}
- if (!found)
- {
- // Insert the parent in the queue.
- if (queue.enqueue_tail (parent) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_interface::gen_server_skeletons - "
- "enqueue op failed\n"),
- -1);
- }
- }
+ (void) this->insert_non_dup (parent);
} // end of for loop
} // end of while queue not empty
@@ -1615,6 +1692,11 @@ be_interface::gen_gperf_things (const char *flat_name)
// GPERF can give Binary search, Linear search and Perfect Hash
// methods. Generate the class defintion according to that.
+ TAO_OutStream *os = this->strategy_->get_out_stream ();
+
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Generate the correct class definition for the operation lookup
// strategy. Then, get the lookup method from GPERF. And then,
// instantiate the correct class for the operation lookup strategy
@@ -1971,16 +2053,16 @@ be_interface::gen_linear_search_instance (const char *flat_name)
<< ";\n" << be_nl;
}
-
int
be_interface::is_a_helper (be_interface * /*derived*/,
be_interface *bi,
TAO_OutStream *os)
{
// Emit the comparison code.
- os->indent ();
- *os << "(!ACE_OS::strcmp ((char *)value, \"" << bi->repoID () <<
- "\")) ||\n";
+ *os << "!ACE_OS::strcmp (" << be_idt << be_idt_nl
+ << "(char *)value," << be_nl
+ << "\"" << bi->repoID () << "\"" << be_uidt_nl
+ << ") ||" << be_uidt_nl;
return 0;
}
@@ -1991,8 +2073,9 @@ be_interface::queryinterface_helper (be_interface *derived,
TAO_OutStream *os)
{
// Emit the comparison code.
- *os << "(type == ACE_reinterpret_cast" << be_idt_nl
- << "(ptr_arith_t," << be_idt_nl;
+ *os << "(type == ACE_reinterpret_cast ("
+ << be_idt << be_idt <<be_idt << be_idt << be_idt << be_idt_nl
+ << "ptr_arith_t," << be_nl;
be_decl *scope =
be_scope::narrow_from_scope (ancestor->defined_in ())->decl ();
@@ -2003,42 +2086,45 @@ be_interface::queryinterface_helper (be_interface *derived,
// If the ancestor is in the root scope, we can use the local name.
if (scope->node_type () == AST_Decl::NT_root)
{
- *os << "&" << ancestor->local_name () << "::_tao_class_id" << be_uidt
- << "))" << be_nl;
+ *os << "&" << ancestor->local_name () << "::_tao_class_id)"
+ << be_uidt_nl;
}
// Or, if it's defined in a scope different than the child's, the
// ACE_NESTED_CLASS macro won't work - we use the scoped name.
else if (scope != derived_scope)
{
- *os << "&::" << ancestor->name () << "::_tao_class_id" << be_uidt
- << "))" << be_nl;
+ *os << "&::" << ancestor->name () << "::_tao_class_id)"
+ << be_uidt_nl;
}
// The ACE_NESTED_CLASS macro is necessary in this case.
else
{
*os << "&ACE_NESTED_CLASS (::" << scope->name () << ", "
- << ancestor->local_name () << ")" << "::_tao_class_id" << be_uidt
- << "))" << be_nl;
+ << ancestor->local_name () << ")" << "::_tao_class_id)"
+ << be_uidt_nl;
}
+ *os << ")" << be_uidt << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_idt_nl;
+
if (derived == ancestor)
{
*os << "retv = ACE_reinterpret_cast (void*, this);" << be_uidt_nl;
}
else
{
- *os << "retv = ACE_reinterpret_cast" << be_idt_nl
- << "(" << be_idt_nl
+ *os << "retv =" << be_idt_nl
+ << "ACE_reinterpret_cast (" << be_idt << be_idt_nl
<< "void *," << be_nl
- << "ACE_static_cast" << be_idt_nl
- << "(" << be_idt_nl
+ << "ACE_static_cast (" << be_idt << be_idt_nl
<< ancestor->full_name () << "_ptr," << be_nl
<< "this" << be_uidt_nl
<< ")" << be_uidt << be_uidt_nl
- << ");" << be_uidt << be_uidt_nl;
+ << ");" << be_uidt << be_uidt << be_uidt_nl;
}
- *os << "else if ";
+ *os << "}" << be_uidt_nl
+ << "else if ";
return 0;
}
@@ -2050,10 +2136,19 @@ be_interface::downcast_helper (be_interface * /* derived */,
be_interface *base,
TAO_OutStream *os)
{
- *os << "if (ACE_OS::strcmp (logical_type_id, \""
+ // Abstract interfaces have no code generated on the skeleton side.
+ if (base->is_abstract ())
+ {
+ return 0;
+ }
+
+ *os << "if (ACE_OS::strcmp (logical_type_id," << be_nl
+ << " \""
<< base->repoID () << "\") == 0)" << be_idt_nl
+ << "{" << be_idt_nl
<< "return ACE_static_cast ("
- << base->full_skel_name () << "_ptr, this);" << be_uidt_nl;
+ << base->full_skel_name () << "_ptr, this);" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
return 0;
}
@@ -2070,6 +2165,17 @@ be_interface::gen_skel_helper (be_interface *derived,
return 0;
}
+ // If an operation or an attribute is abstract (declared in an
+ // abstract interface), we will either generate the full
+ // definition (if there are no concrete interfaces between the
+ // abstract ancestor and us) or, if there is a concrete ancestor
+ // in between, we will catch its definition elsewhere in this
+ // traversal.
+ if (ancestor->is_abstract ())
+ {
+ return 0;
+ }
+
// Else generate code that does the cast to the appropriate type.
if (ancestor->nmembers () > 0)
@@ -2085,11 +2191,15 @@ be_interface::gen_skel_helper (be_interface *derived,
{
// Get the next AST decl node
AST_Decl *d = si.item ();
+
if (d->node_type () == AST_Decl::NT_op)
{
// Start from current indentation level.
os->indent ();
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
if (os->stream_type () == TAO_OutStream::TAO_SVR_HDR)
{
// Generate the static method corresponding to this method.
@@ -2241,10 +2351,12 @@ be_interface::copy_ctor_helper (be_interface *derived,
be_interface *base,
TAO_OutStream *os)
{
- if (derived == base)
- // We are the same. Don't do anything, otherwise we will end up calling
- // ourself.
- return 0;
+ // We can't call ourselves in a copy constructor, and
+ // abstract interfaces don't exist on the skeleton side.
+ if (derived == base || base->is_abstract ())
+ {
+ return 0;
+ }
if (base->is_nested ())
{
@@ -2294,12 +2406,46 @@ be_interface::in_mult_inheritance_helper (be_interface *derived,
return 0;
}
+int
+be_interface::gen_abstract_init_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os)
+{
+ if (node == base)
+ {
+ return 0;
+ }
+
+ *os << ",";
+
+ if (base->is_nested ())
+ {
+ UTL_Scope *parent_scope = base->defined_in ();
+ AST_Decl *parent_decl = ScopeAsDecl (parent_scope);
+
+ *os << be_nl
+ << "ACE_NESTED_CLASS ("
+ << parent_decl->name () << ", "
+ << base->local_name ()
+ << ") (objref, _tao_collocated, servant)";
+ }
+ else
+ {
+ *os << be_nl
+ << base->name ()
+ << " (objref, _tao_collocated, servant)";
+ }
+
+ return 0;
+}
+
void
be_interface::destroy (void)
{
// Call the destroy methods of our base classes.
- be_scope::destroy ();
- be_type::destroy ();
+ this->AST_Interface::destroy ();
+ this->be_scope::destroy ();
+ this->be_type::destroy ();
}
int
@@ -2338,7 +2484,13 @@ be_interface::original_interface ()
be_interface *
be_interface::replacement (void)
{
- return this->strategy_->replacement ();
+ return this->strategy_->replacement ();
+}
+
+idl_bool
+be_interface::has_mixed_parentage (void) const
+{
+ return this->has_mixed_parentage_;
}
const char *
@@ -2453,8 +2605,3 @@ be_interface::server_enclosing_scope (void)
IMPL_NARROW_METHODS3 (be_interface, AST_Interface, be_scope, be_type)
IMPL_NARROW_FROM_DECL (be_interface)
IMPL_NARROW_FROM_SCOPE (be_interface)
-
-TAO_IDL_Inheritance_Hierarchy_Worker::
-~TAO_IDL_Inheritance_Hierarchy_Worker ()
-{
-}
diff --git a/TAO/TAO_IDL/be/be_interface_fwd.cpp b/TAO/TAO_IDL/be/be_interface_fwd.cpp
index 00e1f623e9c..522e549f129 100644
--- a/TAO/TAO_IDL/be/be_interface_fwd.cpp
+++ b/TAO/TAO_IDL/be/be_interface_fwd.cpp
@@ -6,10 +6,10 @@
// TAO IDL
//
// = FILENAME
-// be_interface.h
+// be_interface_fwd.cpp
//
// = DESCRIPTION
-// Extension of class AST_Interface_Fwd that provides additional means for C++
+// Extension of class AST_InterfaceFwd that provides additional means for C++
// mapping of an interface.
//
// = AUTHOR
@@ -19,16 +19,17 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_interface_fwd.h"
+#include "be_visitor.h"
-ACE_RCSID(be, be_interface_fwd, "$Id$")
+ACE_RCSID (be,
+ be_interface_fwd,
+ "$Id$")
be_interface_fwd::be_interface_fwd (void)
{
// Always the case.
- this->size_type (be_decl::VARIABLE);
+ this->size_type (AST_Type::VARIABLE);
}
be_interface_fwd::be_interface_fwd (AST_Interface *dummy,
@@ -39,7 +40,7 @@ be_interface_fwd::be_interface_fwd (AST_Interface *dummy,
n)
{
// Always the case.
- this->size_type (be_decl::VARIABLE);
+ this->size_type (AST_Type::VARIABLE);
}
be_interface_fwd::~be_interface_fwd (void)
diff --git a/TAO/TAO_IDL/be/be_interface_strategy.cpp b/TAO/TAO_IDL/be/be_interface_strategy.cpp
index 20bbbd231b8..11c35748ae8 100644
--- a/TAO/TAO_IDL/be/be_interface_strategy.cpp
+++ b/TAO/TAO_IDL/be/be_interface_strategy.cpp
@@ -17,11 +17,14 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_interface_strategy.h"
+#include "be_interface.h"
+#include "be_extern.h"
+#include "utl_identifier.h"
-ACE_RCSID(be, be_interface_strategy, "$Id$")
+ACE_RCSID (be,
+ be_interface_strategy,
+ "$Id$")
be_interface_strategy::be_interface_strategy (be_interface *node,
@@ -43,21 +46,52 @@ be_interface_strategy::be_interface_strategy (be_interface *node,
be_interface_strategy::~be_interface_strategy (void)
{
if (this->local_name_ != 0)
- delete [] this->local_name_;
+ {
+ delete [] this->local_name_;
+ this->local_name_ = 0;
+ }
+
if (this->full_name_ != 0)
- delete [] this->full_name_;
+ {
+ delete [] this->full_name_;
+ this->full_name_ = 0;
+ }
+
if (this->flat_name_ != 0)
- delete [] this->flat_name_;
+ {
+ delete [] this->flat_name_;
+ this->flat_name_ = 0;
+ }
+
if (this->repoID_ != 0)
- delete [] this->repoID_;
+ {
+ delete [] this->repoID_;
+ this->repoID_ = 0;
+ }
+
if (this->full_skel_name_ != 0)
- delete [] this->full_skel_name_;
+ {
+ delete [] this->full_skel_name_;
+ this->full_skel_name_ = 0;
+ }
+
if (this->full_coll_name_ != 0)
- delete [] this->full_coll_name_;
+ {
+ delete [] this->full_coll_name_;
+ this->full_coll_name_ = 0;
+ }
+
if (this->local_coll_name_ != 0)
- delete [] this->local_coll_name_;
+ {
+ delete [] this->local_coll_name_;
+ this->local_coll_name_ = 0;
+ }
+
if (this->relative_skel_name_ != 0)
- delete [] this->relative_skel_name_;
+ {
+ delete [] this->relative_skel_name_;
+ this->relative_skel_name_ = 0;
+ }
}
// Interface Type Strategy Base Class
@@ -92,6 +126,7 @@ be_interface_strategy::compute_coll_names (int type,
static const char *collocated_names[] = {"_tao_thru_poa_collocated_",
"_tao_direct_collocated_"};
static const char *poa = "POA_";
+
// Reserve enough room for the "POA_" prefix, the "_tao_collocated_"
// prefix and the local name and the (optional) "::"
const char *collocated = collocated_names[type];
@@ -347,8 +382,8 @@ be_interface_ami_handler_strategy::next_state (
// ****************************************************************
// AMI Exception Holder Strategy
-be_interface_ami_exception_holder_strategy
-::be_interface_ami_exception_holder_strategy (be_interface *node)
+be_interface_ami_exception_holder_strategy::
+be_interface_ami_exception_holder_strategy (be_interface *node)
: be_interface_default_strategy (node,
AMI_EXCEPTION_HOLDER)
{
@@ -514,6 +549,113 @@ be_interface_default_strategy::be_interface_default_strategy (
be_interface_default_strategy::~be_interface_default_strategy (void)
{
+ if (this->base_proxy_impl_name_ != 0)
+ {
+ delete this->base_proxy_impl_name_;
+ this->base_proxy_impl_name_ = 0;
+ }
+
+ if (this->remote_proxy_impl_name_ != 0)
+ {
+ delete this->remote_proxy_impl_name_;
+ this->remote_proxy_impl_name_ = 0;
+ }
+
+ if (this->thruPOA_proxy_impl_name_ != 0)
+ {
+ delete this->thruPOA_proxy_impl_name_;
+ this->thruPOA_proxy_impl_name_ = 0;
+ }
+
+ if (this->direct_proxy_impl_name_ != 0)
+ {
+ delete this->direct_proxy_impl_name_;
+ this->direct_proxy_impl_name_ = 0;
+ }
+
+ if (this->full_base_proxy_impl_name_ != 0)
+ {
+ delete this->full_base_proxy_impl_name_;
+ this->full_base_proxy_impl_name_ = 0;
+ }
+
+ if (this->full_remote_proxy_impl_name_ != 0)
+ {
+ delete this->full_remote_proxy_impl_name_;
+ this->full_remote_proxy_impl_name_ = 0;
+ }
+
+ if (this->full_thruPOA_proxy_impl_name_ != 0)
+ {
+ delete this->full_thruPOA_proxy_impl_name_;
+ this->full_thruPOA_proxy_impl_name_ = 0;
+ }
+
+ if (this->full_direct_proxy_impl_name_ != 0)
+ {
+ delete this->full_direct_proxy_impl_name_;
+ this->full_direct_proxy_impl_name_ = 0;
+ }
+
+ if (this->base_proxy_broker_ != 0)
+ {
+ delete this->base_proxy_broker_;
+ this->base_proxy_broker_ = 0;
+ }
+
+ if (this->remote_proxy_broker_ != 0)
+ {
+ delete this->remote_proxy_broker_;
+ this->remote_proxy_broker_ = 0;
+ }
+
+ if (this->strategized_proxy_broker_ != 0)
+ {
+ delete this->strategized_proxy_broker_;
+ this->strategized_proxy_broker_ = 0;
+ }
+
+ if (this->full_base_proxy_broker_name_ != 0)
+ {
+ delete this->full_base_proxy_broker_name_;
+ this->full_base_proxy_broker_name_ = 0;
+ }
+
+ if (this->full_remote_proxy_broker_name_ != 0)
+ {
+ delete this->full_remote_proxy_broker_name_;
+ this->full_remote_proxy_broker_name_ = 0;
+ }
+
+ if (this->full_strategized_proxy_broker_name_ != 0)
+ {
+ delete this->full_strategized_proxy_broker_name_;
+ this->full_strategized_proxy_broker_name_ = 0;
+ }
+
+ if (this->client_scope_ != 0)
+ {
+ delete this->client_scope_;
+ this->client_scope_ = 0;
+ }
+
+ if (this->flat_client_scope_ != 0)
+ {
+ delete this->flat_client_scope_;
+ this->flat_client_scope_ = 0;
+ }
+
+ if (this->server_scope_ != 0)
+ {
+ delete this->server_scope_;
+ this->server_scope_ = 0;
+ }
+
+ if (this->flat_server_scope_ != 0)
+ {
+ delete this->flat_server_scope_;
+ this->flat_server_scope_ = 0;
+ }
}
const char *
@@ -639,7 +781,9 @@ be_interface_default_strategy::create_with_prefix_suffix (
ACE_OS::strlen (separator) +
1; // The '/0'
- ACE_NEW_RETURN (cat_string, char[length], 0);
+ ACE_NEW_RETURN (cat_string,
+ char[length],
+ 0);
ACE_OS::strcpy (cat_string, prefix);
ACE_OS::strcat (cat_string, str);
@@ -653,7 +797,9 @@ const char *
be_interface_default_strategy::base_proxy_impl_name (void)
{
if (this->base_proxy_impl_name_ != 0)
- return this->base_proxy_impl_name_;
+ {
+ return this->base_proxy_impl_name_;
+ }
this->base_proxy_impl_name_ =
this->create_with_prefix_suffix (this->tag_table_[GC_PREFIX],
@@ -668,14 +814,18 @@ const char *
be_interface_default_strategy::client_scope (void)
{
if (this->client_scope_ != 0)
- return this->client_scope_;
+ {
+ return this->client_scope_;
+ }
const char *full_name = this->full_name ();
const char *name = this->local_name ();
int offset = ACE_OS::strlen (name);
int length = ACE_OS::strlen (full_name) - offset;
- this->client_scope_ = new char[length+1];
+ ACE_NEW_RETURN (this->client_scope_,
+ char[length + 1],
+ 0);
ACE_OS::strncpy (this->client_scope_, full_name, length);
this->client_scope_[length] = '\0';
@@ -686,14 +836,18 @@ const char *
be_interface_default_strategy::flat_client_scope (void)
{
if (this->flat_client_scope_ != 0)
- return this->flat_client_scope_;
+ {
+ return this->flat_client_scope_;
+ }
const char *full_name = this->flat_name ();
const char *name = this->local_name ();
int offset = ACE_OS::strlen (name);
int length = ACE_OS::strlen (full_name) - offset;
- this->flat_client_scope_ = new char[length+1];
+ ACE_NEW_RETURN (this->flat_client_scope_,
+ char[length + 1],
+ 0);
ACE_OS::strncpy (this->flat_client_scope_, full_name, length);
this->flat_client_scope_[length] = '\0';
@@ -706,7 +860,9 @@ const char *
be_interface_default_strategy::server_scope (void)
{
if (this->server_scope_ != 0)
- return this->server_scope_;
+ {
+ return this->server_scope_;
+ }
const char *full_name =
this->node_->full_coll_name (be_interface::DIRECT);
@@ -715,7 +871,9 @@ be_interface_default_strategy::server_scope (void)
int offset = ACE_OS::strlen (name);
int length = ACE_OS::strlen (full_name) - offset;
- this->server_scope_ = new char[length+1];
+ ACE_NEW_RETURN (this->server_scope_,
+ char[length + 1],
+ 0);
ACE_OS::strncpy (this->server_scope_, full_name, length);
this->server_scope_[length] = '\0';
@@ -727,14 +885,18 @@ const char *
be_interface_default_strategy::flat_server_scope (void)
{
if (this->flat_server_scope_ != 0)
- return this->flat_server_scope_;
+ {
+ return this->flat_server_scope_;
+ }
const char *full_name = this->flat_name ();
const char *name = this->local_name ();
int offset = ACE_OS::strlen (name);
int length = ACE_OS::strlen (full_name) - offset;
- this->flat_client_scope_ = new char[length+1];
+ ACE_NEW_RETURN (this->flat_client_scope_,
+ char[length + 1],
+ 0);
ACE_OS::strncpy (this->flat_server_scope_, full_name, length);
this->flat_server_scope_[length] = '\0';
@@ -748,12 +910,17 @@ const char *
be_interface_default_strategy::full_base_proxy_impl_name (void)
{
if (this->full_base_proxy_impl_name_ != 0)
- return this->full_base_proxy_impl_name_;
+ {
+ return this->full_base_proxy_impl_name_;
+ }
const char *scope = this->client_scope ();
const char *base_name = this->base_proxy_impl_name ();
int length = ACE_OS::strlen (scope) + ACE_OS::strlen (base_name);
- this->full_base_proxy_impl_name_ = new char[length+1];
+ ACE_NEW_RETURN (this->full_base_proxy_impl_name_,
+ char[length + 1],
+ 0);
+
ACE_OS::strcpy (this->full_base_proxy_impl_name_, scope);
ACE_OS::strcat (this->full_base_proxy_impl_name_, base_name);
@@ -766,7 +933,9 @@ const char *
be_interface_default_strategy::remote_proxy_impl_name (void)
{
if (this->remote_proxy_impl_name_ != 0)
- return this->remote_proxy_impl_name_;
+ {
+ return this->remote_proxy_impl_name_;
+ }
this->remote_proxy_impl_name_ =
@@ -782,12 +951,17 @@ const char *
be_interface_default_strategy::full_remote_proxy_impl_name (void)
{
if (this->full_remote_proxy_impl_name_ != 0)
- return this->full_remote_proxy_impl_name_;
+ {
+ return this->full_remote_proxy_impl_name_;
+ }
const char *scope = this->client_scope ();
const char *base_name = this->remote_proxy_impl_name ();
int length = ACE_OS::strlen (scope) + ACE_OS::strlen (base_name);
- this->full_remote_proxy_impl_name_ = new char[length+1];
+ ACE_NEW_RETURN (this->full_remote_proxy_impl_name_,
+ char[length + 1],
+ 0);
+
ACE_OS::strcpy (this->full_remote_proxy_impl_name_, scope);
ACE_OS::strcat (this->full_remote_proxy_impl_name_, base_name);
@@ -798,7 +972,9 @@ const char *
be_interface_default_strategy::thru_poa_proxy_impl_name (void)
{
if (this->thruPOA_proxy_impl_name_ != 0)
- return this->thruPOA_proxy_impl_name_;
+ {
+ return this->thruPOA_proxy_impl_name_;
+ }
this->thruPOA_proxy_impl_name_ =
this->create_with_prefix_suffix (this->tag_table_[GC_PREFIX],
@@ -813,12 +989,17 @@ const char *
be_interface_default_strategy::full_thru_poa_proxy_impl_name (void)
{
if (this->full_thruPOA_proxy_impl_name_ != 0)
- return this->full_thruPOA_proxy_impl_name_;
+ {
+ return this->full_thruPOA_proxy_impl_name_;
+ }
const char *scope = this->server_scope ();
const char *base_name = this->thru_poa_proxy_impl_name ();
int length = ACE_OS::strlen (scope) + ACE_OS::strlen (base_name);
- this->full_thruPOA_proxy_impl_name_ = new char[length+1];
+ ACE_NEW_RETURN (this->full_thruPOA_proxy_impl_name_,
+ char[length + 1],
+ 0);
+
ACE_OS::strcpy (this->full_thruPOA_proxy_impl_name_, scope);
ACE_OS::strcat (this->full_thruPOA_proxy_impl_name_, base_name);
@@ -830,7 +1011,9 @@ const char *
be_interface_default_strategy::direct_proxy_impl_name (void)
{
if (this->direct_proxy_impl_name_ != 0)
- return this->direct_proxy_impl_name_;
+ {
+ return this->direct_proxy_impl_name_;
+ }
this->direct_proxy_impl_name_ =
this->create_with_prefix_suffix (this->tag_table_[GC_PREFIX],
@@ -846,13 +1029,18 @@ const char *
be_interface_default_strategy::full_direct_proxy_impl_name (void)
{
if (this->full_direct_proxy_impl_name_ != 0)
- return this->full_direct_proxy_impl_name_;
+ {
+ return this->full_direct_proxy_impl_name_;
+ }
const char *scope = this->server_scope ();
const char *base_name = this->direct_proxy_impl_name ();
int length = ACE_OS::strlen (scope) + ACE_OS::strlen (base_name);
- this->full_direct_proxy_impl_name_ = new char[length+1];
+ ACE_NEW_RETURN (this->full_direct_proxy_impl_name_,
+ char[length + 1],
+ 0);
+
ACE_OS::strcpy (this->full_direct_proxy_impl_name_, scope);
ACE_OS::strcat (this->full_direct_proxy_impl_name_, base_name);
@@ -864,7 +1052,9 @@ const char *
be_interface_default_strategy::base_proxy_broker_name (void)
{
if (this->base_proxy_broker_ != 0)
- return this->base_proxy_broker_;
+ {
+ return this->base_proxy_broker_;
+ }
this->base_proxy_broker_ =
this->create_with_prefix_suffix (this->tag_table_[GC_PREFIX],
@@ -879,12 +1069,17 @@ const char *
be_interface_default_strategy::full_base_proxy_broker_name (void)
{
if (this->full_base_proxy_broker_name_ != 0)
- return this->full_base_proxy_broker_name_;
+ {
+ return this->full_base_proxy_broker_name_;
+ }
const char *scope = this->client_scope ();
const char *base_name = this->base_proxy_broker_name ();
int length = ACE_OS::strlen (scope) + ACE_OS::strlen (base_name);
- this->full_base_proxy_broker_name_ = new char[length+1];
+ ACE_NEW_RETURN (this->full_base_proxy_broker_name_,
+ char[length + 1],
+ 0);
+
ACE_OS::strcpy (this->full_base_proxy_broker_name_, scope);
ACE_OS::strcat (this->full_base_proxy_broker_name_, base_name);
@@ -895,7 +1090,9 @@ const char *
be_interface_default_strategy::remote_proxy_broker_name (void)
{
if (this->remote_proxy_broker_ != 0)
- return this->remote_proxy_broker_;
+ {
+ return this->remote_proxy_broker_;
+ }
this->remote_proxy_broker_ =
this->create_with_prefix_suffix (this->tag_table_[GC_PREFIX],
@@ -911,12 +1108,17 @@ const char *
be_interface_default_strategy::full_remote_proxy_broker_name (void)
{
if (this->full_remote_proxy_broker_name_ != 0)
- return this->full_remote_proxy_broker_name_;
+ {
+ return this->full_remote_proxy_broker_name_;
+ }
const char *scope = this->client_scope ();
const char *base_name = this->remote_proxy_broker_name ();
int length = ACE_OS::strlen (scope) + ACE_OS::strlen (base_name);
- this->full_remote_proxy_broker_name_ = new char[length+1];
+ ACE_NEW_RETURN (this->full_remote_proxy_broker_name_,
+ char[length + 1],
+ 0);
+
ACE_OS::strcpy (this->full_remote_proxy_broker_name_, scope);
ACE_OS::strcat (this->full_remote_proxy_broker_name_, base_name);
@@ -928,7 +1130,9 @@ const char *
be_interface_default_strategy::strategized_proxy_broker_name (void)
{
if (this->strategized_proxy_broker_ != 0)
- return this->strategized_proxy_broker_;
+ {
+ return this->strategized_proxy_broker_;
+ }
this->strategized_proxy_broker_ =
this->create_with_prefix_suffix (this->tag_table_[GC_PREFIX],
@@ -943,12 +1147,17 @@ const char *
be_interface_default_strategy::full_strategized_proxy_broker_name (void)
{
if (this->full_strategized_proxy_broker_name_ != 0)
- return this->full_strategized_proxy_broker_name_;
+ {
+ return this->full_strategized_proxy_broker_name_;
+ }
const char *scope = this->server_scope ();
const char *base_name = this->strategized_proxy_broker_name ();
int length = ACE_OS::strlen (scope) + ACE_OS::strlen (base_name);
- this->full_strategized_proxy_broker_name_ = new char[length+1];
+ ACE_NEW_RETURN (this->full_strategized_proxy_broker_name_,
+ char[length + 1],
+ 0);
+
ACE_OS::strcpy (this->full_strategized_proxy_broker_name_, scope);
ACE_OS::strcat (this->full_strategized_proxy_broker_name_, base_name);
diff --git a/TAO/TAO_IDL/be/be_module.cpp b/TAO/TAO_IDL/be/be_module.cpp
index 043dab1f1a3..a7980972eaf 100644
--- a/TAO/TAO_IDL/be/be_module.cpp
+++ b/TAO/TAO_IDL/be/be_module.cpp
@@ -19,11 +19,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_module.h"
+#include "be_visitor.h"
-ACE_RCSID(be, be_module, "$Id$")
+ACE_RCSID (be,
+ be_module,
+ "$Id$")
be_module::be_module (void)
{
@@ -37,14 +38,6 @@ be_module::be_module (UTL_ScopedName *n)
{
}
-// Compute the size type of the node in question.
-int
-be_module::compute_size_type (void)
-{
- // Our size does not matter.
- return 0;
-}
-
void
be_module::destroy (void)
{
diff --git a/TAO/TAO_IDL/be/be_native.cpp b/TAO/TAO_IDL/be/be_native.cpp
index 93e3d1e3d1a..8aa14ed2d39 100644
--- a/TAO/TAO_IDL/be/be_native.cpp
+++ b/TAO/TAO_IDL/be/be_native.cpp
@@ -16,11 +16,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_native.h"
+#include "be_visitor.h"
-ACE_RCSID(be, be_native, "$Id$")
+ACE_RCSID (be,
+ be_native,
+ "$Id$")
be_native::be_native (void)
diff --git a/TAO/TAO_IDL/be/be_operation.cpp b/TAO/TAO_IDL/be/be_operation.cpp
index bcd210104c9..100027e3577 100644
--- a/TAO/TAO_IDL/be/be_operation.cpp
+++ b/TAO/TAO_IDL/be/be_operation.cpp
@@ -19,11 +19,15 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_operation.h"
+#include "be_operation_strategy.h"
+#include "be_predefined_type.h"
+#include "be_argument.h"
+#include "be_visitor.h"
-ACE_RCSID(be, be_operation, "$Id$")
+ACE_RCSID (be,
+ be_operation,
+ "$Id$")
be_operation::be_operation (void)
{
@@ -56,71 +60,16 @@ be_operation::~be_operation (void)
{
}
-int
-be_operation::void_return_type (void)
-{
- be_type* type = be_type::narrow_from_decl (this->return_type ());
-
- if (type->node_type () == AST_Decl::NT_pre_defined
- && (be_predefined_type::narrow_from_decl (type)->pt ()
- == AST_PredefinedType::PT_void))
- {
- return 1;
- }
- else
- {
- return 0;
- }
-}
-
-be_argument *
-be_operation::add_argument_to_scope (be_argument *arg)
-{
- this->add_to_scope (arg);
- this->add_to_referenced (arg,
- 0,
- 0);
- return arg;
-}
-
-// Compute the size type of the node in question.
-int
-be_operation::compute_size_type (void)
-{
-
- for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- // Get the next AST decl node
- AST_Decl *d = si.item ();
- be_decl *bd = be_decl::narrow_from_decl (d);
-
- if (bd != 0)
- {
- // Our sizetype depends on the sizetype of our members. Although
- // previous value of sizetype may get overwritten, we are
- // guaranteed by the "size_type" call that once the value reached
- // be_decl::VARIABLE, nothing else can overwrite it.
- this->size_type (bd->size_type ());
- }
- else
- {
- ACE_DEBUG ((LM_DEBUG,
- "WARNING (%N:%l) be_operation::compute_size_type - "
- "narrow_from_decl returned 0\n"));
- }
- }
-
- return 0;
-}
-
void
be_operation::destroy (void)
{
+ delete this->strategy_;
+ this->strategy_ = 0;
+
// Call the destroy methods of our base classes.
- be_scope::destroy ();
- be_decl::destroy ();
+ this->be_scope::destroy ();
+ this->be_decl::destroy ();
+ this->AST_Operation::destroy ();
}
int
diff --git a/TAO/TAO_IDL/be/be_operation_strategy.cpp b/TAO/TAO_IDL/be/be_operation_strategy.cpp
index d5bb6273e55..268a092ec3a 100644
--- a/TAO/TAO_IDL/be/be_operation_strategy.cpp
+++ b/TAO/TAO_IDL/be/be_operation_strategy.cpp
@@ -17,17 +17,17 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_operation_strategy.h"
-ACE_RCSID(be, be_operation_strategy, "$Id$")
+ACE_RCSID (be,
+ be_operation_strategy,
+ "$Id$")
- be_operation_strategy::be_operation_strategy (be_operation *node,
- Strategy_Kind strategy_type)
- : node_ (node),
- strategy_type_ (strategy_type)
+be_operation_strategy::be_operation_strategy (be_operation *node,
+ Strategy_Kind strategy_type)
+ : node_ (node),
+ strategy_type_ (strategy_type)
{
}
diff --git a/TAO/TAO_IDL/be/be_predefined_type.cpp b/TAO/TAO_IDL/be/be_predefined_type.cpp
index ddab9500d21..b5520ef1995 100644
--- a/TAO/TAO_IDL/be/be_predefined_type.cpp
+++ b/TAO/TAO_IDL/be/be_predefined_type.cpp
@@ -19,11 +19,15 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_predefined_type.h"
+#include "be_visitor.h"
+#include "utl_identifier.h"
+#include "ace/Log_Msg.h"
+#include "ace/ACE.h"
-ACE_RCSID(be, be_predefined_type, "$Id$")
+ACE_RCSID (be,
+ be_predefined_type,
+ "$Id$")
be_predefined_type::be_predefined_type (void)
{
@@ -37,108 +41,14 @@ be_predefined_type::be_predefined_type (AST_PredefinedType::PredefinedType t,
n,
I_TRUE)
{
- // Generate a new Scoped Name for us such that we belong to the CORBA
- // namespace.
- if (this->pt () != AST_PredefinedType::PT_void)
- {
- Identifier *corba_id = 0;
- ACE_NEW (corba_id,
- Identifier ("CORBA"));
-
- UTL_ScopedName *new_name = 0;
- ACE_NEW (new_name,
- UTL_ScopedName (corba_id,
- 0));
-
- Identifier *id = 0;
- UTL_ScopedName *conc_name = 0;
-
- switch (this->pt ())
- {
- case AST_PredefinedType::PT_long:
- ACE_NEW (id,
- Identifier ("Long"));
- break;
- case AST_PredefinedType::PT_ulong:
- ACE_NEW (id,
- Identifier ("ULong"));
- break;
- case AST_PredefinedType::PT_short:
- ACE_NEW (id,
- Identifier ("Short"));
- break;
- case AST_PredefinedType::PT_ushort:
- ACE_NEW (id,
- Identifier ("UShort"));
- break;
- case AST_PredefinedType::PT_float:
- ACE_NEW (id,
- Identifier ("Float"));
- break;
- case AST_PredefinedType::PT_double:
- ACE_NEW (id,
- Identifier ("Double"));
- break;
- case AST_PredefinedType::PT_char:
- ACE_NEW (id,
- Identifier ("Char"));
- break;
- case AST_PredefinedType::PT_octet:
- ACE_NEW (id,
- Identifier ("Octet"));
- break;
- case AST_PredefinedType::PT_wchar:
- ACE_NEW (id,
- Identifier ("WChar"));
- break;
- case AST_PredefinedType::PT_boolean:
- ACE_NEW (id,
- Identifier ("Boolean"));
- break;
- case AST_PredefinedType::PT_longlong:
- ACE_NEW (id,
- Identifier ("LongLong"));
- break;
- case AST_PredefinedType::PT_ulonglong:
- ACE_NEW (id,
- Identifier ("ULongLong"));
- break;
- case AST_PredefinedType::PT_longdouble:
- ACE_NEW (id,
- Identifier ("LongDouble"));
- break;
- case AST_PredefinedType::PT_any:
- ACE_NEW (id,
- Identifier ("Any"));
- break;
- case AST_PredefinedType::PT_pseudo:
- ACE_NEW (id,
- Identifier (n->last_component ()->get_string ()));
- break;
- default:
- ACE_NEW (id,
- Identifier (this->local_name ()->get_string ()));
- }
-
- ACE_NEW (conc_name,
- UTL_ScopedName (id,
- 0));
-
- new_name->nconc (conc_name);
- this->set_name (new_name);
- }
-
// Computes the repoID.
this->compute_repoID ();
- // Computes the fully scoped name.
- AST_Decl::compute_full_name ();
-
// Computes the fully scoped typecode name.
this->compute_tc_name ();
// Compute the flattened fully scoped name.
- this->compute_flat_name ();
+ this->AST_Decl::compute_flat_name ();
}
// Overriden method.
@@ -219,6 +129,10 @@ be_predefined_type::compute_tc_name (void)
ACE_NEW (id,
Identifier ("_tc_any"));
break;
+ case AST_PredefinedType::PT_object:
+ ACE_NEW (id,
+ Identifier ("_tc_Object"));
+ break;
case AST_PredefinedType::PT_pseudo:
{
char tcname [100];
@@ -242,23 +156,6 @@ be_predefined_type::compute_tc_name (void)
this->tc_name_->nconc (conc_name);
}
-// Compute the size type of the node in question.
-int
-be_predefined_type::compute_size_type (void)
-{
- if (this->pt () == AST_PredefinedType::PT_any
- || this->pt () == AST_PredefinedType::PT_pseudo)
- {
- this->size_type (be_decl::VARIABLE);
- }
- else
- {
- this->size_type (be_decl::FIXED);
- }
-
- return 0;
-}
-
void
be_predefined_type::compute_repoID (void)
{
@@ -287,6 +184,13 @@ be_predefined_type::accept (be_visitor *visitor)
return visitor->visit_predefined_type (this);
}
+void
+be_predefined_type::destroy (void)
+{
+ this->AST_PredefinedType::destroy ();
+ this->be_type::destroy ();
+}
+
// Narrowing
IMPL_NARROW_METHODS2 (be_predefined_type, AST_PredefinedType, be_type)
IMPL_NARROW_FROM_DECL (be_predefined_type)
diff --git a/TAO/TAO_IDL/be/be_produce.cpp b/TAO/TAO_IDL/be/be_produce.cpp
index ad7b39a558c..8d993bd5747 100644
--- a/TAO/TAO_IDL/be/be_produce.cpp
+++ b/TAO/TAO_IDL/be/be_produce.cpp
@@ -62,33 +62,30 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
-// BE_produce.cc - Produce the work of the BE - does nothing in the
-// dummy BE
-
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
#include "be_visitor_root.h"
-#include "TAO_IDL_BE_Export.h"
+#include "be_visitor_ami_pre_proc.h"
+#include "be_visitor_amh_pre_proc.h"
+#include "be_visitor_context.h"
+#include "be_root.h"
+#include "be_extern.h"
+#include "global_extern.h"
-ACE_RCSID(be, be_produce, "$Id$")
+ACE_RCSID (be,
+ be_produce,
+ "$Id$")
// Clean up before exit, whether successful or not.
TAO_IDL_BE_Export void
BE_cleanup (void)
{
- AST_Decl *d = idl_global->root ();
- be_root *root = be_root::narrow_from_decl (d);
-
- root->destroy ();
- delete root;
- root = 0;
-
idl_global->destroy ();
delete idl_global;
idl_global = 0;
+
+ delete be_global;
+ be_global = 0;
}
// Abort this run of the BE.
@@ -110,9 +107,6 @@ BE_produce (void)
// Root of the AST made up of BE nodes.
be_root *root = 0;
- // Visitor for root.
- be_visitor *visitor = 0;
-
// Context information for the visitor root.
be_visitor_context ctx;
@@ -136,158 +130,143 @@ BE_produce (void)
{
// Make a first pass over the AST and introduce
// AMI specific interfaces, methods and valuetypes.
- be_visitor_context *local_ctx = 0;
- ACE_NEW (local_ctx,
- be_visitor_context (ctx));
-
- ACE_NEW (visitor,
- be_visitor_ami_pre_proc (local_ctx));
+ be_visitor_ami_pre_proc ami_preproc_visitor (&ctx);
- if (root->accept (visitor) == -1)
+ if (root->accept (&ami_preproc_visitor) == -1)
{
ACE_ERROR ((LM_ERROR,
"(%N:%l) be_produce - "
"client header for Root failed\n"));
BE_abort ();
}
-
- delete visitor;
}
if (be_global->gen_amh_classes () == I_TRUE)
{
// Make a first pass over the AST and introduce
// AMH specific code
- be_visitor_context *local_ctx = 0;
- ACE_NEW (local_ctx,
- be_visitor_context (ctx));
-
- ACE_NEW (visitor,
- be_visitor_amh_pre_proc (local_ctx));
+ be_visitor_amh_pre_proc amh_pre_proc_visitor (&ctx);
- if (root->accept (visitor) == -1)
+ if (root->accept (&amh_pre_proc_visitor) == -1)
{
ACE_ERROR ((LM_ERROR,
"(%N:%l) be_produce - "
"client header for Root failed\n"));
BE_abort ();
}
-
- delete visitor;
}
// Code generation involves six steps because of the six files that we
// generate.
- // (1) Generate client header,
- // instantiate a visitor context, and set the codegen state
- ctx.state (TAO_CodeGen::TAO_ROOT_CH);
-
- // Get a root visitor.
- visitor = tao_cg->make_visitor (&ctx);
-
- // Generate code for the client header
- if (root->accept (visitor) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "(%N:%l) be_produce - "
- "client header for Root failed\n"));
- BE_abort ();
- }
-
- delete visitor;
-
- // (2) Generate client inline and
- // set the context information.
- ctx.reset ();
- ctx.state (TAO_CodeGen::TAO_ROOT_CI);
-
- // Create a visitor.
- visitor = tao_cg->make_visitor (&ctx);
-
- // Generate code for the client inline file.
- if (root->accept (visitor) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "(%N:%l) be_produce - "
- "client inline for Root failed\n"));
- BE_abort ();
- }
-
- delete visitor;
-
-
- // (3) Generate client stubs.
- ctx.reset ();
- ctx.state (TAO_CodeGen::TAO_ROOT_CS);
-
- // Create a visitor.
- visitor = tao_cg->make_visitor (&ctx);
-
- // Generate code for the client stubs.
- if (root->accept (visitor) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "(%N:%l) be_produce - "
- "client stubs for Root failed\n"));
- BE_abort ();
- }
-
- delete visitor;
-
- // (4) Generate server header.
- ctx.reset ();
- ctx.state (TAO_CodeGen::TAO_ROOT_SH);
-
- // Create a visitor.
- visitor = tao_cg->make_visitor (&ctx);
-
- // Generate code for the server header file.
- if (root->accept (visitor) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "(%N:%l) be_produce - "
- "server header for Root failed\n"));
- BE_abort ();
- }
-
- delete visitor;
-
- // (5) Generate server inline.
- ctx.reset ();
- ctx.state (TAO_CodeGen::TAO_ROOT_SI);
-
- // Create a visitor.
- visitor = tao_cg->make_visitor (&ctx);
-
- // Generate code for the server inline file.
- if (root->accept (visitor) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "(%N:%l) be_produce - "
- "server inline for Root failed\n"));
- BE_abort ();
- }
-
- delete visitor;
-
- // (6) Generate server skeletons
- ctx.reset ();
- ctx.state (TAO_CodeGen::TAO_ROOT_SS);
-
- // Create a visitor.
- visitor = tao_cg->make_visitor (&ctx);
-
- // Generate code for the server skeletons.
- if (root->accept (visitor) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "(%N:%l) be_produce - "
- "server skeletons for Root failed\n"));
- BE_abort ();
- }
-
- delete visitor;
+ {
+ // (1) Generate client header,
+ // instantiate a visitor context, and set the codegen state
+ ctx.state (TAO_CodeGen::TAO_ROOT_CH);
+
+ // Get a root visitor.
+ be_visitor_root_ch root_ch_visitor (&ctx);
+
+ // Generate code for the client header
+ if (root->accept (&root_ch_visitor) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%N:%l) be_produce - "
+ "client header for Root failed\n"));
+ BE_abort ();
+ }
+ }
+
+ {
+ // (2) Generate client inline and
+ // set the context information.
+ ctx.reset ();
+ ctx.state (TAO_CodeGen::TAO_ROOT_CI);
+
+ // Create a visitor.
+ be_visitor_root_ci root_ci_visitor (&ctx);
+
+ // Generate code for the client inline file.
+ if (root->accept (&root_ci_visitor) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%N:%l) be_produce - "
+ "client inline for Root failed\n"));
+ BE_abort ();
+ }
+ }
+
+ {
+ // (3) Generate client stubs.
+ ctx.reset ();
+ ctx.state (TAO_CodeGen::TAO_ROOT_CS);
+
+ // Create a visitor.
+ be_visitor_root_cs root_cs_visitor (&ctx);
+
+ // Generate code for the client stubs.
+ if (root->accept (&root_cs_visitor) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%N:%l) be_produce - "
+ "client stubs for Root failed\n"));
+ BE_abort ();
+ }
+ }
+
+ {
+ // (4) Generate server header.
+ ctx.reset ();
+ ctx.state (TAO_CodeGen::TAO_ROOT_SH);
+
+ // Create a visitor.
+ be_visitor_root_sh root_sh_visitor (&ctx);
+
+ // Generate code for the server header file.
+ if (root->accept (&root_sh_visitor) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%N:%l) be_produce - "
+ "server header for Root failed\n"));
+ BE_abort ();
+ }
+ }
+
+ {
+ // (5) Generate server inline.
+ ctx.reset ();
+ ctx.state (TAO_CodeGen::TAO_ROOT_SI);
+
+ // Create a visitor.
+ be_visitor_root_si root_si_visitor (&ctx);
+
+ // Generate code for the server inline file.
+ if (root->accept (&root_si_visitor) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%N:%l) be_produce - "
+ "server inline for Root failed\n"));
+ BE_abort ();
+ }
+ }
+
+ {
+ // (6) Generate server skeletons
+ ctx.reset ();
+ ctx.state (TAO_CodeGen::TAO_ROOT_SS);
+
+ // Create a visitor.
+ be_visitor_root_ss root_ss_visitor (&ctx);
+
+ // Generate code for the server skeletons.
+ if (root->accept (&root_ss_visitor) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%N:%l) be_produce - "
+ "server skeletons for Root failed\n"));
+ BE_abort ();
+ }
+ }
// (7) Generated server template header.
if (be_global->gen_tie_classes ())
@@ -317,10 +296,10 @@ BE_produce (void)
ctx.state (TAO_CodeGen::TAO_ROOT_IH);
// Create a visitor.
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_root_ih root_ih_visitor (&ctx);
// Generate code for the implementation header.
- if (root->accept (visitor) == -1)
+ if (root->accept (&root_ih_visitor) == -1)
{
ACE_ERROR ((LM_ERROR,
"(%N:%l) be_produce - "
@@ -328,25 +307,21 @@ BE_produce (void)
BE_abort ();
}
- delete visitor;
-
// (9) Generate implementation source.
ctx.reset ();
ctx.state (TAO_CodeGen::TAO_ROOT_IS);
// Create a visitor.
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_root_is root_is_visitor (&ctx);
// Generate code for the implementation source.
- if (root->accept (visitor) == -1)
+ if (root->accept (&root_is_visitor) == -1)
{
ACE_ERROR ((LM_ERROR,
"(%N:%l) be_produce - "
"implementation skeletons for Root failed\n"));
BE_abort ();
}
-
- delete visitor;
}
// Clean up.
diff --git a/TAO/TAO_IDL/be/be_root.cpp b/TAO/TAO_IDL/be/be_root.cpp
index 65385b6255c..0e8b89b68fb 100644
--- a/TAO/TAO_IDL/be/be_root.cpp
+++ b/TAO/TAO_IDL/be/be_root.cpp
@@ -19,11 +19,15 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_root.h"
+#include "be_visitor.h"
+#include "ast_sequence.h"
+#include "ast_string.h"
+#include "ast_array.h"
-ACE_RCSID(be, be_root, "$Id$")
+ACE_RCSID (be,
+ be_root,
+ "$Id$")
// Default Constructor.
be_root::be_root (void)
@@ -52,7 +56,7 @@ be_root::fe_add_sequence (AST_Sequence *t)
return 0;
}
- add_to_local_types(t);
+ add_to_local_types (t);
return t;
}
@@ -88,6 +92,7 @@ be_root::destroy (void)
// Call the destroy methods of our base classes.
be_scope::destroy ();
be_decl::destroy ();
+ AST_Root::destroy ();
}
int
diff --git a/TAO/TAO_IDL/be/be_scope.cpp b/TAO/TAO_IDL/be/be_scope.cpp
index c7fde75337d..128ae41716d 100644
--- a/TAO/TAO_IDL/be/be_scope.cpp
+++ b/TAO/TAO_IDL/be/be_scope.cpp
@@ -1,12 +1,23 @@
//
// $Id$
//
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-ACE_RCSID(be, be_scope, "$Id$")
+#include "be_scope.h"
+#include "be_valuetype.h"
+#include "be_component.h"
+#include "be_home.h"
+#include "be_module.h"
+#include "be_exception.h"
+#include "be_union.h"
+#include "be_structure.h"
+#include "be_enum.h"
+#include "be_operation.h"
+#include "be_factory.h"
+#include "be_root.h"
+#include "be_visitor.h"
+ACE_RCSID (be,
+ be_scope,
+ "$Id$")
// Default Constructor.
be_scope::be_scope (void)
@@ -43,10 +54,16 @@ be_scope::comma (void) const
be_decl *
be_scope::decl (void)
{
- switch (this->scope_node_type())
+ switch (this->scope_node_type ())
{
case AST_Decl::NT_interface:
return be_interface::narrow_from_scope (this);
+ case AST_Decl::NT_valuetype:
+ return be_valuetype::narrow_from_scope (this);
+ case AST_Decl::NT_component:
+ return be_component::narrow_from_scope (this);
+ case AST_Decl::NT_home:
+ return be_home::narrow_from_scope (this);
case AST_Decl::NT_module:
return be_module::narrow_from_scope (this);
case AST_Decl::NT_root:
@@ -71,18 +88,7 @@ be_scope::decl (void)
void
be_scope::destroy (void)
{
- for (UTL_ScopeActiveIterator iter (this, IK_decls);
- !iter.is_done ();
- iter.next ())
- {
- AST_Decl *i = iter.item ();
- i->destroy ();
- delete i;
- i = 0;
- }
- // Still some glitches, but the call should eventually
- // be made here.
- // UTL_Scope::destroy ();
+ UTL_Scope::destroy ();
}
int
diff --git a/TAO/TAO_IDL/be/be_sequence.cpp b/TAO/TAO_IDL/be/be_sequence.cpp
index a26d1ebd8f8..89b440663da 100644
--- a/TAO/TAO_IDL/be/be_sequence.cpp
+++ b/TAO/TAO_IDL/be/be_sequence.cpp
@@ -19,50 +19,54 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_sequence.h"
+#include "be_sequence.h"
+#include "be_typedef.h"
+#include "be_interface.h"
+#include "be_interface_fwd.h"
+#include "be_predefined_type.h"
+#include "be_visitor.h"
+#include "utl_identifier.h"
+#include "idl_defines.h"
-ACE_RCSID(be, be_sequence, "$Id$")
+ACE_RCSID (be,
+ be_sequence,
+ "$Id$")
be_sequence::be_sequence (void)
: mt_ (be_sequence::MNG_UNKNOWN)
{
// Always the case.
- this->size_type (be_decl::VARIABLE);
this->has_constructor (I_TRUE);
}
be_sequence::be_sequence (AST_Expression *v,
AST_Type *t,
+ UTL_ScopedName *n,
idl_bool local,
idl_bool abstract)
: be_scope (AST_Decl::NT_sequence),
be_type (AST_Decl::NT_sequence,
- 0),
+ n),
be_decl (AST_Decl::NT_sequence,
- 0),
+ n),
UTL_Scope (AST_Decl::NT_sequence),
AST_Sequence (v,
t,
+ n,
t->is_local () || local,
abstract),
AST_ConcreteType (AST_Decl::NT_sequence,
- 0),
+ n),
AST_Type (AST_Decl::NT_sequence,
- 0),
+ n),
AST_Decl (AST_Decl::NT_sequence,
- 0,
+ n,
I_TRUE),
COMMON_Base (t->is_local () || local,
abstract),
mt_ (be_sequence::MNG_UNKNOWN)
{
- // A sequence data type is always VARIABLE.
- this->size_type (be_decl::VARIABLE);
-
// Always the case.
this->has_constructor (I_TRUE);
}
@@ -135,7 +139,8 @@ be_sequence::gen_name (void)
ACE_OS::sprintf (ulval_str,
"_%lu",
this->max_size ()->ev ()->u.ulval);
- ACE_OS::strcat (namebuf, ulval_str);
+ ACE_OS::strcat (namebuf,
+ ulval_str);
}
return ACE_OS::strdup (namebuf);
@@ -228,28 +233,23 @@ be_sequence::managed_type (void)
switch (prim_type->node_type ())
{
case AST_Decl::NT_interface:
+ if (prim_type->is_abstract ())
+ {
+ this->mt_ = be_sequence::MNG_ABSTRACT;
+ }
+ else
+ {
+ this->mt_ = be_sequence::MNG_OBJREF;
+ }
+
+ break;
case AST_Decl::NT_interface_fwd:
- {
- int is_valuetype = 0;
- be_interface *bf = be_interface::narrow_from_decl (prim_type);
- if (bf != 0)
- is_valuetype = bf->is_valuetype ();
- else
- {
- be_interface_fwd *bff = be_interface_fwd::narrow_from_decl (prim_type);
- if (bff != 0)
- is_valuetype = bff->is_valuetype ();
- }
- if (is_valuetype)
- {
- this->mt_ = be_sequence::MNG_VALUE;
- }
- else
- {
this->mt_ = be_sequence::MNG_OBJREF;
- }
break;
- }
+ case AST_Decl::NT_valuetype:
+ case AST_Decl::NT_valuetype_fwd:
+ this->mt_ = be_sequence::MNG_VALUE;
+ break;
case AST_Decl::NT_string:
this->mt_ = be_sequence::MNG_STRING;
break;
@@ -260,20 +260,15 @@ be_sequence::managed_type (void)
{
be_predefined_type *bpd =
be_predefined_type::narrow_from_decl (prim_type);
+ AST_PredefinedType::PredefinedType pt = bpd->pt ();
- if (bpd->pt () == AST_PredefinedType::PT_pseudo)
+ if (pt == AST_PredefinedType::PT_pseudo)
{
- // If this pseudo is a CORBA::Object, then the managed type is
- // an objref.
- if (!ACE_OS::strcmp (bpd->local_name ()->get_string (),
- "Object"))
- {
- this->mt_ = be_sequence::MNG_OBJREF;
- }
- else
- {
- this->mt_ = be_sequence::MNG_PSEUDO;
- }
+ this->mt_ = be_sequence::MNG_PSEUDO;
+ }
+ else if (pt == AST_PredefinedType::PT_object)
+ {
+ this->mt_ = be_sequence::MNG_OBJREF;
}
else
{
@@ -367,6 +362,23 @@ be_sequence::instance_name ()
this->flat_name (),
this->max_size ()->ev ()->u.ulval);
}
+
+ break;
+ case be_sequence::MNG_ABSTRACT:
+ if (this->unbounded ())
+ {
+ ACE_OS::sprintf (namebuf,
+ "_TAO_Unbounded_Abstract_Sequence_%s",
+ this->flat_name ());
+ }
+ else
+ {
+ ACE_OS::sprintf (namebuf,
+ "_TAO_Bounded_Abstract_Sequence_%s_%lu",
+ this->flat_name (),
+ this->max_size ()->ev ()->u.ulval);
+ }
+
break;
case be_sequence::MNG_VALUE:
if (this->unbounded ())
@@ -382,6 +394,7 @@ be_sequence::instance_name ()
this->flat_name (),
this->max_size ()->ev ()->u.ulval);
}
+
break;
case be_sequence::MNG_STRING:
if (this->unbounded ())
@@ -395,6 +408,7 @@ be_sequence::instance_name ()
"_TAO_Bounded_String_Sequence_%s",
this->flat_name ());
}
+
break;
case be_sequence::MNG_WSTRING:
if (this->unbounded ())
@@ -408,6 +422,7 @@ be_sequence::instance_name ()
"_TAO_Bounded_WString_Sequence_%s",
this->flat_name ());
}
+
break;
default: // Not a managed type.
if (this->unbounded ())
@@ -437,6 +452,7 @@ be_sequence::instance_name ()
this->flat_name (),
this->max_size ()->ev ()->u.ulval);
}
+
break;
}
diff --git a/TAO/TAO_IDL/be/be_stream_factory.cpp b/TAO/TAO_IDL/be/be_stream_factory.cpp
index 9a4c6e2317d..ef327ecd30e 100644
--- a/TAO/TAO_IDL/be/be_stream_factory.cpp
+++ b/TAO/TAO_IDL/be/be_stream_factory.cpp
@@ -1,11 +1,11 @@
// $Id$
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_stream_factory.h"
#include "be_sunsoft.h"
-ACE_RCSID(be, be_factory, "$Id$")
+ACE_RCSID (be,
+ be_streamfactory,
+ "$Id$")
// Constructor.
TAO_OutStream_Factory::TAO_OutStream_Factory (void)
diff --git a/TAO/TAO_IDL/be/be_string.cpp b/TAO/TAO_IDL/be/be_string.cpp
index d2f5dff0608..f16196e015b 100644
--- a/TAO/TAO_IDL/be/be_string.cpp
+++ b/TAO/TAO_IDL/be/be_string.cpp
@@ -9,7 +9,7 @@
// be_string.cpp
//
// = DESCRIPTION
-// Extension of class AST_Array that provides additional means for C++
+// Extension of class AST_String that provides additional means for C++
// mapping.
//
// = AUTHOR
@@ -19,44 +19,34 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_string.h"
+#include "be_visitor.h"
+#include "utl_identifier.h"
-ACE_RCSID(be, be_string, "$Id$")
+ACE_RCSID (be,
+ be_string,
+ "$Id$")
be_string::be_string (void)
{
// Always the case.
- this->size_type (be_decl::VARIABLE);
+ this->size_type (AST_Type::VARIABLE);
}
-be_string::be_string (AST_Expression *v)
- : AST_String (v),
- AST_Decl (AST_Decl::NT_string,
- new UTL_ScopedName (new Identifier ("string"),
- 0),
+be_string::be_string (AST_Decl::NodeType nt,
+ UTL_ScopedName *n,
+ AST_Expression *v,
+ long width)
+ : AST_String (nt,
+ n,
+ v,
+ width),
+ AST_Decl (nt,
+ n,
I_TRUE)
{
// Always the case.
- this->size_type (be_decl::VARIABLE);
-}
-
-be_string::be_string (AST_Expression *v,
- long wide)
- : AST_String (v, wide),
- AST_Decl (wide == (long) sizeof (char)
- ? AST_Decl::NT_string
- : AST_Decl::NT_wstring,
- wide == (long) sizeof (char)
- ? new UTL_ScopedName (new Identifier ("string"),
- 0)
- : new UTL_ScopedName (new Identifier ("wstring"),
- 0),
- I_TRUE)
-{
- // Always the case.
- this->size_type (be_decl::VARIABLE);
+ this->size_type (AST_Type::VARIABLE);
}
// Overriden method.
@@ -90,6 +80,13 @@ be_string::accept (be_visitor *visitor)
return visitor->visit_string (this);
}
+void
+be_string::destroy (void)
+{
+ this->be_type::destroy ();
+ this->AST_String::destroy ();
+}
+
// Narrowing.
IMPL_NARROW_METHODS2 (be_string, AST_String, be_type)
IMPL_NARROW_FROM_DECL (be_string)
diff --git a/TAO/TAO_IDL/be/be_structure.cpp b/TAO/TAO_IDL/be/be_structure.cpp
index 02d193c2380..f4a41acbf30 100644
--- a/TAO/TAO_IDL/be/be_structure.cpp
+++ b/TAO/TAO_IDL/be/be_structure.cpp
@@ -19,11 +19,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-ACE_RCSID(be, be_structure, "$Id$")
+#include "be_structure.h"
+#include "be_codegen.h"
+#include "be_helper.h"
+#include "be_visitor.h"
+#include "be_extern.h"
+#include "ast_field.h"
+#include "utl_identifier.h"
+#include "idl_defines.h"
+
+ACE_RCSID (be,
+ be_structure,
+ "$Id$")
be_structure::be_structure (void)
{
@@ -44,8 +51,6 @@ be_structure::be_structure (UTL_ScopedName *n,
int
be_structure::gen_var_defn (char *)
{
- TAO_OutStream *ch = 0;
- TAO_NL be_nl;
char namebuf [NAMEBUFSIZE];
ACE_OS::memset (namebuf,
@@ -56,7 +61,7 @@ be_structure::gen_var_defn (char *)
"%s_var",
this->local_name ()->get_string ());
- ch = tao_cg->client_header ();
+ TAO_OutStream *ch = tao_cg->client_header ();
// Generate the var definition (always in the client header).
// Depending upon the data type, there are some differences which
@@ -78,7 +83,7 @@ be_structure::gen_var_defn (char *)
*ch << namebuf << " (const " << namebuf << " &);" << be_nl;
// Fixed-size types only.
- if (this->size_type () == be_decl::FIXED)
+ if (this->size_type () == AST_Type::FIXED)
{
*ch << "// Fixed-size types only." << be_nl;
*ch << namebuf << " (const " << this->local_name ()
@@ -97,7 +102,7 @@ be_structure::gen_var_defn (char *)
*ch << namebuf << " &operator= (const " << namebuf << " &);" << be_nl;
// Fixed-size types only.
- if (this->size_type () == be_decl::FIXED)
+ if (this->size_type () == AST_Type::FIXED)
{
*ch << "// Fixed-size types only." << be_nl;
*ch << namebuf << " &operator= (const " << this->local_name ()
@@ -115,7 +120,7 @@ be_structure::gen_var_defn (char *)
*ch << "operator " << this->local_name () << " &();" << be_nl;
*ch << "operator " << this->local_name () << " &() const;" << be_nl;
- if (this->size_type () == be_decl::VARIABLE)
+ if (this->size_type () == AST_Type::VARIABLE)
{
*ch << "// Variable-size types only." << be_nl;
*ch << "operator " << this->local_name ()
@@ -127,7 +132,7 @@ be_structure::gen_var_defn (char *)
// The return types of in, out, inout, and _retn are based on the
// parameter passing rules and the base type.
- if (this->size_type () == be_decl::FIXED)
+ if (this->size_type () == AST_Type::FIXED)
{
*ch << "const " << this->local_name () << " &in (void) const;" << be_nl;
*ch << this->local_name () << " &inout (void);" << be_nl;
@@ -220,7 +225,7 @@ be_structure::gen_var_impl (char *,
*ci << "}\n\n";
// Fixed-size types only.
- if (this->size_type () == be_decl::FIXED)
+ if (this->size_type () == AST_Type::FIXED)
{
*ci << "// fixed-size types only" << be_nl;
*ci << "ACE_INLINE" << be_nl;
@@ -288,7 +293,7 @@ be_structure::gen_var_impl (char *,
<< "}\n\n";
// Fixed-size types only.
- if (this->size_type () == be_decl::FIXED)
+ if (this->size_type () == AST_Type::FIXED)
{
ci->indent ();
*ci << "// fixed-size types only" << be_nl;
@@ -361,7 +366,7 @@ be_structure::gen_var_impl (char *,
*ci << "}\n\n";
// Variable-size types only.
- if (this->size_type () == be_decl::VARIABLE)
+ if (this->size_type () == AST_Type::VARIABLE)
{
ci->indent ();
*ci << "// variable-size types only" << be_nl;
@@ -396,7 +401,7 @@ be_structure::gen_var_impl (char *,
// The out is handled differently based on our size type.
ci->indent ();
- if (this->size_type () == be_decl::VARIABLE)
+ if (this->size_type () == AST_Type::VARIABLE)
{
*ci << "// mapping for variable size " << be_nl;
*ci << "ACE_INLINE " << "::" << this->name () << " *&" << be_nl;
@@ -651,41 +656,6 @@ be_structure::gen_out_impl (char *,
return 0;
}
-// Compute the size type of the node in question.
-int
-be_structure::compute_size_type (void)
-{
- for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- // Get the next AST decl node.
- AST_Decl *d = si.item ();
- be_decl *bd = be_decl::narrow_from_decl (d);
-
- if (bd != 0)
- {
- // Our sizetype depends on the sizetype of our
- // members. Although previous value of sizetype may get
- // overwritten, we are guaranteed by the "size_type" call
- // that once the value reached be_decl::VARIABLE, nothing
- // else can overwrite it.
- this->size_type (bd->size_type ());
-
- // While we're iterating, we might as well do this one too.
- this->has_constructor (bd->has_constructor ());
- }
- else
- {
- ACE_DEBUG ((LM_DEBUG,
- "WARNING (%N:%l) be_structure::compute_size_type - "
- "narrow_from_decl returned 0\n"));
- }
- }
-
- return 0;
-}
-
void
be_structure::destroy (void)
{
diff --git a/TAO/TAO_IDL/be/be_structure_fwd.cpp b/TAO/TAO_IDL/be/be_structure_fwd.cpp
new file mode 100644
index 00000000000..872eb2f094a
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_structure_fwd.cpp
@@ -0,0 +1,60 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_structure_fwd.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_StructureFwd that provides additional means for C++
+// mapping of a struct.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#include "be_structure_fwd.h"
+#include "be_visitor.h"
+
+ACE_RCSID (be,
+ be_structure_fwd,
+ "$Id$")
+
+be_structure_fwd::be_structure_fwd (void)
+{
+}
+
+be_structure_fwd::be_structure_fwd (UTL_ScopedName *n)
+ : be_type (AST_Decl::NT_struct_fwd,
+ n),
+ AST_StructureFwd (n),
+ AST_Type (AST_Decl::NT_struct_fwd,
+ n),
+ AST_Decl (AST_Decl::NT_struct_fwd,
+ n)
+{
+}
+
+be_structure_fwd::~be_structure_fwd (void)
+{
+}
+
+void
+be_structure_fwd::destroy (void)
+{
+ // Do nothing.
+}
+
+int
+be_structure_fwd::accept (be_visitor *visitor)
+{
+ return visitor->visit_structure_fwd (this);
+}
+
+// Narrowing
+IMPL_NARROW_METHODS2 (be_structure_fwd, AST_StructureFwd, be_type)
+IMPL_NARROW_FROM_DECL (be_structure_fwd)
diff --git a/TAO/TAO_IDL/be/be_sunsoft.cpp b/TAO/TAO_IDL/be/be_sunsoft.cpp
index 0364348c8ce..08f6588da15 100644
--- a/TAO/TAO_IDL/be/be_sunsoft.cpp
+++ b/TAO/TAO_IDL/be/be_sunsoft.cpp
@@ -1,11 +1,14 @@
// $Id$
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
#include "be_sunsoft.h"
+#include "ast_expression.h"
+#include "utl_identifier.h"
+#include "utl_idlist.h"
+#include "utl_string.h"
-ACE_RCSID(be, be_sunsoft, "$Id$")
+ACE_RCSID (be,
+ be_sunsoft,
+ "$Id$")
TAO_SunSoft_OutStream::TAO_SunSoft_OutStream (void)
: TAO_OutStream ()
@@ -168,6 +171,9 @@ TAO_SunSoft_OutStream::print (AST_Expression *expr)
case AST_Expression::EV_wstring:
this->TAO_OutStream::print ("L\"%s\"", ev->u.wstrval);
break;
+ case AST_Expression::EV_enum:
+ this->print (expr->n ());
+ break;
default:
break;
}
diff --git a/TAO/TAO_IDL/be/be_tmplinst.cpp b/TAO/TAO_IDL/be/be_tmplinst.cpp
index b288ffdb3c6..9a301cb332d 100644
--- a/TAO/TAO_IDL/be/be_tmplinst.cpp
+++ b/TAO/TAO_IDL/be/be_tmplinst.cpp
@@ -1,21 +1,26 @@
// $Id$
-#include "ace/ACE.h"
#include "be_visitor_typecode/typecode_defn.h"
#include "be_stream_factory.h"
#include "be_visitor_factory.h"
+#include "ace/Singleton.h"
+#include "ace/Synch.h"
+#include "ace/Unbounded_Queue.h"
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Singleton<TAO_CodeGen, ACE_SYNCH_RECURSIVE_MUTEX>;
template class ACE_Singleton<TAO_OutStream_Factory, ACE_SYNCH_RECURSIVE_MUTEX>;
-template class ACE_Singleton<TAO_Common_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX>;
-template class ACE_Singleton<TAO_Compiled_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX>;
+template class ACE_Singleton<TAO_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX>;
template class ACE_Node <be_interface *>;
template class ACE_Unbounded_Queue <be_interface *>;
template class ACE_Unbounded_Queue_Iterator <be_interface *>;
+template class ACE_Node <AST_Interface *>;
+template class ACE_Unbounded_Queue <AST_Interface *>;
+template class ACE_Unbounded_Queue_Iterator <AST_Interface *>;
+
template class ACE_Node<be_visitor_typecode_defn::QNode*>;
template class ACE_Unbounded_Queue<be_visitor_typecode_defn::QNode*>;
template class ACE_Unbounded_Queue_Iterator<be_visitor_typecode_defn::QNode*>;
@@ -28,13 +33,16 @@ template class ACE_Unbounded_Queue_Iterator <be_interface_fwd *>;
#pragma instantiate ACE_Singleton<TAO_CodeGen, ACE_SYNCH_RECURSIVE_MUTEX>
#pragma instantiate ACE_Singleton<TAO_OutStream_Factory, ACE_SYNCH_RECURSIVE_MUTEX>
-#pragma instantiate ACE_Singleton<TAO_Common_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX>
-#pragma instantiate ACE_Singleton<TAO_Compiled_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX>
+#pragma instantiate ACE_Singleton<TAO_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX>
#pragma instantiate ACE_Node <be_interface *>
#pragma instantiate ACE_Unbounded_Queue <be_interface *>
#pragma instantiate ACE_Unbounded_Queue_Iterator <be_interface *>
+#pragma instantiate ACE_Node <AST_Interface *>
+#pragma instantiate ACE_Unbounded_Queue <AST_Interface *>
+#pragma instantiate ACE_Unbounded_Queue_Iterator <AST_Interface *>
+
#pragma instantiate ACE_Node<be_visitor_typecode_defn::QNode*>
#pragma instantiate ACE_Unbounded_Queue<be_visitor_typecode_defn::QNode*>
#pragma instantiate ACE_Unbounded_Queue_Iterator<be_visitor_typecode_defn::QNode*>
diff --git a/TAO/TAO_IDL/be/be_type.cpp b/TAO/TAO_IDL/be/be_type.cpp
index 8e495d578a4..e6726ad85c3 100644
--- a/TAO/TAO_IDL/be/be_type.cpp
+++ b/TAO/TAO_IDL/be/be_type.cpp
@@ -19,15 +19,19 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_type.h"
+#include "be_scope.h"
+#include "be_visitor.h"
+#include "be_codegen.h"
+#include "utl_identifier.h"
+#include "idl_defines.h"
-ACE_RCSID(be, be_type, "$Id$")
+ACE_RCSID (be,
+ be_type,
+ "$Id$")
be_type::be_type (void)
- : tc_name_ (0),
- nested_type_name_ (0)
+ : tc_name_ (0)
{
}
@@ -39,8 +43,7 @@ be_type::be_type (AST_Decl::NodeType nt,
n),
AST_Decl (nt,
n),
- tc_name_ (0),
- nested_type_name_ (0)
+ tc_name_ (0)
{
}
@@ -126,29 +129,6 @@ be_type::tc_name (void)
return this->tc_name_;
}
-// This code works. However, whether we should generate the
-// ACE_NESTED_CLASS macro or not should be based on an option to the
-// compiler. The previous version generated a relative path.
-// This version always generates ACE_NESTED_CLASS, (leave ace/ACE.h and friends
-// do the porting)
-//
-// Caution: returns the same buffer pointer even if the contents may change
-// in the next call. (return std::string anyone?)
-//
-// Return the type name using the ACE_NESTED_CLASS macro
-
-const char *
-be_type::nested_type_name (be_decl *use_scope,
- const char *suffix,
- const char *prefix)
-{
- return nested_name (this->local_name()->get_string(),
- this->full_name(),
- use_scope,
- suffix,
- prefix);
-}
-
// This works for the "special" names generated for smart proxy
// classes. The form of these names is
// scope'TAO_'+flat_name+'_Smart_Proxy_Base'.
@@ -200,275 +180,6 @@ be_type::nested_sp_type_name (be_decl *use_scope,
prefix);
}
-// This is the real thing used by the two other methods above.
-const char *
-be_type::nested_name (const char* local_name,
- const char* full_name,
- be_decl *use_scope,
- const char *suffix,
- const char *prefix)
-{
- // Some compilers do not like generating a fully scoped name for a type that
- // was defined in the same enclosing scope in which it was defined. For such,
- // we emit a macro defined in the ACE library.
- //
-
- // The tricky part here is that it is not enough to check if the
- // typename we are using was defined in the current scope. But we
- // need to ensure that it was not defined in any of our ancestor
- // scopes as well. If that is the case, then we can generate a fully
- // scoped name for that type, else we use the ACE_NESTED_CLASS macro.
-
- // Thus we need some sort of relative name to be generated.
-
- if (this->nested_type_name_ == 0)
- {
- ACE_NEW_RETURN (this->nested_type_name_,
- char[NAMEBUFSIZE],
- 0);
- }
-
- // Our defining scope.
- be_decl *def_scope = 0;
-
- // Hold the fully scoped name.
- char def_name [NAMEBUFSIZE];
- char use_name [NAMEBUFSIZE];
-
- // These point to the prev, curr and next component in the scope.
- char *def_curr = def_name;
- char *def_next = 0;
- char *use_curr = use_name;
- char *use_next = 0;
-
- // How many chars to compare.
- int len_to_match = 0;
-
- // Initialize the buffers.
- ACE_OS::memset (this->nested_type_name_,
- '\0',
- NAMEBUFSIZE);
-
- ACE_OS::memset (def_name,
- '\0',
- NAMEBUFSIZE);
-
- ACE_OS::memset (use_name,
- '\0',
- NAMEBUFSIZE);
-
- // Traverse every component of the def_scope and use_scope beginning at the
- // root and proceeding towards the leaf trying to see if the components
- // match. Continue until there is a match and keep accumulating the path
- // traversed. This forms the first argument to the ACE_NESTED_CLASS
- // macro. Whenever there is no match, the remaining components of the
- // def_scope form the second argument.
-
- def_scope = this->defined_in ()
- ? be_scope::narrow_from_scope (this->defined_in ())->decl ()
- : 0;
-
- if (def_scope
- && def_scope->node_type () != AST_Decl::NT_root
- && use_scope)
- // If both scopes exist and that we are not in the root scope.
- {
- ACE_OS::strcpy (def_name,
- def_scope->full_name ());
-
- ACE_OS::strcpy (use_name,
- use_scope->full_name ());
-
- // Find the first occurrence of a :: and advance
- // the next pointers accordingly.
- def_next = ACE_OS::strstr (def_curr, "::");
- use_next = ACE_OS::strstr (use_curr, "::");
-
- // If the scopes are identical, don't supply them.
- if (ACE_OS::strcmp (def_name,
- use_name)
- == 0)
- {
- if (prefix != 0)
- {
- ACE_OS::strcat (this->nested_type_name_,
- prefix);
- }
-
- ACE_OS::strcat (this->nested_type_name_,
- local_name);
- if (suffix != 0)
- {
- ACE_OS::strcat (this->nested_type_name_,
- suffix);
- }
-
- return this->nested_type_name_;
- }
-
- if (def_next != 0)
- {
- len_to_match =
- ACE_OS::strlen (def_curr) - ACE_OS::strlen (def_next);
- }
- else
- {
- len_to_match = ACE_OS::strlen (def_curr);
- }
-
- if (use_next != 0)
- {
- int len =
- ACE_OS::strlen (use_curr) - ACE_OS::strlen (use_next);
-
- if (len > len_to_match)
- {
- len_to_match = len;
- }
- }
- else
- {
- int len = ACE_OS::strlen (use_curr);
-
- if (len > len_to_match)
- {
- len_to_match = len;
- }
- }
-
- if (ACE_OS::strncmp (def_curr,
- use_curr,
- len_to_match)
- == 0)
- {
- // Initial prefix matches i.e., they have a common root.
- // Start by initializing the macro.
- ACE_OS::sprintf (this->nested_type_name_,
- "ACE_NESTED_CLASS (");
-
- // Initialize the first argument.
- ACE_OS::strncat (this->nested_type_name_,
- def_curr,
- len_to_match);
-
- // Shift the current scopes to the next level.
- def_curr = (def_next ? (def_next + 2) : 0); // Skip the ::
- use_curr = (use_next ? (use_next + 2) : 0); // Skip the ::
-
- while (def_curr && use_curr)
- {
- // Find the first occurrence of a :: and advance the
- // next pointers accordingly.
- def_next = ACE_OS::strstr (def_curr, "::");
- use_next = ACE_OS::strstr (use_curr, "::");
-
- if (def_next != 0)
- {
- len_to_match =
- ACE_OS::strlen (def_curr) - ACE_OS::strlen (def_next);
- }
- else
- {
- len_to_match = ACE_OS::strlen (def_curr);
- }
-
- if (use_next != 0)
- {
- int len =
- ACE_OS::strlen (use_curr) - ACE_OS::strlen (use_next);
-
- if (len > len_to_match)
- {
- len_to_match = len;
- }
- }
- else
- {
- int len = ACE_OS::strlen (use_curr);
-
- if (len > len_to_match)
- {
- len_to_match = len;
- }
- }
-
- if (ACE_OS::strncmp (def_curr,
- use_curr,
- len_to_match)
- == 0)
- {
- // They have same prefix, append to arg1.
- ACE_OS::strcat (this->nested_type_name_,
- "::");
-
- ACE_OS::strncat (this->nested_type_name_,
- def_curr,
- len_to_match);
-
- def_curr = (def_next ? (def_next + 2) : 0); // Skip the ::
- use_curr = (use_next ? (use_next + 2) : 0); // Skip the ::
- }
- else
- {
- // No match. This is the end of the first argument. Get out
- // of the loop as no more comparisons are necessary.
- break;
- }
- }
-
- // Start the 2nd argument of the macro.
- ACE_OS::strcat (this->nested_type_name_, ", ");
-
- // Copy the remaining def_name (if any are left).
- if (def_curr != 0)
- {
- ACE_OS::strcat (this->nested_type_name_,
- def_curr);
-
- ACE_OS::strcat (this->nested_type_name_,
- "::");
- }
-
- // Append our local name.
- if (prefix != 0)
- {
- ACE_OS::strcat (this->nested_type_name_, prefix);
- }
-
- ACE_OS::strcat (this->nested_type_name_,
- local_name);
-
- if (suffix != 0)
- {
- ACE_OS::strcat (this->nested_type_name_,
- suffix);
- }
-
- ACE_OS::strcat (this->nested_type_name_,
- ")");
-
- return this->nested_type_name_;
- } // End of if the root prefixes match.
- }
-
- // Otherwise just emit our full_name.
- if (prefix != 0)
- {
- ACE_OS::strcat (this->nested_type_name_, prefix);
- }
-
- ACE_OS::strcat (this->nested_type_name_,
- full_name);
-
- if (suffix != 0)
- {
- ACE_OS::strcat (this->nested_type_name_,
- suffix);
- }
-
- return this->nested_type_name_;
-}
-
// *****************************
// CODE GENERATION
// *****************************
@@ -522,7 +233,7 @@ be_type::destroy (void)
if (this->nested_type_name_ != 0)
{
- delete this->nested_type_name_;
+ delete [] this->nested_type_name_;
this->nested_type_name_ = 0;
}
}
diff --git a/TAO/TAO_IDL/be/be_typedef.cpp b/TAO/TAO_IDL/be/be_typedef.cpp
index 85ab37e8eee..3a9a71562bf 100644
--- a/TAO/TAO_IDL/be/be_typedef.cpp
+++ b/TAO/TAO_IDL/be/be_typedef.cpp
@@ -19,9 +19,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_typedef.h"
+#include "be_visitor.h"
+#include "ace/Log_Msg.h"
ACE_RCSID (be,
be_typedef,
@@ -69,29 +69,6 @@ be_typedef::primitive_base_type (void)
return d;
}
-// Compute the size type of the node in question.
-int
-be_typedef::compute_size_type (void)
-{
- be_type *type = be_type::narrow_from_decl (this->base_type ());
-
- if (type == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_typedef::compute_size_type - "
- "bad base type\n"),
- -1);
- }
-
- // Our size type is the same as our type.
- this->size_type (type->size_type ());
-
- //While we're here, take care of has_constructor.
- this->has_constructor (type->has_constructor ());
-
- return 0;
-}
-
AST_Decl::NodeType
be_typedef::base_node_type (void) const
{
@@ -105,7 +82,8 @@ be_typedef::base_node_type (void) const
void
be_typedef::destroy (void)
{
- // Do nothing
+ this->AST_Typedef::destroy ();
+ this->be_type::destroy ();
}
int
diff --git a/TAO/TAO_IDL/be/be_union.cpp b/TAO/TAO_IDL/be/be_union.cpp
index d9a2d2461b1..4477c463d60 100644
--- a/TAO/TAO_IDL/be/be_union.cpp
+++ b/TAO/TAO_IDL/be/be_union.cpp
@@ -19,11 +19,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_union.h"
+#include "be_visitor.h"
+#include "be_codegen.h"
+#include "be_helper.h"
+#include "be_extern.h"
+#include "ast_union_branch.h"
+#include "utl_identifier.h"
+#include "idl_defines.h"
-ACE_RCSID(be, be_union, "$Id$")
+ACE_RCSID (be,
+ be_union,
+ "$Id$")
be_union::be_union (void)
@@ -58,8 +65,6 @@ be_union::be_union (AST_ConcreteType *dt,
int
be_union::gen_var_defn (char *)
{
- TAO_OutStream *ch = 0;
- TAO_NL be_nl;
char namebuf [NAMEBUFSIZE];
ACE_OS::memset (namebuf,
@@ -70,7 +75,7 @@ be_union::gen_var_defn (char *)
"%s_var",
this->local_name ()->get_string ());
- ch = tao_cg->client_header ();
+ TAO_OutStream *ch = tao_cg->client_header ();
// Generate the var definition (always in the client header).
// Depending upon the data type, there are some differences which we account
@@ -92,7 +97,7 @@ be_union::gen_var_defn (char *)
<< " &);" << be_nl;
// Fixed-size types only.
- if (this->size_type () == be_decl::FIXED)
+ if (this->size_type () == AST_Type::FIXED)
{
*ch << namebuf << " (const " << this->local_name ()
<< " &); // fixed-size types only" << be_nl;
@@ -110,7 +115,7 @@ be_union::gen_var_defn (char *)
*ch << namebuf << " &operator= (const " << namebuf << " &);" << be_nl;
// Fixed-size types only.
- if (this->size_type () == be_decl::FIXED)
+ if (this->size_type () == AST_Type::FIXED)
{
*ch << namebuf << " &operator= (const " << this->local_name ()
<< " &); // fixed-size types only" << be_nl;
@@ -127,7 +132,7 @@ be_union::gen_var_defn (char *)
*ch << "operator " << this->local_name () << " &();" << be_nl;
*ch << "operator " << this->local_name () << " &() const;" << be_nl;
- if (this->size_type () == be_decl::VARIABLE)
+ if (this->size_type () == AST_Type::VARIABLE)
{
*ch << " // Variable size types only." << be_nl;
*ch << "operator " << this->local_name ()
@@ -139,7 +144,7 @@ be_union::gen_var_defn (char *)
// The return types of in, out, inout, and _retn are based on the parameter
// passing rules and the base type.
- if (this->size_type () == be_decl::FIXED)
+ if (this->size_type () == AST_Type::FIXED)
{
*ch << "const " << local_name () << " &in (void) const;" << be_nl;
*ch << this->local_name () << " &inout (void);" << be_nl;
@@ -237,7 +242,7 @@ be_union::gen_var_impl (char *,
*ci << "}\n\n";
// Fixed-size types only.
- if (this->size_type () == be_decl::FIXED)
+ if (this->size_type () == AST_Type::FIXED)
{
*ci << "// fixed-size types only" << be_nl;
*ci << "ACE_INLINE" << be_nl;
@@ -305,7 +310,7 @@ be_union::gen_var_impl (char *,
<< "}\n\n";
// Fixed-size types only.
- if (this->size_type () == be_decl::FIXED)
+ if (this->size_type () == AST_Type::FIXED)
{
ci->indent ();
*ci << "// fixed-size types only" << be_nl;
@@ -378,7 +383,7 @@ be_union::gen_var_impl (char *,
*ci << "}\n\n";
// Variable-size types only.
- if (this->size_type () == be_decl::VARIABLE)
+ if (this->size_type () == AST_Type::VARIABLE)
{
ci->indent ();
*ci << "// variable-size types only" << be_nl;
@@ -413,7 +418,7 @@ be_union::gen_var_impl (char *,
// The out and _retn are handled differently based on our size type.
ci->indent ();
- if (this->size_type () == be_decl::VARIABLE)
+ if (this->size_type () == AST_Type::VARIABLE)
{
*ci << "// mapping for variable size " << be_nl;
*ci << "ACE_INLINE ::" << this->name () << " *&" << be_nl;
@@ -671,37 +676,6 @@ be_union::gen_out_impl (char *,
return 0;
}
-// Compute the size type of the node in question.
-int
-be_union::compute_size_type (void)
-{
- for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- // Get the next AST decl node.
- AST_Decl *d = si.item ();
- be_decl *bd = be_decl::narrow_from_decl (d);
-
- if (bd != 0)
- {
- // Our sizetype depends on the sizetype of our members. Although
- // previous value of sizetype may get overwritten, we are
- // guaranteed by the "size_type" call that once the value reached
- // be_decl::VARIABLE, nothing else can overwrite it.
- this->size_type (bd->size_type ());
- }
- else
- {
- ACE_DEBUG ((LM_DEBUG,
- "WARNING (%N:%l) be_union::compute_size_type - "
- "narrow_from_decl returned 0\n"));
- }
- }
-
- return 0;
-}
-
idl_bool
be_union::has_duplicate_case_labels (void)
{
diff --git a/TAO/TAO_IDL/be/be_union_branch.cpp b/TAO/TAO_IDL/be/be_union_branch.cpp
index 71c9cc6e445..9e5a934b76b 100644
--- a/TAO/TAO_IDL/be/be_union_branch.cpp
+++ b/TAO/TAO_IDL/be/be_union_branch.cpp
@@ -19,11 +19,17 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-ACE_RCSID(be, be_union_branch, "$Id$")
+#include "be_union_branch.h"
+#include "be_union.h"
+#include "be_type.h"
+#include "be_enum.h"
+#include "be_visitor.h"
+#include "be_helper.h"
+#include "ast_union_label.h"
+
+ACE_RCSID (be,
+ be_union_branch,
+ "$Id$")
be_union_branch::be_union_branch (void)
{
@@ -45,27 +51,6 @@ be_union_branch::be_union_branch (UTL_LabelList *ll,
{
}
-// Compute the size type of the node in question.
-int
-be_union_branch::compute_size_type (void)
-{
- be_type *type = be_type::narrow_from_decl (this->field_type ());
-
- if (type == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_field::compute_size_type - "
- "bad field type\n"),
- -1);
- }
-
- // Our size type is the same as our type.
- // As a side effect will also update the size type of parent.
- this->size_type (type->size_type ());
-
- return 0;
-}
-
int
be_union_branch::gen_label_value (TAO_OutStream *os, unsigned long index)
{
@@ -161,7 +146,7 @@ be_union_branch::gen_default_label_value (TAO_OutStream *os,
case AST_Expression::EV_bool:
*os << dv.u.bool_val;
break;
- case AST_Expression::EV_any:
+ case AST_Expression::EV_enum:
// The discriminant is an enum. Some compilers will
// not accept a numeric value assigned to this
// discriminant, so we must generate the string name.
diff --git a/TAO/TAO_IDL/be/be_union_fwd.cpp b/TAO/TAO_IDL/be/be_union_fwd.cpp
new file mode 100644
index 00000000000..0bdcf6ac257
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_union_fwd.cpp
@@ -0,0 +1,60 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_union_fwd.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_UnionFwd that provides additional means for C++
+// mapping of a union.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#include "be_union_fwd.h"
+#include "be_visitor.h"
+
+ACE_RCSID (be,
+ be_union_fwd,
+ "$Id$")
+
+be_union_fwd::be_union_fwd (void)
+{
+}
+
+be_union_fwd::be_union_fwd (UTL_ScopedName *n)
+ : be_type (AST_Decl::NT_union_fwd,
+ n),
+ AST_UnionFwd (n),
+ AST_Type (AST_Decl::NT_union_fwd,
+ n),
+ AST_Decl (AST_Decl::NT_union_fwd,
+ n)
+{
+}
+
+be_union_fwd::~be_union_fwd (void)
+{
+}
+
+void
+be_union_fwd::destroy (void)
+{
+ // Do nothing.
+}
+
+int
+be_union_fwd::accept (be_visitor *visitor)
+{
+ return visitor->visit_union_fwd (this);
+}
+
+// Narrowing
+IMPL_NARROW_METHODS2 (be_union_fwd, AST_UnionFwd, be_type)
+IMPL_NARROW_FROM_DECL (be_union_fwd)
diff --git a/TAO/TAO_IDL/be/be_union_label.cpp b/TAO/TAO_IDL/be/be_union_label.cpp
index ff9ee596a3c..a6889166db1 100644
--- a/TAO/TAO_IDL/be/be_union_label.cpp
+++ b/TAO/TAO_IDL/be/be_union_label.cpp
@@ -1,17 +1,20 @@
//
// $Id$
//
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-ACE_RCSID(be, be_union_label, "$Id$")
+#include "be_union_label.h"
+#include "be_visitor.h"
-be_union_label::be_union_label()
+ACE_RCSID (be,
+ be_union_label,
+ "$Id$")
+
+be_union_label::be_union_label (void)
{
}
+
be_union_label::be_union_label (AST_UnionLabel::UnionLabel ul,
- AST_Expression *v)
+ AST_Expression *v)
: AST_UnionLabel (ul,
v)
{
diff --git a/TAO/TAO_IDL/be/be_valuetype.cpp b/TAO/TAO_IDL/be/be_valuetype.cpp
index 279a4c2ae13..112b060e3e6 100644
--- a/TAO/TAO_IDL/be/be_valuetype.cpp
+++ b/TAO/TAO_IDL/be/be_valuetype.cpp
@@ -19,18 +19,24 @@
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-ACE_RCSID(be, be_valuetype, "$Id$")
+#include "be_valuetype.h"
+#include "be_visitor.h"
+#include "be_extern.h"
+#include "be_helper.h"
+#include "ast_module.h"
+#include "idl_defines.h"
+#include "nr_extern.h"
+
+ACE_RCSID (be,
+ be_valuetype,
+ "$Id$")
// Default constructor.
be_valuetype::be_valuetype (void)
: full_obv_skel_name_ (0)
{
// Always the case.
- this->size_type (be_decl::VARIABLE);
+ this->size_type (AST_Type::VARIABLE);
AST_Module *m = AST_Module::narrow_from_scope (this->defined_in ());
@@ -41,41 +47,57 @@ be_valuetype::be_valuetype (void)
// Always the case.
this->has_constructor (I_TRUE);
-
- // Set the base (AST_Interface) class member.
- this->set_valuetype ();
}
// Constructor used to build the AST.
be_valuetype::be_valuetype (UTL_ScopedName *n,
- AST_Interface **ih,
- long nih,
- idl_bool set_abstract)
+ AST_Interface **inherits,
+ long n_inherits,
+ AST_ValueType *inherits_concrete,
+ AST_Interface **inherits_flat,
+ long n_inherits_flat,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface *supports_concrete,
+ idl_bool abstract,
+ idl_bool truncatable)
: be_interface (n,
- ih,
- nih,
- 0,
+ inherits,
+ n_inherits,
+ inherits_flat,
+ n_inherits_flat,
0,
- 0,
- set_abstract),
+ abstract),
+ AST_ValueType (n,
+ inherits,
+ n_inherits,
+ inherits_concrete,
+ inherits_flat,
+ n_inherits_flat,
+ supports,
+ n_supports,
+ supports_concrete,
+ abstract,
+ truncatable),
AST_Interface (n,
- ih,
- nih,
- 0,
- 0,
+ inherits,
+ n_inherits,
+ inherits_flat,
+ n_inherits_flat,
0,
- set_abstract),
- AST_Decl (AST_Decl::NT_interface, // It's like an interface.
+ abstract),
+ AST_Decl (AST_Decl::NT_valuetype,
n),
- UTL_Scope (AST_Decl::NT_interface),
+ UTL_Scope (AST_Decl::NT_valuetype),
COMMON_Base (0,
- set_abstract),
- full_obv_skel_name_ (0)
+ abstract),
+ full_obv_skel_name_ (0),
+ supports_abstract_ (0)
{
// Check that redefine() copies all members.
// Always the case.
- this->size_type (be_decl::VARIABLE);
+ this->size_type (AST_Type::VARIABLE);
AST_Module *m = AST_Module::narrow_from_scope (this->defined_in ());
@@ -87,21 +109,24 @@ be_valuetype::be_valuetype (UTL_ScopedName *n,
// Always the case.
this->has_constructor (I_TRUE);
- // Set the base (AST_Interface) class member.
- this->set_valuetype ();
+ for (long i = 0; i < this->pd_n_supports; ++i)
+ {
+ if (this->pd_supports[i]->is_abstract ())
+ {
+ this->supports_abstract_ = I_TRUE;
+ break;
+ }
+ }
}
be_valuetype::~be_valuetype (void)
{
-
}
void
-be_valuetype::redefine (AST_Interface *from)
+be_valuetype::redefine (AST_ValueType *from)
{
- this->AST_Interface::redefine (from);
-
- this->is_abstract_ = from->is_abstract_valuetype ();
+ this->AST_ValueType::redefine (from);
}
// Is true if non-virtual accessor and modifier should be generated
@@ -134,48 +159,53 @@ be_valuetype::full_obv_skel_name (void)
// Generate the var definition.
int
-be_valuetype::gen_var_defn (char *)
+be_valuetype::gen_var_defn (char *local_name)
{
- TAO_OutStream *ch = 0;
- TAO_NL be_nl;
char namebuf [NAMEBUFSIZE];
+ if (local_name == 0)
+ {
+ local_name = (char *) this->local_name ();
+ }
+
ACE_OS::memset (namebuf,
'\0',
NAMEBUFSIZE);
ACE_OS::sprintf (namebuf,
"%s_var",
- this->local_name ());
+ local_name);
- ch = tao_cg->client_header ();
+ TAO_OutStream *ch = tao_cg->client_header ();
+
+ *ch << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
// Generate the var definition (always in the client header).
// Depending upon the data type, there are some differences which we account
// for over here.
- // Start with whatever was our current indent level.
*ch << "class " << be_global->stub_export_macro ()
<< " " << namebuf << be_nl;
*ch << "{" << be_nl;
*ch << "public:" << be_idt_nl;
// Default constructor.
- *ch << namebuf << " (void); // default constructor" << be_nl;
- *ch << namebuf << " (" << this->local_name () << "*);" << be_nl;
- *ch << namebuf << " (const " << this->local_name ()
+ *ch << namebuf << " (void);" << be_nl;
+ *ch << namebuf << " (" << local_name << "*);" << be_nl;
+ *ch << namebuf << " (const " << local_name
<< "*); // (TAO extension)" << be_nl;
// Copy constructor.
*ch << namebuf << " (const " << namebuf <<
- " &); // copy constructor" << be_nl;
+ " &);" << be_nl;
// Destructor.
- *ch << "~" << namebuf << " (void); // destructor" << be_nl;
+ *ch << "~" << namebuf << " (void);" << be_nl;
*ch << be_nl;
// Assignment operator from a pointer.
- *ch << namebuf << " &operator= (" << this->local_name ()
+ *ch << namebuf << " &operator= (" << local_name
<< "*);" << be_nl;
// Assignment from _var.
@@ -183,32 +213,38 @@ be_valuetype::gen_var_defn (char *)
" &);" << be_nl;
// Arrow operator.
- *ch << local_name () << "* operator-> (void) const;" << be_nl;
+ *ch << local_name << "* operator-> (void) const;" << be_nl;
*ch << be_nl;
// Other extra types (cast operators, [] operator, and others).
- *ch << "operator const " << this->local_name ()
+ *ch << "operator const " << local_name
<< "* () const;" << be_nl;
- *ch << "operator " << this->local_name () << "* ();" << be_nl;
+ *ch << "operator " << local_name << "* ();" << be_nl;
*ch << "// 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.
- *ch << this->local_name () << "* in (void) const;" << be_nl;
- *ch << this->local_name () << "* &inout (void);" << be_nl;
- *ch << this->local_name () << "* &out (void);" << be_nl;
- *ch << this->local_name () << "* _retn (void);" << be_nl;
+ *ch << local_name << "* in (void) const;" << be_nl;
+ *ch << local_name << "*& inout (void);" << be_nl;
+ *ch << local_name << "*& out (void);" << be_nl;
+ *ch << local_name << "* _retn (void);" << be_nl;
// Generate an additional member function that returns
// the underlying pointer.
- *ch << this->local_name () << "* ptr (void) const;";
+ *ch << local_name << "* ptr (void) const;" << be_nl << be_nl;
- *ch << be_uidt_nl << be_nl;
+ // Hooks for non-defined forward declared interfaces.
+ *ch << "// Hooks used by template sequence and valuetype manager classes"
+ << be_nl
+ << "// for non-defined forward declared valuetypes." << be_nl
+ << "static void tao_add_ref (" << local_name << " *);" << be_nl
+ << "static void tao_remove_ref (" << local_name << " *);"
+ << be_uidt_nl << be_nl;
// Private.
*ch << "private:" << be_idt_nl;
- *ch << this->local_name () << "* ptr_;" << be_uidt_nl;
+ *ch << local_name << "* ptr_;" << be_uidt_nl;
*ch << "};" << be_nl << be_nl;
@@ -218,12 +254,21 @@ be_valuetype::gen_var_defn (char *)
// Implementation of the _var class. All of these get generated in the stubs
// file.
int
-be_valuetype::gen_var_impl (char *,
- char *)
+be_valuetype::gen_var_impl (char *local_name,
+ char *full_name)
{
TAO_OutStream *cs = 0;
TAO_NL be_nl;
+ // Decide on the names to use.
+ // Even if one argument is 0, there is no point using the
+ // arguments. Let us then use the name in this node.
+ if (local_name == 0 || full_name == 0)
+ {
+ local_name = (char *) this->local_name ();
+ full_name = (char *) this->full_name ();
+ }
+
// To hold the full and local _var names.
char fname [NAMEBUFSIZE];
char lname [NAMEBUFSIZE];
@@ -234,7 +279,7 @@ be_valuetype::gen_var_impl (char *,
ACE_OS::sprintf (fname,
"%s_var",
- this->full_name ());
+ full_name);
ACE_OS::memset (lname,
'\0',
@@ -242,7 +287,7 @@ be_valuetype::gen_var_impl (char *,
ACE_OS::sprintf (lname,
"%s_var",
- this->local_name ());
+ local_name);
cs = tao_cg->client_stubs ();
@@ -250,170 +295,176 @@ be_valuetype::gen_var_impl (char *,
// Depending upon the data type, there are some differences which we account
// for over here.
- cs->indent (); // start with whatever was our current indent level
+ *cs << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
*cs << "// *************************************************************"
<< be_nl;
*cs << "// Operations for class " << fname << be_nl;
- *cs << "// *************************************************************\n\n";
+ *cs << "// *************************************************************"
+ << be_nl << be_nl;
// Default constructor.
*cs << fname << "::" << lname <<
- " (void) // default constructor" << be_nl;
+ " (void)" << be_nl;
*cs << " " << ": ptr_ (0)" << be_nl;
- *cs << "{}\n\n";
+ *cs << "{}" << be_nl << be_nl;
// Constructor from a pointer.
- cs->indent ();
*cs << fname << "::" << lname << " ("
- << this->local_name () << "* p)" << be_nl;
+ << local_name << "* p)" << be_nl;
*cs << " : ptr_ (p)" << be_nl;
- *cs << "{}\n\n";
+ *cs << "{}" << be_nl << be_nl;
// Constructor from a const pointer.
// TAO extension - it appears that there are problems with at least g++
// which reclaims amguity between T(T*) and T(const T_var &)
- cs->indent ();
*cs << fname << "::" << lname << " (const "
- << this->local_name () << "* p)" << be_nl;
- *cs << " : ptr_ (ACE_const_cast("
- << this->local_name () << "*, p))" << be_nl;
- *cs << "{}\n\n";
+ << local_name << "* p)" << be_nl;
+ *cs << " : ptr_ (ACE_const_cast ("
+ << local_name << " *, p))" << be_nl;
+ *cs << "{}" << be_nl << be_nl;
// The additional ptr () member function. This member function must be
// defined before the remaining member functions including the copy
// constructor because this inline function is used elsewhere. Hence to make
// inlining of this function possible, we must define it before its use.
- cs->indent ();
- *cs << this->name () << "* " << be_nl;
+ *cs << full_name << " *" << be_nl;
*cs << fname << "::ptr (void) const" << be_nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "return this->ptr_;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
+ *cs << "{" << be_idt_nl;
+
+ *cs << "return this->ptr_;" << be_uidt_nl;
+
+ *cs << "}" << be_nl << be_nl;
// Copy constructor.
- cs->indent ();
*cs << fname << "::" << lname << " (const " << lname <<
- " &p) // copy constructor" << be_nl;
+ " &p)" << be_nl;
*cs << "{" << be_idt_nl
<< "CORBA::add_ref (p.ptr ());" << be_nl
<< "this->ptr_ = p.ptr ();" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
// Destructor.
- cs->indent ();
*cs << fname << "::~" << lname << " (void) // destructor" << be_nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "CORBA::remove_ref (this->ptr_);\n";
- cs->decr_indent ();
- *cs << "}\n\n";
+ *cs << "{" << be_idt_nl;
+
+ *cs << "CORBA::remove_ref (this->ptr_);" << be_uidt_nl;
+
+ *cs << "}" << be_nl << be_nl;
// Assignment operator.
- cs->indent ();
*cs << fname << " &" << be_nl;
- *cs << fname << "::operator= (" << this->local_name ()
- << "* p)" << be_nl;
- *cs << "{\n";
- cs->incr_indent ();
+ *cs << fname << "::operator= (" << local_name
+ << " *p)" << be_nl;
+ *cs << "{" << be_idt_nl;
+
*cs << "CORBA::remove_ref (this->ptr_);" << be_nl;
*cs << "this->ptr_ = p;" << be_nl;
- *cs << "return *this;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
+ *cs << "return *this;" << be_uidt_nl;
+
+ *cs << "}" << be_nl << be_nl;
// Assignment operator from _var.
- cs->indent ();
*cs << fname << " &" << be_nl;
*cs << fname << "::operator= (const " << lname
<< " &p)" << be_nl;
- *cs << "{\n";
- cs->incr_indent ();
+ *cs << "{" << be_idt_nl;
+
*cs << "if (this != &p)" << be_nl;
- *cs << "{\n";
- cs->incr_indent ();
+ *cs << "{" << be_idt_nl;
+
*cs << "CORBA::remove_ref (this->ptr_);" << be_nl
- << this->local_name() << "* tmp = p.ptr ();" << be_nl
+ << local_name << " *tmp = p.ptr ();" << be_nl
<< "CORBA::add_ref (tmp);" << be_nl
- << "this->ptr_ = tmp;\n";
- cs->decr_indent ();
- *cs << "}" << be_nl;
- *cs << "return *this;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
+ << "this->ptr_ = tmp;" << be_uidt_nl;
+
+ *cs << "}" << be_nl << be_nl;
+ *cs << "return *this;" << be_uidt_nl;
+
+ *cs << "}" << be_nl << be_nl;
// Other extra methods - cast operator ().
- cs->indent ();
- *cs << fname << "::operator const " << this->name ()
+ *cs << fname << "::operator const " << full_name
<< "* () const // cast" << be_nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "return this->ptr_;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
+ *cs << "{" << be_idt_nl;
- cs->indent ();
- *cs << fname << "::operator " << this->name ()
+ *cs << "return this->ptr_;" << be_uidt_nl;
+
+ *cs << "}" << be_nl << be_nl;
+
+ *cs << fname << "::operator " << full_name
<< "* () // cast " << be_nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "return this->ptr_;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
+ *cs << "{" << be_idt_nl;
+
+ *cs << "return this->ptr_;" << be_uidt_nl;
+
+ *cs << "}" << be_nl << be_nl;
// operator->
- cs->indent ();
- *cs << this->name () << "* " << be_nl;
+ *cs << full_name << " *" << be_nl;
*cs << fname << "::operator-> (void) const" << be_nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "return this->ptr_;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
+ *cs << "{" << be_idt_nl;
+
+ *cs << "return this->ptr_;" << be_uidt_nl;
+
+ *cs << "}" << be_nl << be_nl;
// in, inout, out, and _retn.
- cs->indent ();
- *cs << this->name () << "*" << be_nl;
+ *cs << full_name << " *" << be_nl;
*cs << fname << "::in (void) const" << be_nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "return this->ptr_;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
-
- cs->indent ();
- *cs << this->name () << "* &" << be_nl;
+ *cs << "{" << be_idt_nl;
+
+ *cs << "return this->ptr_;" << be_uidt_nl;
+
+ *cs << "}" << be_nl << be_nl;
+
+ *cs << full_name << " *&" << be_nl;
*cs << fname << "::inout (void)" << be_nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "return this->ptr_;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
-
- cs->indent ();
- *cs << this->name () << "* &" << be_nl;
+ *cs << "{" << be_idt_nl;
+
+ *cs << "return this->ptr_;" << be_uidt_nl;
+
+ *cs << "}" << be_nl << be_nl;
+
+ *cs << full_name << " *&" << be_nl;
*cs << fname << "::out (void)" << be_nl;
- *cs << "{\n";
- cs->incr_indent ();
+ *cs << "{" << be_idt_nl;
+
*cs << "CORBA::remove_ref (this->ptr_);" << be_nl;
*cs << "this->ptr_ = 0;" << be_nl;
- *cs << "return this->ptr_;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
+ *cs << "return this->ptr_;" << be_uidt_nl;
+
+ *cs << "}" << be_nl << be_nl;
- cs->indent ();
- *cs << this->name () << "* " << be_nl;
+ *cs << full_name << " *" << be_nl;
*cs << fname << "::_retn (void)" << be_nl;
- *cs << "{\n";
- cs->incr_indent ();
+ *cs << "{" << be_idt_nl;
+
*cs << "// yield ownership of managed obj reference" << be_nl;
- *cs << this->local_name () << "* tmp = this->ptr_;" << be_nl;
+ *cs << local_name << "* tmp = this->ptr_;" << be_nl;
*cs << "this->ptr_ = 0;" << be_nl;
- *cs << "return tmp;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
+ *cs << "return tmp;" << be_uidt_nl;
+ *cs << "}" << be_nl << be_nl;
+
+ // Hooks for the flat name global functions used by references to
+ // non-defined valuetypes.
+ *cs << "void" << be_nl
+ << fname << "::tao_add_ref (" << be_idt << be_idt_nl
+ << local_name << " *p" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "CORBA::add_ref (p);"
+ << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *cs << "void" << be_nl
+ << fname << "::tao_remove_ref (" << be_idt << be_idt_nl
+ << local_name << " *p" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "CORBA::remove_ref (p);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
return 0;
}
@@ -436,6 +487,9 @@ be_valuetype::gen_out_defn (char *)
ch = tao_cg->client_header ();
+ *ch << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Generate the out definition (always in the client header).
*ch << "class " << be_global->stub_export_macro ()
@@ -466,10 +520,10 @@ be_valuetype::gen_out_defn (char *)
<< "*);" << be_nl;
// Cast.
- *ch << "operator " << this->local_name () << "* &();" << be_nl;
+ *ch << "operator " << this->local_name () << "*& ();" << be_nl;
// ptr function.
- *ch << this->local_name () << "* &ptr (void);" << be_nl;
+ *ch << this->local_name () << "*& ptr (void);" << be_nl;
// operator ->
*ch << this->local_name () << "* operator-> (void);" << be_nl;
@@ -511,144 +565,142 @@ be_valuetype::gen_out_impl (char *,
cs = tao_cg->client_stubs ();
+ *cs << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Generate the var implementation in the inline file
// Depending upon the data type, there are some differences which we account
// for over here.
- // Start with whatever was our current indent level.
- cs->indent ();
-
*cs << "// *************************************************************"
<< be_nl;
*cs << "// Operations for class " << fname << be_nl;
- *cs << "// *************************************************************\n\n";
+ *cs << "// *************************************************************"
+ << be_nl << be_nl;
// Constructor from a pointer.
- cs->indent ();
*cs << fname << "::" << lname << " (" << this->local_name ()
- << "* &p)" << be_nl;
+ << " *&p)" << be_nl;
*cs << " : ptr_ (p)" << be_nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "this->ptr_ = 0;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
+ *cs << "{" << be_idt_nl;
+
+ *cs << "this->ptr_ = 0;" << be_uidt_nl;
+
+ *cs << "}" << be_nl << be_nl;
// Constructor from _var &.
- cs->indent ();
*cs << fname << "::" << lname << " (" << this->local_name ()
- << "_var &p) // constructor from _var" << be_nl;
+ << "_var &p)" << be_nl;
*cs << " : ptr_ (p.out ())" << be_nl;
- *cs << "{\n";
- cs->incr_indent ();
+ *cs << "{" << be_idt_nl;
+
*cs << "CORBA::remove_ref (this->ptr_);" << be_nl;
- *cs << "this->ptr_ = 0;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
+ *cs << "this->ptr_ = 0;" << be_uidt_nl;
+
+ *cs << "}" << be_nl << be_nl;
// Copy constructor.
- cs->indent ();
*cs << fname << "::" << lname << " (const " << lname
- << " &p) // copy constructor" << be_nl;
- *cs << " : ptr_ (ACE_const_cast (" << lname << "&,p).ptr_)" << be_nl;
- *cs << "{}\n\n";
+ << " &p)" << be_nl;
+ *cs << " : ptr_ (ACE_const_cast (" << lname << "&, p).ptr_)" << be_nl;
+ *cs << "{}" << be_nl << be_nl;
// Assignment operator from _out &.
- cs->indent ();
*cs << fname << " &" << be_nl;
*cs << fname << "::operator= (const " << lname <<
" &p)" << be_nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "this->ptr_ = ACE_const_cast (" << lname << "&,p).ptr_;" << be_nl;
- *cs << "return *this;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
+ *cs << "{" << be_idt_nl;
+
+ *cs << "this->ptr_ = ACE_const_cast (" << lname << "&, p).ptr_;" << be_nl;
+ *cs << "return *this;" << be_uidt_nl;
+
+ *cs << "}" << be_nl << be_nl;
// Assignment operator from _var.
- cs->indent ();
*cs << fname << " &" << be_nl;
*cs << fname << "::operator= (const " << this->local_name ()
<< "_var &p)" << be_nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << this->local_name () << "* tmp = p.ptr ();" << be_nl
+ *cs << "{" << be_idt_nl;
+
+ *cs << this->local_name () << " *tmp = p.ptr ();" << be_nl
<< "CORBA::add_ref (tmp);" << be_nl
<< "this->ptr_ = tmp;" << be_nl;
- *cs << "return *this;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
+ *cs << "return *this;" << be_uidt_nl;
+
+ *cs << "}" << be_nl << be_nl;
// Assignment operator from *.
- cs->indent ();
*cs << fname << " &" << be_nl;
*cs << fname << "::operator= (" << this->local_name ()
- << "* p)" << be_nl;
- *cs << "{\n";
- cs->incr_indent ();
+ << " *p)" << be_nl;
+ *cs << "{" << be_idt_nl;
+
*cs << "this->ptr_ = p;" << be_nl;
- *cs << "return *this;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
+ *cs << "return *this;" << be_uidt_nl;
+
+ *cs << "}" << be_nl << be_nl;
// Other extra methods - cast operator ().
- cs->indent ();
*cs << fname << "::operator " << this->name ()
- << "* &() // cast" << be_nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "return this->ptr_;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
+ << "*& () // cast" << be_nl;
+ *cs << "{" << be_idt_nl;
+ *cs << "return this->ptr_;" << be_uidt_nl;
+
+ *cs << "}" << be_nl << be_nl;
// ptr function.
- cs->indent ();
- *cs << this->name () << "* &" << be_nl;
+ *cs << this->name () << " *&" << be_nl;
*cs << fname << "::ptr (void) // ptr" << be_nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "return this->ptr_;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
+ *cs << "{" << be_idt_nl;
+ *cs << "return this->ptr_;" << be_uidt_nl;
+
+ *cs << "}" << be_nl << be_nl;
// operator->
- cs->indent ();
- *cs << this->name () << "* " << be_nl;
+ *cs << this->name () << " *" << be_nl;
*cs << fname << "::operator-> (void)" << be_nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "return this->ptr_;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
+ *cs << "{" << be_idt_nl;
+
+ *cs << "return this->ptr_;" << be_uidt_nl;
+
+ *cs << "}" << be_nl << be_nl;
+
+ *cs << "// *************************************************************"
+ << be_nl << be_nl;
return 0;
}
int
-be_valuetype::gen_helper_header (char* ,
- char* )
+be_valuetype::gen_helper_header (char*,
+ char*)
{
TAO_OutStream *os = 0;
os = tao_cg->client_header ();
- *os << "//@@ Boris: begin experimental" << be_nl
- << "TAO_NAMESPACE CORBA" << be_nl
+ *os << be_nl
+ << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "TAO_NAMESPACE CORBA" << be_nl
<< "{"
<< be_idt_nl
- << "TAO_NAMESPACE_STORAGE_CLASS void add_ref (" << this->full_name () << " *);" << be_nl
- << "TAO_NAMESPACE_STORAGE_CLASS void remove_ref (" << this->full_name () << " *);"
- << be_uidt_nl
+ << "TAO_NAMESPACE_STORAGE_CLASS void add_ref ("
+ << this->full_name () << " *);" << be_nl
+ << "TAO_NAMESPACE_STORAGE_CLASS void remove_ref ("
+ << this->full_name () << " *);";
+
+ *os << be_uidt_nl
<< "}" << be_nl
- << "TAO_NAMESPACE_CLOSE" << be_nl
- << "//@@ Boris: end experimental" << be_nl << be_nl;
+ << "TAO_NAMESPACE_CLOSE" << be_nl << be_nl;
return 0;
}
int
-be_valuetype::gen_helper_inline (char* ,
- char* )
+be_valuetype::gen_helper_inline (char*,
+ char*)
{
TAO_OutStream *os = 0;
@@ -658,17 +710,20 @@ be_valuetype::gen_helper_inline (char* ,
// is not getting generated... Actually this is a much bigger
// problem. Just hacking it up for the timebeing..
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
*os << "#if defined (__ACE_INLINE__)" << be_nl
- << "//@@ Boris: begin experimental" << be_nl
<< "TAO_NAMESPACE CORBA" << be_nl
<< "{"
<< be_idt_nl
- << "TAO_NAMESPACE_STORAGE_CLASS void add_ref (" << this->full_name () << " *);" << be_nl
- << "TAO_NAMESPACE_STORAGE_CLASS void remove_ref (" << this->full_name () << " *);"
+ << "TAO_NAMESPACE_STORAGE_CLASS void add_ref ("
+ << this->full_name () << " *);" << be_nl
+ << "TAO_NAMESPACE_STORAGE_CLASS void remove_ref ("
+ << this->full_name () << " *);"
<< be_uidt_nl
<< "}" << be_nl
<< "TAO_NAMESPACE_CLOSE" << be_nl
- << "//@@ Boris: end experimental" << be_nl
<< "#endif /*__ACE_INLINE__*/"<< be_nl;
return 0;
@@ -683,68 +738,54 @@ be_valuetype::gen_helper_stubs (char* ,
os = tao_cg->client_stubs ();
- *os << "//@@ Boris: begin experimental" << be_nl
- // add_ref
- << "void" << be_nl
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "void" << be_nl
<< "CORBA::add_ref (" << this->full_name () << " * vt)" << be_nl
- << "{"
- << be_idt_nl
- << "if (vt != 0)" << be_nl
- << "{"
- << be_idt_nl
- << "vt->_add_ref ();"
- << be_uidt_nl
- << "}"
- << be_uidt_nl
- << "}" << be_nl << be_nl
- // remove_ref
- << "void" << be_nl
+ << "{" << be_idt_nl
+ << "if (vt != 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "vt->_add_ref ();" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "void" << be_nl
<< "CORBA::remove_ref (" << this->full_name () << " * vt)" << be_nl
- << "{"
- << be_idt_nl
- << "if (vt != 0)" << be_nl
- << "{"
- << be_idt_nl
- << "vt->_remove_ref ();"
- << be_uidt_nl
- << "}"
- << be_uidt_nl
- << "}" << be_nl << be_nl
- << "//@@ Boris: end experimental" << be_nl;
+ << "{" << be_idt_nl
+ << "if (vt != 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "vt->_remove_ref ();" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
return 0;
}
// For building the pre and postfix of private data fields.
-const char*
+const char *
be_valuetype::field_pd_prefix (void)
{
return "_pd_";
}
-const char*
+const char *
be_valuetype::field_pd_postfix (void)
{
return "";
}
-be_valuetype*
+be_valuetype *
be_valuetype::statefull_inherit (void)
{
- be_valuetype *rval = 0;
-
- if (this->n_inherits () > 0)
+ if (this->pd_inherits_concrete != 0)
{
- rval = be_valuetype::narrow_from_decl (this->inherits ()[0]);
-
- if (rval && (rval->is_valuetype ())
- && (!rval->is_abstract_valuetype ()))
- {
- return rval;
- }
+ return be_valuetype::narrow_from_decl (this->pd_inherits_concrete);
+ }
+ else
+ {
+ return 0;
}
-
- return 0;
}
// Accept a visitor.
@@ -754,6 +795,12 @@ be_valuetype::accept (be_visitor *visitor)
return visitor->visit_valuetype (this);
}
+void
+be_valuetype::destroy (void)
+{
+ this->be_interface::destroy ();
+}
+
ACE_CDR::ULong
be_valuetype::data_members_count (AST_Field::Visibility vis)
{
@@ -860,8 +907,226 @@ be_valuetype::in_recursion (AST_Type *node)
return 0;
}
+idl_bool
+be_valuetype::supports_abstract (void) const
+{
+ return this->supports_abstract_;
+}
+
+// Template method that traverses the inheritance graph in a breadth-first
+// style. The actual work on each element in the inheritance graph is carried
+// out by the function passed as argument.
+int
+be_valuetype::traverse_supports_list_graphs (
+ be_interface::tao_code_emitter gen,
+ TAO_OutStream *os,
+ idl_bool abstract_paths_only
+ )
+{
+ long n_supports = this->n_supports ();
+
+ if (n_supports == 0)
+ {
+ return 0;
+ }
+
+ // Make sure the queues are empty.
+ this->insert_queue.reset ();
+ this->del_queue.reset ();
+
+ be_interface *supported_interface = 0;
+
+ for (long i = 0; i < n_supports; ++i)
+ {
+ if (abstract_paths_only
+ && ! this->pd_supports[i]->is_abstract ())
+ {
+ continue;
+ }
+
+ supported_interface =
+ be_interface::narrow_from_decl (this->pd_supports[i]);
+
+ // Insert a supported interface in the queue.
+ if (this->insert_queue.enqueue_tail (supported_interface) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_valuetype::"
+ "traverse_supports_graph_list - "
+ "error generating entries\n"),
+ -1);
+ }
+ }
+
+ be_code_emitter_wrapper wrapper (gen);
+
+ return this->traverse_inheritance_graph (wrapper,
+ os,
+ abstract_paths_only);
+}
+
+int
+be_valuetype::traverse_concrete_inheritance_graph (tao_code_emitter gen,
+ TAO_OutStream *os)
+{
+ AST_Interface *supported = this->supports_concrete ();
+
+ if (supported == 0)
+ {
+ return 0;
+ }
+
+ be_interface *concrete = be_interface::narrow_from_decl (supported);
+
+ // Make sure the queues are empty.
+ this->insert_queue.reset ();
+ this->del_queue.reset ();
+
+ // Insert the supported concrete interface in the queue.
+ if (this->insert_queue.enqueue_tail (concrete) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_valuetype::"
+ "traverse_concrete_inheritance_graph - "
+ "error generating entries\n"),
+ -1);
+ }
+
+ be_code_emitter_wrapper wrapper (gen);
+
+ return this->traverse_inheritance_graph (wrapper,
+ os);
+}
+
+int
+be_valuetype::abstract_supports_helper (be_interface *,
+ be_interface *base,
+ TAO_OutStream *os)
+{
+ *os << "," << be_nl
+ << "public virtual ";
+
+ if (base->is_nested ())
+ {
+ UTL_Scope *parent_scope = base->defined_in ();
+ AST_Decl *parent_decl = ScopeAsDecl (parent_scope);
+
+ *os << "ACE_NESTED_CLASS ("
+ << parent_decl->name () << ", "
+ << base->local_name () << ")";
+ }
+ else
+ {
+ *os << base->local_name ();
+ }
+
+ return 0;
+}
+
+int
+be_valuetype::gen_abstract_init_helper (be_interface *,
+ be_interface *,
+ TAO_OutStream *os)
+{
+// *os << be_nl
+// << "this->value_ = this;";
+
+ return 0;
+}
+
+int
+be_valuetype::gen_skel_helper (be_interface *concrete,
+ be_interface *ancestor,
+ TAO_OutStream *os)
+{
+ // If derived and ancestor are same, skip it.
+ if (concrete == ancestor)
+ {
+ return 0;
+ }
+
+ // If an operation or an attribute is abstract (declared in an
+ // abstract interface), we will either generate the full
+ // definition (if there are no concrete interfaces between the
+ // abstract ancestor and us) or, if there is a concrete ancestor
+ // in between, we will catch its definition elsewhere in this
+ // traversal.
+ if (ancestor->is_abstract ())
+ {
+ return 0;
+ }
+
+ // Else generate code that does the cast to the appropriate type.
+
+ if (ancestor->nmembers () > 0)
+ {
+ // If there are elements in ancestor scope i.e., any operations and
+ // attributes defined by "ancestor", become methods on the derived class
+ // which call the corresponding method of the base class by doing the
+ // proper casting.
+
+ for (UTL_ScopeActiveIterator si (ancestor, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ // Get the next AST decl node
+ AST_Decl *d = si.item ();
+
+ if (d->node_type () == AST_Decl::NT_op)
+ {
+ // Start from current indentation level.
+ os->indent ();
+
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ if (os->stream_type () == TAO_OutStream::TAO_SVR_HDR)
+ {
+ // Generate the static method corresponding to this method.
+ *os << "static void " << d->local_name ()
+ << "_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest &req, " << be_nl
+ << "void *obj," << be_nl
+ << "void *context" << be_nl
+ << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
+ << ");" << be_uidt << "\n\n";
+ }
+ else
+ { // Generate code in the inline file.
+ // Generate the static method corresponding to this method.
+ *os << "ACE_INLINE void "
+ << concrete->full_skel_name () << "::"
+ << d->local_name ()
+ << "_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest &req," << be_nl
+ << "void *obj," << be_nl
+ << "void *context" << be_nl
+ << "ACE_ENV_ARG_DECL" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+ *os << ancestor->full_skel_name ()
+ << "_ptr impl = ("
+ << concrete->full_skel_name ()
+ << "_ptr) obj;" << be_nl;
+ *os << ancestor->full_skel_name ()
+ << "::" << d->local_name ()
+ << "_skel (" << be_idt << be_idt_nl
+ << "req," << be_nl
+ << "(" << ancestor->full_skel_name ()
+ << "_ptr) impl," << be_nl
+ << "context" << be_nl
+ << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}\n";
+ }
+ }
+ } // End of scope iterator.
+ }
+
+ return 0;
+}
// Narrowing.
-IMPL_NARROW_METHODS1 (be_valuetype, be_interface)
+IMPL_NARROW_METHODS2 (be_valuetype, be_interface, AST_ValueType)
IMPL_NARROW_FROM_DECL (be_valuetype)
IMPL_NARROW_FROM_SCOPE (be_valuetype)
diff --git a/TAO/TAO_IDL/be/be_valuetype_fwd.cpp b/TAO/TAO_IDL/be/be_valuetype_fwd.cpp
index 7a40580c295..b62641c922b 100644
--- a/TAO/TAO_IDL/be/be_valuetype_fwd.cpp
+++ b/TAO/TAO_IDL/be/be_valuetype_fwd.cpp
@@ -21,11 +21,13 @@
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_valuetype_fwd.h"
+#include "be_visitor.h"
+#include "ast_interface.h"
-ACE_RCSID(be, be_valuetype_fwd, "$Id$")
+ACE_RCSID (be,
+ be_valuetype_fwd,
+ "$Id$")
be_valuetype_fwd::be_valuetype_fwd (void)
{
@@ -35,9 +37,11 @@ be_valuetype_fwd::be_valuetype_fwd (AST_Interface *dummy,
UTL_ScopedName *n)
: be_interface_fwd (dummy,
n),
+ AST_ValueTypeFwd (dummy,
+ n),
AST_InterfaceFwd (dummy,
n),
- AST_Decl (AST_Decl::NT_interface_fwd,
+ AST_Decl (AST_Decl::NT_valuetype_fwd,
n)
{
}
@@ -46,20 +50,19 @@ be_valuetype_fwd::~be_valuetype_fwd (void)
{
}
-
-void
-be_valuetype_fwd::set_abstract_valuetype (void)
-{
- this->full_definition ()->set_abstract_valuetype ();
-}
-
int
be_valuetype_fwd::accept (be_visitor *visitor)
{
return visitor->visit_valuetype_fwd (this);
}
+void
+be_valuetype_fwd::destroy (void)
+{
+ this->be_interface_fwd::destroy ();
+}
+
// Narrowing.
-IMPL_NARROW_METHODS1 (be_valuetype_fwd, be_interface_fwd)
+IMPL_NARROW_METHODS2 (be_valuetype_fwd, be_interface_fwd, AST_ValueTypeFwd)
IMPL_NARROW_FROM_DECL (be_valuetype_fwd)
diff --git a/TAO/TAO_IDL/be/be_visitor.cpp b/TAO/TAO_IDL/be/be_visitor.cpp
index 440c1f9a3b3..b25f89f7914 100644
--- a/TAO/TAO_IDL/be/be_visitor.cpp
+++ b/TAO/TAO_IDL/be/be_visitor.cpp
@@ -21,11 +21,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "be.h"
#include "be_visitor.h"
-#include "be_visitor_valuetype.h"
-ACE_RCSID(be, be_visitor, "$Id$")
+#include "ace/config-all.h"
+
+ACE_RCSID (be,
+ be_visitor,
+ "$Id$")
be_visitor::be_visitor (void)
{
@@ -81,6 +82,21 @@ int be_visitor::visit_valuetype_fwd (be_valuetype_fwd *)
return 0;
}
+int be_visitor::visit_component (be_component *)
+{
+ return 0;
+}
+
+int be_visitor::visit_component_fwd (be_component_fwd *)
+{
+ return 0;
+}
+
+int be_visitor::visit_home (be_home *)
+{
+ return 0;
+}
+
int be_visitor::visit_factory (be_factory *)
{
return 0;
@@ -91,6 +107,11 @@ int be_visitor::visit_structure (be_structure *)
return 0;
}
+int be_visitor::visit_structure_fwd (be_structure_fwd *)
+{
+ return 0;
+}
+
int be_visitor::visit_exception (be_exception *)
{
return 0;
@@ -131,6 +152,11 @@ int be_visitor::visit_union (be_union *)
return 0;
}
+int be_visitor::visit_union_fwd (be_union_fwd *)
+{
+ return 0;
+}
+
int be_visitor::visit_union_branch (be_union_branch *)
{
return 0;
@@ -180,3 +206,4 @@ int be_visitor::visit_native (be_native *)
{
return 0;
}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp
index 25ccb84e649..a38874c9b05 100644
--- a/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp
@@ -1,4 +1,3 @@
-//=============================================================================
/**
* @file be_visitor_amh_pre_proc.cpp
*
@@ -15,20 +14,26 @@
//=============================================================================
#include "be_visitor_amh_pre_proc.h"
+#include "be_visitor_context.h"
+#include "be_root.h"
+#include "be_module.h"
+#include "be_interface.h"
+#include "be_valuetype.h"
+#include "be_attribute.h"
+#include "be_operation.h"
+#include "be_predefined_type.h"
+#include "be_argument.h"
+#include "utl_identifier.h"
be_visitor_amh_pre_proc::be_visitor_amh_pre_proc (be_visitor_context *ctx)
: be_visitor_scope (ctx)
{
}
-
-
be_visitor_amh_pre_proc::~be_visitor_amh_pre_proc (void)
{
}
-
-
int
be_visitor_amh_pre_proc::visit_root (be_root *node)
{
@@ -43,8 +48,6 @@ be_visitor_amh_pre_proc::visit_root (be_root *node)
return 0;
}
-
-
int
be_visitor_amh_pre_proc::visit_module (be_module *node)
{
@@ -59,8 +62,6 @@ be_visitor_amh_pre_proc::visit_module (be_module *node)
return 0;
}
-
-
int
be_visitor_amh_pre_proc::visit_interface (be_interface *node)
{
@@ -70,13 +71,13 @@ be_visitor_amh_pre_proc::visit_interface (be_interface *node)
return 0;
}
- // don't generate AMH classes for imported or local interfaces
+ // Don't generate AMH classes for imported, local or abstract interfaces
// either...
// @@ Mayur, maybe we do want to insert the AMH node for imported
// interfaces, not because we want to generate code for them, but
// because the (imported-AMH-) node could be needed to generate a
// non-imported, AMH node, for example, for a derived interface.
- if (node->imported () || node->is_local ())
+ if (node->imported () || node->is_local () || node->is_abstract ())
{
return 0;
}
@@ -128,7 +129,6 @@ be_visitor_amh_pre_proc::visit_interface (be_interface *node)
return 0;
}
-
be_interface *
be_visitor_amh_pre_proc::create_response_handler (
be_interface *node,
@@ -174,7 +174,6 @@ be_visitor_amh_pre_proc::create_response_handler (
return response_handler;
}
-
int
be_visitor_amh_pre_proc::add_rh_node_members ( be_interface *node,
be_interface *response_handler,
@@ -201,7 +200,9 @@ be_visitor_amh_pre_proc::add_rh_node_members ( be_interface *node,
0);
}
- if (d->node_type () == AST_Decl::NT_attr)
+ AST_Decl::NodeType nt = d->node_type ();
+
+ if (nt == AST_Decl::NT_attr)
{
be_attribute *attribute = be_attribute::narrow_from_decl (d);
@@ -210,7 +211,7 @@ be_visitor_amh_pre_proc::add_rh_node_members ( be_interface *node,
return 0;
}
}
- else
+ else if (nt == AST_Decl::NT_op)
{
be_operation* operation = be_operation::narrow_from_decl (d);
@@ -221,12 +222,15 @@ be_visitor_amh_pre_proc::add_rh_node_members ( be_interface *node,
exception_holder);
}
}
+ else
+ {
+ continue;
+ }
}
return 1;
}
-
int
be_visitor_amh_pre_proc::create_response_handler_operation (
be_operation *node,
@@ -263,7 +267,7 @@ be_visitor_amh_pre_proc::add_exception_reply (be_operation *node,
be_interface *response_handler,
be_valuetype *exception_holder)
{
- Identifier *id = 0;
+ Identifier *id = 0;
UTL_ScopedName *sn = 0;
ACE_NEW_RETURN (id,
@@ -312,7 +316,7 @@ be_visitor_amh_pre_proc::add_exception_reply (be_operation *node,
-1);
argument->set_defined_in (node_excep);
- node_excep->add_argument_to_scope (argument);
+ node_excep->be_add_argument (argument);
node_excep->set_defined_in (response_handler);
response_handler->be_add_operation (node_excep);
@@ -395,7 +399,7 @@ be_visitor_amh_pre_proc::add_normal_reply (be_operation *node,
-1);
// Add the response handler to the argument list
- operation->add_argument_to_scope (arg);
+ operation->be_add_argument (arg);
}
// Iterate over the arguments and put all the out and inout arguments
@@ -430,7 +434,7 @@ be_visitor_amh_pre_proc::add_normal_reply (be_operation *node,
original_arg->name ()),
-1);
- operation->add_argument_to_scope (arg);
+ operation->be_add_argument (arg);
}
}
@@ -446,7 +450,6 @@ be_visitor_amh_pre_proc::add_normal_reply (be_operation *node,
return 0;
}
-
int
be_visitor_amh_pre_proc::visit_operation (be_operation *node)
{
@@ -476,7 +479,6 @@ be_visitor_amh_pre_proc::visit_operation (be_operation *node)
return 0;
}
-
int
be_visitor_amh_pre_proc::visit_attribute (be_attribute *node)
{
@@ -616,14 +618,22 @@ be_visitor_amh_pre_proc::create_exception_holder (be_interface *node)
AST_Interface **p_intf = 0;
UTL_ScopedName *excep_holder_name =
- node->compute_name ("AMH_", "ExceptionHolder");
+ node->compute_name ("AMH_",
+ "ExceptionHolder");
be_valuetype *excep_holder = 0;
ACE_NEW_RETURN (excep_holder,
- be_valuetype (excep_holder_name, // name
- p_intf, // list of inherited
- inherit_count, // number of inherited
- 1), // set not abstract
+ be_valuetype (excep_holder_name,
+ p_intf,
+ inherit_count,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0),
0);
excep_holder->set_name (excep_holder_name);
@@ -648,8 +658,9 @@ be_visitor_amh_pre_proc::create_exception_holder (be_interface *node)
}
be_decl *op = be_decl::narrow_from_decl (d);
+ AST_Decl::NodeType nt = d->node_type ();
- if (d->node_type () == AST_Decl::NT_attr)
+ if (nt == AST_Decl::NT_attr)
{
AST_Attribute *attribute = AST_Attribute::narrow_from_decl (d);
@@ -669,12 +680,16 @@ be_visitor_amh_pre_proc::create_exception_holder (be_interface *node)
SET_OPERATION);
}
}
- else
+ else if (nt == AST_Decl::NT_op)
{
this->create_raise_operation (op,
excep_holder,
NORMAL);
}
+ else
+ {
+ continue;
+ }
}
return excep_holder;
@@ -780,9 +795,11 @@ be_visitor_amh_pre_proc::create_raise_operation (
// Set the proper strategy.
be_operation_ami_exception_holder_raise_strategy *ehrs = 0;
- ACE_NEW_RETURN (ehrs,
- be_operation_ami_exception_holder_raise_strategy (operation),
- -1);
+ ACE_NEW_RETURN (
+ ehrs,
+ be_operation_ami_exception_holder_raise_strategy (operation),
+ -1
+ );
be_operation_strategy *old_strategy =
operation->set_strategy (ehrs);
@@ -846,7 +863,9 @@ be_visitor_amh_pre_proc::generate_get_operation (be_attribute *node)
be_operation *
be_visitor_amh_pre_proc::generate_set_operation (be_attribute *node)
{
- ACE_CString original_op_name (node->name ()->last_component ()->get_string ());
+ ACE_CString original_op_name (
+ node->name ()->last_component ()->get_string ()
+ );
ACE_CString new_op_name = ACE_CString ("set_") + original_op_name;
UTL_ScopedName *set_name = ACE_static_cast (UTL_ScopedName *,
@@ -894,7 +913,7 @@ be_visitor_amh_pre_proc::generate_set_operation (be_attribute *node)
operation->set_name (set_name);
operation->set_defined_in (node->defined_in ());
- operation->add_argument_to_scope (arg);
+ operation->be_add_argument (arg);
return operation;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp
index ed55e812afe..4b8035eac7b 100644
--- a/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp
@@ -22,11 +22,23 @@
//
// ============================================================================
-
#include "be_visitor_ami_pre_proc.h"
-
-
-ACE_RCSID(be, be_visitor_ami_pre_proc, "$Id$")
+#include "be_visitor_context.h"
+#include "be_root.h"
+#include "be_module.h"
+#include "be_interface.h"
+#include "be_interface_strategy.h"
+#include "be_valuetype.h"
+#include "be_operation.h"
+#include "be_operation_strategy.h"
+#include "be_attribute.h"
+#include "be_predefined_type.h"
+#include "be_argument.h"
+#include "utl_identifier.h"
+
+ACE_RCSID (be,
+ be_visitor_ami_pre_proc,
+ "$Id$")
be_visitor_ami_pre_proc::be_visitor_ami_pre_proc (be_visitor_context *ctx)
@@ -35,13 +47,11 @@ be_visitor_ami_pre_proc::be_visitor_ami_pre_proc (be_visitor_context *ctx)
}
- // constructor is protected
be_visitor_ami_pre_proc::~be_visitor_ami_pre_proc (void)
{
}
-
int
be_visitor_ami_pre_proc::visit_root (be_root *node)
{
@@ -78,105 +88,106 @@ be_visitor_ami_pre_proc::visit_module (be_module *node)
int
be_visitor_ami_pre_proc::visit_interface (be_interface *node)
{
- if (!node->imported () && !node->is_local ())
+ if (node->imported () || node->is_local () || node->is_abstract ())
{
- AST_Module *module =
- AST_Module::narrow_from_scope (node->defined_in ());
+ return 0;
+ }
- if (!module)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_ami_pre_proc::"
- "visit_interface - "
- "module is null\n"),
- -1);
- }
+ AST_Module *module =
+ AST_Module::narrow_from_scope (node->defined_in ());
- be_valuetype *excep_holder = this->create_exception_holder (node);
+ if (!module)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ami_pre_proc::"
+ "visit_interface - "
+ "module is null\n"),
+ -1);
+ }
+ be_valuetype *excep_holder = this->create_exception_holder (node);
- be_interface *reply_handler = this->create_reply_handler (node,
- excep_holder);
- if (reply_handler)
- {
- reply_handler->set_defined_in (node->defined_in ());
+ be_interface *reply_handler = this->create_reply_handler (node,
+ excep_holder);
+ if (reply_handler)
+ {
+ reply_handler->set_defined_in (node->defined_in ());
- // Insert the ami handler after the node, the
- // exception holder will be placed between these two later.
- module->be_add_interface (reply_handler, node);
+ // Insert the ami handler after the node, the
+ // exception holder will be placed between these two later.
+ module->be_add_interface (reply_handler, node);
- // Remember from whom we were cloned
- reply_handler->original_interface (node);
- }
- else
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_ami_pre_proc::"
- "visit_interface - "
- "creating the reply handler failed\n"),
- -1);
- }
+ // Remember from whom we were cloned
+ reply_handler->original_interface (node);
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ami_pre_proc::"
+ "visit_interface - "
+ "creating the reply handler failed\n"),
+ -1);
+ }
+
+ // Set the proper strategy.
+ be_interface_ami_strategy *bias = 0;
+ ACE_NEW_RETURN (bias,
+ be_interface_ami_strategy (node,
+ reply_handler),
+ -1);
+ be_interface_strategy *old_strategy = node->set_strategy (bias);
+
+ if (old_strategy)
+ {
+ delete old_strategy;
+ old_strategy = 0;
+ }
- // Set the proper strategy.
- be_interface_ami_strategy *bias = 0;
- ACE_NEW_RETURN (bias,
- be_interface_ami_strategy (node,
- reply_handler),
+ if (excep_holder)
+ {
+ excep_holder->set_defined_in (node->defined_in ());
+ // Insert the exception holder after the original node,
+ // this way we ensure that it is *before* the
+ // ami handler, which is the way we want to have it.
+ module->be_add_interface (excep_holder, node);
+ module->set_has_nested_valuetype ();
+ // Remember from whom we were cloned.
+ excep_holder->original_interface (node);
+
+ // Set the strategy.
+ be_interface_ami_exception_holder_strategy *biaehs = 0;
+ ACE_NEW_RETURN (biaehs,
+ be_interface_ami_exception_holder_strategy (
+ excep_holder
+ ),
-1);
- be_interface_strategy *old_strategy = node->set_strategy (bias);
+
+ be_interface_strategy *old_strategy =
+ excep_holder->set_strategy (biaehs);
if (old_strategy)
{
delete old_strategy;
old_strategy = 0;
}
-
- if (excep_holder)
- {
- excep_holder->set_defined_in (node->defined_in ());
- // Insert the exception holder after the original node,
- // this way we ensure that it is *before* the
- // ami handler, which is the way we want to have it.
- module->be_add_interface (excep_holder, node);
- module->set_has_nested_valuetype ();
- // Remember from whom we were cloned.
- excep_holder->original_interface (node);
-
- // Set the strategy.
- be_interface_ami_exception_holder_strategy *biaehs = 0;
- ACE_NEW_RETURN (biaehs,
- be_interface_ami_exception_holder_strategy (
- excep_holder
- ),
- -1);
-
- be_interface_strategy *old_strategy =
- excep_holder->set_strategy (biaehs);
-
- if (old_strategy)
- {
- delete old_strategy;
- old_strategy = 0;
- }
- }
- else
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_ami_pre_proc::"
- "visit_interface - "
- "creating the exception holder failed\n"),
- -1);
- }
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ami_pre_proc::"
+ "visit_interface - "
+ "creating the exception holder failed\n"),
+ -1);
+ }
- if (this->visit_scope (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_ami_pre_proc::"
- "visit_interface - "
- "visit scope failed\n"),
- -1);
- }
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ami_pre_proc::"
+ "visit_interface - "
+ "visit scope failed\n"),
+ -1);
}
return 0;
@@ -210,7 +221,7 @@ be_visitor_ami_pre_proc::visit_operation (be_operation *node)
// Set the proper strategy, and store the specialized
// marshaling and arguments operations in it.
- be_operation_ami_sendc_strategy * boass= 0;
+ be_operation_ami_sendc_strategy * boass = 0;
ACE_NEW_RETURN (boass,
be_operation_ami_sendc_strategy (node,
sendc_marshaling,
@@ -229,7 +240,6 @@ be_visitor_ami_pre_proc::visit_operation (be_operation *node)
return 0;
}
-
int
be_visitor_ami_pre_proc::visit_attribute (be_attribute *node)
{
@@ -281,11 +291,6 @@ be_visitor_ami_pre_proc::visit_attribute (be_attribute *node)
return 0;
}
-
-
-
-
-
be_valuetype *
be_visitor_ami_pre_proc::create_exception_holder (be_interface *node)
{
@@ -319,6 +324,13 @@ be_visitor_ami_pre_proc::create_exception_holder (be_interface *node)
be_valuetype (inherit_name,
0,
0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
0),
0);
@@ -360,15 +372,21 @@ be_visitor_ami_pre_proc::create_exception_holder (be_interface *node)
AST_Interface_ptr[1],
0);
- p_intf[0] = ACE_static_cast (AST_Interface *,
- inherit_vt);
+ p_intf[0] = inherit_vt;
be_valuetype *excep_holder = 0;
ACE_NEW_RETURN (excep_holder,
- be_valuetype (excep_holder_name, // name
- p_intf, // list of inherited
- 1, // number of inherited
- 0), // set abstract
+ be_valuetype (0,
+ p_intf,
+ 1,
+ inherit_vt,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0),
0);
excep_holder->set_name (excep_holder_name);
@@ -395,8 +413,9 @@ be_visitor_ami_pre_proc::create_exception_holder (be_interface *node)
}
be_decl *op = be_decl::narrow_from_decl (d);
+ AST_Decl::NodeType nt = d->node_type ();
- if (d->node_type () == AST_Decl::NT_attr)
+ if (nt == AST_Decl::NT_attr)
{
AST_Attribute *attribute = AST_Attribute::narrow_from_decl (d);
@@ -417,19 +436,22 @@ be_visitor_ami_pre_proc::create_exception_holder (be_interface *node)
}
}
- else
+ else if (nt == AST_Decl::NT_op)
{
this->create_raise_operation (op,
excep_holder,
NORMAL);
}
+ else
+ {
+ continue;
+ }
} // end of while loop
} // end of if
return excep_holder;
}
-
be_interface *
be_visitor_ami_pre_proc::create_reply_handler (be_interface *node,
be_valuetype *excep_holder)
@@ -518,8 +540,8 @@ be_visitor_ami_pre_proc::create_reply_handler (be_interface *node,
be_interface (reply_handler_name, // name
p_intf, // list of inherited
1, // number of inherited
- p_intf, // list of ancestors
- 1, // number of ancestors
+ 0, // list of all ancestors
+ 0, // number of ancestors
0, // non-local
0), // non-abstract
0);
@@ -600,7 +622,6 @@ be_visitor_ami_pre_proc::create_reply_handler (be_interface *node,
return reply_handler;
}
-
int
be_visitor_ami_pre_proc::create_raise_operation (
be_decl *node,
@@ -819,7 +840,7 @@ be_visitor_ami_pre_proc::create_sendc_operation (be_operation *node,
0);
// Add the reply handler to the argument list
- op->add_argument_to_scope (arg);
+ op->be_add_argument (arg);
}
// Iterate over the arguments and put all the in and inout
@@ -858,7 +879,7 @@ be_visitor_ami_pre_proc::create_sendc_operation (be_operation *node,
original_arg->name ()),
0);
- op->add_argument_to_scope (arg);
+ op->be_add_argument (arg);
}
} // end of while loop
} // end of if
@@ -955,7 +976,7 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (
-1);
// Add the reply handler to the argument list.
- operation->add_argument_to_scope (arg);
+ operation->be_add_argument (arg);
}
// Iterate over the arguments and put all the in and inout
@@ -992,7 +1013,7 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (
original_arg->name ()),
-1);
- operation->add_argument_to_scope (arg);
+ operation->be_add_argument (arg);
}
} // end of while loop
} // end of if
@@ -1107,7 +1128,7 @@ be_visitor_ami_pre_proc::create_excep_operation (be_operation *node,
-1);
operation->set_name (op_name);
- operation->add_argument_to_scope (arg);
+ operation->be_add_argument (arg);
operation->set_defined_in (reply_handler);
@@ -1121,7 +1142,6 @@ be_visitor_ami_pre_proc::create_excep_operation (be_operation *node,
return 0;
}
-
// Visit the scope and its elements.
int
be_visitor_ami_pre_proc::visit_scope (be_scope *node)
@@ -1222,8 +1242,6 @@ be_visitor_ami_pre_proc::generate_name (ACE_CString &destination,
return 0;
}
-
-
be_operation *
be_visitor_ami_pre_proc::generate_get_operation (be_attribute *node)
{
@@ -1304,7 +1322,7 @@ be_visitor_ami_pre_proc::generate_set_operation (be_attribute *node)
operation->set_name (set_name);
operation->set_defined_in (node->defined_in ());
- operation->add_argument_to_scope (arg);
+ operation->be_add_argument (arg);
return operation;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_argument.cpp b/TAO/TAO_IDL/be/be_visitor_argument.cpp
index 2d436b89bae..1ffec9f5654 100644
--- a/TAO/TAO_IDL/be/be_visitor_argument.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_argument.cpp
@@ -18,11 +18,27 @@
//
// ============================================================================
-#include "idl.h"
-#include "be.h"
#include "be_visitor_argument.h"
+#include "be_visitor_context.h"
+#include "be_argument.h"
+#include "be_type.h"
+#include "be_array.h"
+#include "be_enum.h"
+#include "be_interface.h"
+#include "be_interface_fwd.h"
+#include "be_native.h"
+#include "be_predefined_type.h"
+#include "be_string.h"
+#include "be_typedef.h"
+#include "be_structure.h"
+#include "be_union.h"
+#include "be_sequence.h"
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
+#include "be_operation.h"
+#include "be_helper.h"
+#include "utl_identifier.h"
-// include all the individual files
#include "be_visitor_argument/arglist.cpp"
#include "be_visitor_argument/argument.cpp"
#include "be_visitor_argument/marshal_ss.cpp"
@@ -40,4 +56,6 @@
#include "be_visitor_argument/request_info_result.cpp"
#include "be_visitor_argument/request_info_arglist.cpp"
-ACE_RCSID(be, be_visitor_argument, "$Id$")
+ACE_RCSID (be,
+ be_visitor_argument,
+ "$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp
index 8ab31451328..33f70ae17a0 100644
--- a/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp
@@ -18,11 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "be.h"
-#include "be_visitor_argument.h"
-
-ACE_RCSID(be_visitor_argument, arglist, "$Id$")
+ACE_RCSID (be_visitor_argument,
+ arglist,
+ "$Id$")
// ************************************************************
@@ -41,10 +39,10 @@ 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
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
- // retrieve the type
+ // Retrieve the type.
be_type *bt = be_type::narrow_from_decl (node->field_type ());
if (!bt)
@@ -153,7 +151,7 @@ int be_visitor_args_arglist::visit_interface_fwd (be_interface_fwd *node)
int be_visitor_args_arglist::visit_native (be_native *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (this->direction ())
{
@@ -167,15 +165,16 @@ int be_visitor_args_arglist::visit_native (be_native *node)
*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
+ TAO_OutStream *os = this->ctx_->stream ();
+ AST_PredefinedType::PredefinedType pt = node->pt ();
- // check if the type is an any
- if (node->pt () == AST_PredefinedType::PT_any)
+ if (pt == AST_PredefinedType::PT_any)
{
switch (this->direction ())
{
@@ -188,9 +187,10 @@ int be_visitor_args_arglist::visit_predefined_type (be_predefined_type *node)
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
+ }
+ }
+ else if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
{
// The only PT_pseudo that doesn't take a _ptr suffix.
idl_bool is_tckind =
@@ -223,9 +223,9 @@ int be_visitor_args_arglist::visit_predefined_type (be_predefined_type *node)
case AST_Argument::dir_OUT:
*os << this->type_name (node, "_out");
break;
- } // end switch direction
- } // end else if
- else // simple predefined types
+ }
+ }
+ else
{
switch (this->direction ())
{
@@ -238,15 +238,15 @@ int be_visitor_args_arglist::visit_predefined_type (be_predefined_type *node)
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
+ TAO_OutStream *os = this->ctx_->stream ();
switch (this->direction ())
{
@@ -266,7 +266,7 @@ int be_visitor_args_arglist::visit_sequence (be_sequence *node)
int be_visitor_args_arglist::visit_string (be_string *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get the stream
+ TAO_OutStream *os = this->ctx_->stream ();
if (node->width () == (long) sizeof (char))
{
@@ -304,7 +304,7 @@ int be_visitor_args_arglist::visit_string (be_string *node)
int be_visitor_args_arglist::visit_structure (be_structure *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get the stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (this->direction ())
{
@@ -324,7 +324,7 @@ int be_visitor_args_arglist::visit_structure (be_structure *node)
int be_visitor_args_arglist::visit_union (be_union *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get the stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (this->direction ())
{
@@ -362,7 +362,7 @@ int be_visitor_args_arglist::visit_typedef (be_typedef *node)
int be_visitor_args_arglist::visit_valuetype (be_valuetype *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get the stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (this->direction ())
{
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/argument.cpp b/TAO/TAO_IDL/be/be_visitor_argument/argument.cpp
index c172a002252..74090920d4a 100644
--- a/TAO/TAO_IDL/be/be_visitor_argument/argument.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_argument/argument.cpp
@@ -18,15 +18,13 @@
//
// ============================================================================
-#include "idl.h"
-#include "be.h"
-#include "be_visitor_argument.h"
-
-ACE_RCSID(be_visitor_argument, argument, "$Id$")
+ACE_RCSID (be_visitor_argument,
+ argument,
+ "$Id$")
be_visitor_args::be_visitor_args (be_visitor_context *ctx)
- : be_visitor_decl (ctx)
- , fixed_direction_ (-1)
+ : be_visitor_decl (ctx),
+ fixed_direction_ (-1)
{
}
@@ -47,23 +45,31 @@ be_visitor_args::type_name (be_type *node,
const char *suffix)
{
static char namebuf [NAMEBUFSIZE];
- ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
+ ACE_OS::memset (namebuf,
+ '\0',
+ NAMEBUFSIZE);
- be_type *bt; // type to use
+ be_type *bt;
- // use the typedefed name if that is the one used in the IDL defn
+ // Use the typedefed name if that is the one used in the IDL defn.
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
ACE_OS::sprintf (namebuf,
"%s",
bt->full_name ());
if (suffix)
- ACE_OS::strcat (namebuf,
- suffix);
+ {
+ ACE_OS::strcat (namebuf,
+ suffix);
+ }
return namebuf;
}
@@ -73,7 +79,9 @@ AST_Argument::Direction
be_visitor_args::direction (void)
{
if (this->fixed_direction_ != -1)
- return AST_Argument::Direction (this->fixed_direction_);
+ {
+ return AST_Argument::Direction (this->fixed_direction_);
+ }
// grab the argument node. We know that our context has stored the right
// argument node
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/invoke_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/invoke_cs.cpp
index e24a84e9ce0..59672368f62 100644
--- a/TAO/TAO_IDL/be/be_visitor_argument/invoke_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_argument/invoke_cs.cpp
@@ -18,11 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "be.h"
-#include "be_visitor_argument.h"
-
-ACE_RCSID(be_visitor_argument, invoke_cs, "$Id$")
+ACE_RCSID (be_visitor_argument,
+ invoke_cs,
+ "$Id$")
// ****************************************************************************
@@ -43,9 +41,8 @@ be_visitor_args_invoke_cs::
int be_visitor_args_invoke_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,
@@ -60,8 +57,6 @@ int be_visitor_args_invoke_cs::visit_argument (be_argument *node)
TAO_OutStream *os = this->ctx_->stream (); // get output stream
- os->indent ();
-
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
{
switch (this->direction ())
@@ -142,9 +137,8 @@ int be_visitor_args_invoke_cs::visit_argument (be_argument *node)
int be_visitor_args_invoke_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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
{
@@ -158,7 +152,7 @@ int be_visitor_args_invoke_cs::visit_array (be_array *node)
case AST_Argument::dir_INOUT:
*os << node->name () << "_forany ("
<< arg->local_name () << ")";
- break;
+ break;
case AST_Argument::dir_OUT:
break;
}
@@ -170,17 +164,8 @@ int be_visitor_args_invoke_cs::visit_array (be_array *node)
case AST_Argument::dir_IN:
break;
case AST_Argument::dir_INOUT:
- *os << "_tao_argument_" << arg->local_name ();
- break;
case AST_Argument::dir_OUT:
- if (node->size_type () == be_decl::VARIABLE)
- {
- *os << "_tao_argument_" << arg->local_name ();
- }
- else
- {
- *os << "_tao_argument_" << arg->local_name ();
- }
+ *os << "_tao_argument_" << arg->local_name ();
break;
}
}
@@ -192,14 +177,14 @@ int be_visitor_args_invoke_cs::visit_array (be_array *node)
"Bad substate\n"),
-1);
}
+
return 0;
}
int be_visitor_args_invoke_cs::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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
{
@@ -233,14 +218,14 @@ int be_visitor_args_invoke_cs::visit_enum (be_enum *)
"Bad substate\n"),
-1);
}
+
return 0;
}
int be_visitor_args_invoke_cs::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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
{
@@ -276,14 +261,14 @@ int be_visitor_args_invoke_cs::visit_interface (be_interface *)
"Bad substate\n"),
-1);
}
+
return 0;
}
int be_visitor_args_invoke_cs::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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
{
@@ -369,9 +354,8 @@ int be_visitor_args_invoke_cs::visit_valuetype (be_valuetype *)
int
be_visitor_args_invoke_cs::visit_valuetype_fwd (be_valuetype_fwd *)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
- be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument
- // node
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
{
@@ -407,13 +391,14 @@ be_visitor_args_invoke_cs::visit_valuetype_fwd (be_valuetype_fwd *)
"Bad substate\n"),
-1);
}
+
return 0;
}
int be_visitor_args_invoke_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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
{
@@ -424,6 +409,7 @@ int be_visitor_args_invoke_cs::visit_predefined_type (be_predefined_type *node)
switch (node->pt ())
{
case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
case AST_PredefinedType::PT_any:
case AST_PredefinedType::PT_long:
case AST_PredefinedType::PT_ulong:
@@ -470,6 +456,7 @@ int be_visitor_args_invoke_cs::visit_predefined_type (be_predefined_type *node)
switch (node->pt ())
{
case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
case AST_PredefinedType::PT_any:
case AST_PredefinedType::PT_long:
case AST_PredefinedType::PT_ulong:
@@ -506,6 +493,7 @@ int be_visitor_args_invoke_cs::visit_predefined_type (be_predefined_type *node)
switch (node->pt ())
{
case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
*os << arg->local_name () << ".ptr ()";
break;
case AST_PredefinedType::PT_any:
@@ -552,14 +540,14 @@ int be_visitor_args_invoke_cs::visit_predefined_type (be_predefined_type *node)
"Bad substate\n"),
-1);
}
+
return 0;
}
int be_visitor_args_invoke_cs::visit_sequence (be_sequence *)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
- be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument
- // node
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
{
@@ -595,14 +583,14 @@ int be_visitor_args_invoke_cs::visit_sequence (be_sequence *)
"Bad substate\n"),
-1);
}
+
return 0;
}
int be_visitor_args_invoke_cs::visit_string (be_string *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
- be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument
- // node
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
{
@@ -618,10 +606,10 @@ int be_visitor_args_invoke_cs::visit_string (be_string *node)
}
else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
{
- // we need to make a distinction between bounded and unbounded strings
+ // We need to make a distinction between bounded and unbounded strings.
if (node->max_size ()->ev ()->u.ulval == 0)
{
- // unbounded
+ // Unbounded.
switch (this->direction ())
{
case AST_Argument::dir_IN:
@@ -636,7 +624,7 @@ int be_visitor_args_invoke_cs::visit_string (be_string *node)
}
else
{
- // bounded
+ // Bounded.
switch (this->direction ())
{
case AST_Argument::dir_IN:
@@ -678,14 +666,14 @@ int be_visitor_args_invoke_cs::visit_string (be_string *node)
"Bad substate\n"),
-1);
}
+
return 0;
}
int be_visitor_args_invoke_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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
{
@@ -709,7 +697,7 @@ int be_visitor_args_invoke_cs::visit_structure (be_structure *node)
*os << arg->local_name ();
break;
case AST_Argument::dir_OUT:
- if (node->size_type () == be_decl::VARIABLE)
+ if (node->size_type () == AST_Type::VARIABLE)
*os << "*" << arg->local_name () << ".ptr ()";
else
*os << arg->local_name ();
@@ -724,14 +712,14 @@ int be_visitor_args_invoke_cs::visit_structure (be_structure *node)
"Bad substate\n"),
-1);
}
+
return 0;
}
int be_visitor_args_invoke_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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
{
@@ -755,7 +743,7 @@ int be_visitor_args_invoke_cs::visit_union (be_union *node)
*os << arg->local_name ();
break;
case AST_Argument::dir_OUT:
- if (node->size_type () == be_decl::VARIABLE)
+ if (node->size_type () == AST_Type::VARIABLE)
*os << "*" << arg->local_name () << ".ptr ()";
else
*os << arg->local_name ();
@@ -777,6 +765,7 @@ int be_visitor_args_invoke_cs::visit_union (be_union *node)
int be_visitor_args_invoke_cs::visit_typedef (be_typedef *node)
{
this->ctx_->alias (node);
+
if (node->primitive_base_type ()->accept (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -785,6 +774,7 @@ int be_visitor_args_invoke_cs::visit_typedef (be_typedef *node)
"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
index 8842e708c3f..0be2a5f206d 100644
--- a/TAO/TAO_IDL/be/be_visitor_argument/marshal_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_argument/marshal_ss.cpp
@@ -19,11 +19,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "be.h"
-#include "be_visitor_argument.h"
-
-ACE_RCSID(be_visitor_argument, marshal_ss, "$Id$")
+ACE_RCSID (be_visitor_argument,
+ marshal_ss,
+ "$Id$")
// ************************************************************************
@@ -44,10 +42,9 @@ be_visitor_args_marshal_ss::
int be_visitor_args_marshal_ss::visit_argument (be_argument *node)
{
- this->ctx_->node (node); // save the argument node
-
- // retrieve the type of the argument
+ this->ctx_->node (node);
be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -144,9 +141,8 @@ int be_visitor_args_marshal_ss::visit_argument (be_argument *node)
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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
{
@@ -184,14 +180,14 @@ int be_visitor_args_marshal_ss::visit_array (be_array *)
"Bad substate\n"),
-1);
}
+
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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
{
@@ -225,14 +221,14 @@ int be_visitor_args_marshal_ss::visit_enum (be_enum *)
"Bad substate\n"),
-1);
}
+
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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
{
@@ -266,14 +262,14 @@ int be_visitor_args_marshal_ss::visit_interface (be_interface *)
"Bad substate\n"),
-1);
}
+
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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
{
@@ -307,14 +303,14 @@ int be_visitor_args_marshal_ss::visit_interface_fwd (be_interface_fwd *)
"Bad substate\n"),
-1);
}
+
return 0;
}
int be_visitor_args_marshal_ss::visit_valuetype (be_valuetype *)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
- be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument
- // node
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
{
@@ -348,14 +344,14 @@ int be_visitor_args_marshal_ss::visit_valuetype (be_valuetype *)
"Bad substate\n"),
-1);
}
+
return 0;
}
int be_visitor_args_marshal_ss::visit_valuetype_fwd (be_valuetype_fwd *)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
- be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument
- // node
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
{
@@ -389,13 +385,16 @@ int be_visitor_args_marshal_ss::visit_valuetype_fwd (be_valuetype_fwd *)
"Bad substate\n"),
-1);
}
+
return 0;
}
-int be_visitor_args_marshal_ss::visit_predefined_type (be_predefined_type *node)
+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 argument node
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
{
@@ -406,6 +405,7 @@ int be_visitor_args_marshal_ss::visit_predefined_type (be_predefined_type *node)
switch (node->pt ())
{
case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
*os << arg->local_name () << ".out ()";
break;
case AST_PredefinedType::PT_any:
@@ -454,6 +454,7 @@ int be_visitor_args_marshal_ss::visit_predefined_type (be_predefined_type *node)
switch (node->pt ())
{
case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
*os << arg->local_name () << ".in ()";
break;
case AST_PredefinedType::PT_any:
@@ -494,6 +495,7 @@ int be_visitor_args_marshal_ss::visit_predefined_type (be_predefined_type *node)
switch (node->pt ())
{
case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
*os << arg->local_name () << ".in ()";
break;
case AST_PredefinedType::PT_any:
@@ -523,11 +525,14 @@ int be_visitor_args_marshal_ss::visit_predefined_type (be_predefined_type *node)
*os << "CORBA::Any::from_octet (" << arg->local_name () << ")";
break;
default:
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_operation_rettype_compiled_marshal_ss::"
- "visit_array - "
- "Bad predefined type\n"),
- -1);
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "be_visitor_operation_rettype_compiled_marshal_ss::"
+ "visit_array - "
+ "Bad predefined type\n"
+ ),
+ -1
+ );
}
break;
}
@@ -540,14 +545,14 @@ int be_visitor_args_marshal_ss::visit_predefined_type (be_predefined_type *node)
"Bad substate\n"),
-1);
}
+
return 0;
}
int be_visitor_args_marshal_ss::visit_sequence (be_sequence *)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
- be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument
- // node
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
{
@@ -583,14 +588,14 @@ int be_visitor_args_marshal_ss::visit_sequence (be_sequence *)
"Bad substate\n"),
-1);
}
+
return 0;
}
int be_visitor_args_marshal_ss::visit_string (be_string *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
- be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument
- // node
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
{
@@ -671,14 +676,14 @@ int be_visitor_args_marshal_ss::visit_string (be_string *node)
"Bad substate\n"),
-1);
}
+
return 0;
}
int be_visitor_args_marshal_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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
{
@@ -702,7 +707,7 @@ int be_visitor_args_marshal_ss::visit_structure (be_structure *node)
*os << arg->local_name ();
break;
case AST_Argument::dir_OUT:
- if (node->size_type () == be_decl::VARIABLE)
+ if (node->size_type () == AST_Type::VARIABLE)
*os << arg->local_name () << ".in ()";
else
*os << arg->local_name ();
@@ -717,14 +722,14 @@ int be_visitor_args_marshal_ss::visit_structure (be_structure *node)
"Bad substate\n"),
-1);
}
+
return 0;
}
int be_visitor_args_marshal_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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
{
@@ -748,7 +753,7 @@ int be_visitor_args_marshal_ss::visit_union (be_union *node)
*os << arg->local_name ();
break;
case AST_Argument::dir_OUT:
- if (node->size_type () == be_decl::VARIABLE)
+ if (node->size_type () == AST_Type::VARIABLE)
*os << arg->local_name () << ".in ()";
else
*os << arg->local_name ();
@@ -770,6 +775,7 @@ int be_visitor_args_marshal_ss::visit_union (be_union *node)
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,
@@ -778,6 +784,7 @@ int be_visitor_args_marshal_ss::visit_typedef (be_typedef *node)
"accept on primitive type failed\n"),
-1);
}
+
this->ctx_->alias (0);
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/paramlist.cpp b/TAO/TAO_IDL/be/be_visitor_argument/paramlist.cpp
index cc952c4c0f9..7dea1734128 100644
--- a/TAO/TAO_IDL/be/be_visitor_argument/paramlist.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_argument/paramlist.cpp
@@ -19,10 +19,6 @@
//
// ============================================================================
-#include "idl.h"
-#include "be.h"
-#include "be_visitor_argument.h"
-
ACE_RCSID (be_visitor_argument,
paramlist,
"$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/post_invoke_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/post_invoke_cs.cpp
index 865425354cd..2e8ebf3f89e 100644
--- a/TAO/TAO_IDL/be/be_visitor_argument/post_invoke_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_argument/post_invoke_cs.cpp
@@ -19,11 +19,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "be.h"
-#include "be_visitor_argument.h"
-
-ACE_RCSID(be_visitor_argument, post_invoke_cs, "$Id$")
+ACE_RCSID (be_visitor_argument,
+ post_invoke_cs,
+ "$Id$")
// *************************************************************************
@@ -33,8 +31,9 @@ ACE_RCSID(be_visitor_argument, post_invoke_cs, "$Id$")
// type and vice versa.
// *************************************************************************
-be_visitor_args_post_invoke_cs::be_visitor_args_post_invoke_cs
-(be_visitor_context *ctx)
+be_visitor_args_post_invoke_cs::be_visitor_args_post_invoke_cs (
+ be_visitor_context *ctx
+ )
: be_visitor_args (ctx)
{
}
@@ -46,10 +45,11 @@ be_visitor_args_post_invoke_cs::~be_visitor_args_post_invoke_cs (void)
int
be_visitor_args_post_invoke_cs::visit_argument (be_argument *node)
{
- this->ctx_->node (node); // save the argument node
+ this->ctx_->node (node);
- // retrieve the type of the argument
+ // Retrieve the type of the argument.
be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -77,10 +77,9 @@ be_visitor_args_post_invoke_cs::visit_argument (be_argument *node)
int
be_visitor_args_post_invoke_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
+ // We must narrow the out object reference to the appropriate type.
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
switch (this->direction ())
{
@@ -101,16 +100,16 @@ be_visitor_args_post_invoke_cs::visit_interface (be_interface *node)
default:
break;
}
+
return 0;
}
int
be_visitor_args_post_invoke_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
+ // We must narrow the out object reference to the appropriate type.
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
switch (this->direction ())
{
@@ -131,16 +130,16 @@ be_visitor_args_post_invoke_cs::visit_interface_fwd (be_interface_fwd *node)
default:
break;
}
+
return 0;
}
int
be_visitor_args_post_invoke_cs::visit_valuetype (be_valuetype *)
{
- // 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
+ // We must narrow the out object reference to the appropriate type.
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
switch (this->direction ())
{
@@ -154,16 +153,16 @@ be_visitor_args_post_invoke_cs::visit_valuetype (be_valuetype *)
default:
break;
}
+
return 0;
}
int
be_visitor_args_post_invoke_cs::visit_valuetype_fwd (be_valuetype_fwd *)
{
- // 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
+ // We must narrow the out object reference to the appropriate type.
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
switch (this->direction ())
{
@@ -177,15 +176,16 @@ be_visitor_args_post_invoke_cs::visit_valuetype_fwd (be_valuetype_fwd *)
default:
break;
}
+
return 0;
}
int
be_visitor_args_post_invoke_cs::visit_string (be_string *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
- be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument
- // node
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
+
switch (this->direction ())
{
case AST_Argument::dir_IN:
@@ -208,6 +208,7 @@ be_visitor_args_post_invoke_cs::visit_string (be_string *node)
case AST_Argument::dir_OUT:
break;
}
+
return 0;
}
@@ -215,6 +216,7 @@ int
be_visitor_args_post_invoke_cs::visit_typedef (be_typedef *node)
{
this->ctx_->alias (node);
+
if (node->primitive_base_type ()->accept (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -223,6 +225,7 @@ be_visitor_args_post_invoke_cs::visit_typedef (be_typedef *node)
"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
index a532881930a..e3362d2bf16 100644
--- a/TAO/TAO_IDL/be/be_visitor_argument/post_marshal_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_argument/post_marshal_ss.cpp
@@ -19,12 +19,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "be.h"
-#include "be_visitor_argument.h"
-
-ACE_RCSID(be_visitor_argument, post_marshal_ss, "$Id$")
-
+ACE_RCSID (be_visitor_argument,
+ post_marshal_ss,
+ "$Id$")
// ************************************************************************
// visitor for doing any post-processing after the marshaling is done
@@ -45,6 +42,7 @@ int be_visitor_args_post_marshal_ss::visit_argument (be_argument *node)
// retrieve the type
be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -69,160 +67,10 @@ int be_visitor_args_post_marshal_ss::visit_argument (be_argument *node)
return 0;
}
-int be_visitor_args_post_marshal_ss::visit_array (be_array *)
-{
- 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 *)
-{
- 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 *)
-{
- 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 *)
-{
- 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)
-{
- // 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 *)
-{
- 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 *)
-{
- 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 *)
-{
- 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 *)
-{
- 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,
@@ -231,6 +79,7 @@ int be_visitor_args_post_marshal_ss::visit_typedef (be_typedef *node)
"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
index 06cfa4d0cce..41c9e5b9d10 100644
--- a/TAO/TAO_IDL/be/be_visitor_argument/post_upcall_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_argument/post_upcall_ss.cpp
@@ -19,17 +19,17 @@
//
// ============================================================================
-#include "idl.h"
-#include "be.h"
-#include "be_visitor_argument.h"
-
-ACE_RCSID(be_visitor_argument, post_upcall_ss, "$Id$")
+ACE_RCSID (be_visitor_argument,
+ post_upcall_ss,
+ "$Id$")
// ************************************************************************
// 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_post_upcall_ss::be_visitor_args_post_upcall_ss (
+ be_visitor_context *ctx
+ )
: be_visitor_scope (ctx)
{
}
@@ -50,10 +50,11 @@ int be_visitor_args_post_upcall_ss::visit_argument (be_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_compiled_args_post_upcall::"
+ "be_visitor_args_post_upcall::"
"visit_argument - "
"Bad argument type\n"),
-1);
@@ -65,7 +66,7 @@ int be_visitor_args_post_upcall_ss::visit_argument (be_argument *node)
if (bt->accept (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_compiled_args_post_upcall::"
+ "be_visitor_args_post_upcall::"
"visit_argument - "
"cannot accept visitor\n"),
-1);
@@ -81,8 +82,11 @@ int be_visitor_args_post_upcall_ss::visit_array (be_array *node)
// if the current type is an alias, use that
be_type *bt = node;
+
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
switch (arg->direction ())
{
@@ -105,6 +109,7 @@ int be_visitor_args_post_upcall_ss::visit_array (be_array *node)
<< arg->local_name () << be_uidt_nl
<< ");\n" << be_uidt;
}
+
break;
}
return 0;
@@ -113,14 +118,16 @@ int be_visitor_args_post_upcall_ss::visit_array (be_array *node)
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_compiled_args_post_upcall::"
+ "be_visitor_args_post_upcall::"
"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_invoke_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/pre_invoke_cs.cpp
index 43c173b574d..2c322980928 100644
--- a/TAO/TAO_IDL/be/be_visitor_argument/pre_invoke_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_argument/pre_invoke_cs.cpp
@@ -19,11 +19,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "be.h"
-#include "be_visitor_argument.h"
-
-ACE_RCSID(be_visitor_argument, pre_invoke_cs, "$Id$")
+ACE_RCSID (be_visitor_argument,
+ pre_invoke_cs,
+ "$Id$")
// *************************************************************************
@@ -78,7 +76,7 @@ be_visitor_args_pre_invoke_cs::cannot_return_zero (void)
return 1;
}
else if (bt->base_node_type () == AST_Decl::NT_struct
- && bt->size_type () == be_decl::FIXED)
+ && bt->size_type () == AST_Type::FIXED)
{
return 1;
}
@@ -139,7 +137,7 @@ be_visitor_args_pre_invoke_cs::visit_array (be_array *node)
switch (this->direction ())
{
case AST_Argument::dir_OUT:
- if (node->size_type () == be_decl::VARIABLE)
+ if (node->size_type () == AST_Type::VARIABLE)
{
os->indent ();
@@ -199,6 +197,7 @@ be_visitor_args_pre_invoke_cs::visit_predefined_type (be_predefined_type *node)
switch (node->pt ())
{
case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
{
switch (this->direction ())
{
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/request_info_arglist.cpp b/TAO/TAO_IDL/be/be_visitor_argument/request_info_arglist.cpp
index 8ccd92cb024..e4c9831a881 100644
--- a/TAO/TAO_IDL/be/be_visitor_argument/request_info_arglist.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_argument/request_info_arglist.cpp
@@ -18,11 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "be.h"
-#include "be_visitor_argument.h"
-
-ACE_RCSID(be_visitor_argument, request_info_arglist, "$Id$")
+ACE_RCSID (be_visitor_argument,
+ request_info_arglist,
+ "$Id$")
// ************************************************************
@@ -150,6 +148,7 @@ int be_visitor_args_request_info_arglist::visit_interface (be_interface *node)
*os << this->type_name (node, "_out");
break;
}
+
return 0;
}
@@ -171,6 +170,7 @@ int be_visitor_args_request_info_arglist::visit_interface_fwd (
*os << this->type_name (node, "_out");
break;
}
+
return 0;
}
@@ -190,6 +190,7 @@ int be_visitor_args_request_info_arglist::visit_native (be_native *node)
*os << this->type_name (node) << " &";
break;
}
+
return 0;
}
@@ -198,9 +199,9 @@ int be_visitor_args_request_info_arglist::visit_predefined_type (
)
{
TAO_OutStream *os = this->ctx_->stream ();
+ AST_PredefinedType::PredefinedType pt = node->pt ();
- // Check if the type is an any.
- if (node->pt () == AST_PredefinedType::PT_any)
+ if (pt == AST_PredefinedType::PT_any)
{
switch (this->direction ())
{
@@ -222,9 +223,10 @@ int be_visitor_args_request_info_arglist::visit_predefined_type (
break;
}
- } // end switch direction
- } // end of if
- else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g. CORBA::Object
+ }
+ }
+ else if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
{
switch (this->direction ())
{
@@ -237,9 +239,9 @@ int be_visitor_args_request_info_arglist::visit_predefined_type (
case AST_Argument::dir_OUT:
*os << this->type_name (node, "_out");
break;
- } // end switch direction
- } // end else if
- else // Simple predefined types.
+ }
+ }
+ else
{
switch (this->direction ())
{
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/request_info_ch.cpp b/TAO/TAO_IDL/be/be_visitor_argument/request_info_ch.cpp
index e2e0b7496e7..993c3d44b18 100644
--- a/TAO/TAO_IDL/be/be_visitor_argument/request_info_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_argument/request_info_ch.cpp
@@ -18,11 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "be.h"
-#include "be_visitor_argument.h"
-
-ACE_RCSID(be_visitor_argument, request_info_ch, "$Id$")
+ACE_RCSID (be_visitor_argument,
+ request_info_ch,
+ "$Id$")
// ************************************************************
@@ -41,8 +39,8 @@ be_visitor_args_request_info_ch::~be_visitor_args_request_info_ch (void)
int be_visitor_args_request_info_ch::visit_argument (be_argument *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
- this->ctx_->node (node); // save the argument node
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
// retrieve the type
be_type *bt = be_type::narrow_from_decl (node->field_type ());
@@ -75,7 +73,7 @@ int be_visitor_args_request_info_ch::visit_argument (be_argument *node)
int be_visitor_args_request_info_ch::visit_array (be_array *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (this->direction ())
{
@@ -104,7 +102,7 @@ int be_visitor_args_request_info_ch::visit_array (be_array *node)
int be_visitor_args_request_info_ch::visit_enum (be_enum *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (this->direction ())
{
@@ -134,7 +132,7 @@ int be_visitor_args_request_info_ch::visit_enum (be_enum *node)
int be_visitor_args_request_info_ch::visit_interface (be_interface *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (this->direction ())
{
@@ -148,6 +146,7 @@ int be_visitor_args_request_info_ch::visit_interface (be_interface *node)
*os << this->type_name (node, "_out");
break;
}
+
return 0;
}
@@ -155,7 +154,7 @@ int be_visitor_args_request_info_ch::visit_interface_fwd (
be_interface_fwd *node
)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (this->direction ())
{
@@ -169,12 +168,13 @@ int be_visitor_args_request_info_ch::visit_interface_fwd (
*os << this->type_name (node, "_out");
break;
}
+
return 0;
}
int be_visitor_args_request_info_ch::visit_native (be_native *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (this->direction ())
{
@@ -188,6 +188,7 @@ int be_visitor_args_request_info_ch::visit_native (be_native *node)
*os << this->type_name (node) << " &";
break;
}
+
return 0;
}
@@ -195,10 +196,10 @@ int be_visitor_args_request_info_ch::visit_predefined_type (
be_predefined_type *node
)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
+ AST_PredefinedType::PredefinedType pt = node-> pt ();
- // Check if the type is an any.
- if (node->pt () == AST_PredefinedType::PT_any)
+ if (pt == AST_PredefinedType::PT_any)
{
switch (this->direction ())
{
@@ -220,9 +221,10 @@ int be_visitor_args_request_info_ch::visit_predefined_type (
break;
}
- } // end switch direction
- } // end of if
- else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object
+ }
+ }
+ else if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
{
switch (this->direction ())
{
@@ -235,9 +237,9 @@ int be_visitor_args_request_info_ch::visit_predefined_type (
case AST_Argument::dir_OUT:
*os << this->type_name (node, "_out");
break;
- } // end switch direction
- } // end else if
- else // Simple predefined types.
+ }
+ }
+ else
{
switch (this->direction ())
{
@@ -267,7 +269,7 @@ int be_visitor_args_request_info_ch::visit_predefined_type (
int be_visitor_args_request_info_ch::visit_sequence (be_sequence *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get the stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (this->direction ())
{
@@ -294,7 +296,7 @@ int be_visitor_args_request_info_ch::visit_sequence (be_sequence *node)
int be_visitor_args_request_info_ch::visit_string (be_string *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get the stream
+ TAO_OutStream *os = this->ctx_->stream ();
if (node->width () == 1)
{
@@ -332,7 +334,7 @@ int be_visitor_args_request_info_ch::visit_string (be_string *node)
int be_visitor_args_request_info_ch::visit_structure (be_structure *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get the stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (this->direction ())
{
@@ -354,14 +356,14 @@ int be_visitor_args_request_info_ch::visit_structure (be_structure *node)
break;
}
-
}
+
return 0;
}
int be_visitor_args_request_info_ch::visit_union (be_union *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get the stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (this->direction ())
{
@@ -383,8 +385,8 @@ int be_visitor_args_request_info_ch::visit_union (be_union *node)
break;
}
-
}
+
return 0;
}
@@ -408,7 +410,7 @@ int be_visitor_args_request_info_ch::visit_typedef (be_typedef *node)
int be_visitor_args_request_info_ch::visit_valuetype (be_valuetype *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get the stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (this->direction ())
{
@@ -422,6 +424,7 @@ int be_visitor_args_request_info_ch::visit_valuetype (be_valuetype *node)
*os << this->type_name (node, "_out");
break;
}
+
return 0;
}
@@ -429,7 +432,7 @@ int be_visitor_args_request_info_ch::visit_valuetype_fwd (
be_valuetype_fwd *node
)
{
- TAO_OutStream *os = this->ctx_->stream (); // get the stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (this->direction ())
{
@@ -443,6 +446,7 @@ int be_visitor_args_request_info_ch::visit_valuetype_fwd (
*os << this->type_name (node, "_out");
break;
}
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/request_info_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/request_info_cs.cpp
index 09d7050b34e..07650498daf 100644
--- a/TAO/TAO_IDL/be/be_visitor_argument/request_info_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_argument/request_info_cs.cpp
@@ -18,11 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "be.h"
-#include "be_visitor_argument.h"
-
-ACE_RCSID(be_visitor_argument, request_info_cs, "$Id$")
+ACE_RCSID (be_visitor_argument,
+ request_info_cs,
+ "$Id$")
// ************************************************************
@@ -30,7 +28,9 @@ ACE_RCSID(be_visitor_argument, request_info_cs, "$Id$")
// definitions
// ************************************************************
-be_visitor_args_request_info_cs::be_visitor_args_request_info_cs (be_visitor_context *ctx)
+be_visitor_args_request_info_cs::be_visitor_args_request_info_cs (
+ be_visitor_context *ctx
+ )
: be_visitor_args (ctx)
{
}
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/request_info_result.cpp b/TAO/TAO_IDL/be/be_visitor_argument/request_info_result.cpp
index 1d1ef00aa91..ea9a7062592 100644
--- a/TAO/TAO_IDL/be/be_visitor_argument/request_info_result.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_argument/request_info_result.cpp
@@ -18,11 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "be.h"
-#include "be_visitor_argument.h"
-
-ACE_RCSID(be_visitor_argument, request_info_result, "$Id$")
+ACE_RCSID (be_visitor_argument,
+ request_info_result,
+ "$Id$")
// ************************************************************
@@ -30,25 +28,27 @@ ACE_RCSID(be_visitor_argument, request_info_result, "$Id$")
// stored in the request info for interceptors
// ************************************************************
-be_visitor_args_request_info_result::be_visitor_args_request_info_result (be_visitor_context *ctx)
+be_visitor_args_request_info_result::be_visitor_args_request_info_result (
+ be_visitor_context *ctx
+ )
: be_visitor_args (ctx)
{
}
-be_visitor_args_request_info_result::~be_visitor_args_request_info_result (void)
+be_visitor_args_request_info_result::~be_visitor_args_request_info_result (
+ void
+ )
{
}
int be_visitor_args_request_info_result::visit_argument (be_argument *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
- this->ctx_->node (node); // save the argument node
- be_type *bt;
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
os->indent ();
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
- // retrieve the type
- bt = be_type::narrow_from_decl (node->field_type ());
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -59,40 +59,47 @@ int be_visitor_args_request_info_result::visit_argument (be_argument *node)
}
if (bt->accept (this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_args_vardecl_ss::"
- "visit_argument - "
- "cannot accept visitor\n"),
- -1);
- }
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_args_vardecl_ss::"
+ "visit_argument - "
+ "cannot accept visitor\n"),
+ -1);
+ }
*os << be_nl;
+
// Set the appropriate mode for each parameter.
return 0;
}
int be_visitor_args_request_info_result::visit_array (be_array *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
- // if the current type is an alias, use that
be_type *bt;
+
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
os->indent ();
+
*os << bt->name () << "_forany _tao_forany_result"
<< " (this->result_);" << be_nl
- << "this->result_val_ <<= _tao_forany_result;"<< be_nl;
+ << "this->result_val_ <<= _tao_forany_result;" << be_nl;
+
return 0;
}
int be_visitor_args_request_info_result::visit_enum (be_enum *)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
os->indent ();
*os << "this->result_val_ <<= this->result_;";
@@ -102,7 +109,7 @@ int be_visitor_args_request_info_result::visit_enum (be_enum *)
int be_visitor_args_request_info_result::visit_interface (be_interface *)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
os->indent ();
*os << "this->result_val_ <<= this->result_;";
@@ -110,90 +117,98 @@ int be_visitor_args_request_info_result::visit_interface (be_interface *)
return 0;
}
-int be_visitor_args_request_info_result::visit_interface_fwd (be_interface_fwd *)
+int be_visitor_args_request_info_result::visit_interface_fwd (
+ be_interface_fwd *
+ )
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
os->indent ();
*os << "this->result_val_ <<= this->result_;";
return 0;
-
}
int be_visitor_args_request_info_result::visit_valuetype (be_valuetype *)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
os->indent ();
*os << "this->result_val_ <<= this->result_;";
return 0;
-
}
-int be_visitor_args_request_info_result::visit_valuetype_fwd (be_valuetype_fwd *)
+int be_visitor_args_request_info_result::visit_valuetype_fwd (
+ be_valuetype_fwd *
+ )
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
os->indent ();
*os << "this->result_val_ <<= this->result_;";
return 0;
-
}
int
-be_visitor_args_request_info_result::visit_predefined_type (be_predefined_type *node)
+be_visitor_args_request_info_result::visit_predefined_type (
+ be_predefined_type *node
+ )
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
os->indent ();
+
*os << "this->result_val_ <<= ";
+
switch (node->pt ())
{
case AST_PredefinedType::PT_boolean:
*os << "CORBA::Any::from_boolean (this->result_);" << be_nl;
+
break;
case AST_PredefinedType::PT_char:
*os << "CORBA::Any::from_char (this->result_);"<<be_nl;
+
break;
case AST_PredefinedType::PT_wchar:
*os << "CORBA::Any::from_wchar (this->result_);"<<be_nl;
+
break;
case AST_PredefinedType::PT_octet:
*os << "CORBA::Any::from_octet (this->result_);"<<be_nl;
- break;
+ break;
default:
*os << "this->result_;"<<be_nl;
+
break;
}
- return 0;
+ return 0;
}
int be_visitor_args_request_info_result::visit_sequence (be_sequence *)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
-
+ TAO_OutStream *os = this->ctx_->stream ();
os->indent ();
+
*os << "this->result_val_ <<= this->result_;";
return 0;
-
}
int
be_visitor_args_request_info_result::visit_string (be_string *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
-
+ TAO_OutStream *os = this->ctx_->stream ();
os->indent ();
+
*os << "this->result_val_ <<= ";
- // we need to make a distinction between bounded and unbounded strings
+
+ // We need to make a distinction between bounded and unbounded strings.
if (node->max_size ()->ev ()->u.ulval != 0)
{
- // bounded strings
if (node->width () == (long) sizeof (char))
{
*os << "CORBA::Any::from_string ((char *)";
@@ -202,44 +217,45 @@ be_visitor_args_request_info_result::visit_string (be_string *node)
{
*os << "CORBA::Any::from_wstring ((CORBA::WChar *)";
}
+
*os <<"this->result_, "
<< node->max_size ()->ev ()->u.ulval
<< ");";
}
else
+ {
*os << "this->result_; ";
-return 0;
+ }
+
+ return 0;
}
int be_visitor_args_request_info_result::visit_structure (be_structure *)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
-
+ TAO_OutStream *os = this->ctx_->stream ();
os->indent ();
+
*os << "this->result_val_ <<= this->result_;";
return 0;
-
}
int be_visitor_args_request_info_result::visit_union (be_union *)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
-
+ TAO_OutStream *os = this->ctx_->stream ();
os->indent ();
+
*os << "this->result_val_ <<= this->result_;";
return 0;
-
}
int be_visitor_args_request_info_result::visit_typedef (be_typedef *)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
-
+ TAO_OutStream *os = this->ctx_->stream ();
os->indent ();
+
*os << "this->result_val_ <<= this->result_;";
return 0;
-
}
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/request_info_sh.cpp b/TAO/TAO_IDL/be/be_visitor_argument/request_info_sh.cpp
index 07ffc2bf17a..049d3e7d874 100644
--- a/TAO/TAO_IDL/be/be_visitor_argument/request_info_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_argument/request_info_sh.cpp
@@ -18,11 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "be.h"
-#include "be_visitor_argument.h"
-
-ACE_RCSID(be_visitor_argument, request_info_sh, "$Id$")
+ACE_RCSID (be_visitor_argument,
+ request_info_sh,
+ "$Id$")
// ************************************************************
@@ -30,7 +28,9 @@ ACE_RCSID(be_visitor_argument, request_info_sh, "$Id$")
// definitions
// ************************************************************
-be_visitor_args_request_info_sh::be_visitor_args_request_info_sh (be_visitor_context *ctx)
+be_visitor_args_request_info_sh::be_visitor_args_request_info_sh (
+ be_visitor_context *ctx
+ )
: be_visitor_args (ctx)
{
}
@@ -43,8 +43,6 @@ int be_visitor_args_request_info_sh::visit_argument (be_argument *node)
{
TAO_OutStream *os = this->ctx_->stream ();
this->ctx_->node (node);
-
- // retrieve the type
be_type *bt = be_type::narrow_from_decl (node->field_type ());
if (!bt)
@@ -70,8 +68,10 @@ int be_visitor_args_request_info_sh::visit_argument (be_argument *node)
// As we visit each type we print out the &.
*os <<" "<< node->local_name () << "_;" << be_nl;
+
return 0;
}
+
int be_visitor_args_request_info_sh::visit_array (be_array *node)
{
TAO_OutStream *os = this->ctx_->stream ();
@@ -88,12 +88,13 @@ int be_visitor_args_request_info_sh::visit_array (be_array *node)
*os << this->type_name (node, "_out");
break;
}
+
return 0;
}
int be_visitor_args_request_info_sh::visit_enum (be_enum *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (this->direction ())
{
@@ -107,12 +108,13 @@ int be_visitor_args_request_info_sh::visit_enum (be_enum *node)
*os << this->type_name (node, "_out");
break;
}
+
return 0;
}
int be_visitor_args_request_info_sh::visit_interface (be_interface *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (this->direction ())
{
@@ -126,12 +128,13 @@ int be_visitor_args_request_info_sh::visit_interface (be_interface *node)
*os << this->type_name (node, "_out");
break;
}
+
return 0;
}
int be_visitor_args_request_info_sh::visit_interface_fwd (be_interface_fwd *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (this->direction ())
{
@@ -145,12 +148,13 @@ int be_visitor_args_request_info_sh::visit_interface_fwd (be_interface_fwd *node
*os << this->type_name (node, "_out");
break;
}
+
return 0;
}
int be_visitor_args_request_info_sh::visit_native (be_native *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (this->direction ())
{
@@ -164,15 +168,18 @@ int be_visitor_args_request_info_sh::visit_native (be_native *node)
*os << this->type_name (node) << " &";
break;
}
+
return 0;
}
-int be_visitor_args_request_info_sh::visit_predefined_type (be_predefined_type *node)
+int be_visitor_args_request_info_sh::visit_predefined_type (
+ be_predefined_type *node
+ )
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
+ AST_PredefinedType::PredefinedType pt = node->pt ();
- // check if the type is an any
- if (node->pt () == AST_PredefinedType::PT_any)
+ if (pt == AST_PredefinedType::PT_any)
{
switch (this->direction ())
{
@@ -185,9 +192,10 @@ int be_visitor_args_request_info_sh::visit_predefined_type (be_predefined_type *
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
+ }
+ }
+ else if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
{
switch (this->direction ())
{
@@ -200,9 +208,9 @@ int be_visitor_args_request_info_sh::visit_predefined_type (be_predefined_type *
case AST_Argument::dir_OUT:
*os << this->type_name (node, "_out");
break;
- } // end switch direction
- } // end else if
- else // simple predefined types
+ }
+ }
+ else
{
switch (this->direction ())
{
@@ -223,7 +231,7 @@ int be_visitor_args_request_info_sh::visit_predefined_type (be_predefined_type *
int be_visitor_args_request_info_sh::visit_sequence (be_sequence *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get the stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (this->direction ())
{
@@ -237,12 +245,13 @@ int be_visitor_args_request_info_sh::visit_sequence (be_sequence *node)
*os << this->type_name (node, "_out");
break;
}
+
return 0;
}
int be_visitor_args_request_info_sh::visit_string (be_string *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get the stream
+ TAO_OutStream *os = this->ctx_->stream ();
if (node->width () == 1)
{
@@ -280,7 +289,7 @@ int be_visitor_args_request_info_sh::visit_string (be_string *node)
int be_visitor_args_request_info_sh::visit_structure (be_structure *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get the stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (this->direction ())
{
@@ -294,6 +303,7 @@ int be_visitor_args_request_info_sh::visit_structure (be_structure *node)
*os << this->type_name (node, "_out");
break;
}
+
return 0;
}
@@ -313,12 +323,14 @@ int be_visitor_args_request_info_sh::visit_union (be_union *node)
*os << this->type_name (node, "_out");
break;
}
+
return 0;
}
int be_visitor_args_request_info_sh::visit_typedef (be_typedef *node)
{
this->ctx_->alias (node);
+
if (node->primitive_base_type ()->accept (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -327,6 +339,7 @@ int be_visitor_args_request_info_sh::visit_typedef (be_typedef *node)
"accept on primitive type failed\n"),
-1);
}
+
this->ctx_->alias (0);
return 0;
}
@@ -334,7 +347,7 @@ int be_visitor_args_request_info_sh::visit_typedef (be_typedef *node)
int be_visitor_args_request_info_sh::visit_valuetype (be_valuetype *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get the stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (this->direction ())
{
@@ -348,12 +361,15 @@ int be_visitor_args_request_info_sh::visit_valuetype (be_valuetype *node)
*os << this->type_name (node, "_out");
break;
}
+
return 0;
}
-int be_visitor_args_request_info_sh::visit_valuetype_fwd (be_valuetype_fwd *node)
+int be_visitor_args_request_info_sh::visit_valuetype_fwd (
+ be_valuetype_fwd *node
+ )
{
- TAO_OutStream *os = this->ctx_->stream (); // get the stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (this->direction ())
{
@@ -367,6 +383,7 @@ int be_visitor_args_request_info_sh::visit_valuetype_fwd (be_valuetype_fwd *node
*os << this->type_name (node, "_out");
break;
}
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/request_info_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/request_info_ss.cpp
index e68b5b16c07..024686018c7 100644
--- a/TAO/TAO_IDL/be/be_visitor_argument/request_info_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_argument/request_info_ss.cpp
@@ -18,11 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "be.h"
-#include "be_visitor_argument.h"
-
-ACE_RCSID(be_visitor_argument, request_info_ss, "$Id$")
+ACE_RCSID (be_visitor_argument,
+ request_info_ss,
+ "$Id$")
// ************************************************************
@@ -30,7 +28,9 @@ ACE_RCSID(be_visitor_argument, request_info_ss, "$Id$")
// definitions
// ************************************************************
-be_visitor_args_request_info_ss::be_visitor_args_request_info_ss (be_visitor_context *ctx)
+be_visitor_args_request_info_ss::be_visitor_args_request_info_ss (
+ be_visitor_context *ctx
+ )
: be_visitor_args (ctx)
{
}
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/upcall_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/upcall_ss.cpp
index 857d33a1896..434f4f02025 100644
--- a/TAO/TAO_IDL/be/be_visitor_argument/upcall_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_argument/upcall_ss.cpp
@@ -19,11 +19,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "be.h"
-#include "be_visitor_argument.h"
-
-ACE_RCSID(be_visitor_argument, upcall_ss, "$Id$")
+ACE_RCSID (be_visitor_argument,
+ upcall_ss,
+ "$Id$")
// ************************************************************************
@@ -41,10 +39,9 @@ be_visitor_args_upcall_ss::~be_visitor_args_upcall_ss (void)
int be_visitor_args_upcall_ss::visit_argument (be_argument *node)
{
- this->ctx_->node (node); // save the argument node
-
- // retrieve the type
+ this->ctx_->node (node);
be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -70,9 +67,8 @@ int be_visitor_args_upcall_ss::visit_argument (be_argument *node)
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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
switch (this->direction ())
{
@@ -85,29 +81,40 @@ int be_visitor_args_upcall_ss::visit_array (be_array *node)
}
*os << arg->local_name ();
+
break;
case AST_Argument::dir_INOUT:
*os << arg->local_name ();
+
break;
case AST_Argument::dir_OUT:
- if (node->size_type () == be_decl::VARIABLE)
- if (this->ctx_->state ()
- == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
- *os << arg->local_name ();
- else
- *os << arg->local_name () << ".out ()";
+ if (node->size_type () == AST_Type::VARIABLE)
+ {
+ if (this->ctx_->state ()
+ == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
+ {
+ *os << arg->local_name ();
+ }
+ else
+ {
+ *os << arg->local_name () << ".out ()";
+ }
+ }
else
- *os << arg->local_name ();
+ {
+ *os << arg->local_name ();
+ }
+
break;
}
+
return 0;
}
int be_visitor_args_upcall_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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
switch (this->direction ())
{
@@ -115,190 +122,278 @@ int be_visitor_args_upcall_ss::visit_enum (be_enum *)
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 *)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
- be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument
- // node
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
+
switch (this->direction ())
{
case AST_Argument::dir_IN:
if (this->ctx_->state ()
- == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
- *os << arg->local_name ();
+ == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
+ {
+ *os << arg->local_name ();
+ }
else
- *os << arg->local_name () << ".in ()";
+ {
+ *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 ();
+ == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
+ {
+ *os << arg->local_name ();
+ }
else
- *os << arg->local_name () << ".inout ()";
+ {
+ *os << arg->local_name () << ".inout ()";
+ }
+
break;
case AST_Argument::dir_OUT:
if (this->ctx_->state ()
- == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
- *os << arg->local_name ();
+ == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
+ {
+ *os << arg->local_name ();
+ }
else
- *os << arg->local_name () << ".out ()";
+ {
+ *os << arg->local_name () << ".out ()";
+ }
+
break;
}
+
return 0;
}
int be_visitor_args_upcall_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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
+
switch (this->direction ())
{
case AST_Argument::dir_IN:
if (this->ctx_->state ()
- == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
- *os << arg->local_name ();
+ == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
+ {
+ *os << arg->local_name ();
+ }
else
- *os << arg->local_name () << ".in ()";
+ {
+ *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 ();
+ == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
+ {
+ *os << arg->local_name ();
+ }
else
- *os << arg->local_name () << ".inout ()";
+ {
+ *os << arg->local_name () << ".inout ()";
+ }
+
break;
case AST_Argument::dir_OUT:
if (this->ctx_->state ()
- == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
- *os << arg->local_name ();
+ == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
+ {
+ *os << arg->local_name ();
+ }
else
- *os << arg->local_name () << ".out ()";
+ {
+ *os << arg->local_name () << ".out ()";
+ }
+
break;
}
+
return 0;
}
int be_visitor_args_upcall_ss::visit_valuetype (be_valuetype *)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
- be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument
- // node
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
+
switch (this->direction ())
{
case AST_Argument::dir_IN:
if (this->ctx_->state ()
- == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
- *os << arg->local_name ();
+ == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
+ {
+ *os << arg->local_name ();
+ }
else
- *os << arg->local_name () << ".in ()";
+ {
+ *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 ();
+ == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
+ {
+ *os << arg->local_name ();
+ }
else
- *os << arg->local_name () << ".inout ()";
+ {
+ *os << arg->local_name () << ".inout ()";
+ }
+
break;
case AST_Argument::dir_OUT:
if (this->ctx_->state ()
- == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
- *os << arg->local_name ();
+ == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
+ {
+ *os << arg->local_name ();
+ }
else
- *os << arg->local_name () << ".out ()";
+ {
+ *os << arg->local_name () << ".out ()";
+ }
+
break;
}
+
return 0;
}
int be_visitor_args_upcall_ss::visit_valuetype_fwd (be_valuetype_fwd *)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
- be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument
- // node
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
+
switch (this->direction ())
{
case AST_Argument::dir_IN:
if (this->ctx_->state ()
- == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
- *os << arg->local_name ();
+ == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
+ {
+ *os << arg->local_name ();
+ }
else
- *os << arg->local_name () << ".in ()";
+ {
+ *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 ();
+ == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
+ {
+ *os << arg->local_name ();
+ }
else
- *os << arg->local_name () << ".inout ()";
+ {
+ *os << arg->local_name () << ".inout ()";
+ }
+
break;
case AST_Argument::dir_OUT:
if (this->ctx_->state ()
- == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
- *os << arg->local_name ();
+ == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
+ {
+ *os << arg->local_name ();
+ }
else
- *os << arg->local_name () << ".out ()";
+ {
+ *os << arg->local_name () << ".out ()";
+ }
+
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
- // check if the type is an any
- if (node->pt () == AST_PredefinedType::PT_any)
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
+ AST_PredefinedType::PredefinedType pt = node->pt ();
+
+ if (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:
if (this->ctx_->state ()
== TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
- *os << arg->local_name ();
+ {
+ *os << arg->local_name ();
+ }
else
- *os << arg->local_name () << ".out ()";
+ {
+ *os << arg->local_name () << ".out ()";
+ }
+
break;
- } // end switch direction
- } // end of if
- else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object
+ }
+ }
+ else if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
{
switch (this->direction ())
{
case AST_Argument::dir_IN:
if (this->ctx_->state ()
== TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
- *os << arg->local_name ();
+ {
+ *os << arg->local_name ();
+ }
else
- *os << arg->local_name () << ".in ()";
+ {
+ *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 ();
+ {
+ *os << arg->local_name ();
+ }
else
- *os << arg->local_name () << ".inout ()";
+ {
+ *os << arg->local_name () << ".inout ()";
+ }
+
break;
case AST_Argument::dir_OUT:
if (this->ctx_->state ()
== TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
- *os << arg->local_name ();
+ {
+ *os << arg->local_name ();
+ }
else
- *os << arg->local_name () << ".out ()";
+ {
+ *os << arg->local_name () << ".out ()";
+ }
+
break;
- } // end switch direction
- } // end else if
- else // simple predefined types
+ }
+ }
+ else
{
switch (this->direction ())
{
@@ -306,6 +401,7 @@ int be_visitor_args_upcall_ss::visit_predefined_type (be_predefined_type *node)
case AST_Argument::dir_INOUT:
case AST_Argument::dir_OUT:
*os << arg->local_name ();
+
break;
} // end switch direction
} // end of else
@@ -315,111 +411,157 @@ int be_visitor_args_upcall_ss::visit_predefined_type (be_predefined_type *node)
int be_visitor_args_upcall_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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
+
switch (this->direction ())
{
case AST_Argument::dir_IN:
case AST_Argument::dir_INOUT:
*os << arg->local_name ();
+
break;
case AST_Argument::dir_OUT:
if (this->ctx_->state ()
== TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
- *os << arg->local_name ();
+ {
+ *os << arg->local_name ();
+ }
else
- *os << arg->local_name () << ".out ()";
+ {
+ *os << arg->local_name () << ".out ()";
+ }
+
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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
+
switch (this->direction ())
{
case AST_Argument::dir_IN:
if (this->ctx_->state ()
== TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
- *os << arg->local_name ();
+ {
+ *os << arg->local_name ();
+ }
else
- *os << arg->local_name () << ".in ()";
+ {
+ *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 ();
+ {
+ *os << arg->local_name ();
+ }
else
+ {
*os << arg->local_name () << ".inout ()";
+ }
+
break;
case AST_Argument::dir_OUT:
if (this->ctx_->state ()
== TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
- *os << arg->local_name ();
+ {
+ *os << arg->local_name ();
+ }
else
- *os << arg->local_name () << ".out ()";
+ {
+ *os << arg->local_name () << ".out ()";
+ }
+
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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
+
switch (this->direction ())
{
case AST_Argument::dir_IN:
case AST_Argument::dir_INOUT:
*os << arg->local_name ();
+
break;
case AST_Argument::dir_OUT:
- if (node->size_type () == be_decl::VARIABLE)
- if (this->ctx_->state ()
- == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
- *os << arg->local_name ();
- else
- *os << arg->local_name () << ".out ()";
+ if (node->size_type () == AST_Type::VARIABLE)
+ {
+ if (this->ctx_->state ()
+ == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
+ {
+ *os << arg->local_name ();
+ }
+ else
+ {
+ *os << arg->local_name () << ".out ()";
+ }
+ }
else
- *os << arg->local_name ();
+ {
+ *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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
+
switch (this->direction ())
{
case AST_Argument::dir_IN:
case AST_Argument::dir_INOUT:
*os << arg->local_name ();
+
break;
case AST_Argument::dir_OUT:
- if (node->size_type () == be_decl::VARIABLE)
- if (this->ctx_->state ()
- == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
- *os << arg->local_name ();
- else
- *os << arg->local_name () << ".out ()";
+ if (node->size_type () == AST_Type::VARIABLE)
+ {
+ if (this->ctx_->state ()
+ == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS)
+ {
+ *os << arg->local_name ();
+ }
+ else
+ {
+ *os << arg->local_name () << ".out ()";
+ }
+ }
else
- *os << arg->local_name ();
+ {
+ *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,
@@ -428,6 +570,7 @@ int be_visitor_args_upcall_ss::visit_typedef (be_typedef *node)
"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
index 6113da06ab4..b6d69df63d6 100644
--- a/TAO/TAO_IDL/be/be_visitor_argument/vardecl_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_argument/vardecl_ss.cpp
@@ -19,18 +19,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "be.h"
-#include "be_visitor_argument.h"
-
-ACE_RCSID(be_visitor_argument, vardecl_ss, "$Id$")
+ACE_RCSID (be_visitor_argument,
+ vardecl_ss,
+ "$Id$")
// ************************************************************************
// 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_vardecl_ss::be_visitor_args_vardecl_ss (
+ be_visitor_context *ctx
+ )
: be_visitor_args (ctx)
{
}
@@ -41,10 +41,9 @@ be_visitor_args_vardecl_ss::~be_visitor_args_vardecl_ss (void)
int be_visitor_args_vardecl_ss::visit_argument (be_argument *node)
{
- this->ctx_->node (node); // save the argument node
-
- // retrieve the type
+ this->ctx_->node (node);
be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -56,7 +55,6 @@ int be_visitor_args_vardecl_ss::visit_argument (be_argument *node)
// 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,
@@ -71,30 +69,35 @@ int be_visitor_args_vardecl_ss::visit_argument (be_argument *node)
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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
be_type *bt;
+
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
switch (this->direction ())
{
case AST_Argument::dir_IN:
case AST_Argument::dir_INOUT:
os->indent ();
+
*os << bt->name () << " " << arg->local_name () << ";" << be_nl
<< bt->name () << "_forany _tao_forany_"
<< arg->local_name () << " (" << be_idt << be_idt_nl
<< arg->local_name () << be_uidt_nl
<< ");\n" << be_uidt;
- break;
+ break;
case AST_Argument::dir_OUT:
os->indent ();
+
if (node->size_type () == be_type::VARIABLE)
{
*os << bt->name () << "_var " << arg->local_name ()
@@ -105,22 +108,27 @@ int be_visitor_args_vardecl_ss::visit_array (be_array *node)
*os << bt->name () << " " << arg->local_name ()
<< ";\n\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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
be_type *bt;
+
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
switch (this->direction ())
{
@@ -128,172 +136,220 @@ int be_visitor_args_vardecl_ss::visit_enum (be_enum *node)
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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
be_type *bt;
+
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
switch (this->direction ())
{
case AST_Argument::dir_IN:
case AST_Argument::dir_INOUT:
os->indent ();
+
*os << bt->name () << "_var " << arg->local_name () << ";\n";
+
break;
case AST_Argument::dir_OUT:
os->indent ();
+
*os << bt->name () << "_var "
<< arg->local_name () << ";\n";
+
break;
}
+
return 0;
}
int be_visitor_args_vardecl_ss::visit_interface_fwd (be_interface_fwd *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
- be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument
- // node
- // if the current type is an alias, use that
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
be_type *bt;
+
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
switch (this->direction ())
{
case AST_Argument::dir_IN:
case AST_Argument::dir_INOUT:
os->indent ();
+
*os << bt->name () << "_var " << arg->local_name () << ";\n";
+
break;
case AST_Argument::dir_OUT:
os->indent ();
+
*os << bt->name () << "_var "
<< arg->local_name () << ";\n";
+
break;
}
+
return 0;
}
int be_visitor_args_vardecl_ss::visit_valuetype (be_valuetype *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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
be_type *bt;
+
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
switch (this->direction ())
{
case AST_Argument::dir_IN:
case AST_Argument::dir_INOUT:
os->indent ();
+
*os << bt->name () << "_var " << arg->local_name () << ";\n";
+
break;
case AST_Argument::dir_OUT:
os->indent ();
+
*os << bt->name () << "_var "
<< arg->local_name () << ";\n";
+
break;
}
+
return 0;
}
int be_visitor_args_vardecl_ss::visit_valuetype_fwd (be_valuetype_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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
be_type *bt;
+
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
switch (this->direction ())
{
case AST_Argument::dir_IN:
case AST_Argument::dir_INOUT:
os->indent ();
+
*os << bt->name () << "_var " << arg->local_name () << ";\n";
+
break;
case AST_Argument::dir_OUT:
os->indent ();
+
*os << bt->name () << "_var "
<< arg->local_name () << ";\n";
+
break;
}
+
return 0;
}
int be_visitor_args_vardecl_ss::visit_predefined_type (be_predefined_type *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
- be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument
- // node
- // if the current type is an alias, use that
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
be_type *bt;
+
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
+
+ AST_PredefinedType::PredefinedType pt = node->pt ();
- // check if the type is an any
- if (node->pt () == AST_PredefinedType::PT_any)
+ if (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 "
<< arg->local_name () << ";\n";
+
break;
- } // end switch direction
- } // end of if
- else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object
+ }
+ }
+ else if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
{
switch (this->direction ())
{
case AST_Argument::dir_IN:
case AST_Argument::dir_INOUT:
os->indent ();
+
*os << bt->name () << "_var " << arg->local_name ()
+
<< ";\n";
break;
case AST_Argument::dir_OUT:
os->indent ();
+
*os << bt->name () << "_var "
<< arg->local_name () << ";\n";
+
break;
- } // end switch direction
- } // end else if
- else // simple predefined types
+ }
+ }
+ else
{
switch (this->direction ())
{
@@ -301,47 +357,57 @@ int be_visitor_args_vardecl_ss::visit_predefined_type (be_predefined_type *node)
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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
be_type *bt;
+
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ 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 "
<< arg->local_name () << ";" << be_nl;
+
break;
}
+
return 0;
}
int be_visitor_args_vardecl_ss::visit_string (be_string *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
- be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument
- // node
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
+
switch (this->direction ())
{
case AST_Argument::dir_IN:
@@ -372,65 +438,80 @@ int be_visitor_args_vardecl_ss::visit_string (be_string *node)
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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
be_type *bt;
+
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ 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 "
<< arg->local_name () << ";\n";
}
else
- *os << bt->name () << " " << arg->local_name () << ";\n";
+ {
+ *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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_argument *arg = this->ctx_->be_node_as_argument ();
be_type *bt;
+
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ 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 "
@@ -438,15 +519,20 @@ int be_visitor_args_vardecl_ss::visit_union (be_union *node)
}
else
- *os << bt->name () << " " << arg->local_name () << ";\n";
+ {
+ *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,
@@ -455,6 +541,7 @@ int be_visitor_args_vardecl_ss::visit_typedef (be_typedef *node)
"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 3e09618fa28..5b425c96a6e 100644
--- a/TAO/TAO_IDL/be/be_visitor_array.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array.cpp
@@ -18,13 +18,26 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_enum.h"
+#include "be_type.h"
+#include "be_typedef.h"
+#include "be_predefined_type.h"
+#include "be_array.h"
+#include "be_string.h"
+#include "be_interface.h"
+#include "be_interface_fwd.h"
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
+#include "be_structure.h"
+#include "be_union.h"
+#include "be_sequence.h"
+#include "be_helper.h"
+#include "be_extern.h"
+#include "utl_identifier.h"
#include "be_visitor_array.h"
+#include "be_visitor_context.h"
-// include all the individual files
#include "be_visitor_array/array.cpp"
#include "be_visitor_array/array_ch.cpp"
#include "be_visitor_array/array_ci.cpp"
@@ -35,4 +48,6 @@
#include "be_visitor_array/cdr_op_ci.cpp"
#include "be_visitor_array/cdr_op_cs.cpp"
-ACE_RCSID(be, be_visitor_array, "$Id$")
+ACE_RCSID (be,
+ be_visitor_array,
+ "$Id$")
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
index c06cd148e8b..d91076f394f 100644
--- a/TAO/TAO_IDL/be/be_visitor_array/any_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array/any_op_ch.cpp
@@ -19,13 +19,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_array.h"
-
-ACE_RCSID(be_visitor_array, any_op_ch, "$Id$")
-
+ACE_RCSID (be_visitor_array,
+ any_op_ch,
+ "$Id$")
// ***************************************************************************
// Array visitor for generating Any operator declarations in the client header
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
index f61e08092f5..d54682fa490 100644
--- a/TAO/TAO_IDL/be/be_visitor_array/any_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array/any_op_cs.cpp
@@ -19,12 +19,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_array.h"
-
-ACE_RCSID(be_visitor_array, any_op_cs, "$Id$")
+ACE_RCSID (be_visitor_array,
+ any_op_cs,
+ "$Id$")
// ***************************************************************************
diff --git a/TAO/TAO_IDL/be/be_visitor_array/array.cpp b/TAO/TAO_IDL/be/be_visitor_array/array.cpp
index b591c362a4f..96bf2fcb913 100644
--- a/TAO/TAO_IDL/be/be_visitor_array/array.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array/array.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_array.h"
-#include "be_visitor_enum.h"
-
-ACE_RCSID(be_visitor_array, array, "$Id$")
+ACE_RCSID (be_visitor_array,
+ array,
+ "$Id$")
// ************************************************************************
@@ -43,7 +38,7 @@ be_visitor_array::~be_visitor_array (void)
int be_visitor_array::visit_array (be_array *)
{
- // must be overloaded by derived visitors
+ // Must be overloaded by derived visitors.
return -1;
}
@@ -60,14 +55,23 @@ be_visitor_array::visit_interface (be_interface *node)
be_type *bt;
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (this->ctx_->state () == TAO_CodeGen::TAO_ARRAY_CH)
- *os << bt->nested_type_name (this->ctx_->scope (), "_var");
+ {
+ *os << bt->nested_type_name (this->ctx_->scope (), "_var");
+ }
else
- *os << bt->name () << "_var";
+ {
+ *os << bt->name () << "_var";
+ }
+
return 0;
}
@@ -78,14 +82,77 @@ be_visitor_array::visit_interface_fwd (be_interface_fwd *node)
be_type *bt;
if (this->ctx_->alias ())
- bt = 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_valuetype (be_valuetype *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_valuetype_fwd (be_valuetype_fwd *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (this->ctx_->state () == TAO_CodeGen::TAO_ARRAY_CH)
- *os << bt->nested_type_name (this->ctx_->scope (), "_var");
+ {
+ *os << bt->nested_type_name (this->ctx_->scope (), "_var");
+ }
else
- *os << bt->name () << "_var";
+ {
+ *os << bt->name () << "_var";
+ }
+
return 0;
}
@@ -93,10 +160,18 @@ 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";
+ AST_PredefinedType::PredefinedType pt = node->pt ();
+
+ if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ *os << node->name () << "_var";
+ }
else
- *os << node->name ();
+ {
+ *os << node->name ();
+ }
+
return 0;
}
@@ -139,7 +214,6 @@ int
be_visitor_array::visit_typedef (be_typedef *node)
{
int result = this->visit_node (node);
-
TAO_OutStream *os = this->ctx_->stream ();
AST_Decl::NodeType nt = node->primitive_base_type ()->node_type ();
@@ -159,13 +233,22 @@ be_visitor_array::visit_node (be_type *node)
be_type *bt;
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (this->ctx_->state () == TAO_CodeGen::TAO_ARRAY_CH)
- *os << bt->nested_type_name (this->ctx_->scope ());
+ {
+ *os << bt->nested_type_name (this->ctx_->scope ());
+ }
else
- *os << bt->name ();
+ {
+ *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
index 62cc817c917..1825b00443e 100644
--- a/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_array.h"
-
-ACE_RCSID(be_visitor_array, array_ch, "$Id$")
-
+ACE_RCSID (be_visitor_array,
+ array_ch,
+ "$Id$")
// ************************************************************************
// visitor for array declaration in client header
@@ -43,7 +38,6 @@ 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 ();
- be_type *bt;
be_decl *scope = this->ctx_->scope ();
// Nothing to do if we are imported or code is already generated.
@@ -55,7 +49,7 @@ int be_visitor_array_ch::visit_array (be_array *node)
this->ctx_->node (node);
// Retrieve the type.
- bt = be_type::narrow_from_decl (node->base_type ());
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
if (!bt)
{
@@ -66,6 +60,10 @@ int be_visitor_array_ch::visit_array (be_array *node)
-1);
}
+ *os << be_nl << "// TAO_IDL - Generated from " << be_nl
+ << "// " __FILE__ << ":" << __LINE__
+ << be_nl << be_nl;
+
// Generate the ifdefined macro.
os->gen_ifdef_macro (node->flat_name ());
@@ -98,7 +96,9 @@ int be_visitor_array_ch::visit_array (be_array *node)
*os << " ";
- if (!this->ctx_->tdef ())
+ be_typedef *td = this->ctx_->tdef ();
+
+ if (td == 0)
{
// We are dealing with an anonymous array case. Generate a typedef with
// an _ prepended to the name.
@@ -166,7 +166,7 @@ int be_visitor_array_ch::visit_array (be_array *node)
}
// An out defn is generated only for a variable size array.
- if (node->size_type () == be_decl::VARIABLE)
+ if (node->size_type () == AST_Type::VARIABLE)
{
if (this->gen_out_defn (node) == -1)
{
@@ -217,22 +217,24 @@ int be_visitor_array_ch::visit_array (be_array *node)
{
// Typedefed array.
*os << storage_class << node->nested_type_name (scope, "_slice")
- << " *";
- *os << node->nested_type_name (scope, "_alloc") << " (void);" << be_nl;
- *os << storage_class << "void "
+ << " *" << be_nl;
+ *os << node->nested_type_name (scope, "_alloc") << " (void);"
+ << be_nl << be_nl;
+ *os << storage_class << "void" << be_nl
<< node->nested_type_name (scope, "_free")
<< " (" << be_idt << be_idt_nl;
*os << node->nested_type_name (scope, "_slice")
<< " *_tao_slice " << be_uidt_nl
- << ");" << be_uidt_nl;
- *os << storage_class << node->nested_type_name (scope, "_slice") << " *";
+ << ");" << be_uidt_nl << be_nl;
+ *os << storage_class << node->nested_type_name (scope, "_slice")
+ << " *" << be_nl;
*os << node->nested_type_name (scope, "_dup")
<< " (" << be_idt << be_idt_nl
<< "const ";
*os << node->nested_type_name (scope, "_slice")
<< " *_tao_slice" << be_uidt_nl
- << ");" << be_uidt_nl;
- *os << storage_class << "void "
+ << ");" << be_uidt_nl << be_nl;
+ *os << storage_class << "void" << be_nl
<< node->nested_type_name (scope, "_copy")
<< " (" << be_idt << be_idt_nl;
*os << node->nested_type_name (scope, "_slice") << " *_tao_to," << be_nl
@@ -245,24 +247,24 @@ int be_visitor_array_ch::visit_array (be_array *node)
{
// Anonymous array.
*os << storage_class << node->nested_type_name (scope, "_slice", "_")
- << " *";
+ << " *" << be_nl;
*os << node->nested_type_name (scope, "_alloc", "_")
- << " (void);" << be_nl;
- *os << storage_class << "void "
+ << " (void);" << be_nl << be_nl;
+ *os << storage_class << "void" << be_nl
<< node->nested_type_name (scope, "_free", "_")
<< " (" << be_idt << be_idt_nl;
*os << node->nested_type_name (scope, "_slice", "_")
<< " *_tao_slice" << be_uidt_nl
- << ");" << be_uidt_nl;
+ << ");" << be_uidt_nl << be_nl;
*os << storage_class << node->nested_type_name (scope, "_slice", "_")
- << " *";
+ << " *" << be_nl;
*os << node->nested_type_name (scope, "_dup", "_")
<< " (" << be_idt << be_idt_nl
<< "const ";
*os << node->nested_type_name (scope, "_slice", "_")
<< " *_tao_slice" << be_uidt_nl
- << ");" << be_uidt_nl;
- *os << storage_class << "void "
+ << ");" << be_uidt_nl << be_nl;
+ *os << storage_class << "void" << be_nl
<< node->nested_type_name (scope, "_copy", "_")
<< " (" << be_idt << be_idt_nl;
*os << node->nested_type_name (scope, "_slice", "_")
@@ -356,7 +358,7 @@ be_visitor_array_ch::gen_var_defn (be_array *node)
*os << "operator " << namebuf << "_slice * const &() const;"
<< be_nl;
- if (node->size_type () == be_decl::VARIABLE)
+ if (node->size_type () == AST_Type::VARIABLE)
{
*os << "operator " << namebuf << "_slice *&();" << be_nl;
}
@@ -375,7 +377,7 @@ be_visitor_array_ch::gen_var_defn (be_array *node)
*os << "// in, inout, out, _retn " << be_nl;
*os << "const " << namebuf << "_slice *in (void) const;" << be_nl;
- if (node->size_type () == be_decl::FIXED)
+ if (node->size_type () == AST_Type::FIXED)
{
*os << namebuf << "_slice *inout (void);" << be_nl;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp b/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp
index e89dc21302f..d5dc7a1647c 100644
--- a/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp
@@ -18,13 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_array.h"
-
-ACE_RCSID(be_visitor_array, array_ci, "$Id$")
+ACE_RCSID (be_visitor_array,
+ array_ci,
+ "$Id$")
// ************************************************************************
@@ -42,15 +38,17 @@ be_visitor_array_ci::~be_visitor_array_ci (void)
int be_visitor_array_ci::visit_array (be_array *node)
{
- // nothing to do if we are imported or code is already generated
+ // Nothing to do if we are imported or code is already generated.
if (node->imported () || (node->cli_inline_gen ()))
- return 0;
+ {
+ return 0;
+ }
this->ctx_->node (node); // save the array node
// If we contain an anonymous sequence, generate code for it here.
-
be_type *bt = be_type::narrow_from_decl (node->base_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -86,7 +84,7 @@ int be_visitor_array_ci::visit_array (be_array *node)
"var_defn failed\n"),
-1);
}
- if (node->size_type () == be_decl::VARIABLE)
+ if (node->size_type () == AST_Type::VARIABLE)
{
if (this->gen_out_impl (node) == -1)
{
@@ -118,22 +116,33 @@ int be_visitor_array_ci::visit_array (be_array *node)
int
be_visitor_array_ci::gen_var_impl (be_array *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // output stream
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ char nodename [NAMEBUFSIZE];
+ char fname [NAMEBUFSIZE];
+ char lname [NAMEBUFSIZE];
+
+ ACE_OS::memset (nodename,
+ '\0',
+ NAMEBUFSIZE);
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
+ ACE_OS::memset (lname,
+ '\0',
+ NAMEBUFSIZE);
- char nodename [NAMEBUFSIZE]; // node name
- char fname [NAMEBUFSIZE]; // to hold the full and
- char lname [NAMEBUFSIZE]; // local names of the var
- // save the node's local name and full name in a buffer for quick use later
- // on
- ACE_OS::memset (nodename, '\0', NAMEBUFSIZE);
- ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
- ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
if (this->ctx_->tdef ())
{
// typedefed node
- ACE_OS::sprintf (nodename, "%s", node->full_name ());
- ACE_OS::sprintf (fname, "%s_var", node->full_name ());
- ACE_OS::sprintf (lname, "%s_var",
+ ACE_OS::sprintf (nodename,
+ "%s",
+ node->full_name ());
+ ACE_OS::sprintf (fname,
+ "%s_var",
+ node->full_name ());
+ ACE_OS::sprintf (lname,
+ "%s_var",
node->local_name ()->get_string ());
}
else
@@ -143,26 +152,40 @@ be_visitor_array_ci::gen_var_impl (be_array *node)
// our local name. This needs to be inserted after the parents's name
if (node->is_nested ())
{
- be_decl *parent = be_scope::narrow_from_scope (node->defined_in ())->decl ();
- ACE_OS::sprintf (nodename, "%s::_%s", parent->full_name (),
+ be_decl *parent =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
+ ACE_OS::sprintf (nodename,
+ "%s::_%s",
+ parent->full_name (),
node->local_name ()->get_string ());
- ACE_OS::sprintf (fname, "%s::_%s_var", parent->full_name (),
+ ACE_OS::sprintf (fname,
+ "%s::_%s_var",
+ parent->full_name (),
node->local_name ()->get_string ());
- ACE_OS::sprintf (lname, "_%s_var",
+ ACE_OS::sprintf (lname,
+ "_%s_var",
node->local_name ()->get_string ());
}
else
{
- ACE_OS::sprintf (nodename, "_%s", node->full_name ());
- ACE_OS::sprintf (fname, "_%s_var", node->full_name ());
- ACE_OS::sprintf (lname, "_%s_var",
+ ACE_OS::sprintf (nodename,
+ "_%s",
+ node->full_name ());
+ ACE_OS::sprintf (fname,
+ "_%s_var",
+ node->full_name ());
+ ACE_OS::sprintf (lname,
+ "_%s_var",
node->local_name ()->get_string ());
}
}
- // generate the var implementation in the inline file
+ // Generate the var implementation in the inline file.
- os->indent (); // start with whatever was our current indent level
+ os->indent ();
+
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
*os << "// *************************************************************"
<< be_nl;
@@ -172,134 +195,140 @@ be_visitor_array_ci::gen_var_impl (be_array *node)
// default constr
*os << "ACE_INLINE" << be_nl;
*os << fname << "::" << lname <<
- " (void) // default constructor" << be_nl;
+ " (void)" << be_nl;
*os << " " << ": ptr_ (0)" << be_nl;
- *os << "{}\n\n";
+ *os << "{}" << be_nl << be_nl;
// constr from a _slice *
- os->indent ();
*os << "ACE_INLINE" << be_nl;
*os << fname << "::" << lname << " (" << nodename << "_slice *p)" << be_nl;
*os << " : ptr_ (p)" << be_nl;
- *os << "{}\n\n";
+ *os << "{}" << be_nl << be_nl;
// copy constructor (deep copy)
- os->indent ();
*os << "ACE_INLINE" << be_nl;
*os << fname << "::" << lname << " (const " << fname
- << " &p) // copy constructor" << be_nl;
+ << " &p)" << be_nl;
*os << "{" << be_idt_nl;
- *os << "this->ptr_ = " << nodename << "_dup " << "(ACE_const_cast (const "
- << nodename << "_slice *, p.ptr_));" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "this->ptr_ =" << be_idt_nl << nodename << "_dup " << "("
+ << be_idt << be_idt_nl
+ << "ACE_const_cast (" << be_idt << be_idt_nl
+ << "const "
+ << nodename << "_slice *," << be_nl
+ << "p.ptr_" << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
// destructor
- os->indent ();
*os << "ACE_INLINE" << be_nl;
- *os << fname << "::~" << lname << " (void) // destructor" << be_nl;
+ *os << fname << "::~" << lname << " (void)" << be_nl;
*os << "{" << be_idt_nl;
*os << nodename << "_free (this->ptr_);" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
// assignment operator
- os->indent ();
*os << "ACE_INLINE " << fname << " &" << be_nl;
*os << fname << "::operator= (" << nodename
<< "_slice *p)" << be_nl;
*os << "{" << be_idt_nl;
- *os << "// is what we own the same that is being assigned to us?"
+ *os << "// Is what we own the same that is being assigned to us?"
<< be_nl;
- *os << "if (this->ptr_ != p)" << be_nl;
+ *os << "if (this->ptr_ != p)" << be_idt_nl;
*os << "{" << be_idt_nl;
- *os << "// delete our stuff and assume ownership of p" << be_nl;
+ *os << "// Delete our stuff and assume ownership of p." << be_nl;
*os << nodename << "_free (this->ptr_);" << be_nl;
*os << "this->ptr_ = p;" << be_uidt_nl;
- *os << "}" << be_nl;
+ *os << "}" << be_uidt_nl << be_nl;
*os << "return *this;" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
// assignment operator from _var
- os->indent ();
*os << "ACE_INLINE " << fname << " &" << be_nl;
*os << fname << "::operator= (const " << fname
<< " &p)" << be_nl;
*os << "{" << be_idt_nl;
- *os << "if (this != &p)" << be_nl;
+ *os << "if (this != &p)" << be_idt_nl;
*os << "{" << be_idt_nl;
- *os << "// not assigning to ourselves" << be_nl;
- *os << nodename << "_free (this->ptr_); // free old stuff" << be_nl;
- *os << "// deep copy" << be_nl;
- *os << "this->ptr_ = " << nodename << "_dup (ACE_const_cast (const "
- << nodename << "_slice *, p.ptr_));" << be_uidt_nl;
- *os << "}" << be_nl;
+ *os << nodename << "_free (this->ptr_);" << be_nl;
+ *os << "// Deep copy." << be_nl;
+ *os << "this->ptr_ =" << be_idt_nl
+ << nodename << "_dup (" << be_idt << be_idt_nl
+ << "ACE_const_cast (" << be_idt << be_idt_nl
+ << "const " << nodename << "_slice *," << be_nl\
+ << "p.ptr_" << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl;
+ *os << "}" << be_uidt_nl << be_nl;
*os << "return *this;" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
// other extra methods - cast operators ()
- os->indent ();
*os << "ACE_INLINE " << be_nl;
*os << fname << "::operator " << nodename
- << "_slice * const &() const // cast" << be_nl;
+ << "_slice * const &() const" << be_nl;
*os << "{" << be_idt_nl;
*os << "return this->ptr_;" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
- if (node->size_type () == be_decl::VARIABLE)
+ if (node->size_type () == AST_Type::VARIABLE)
{
- os->indent ();
*os << "ACE_INLINE " << be_nl;
*os << fname << "::operator " << nodename
<< "_slice *&() // cast " << be_nl;
*os << "{" << be_idt_nl;
*os << "return this->ptr_;" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
}
// two operator []s instead of ->
- os->indent ();
*os << "ACE_INLINE " << be_nl;
*os << "const " << nodename << "_slice &" << be_nl;
*os << fname << "::operator[] (CORBA::ULong index) const" << be_nl;
*os << "{" << be_nl;
*os << "#if defined (ACE_HAS_BROKEN_IMPLICIT_CONST_CAST)" << be_idt_nl;
- *os << "return ACE_const_cast (const " << nodename
- << "_slice &, this->ptr_[index]);" << be_uidt_nl;
+ *os << "return ACE_const_cast (" << be_idt << be_idt_nl
+ << "const " << nodename
+ << "_slice &," << be_nl
+ << "this->ptr_[index]" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl;
*os << "#else" << be_idt_nl;
*os << "const " << nodename << "_slice &tmp = this->ptr_[index];" << be_nl;
*os << "return tmp;" << be_uidt_nl;
*os << "#endif /* ACE_HAS_BROKEN_IMPLICIT_CONST_CAST */" << be_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
- os->indent ();
*os << "ACE_INLINE " << be_nl;
*os << nodename << "_slice &" << be_nl;
*os << fname << "::operator[] (CORBA::ULong index)" << be_nl;
*os << "{" << be_idt_nl;
*os << "return this->ptr_[index];" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
// copy (in case we are a sequence element)
- os->indent ();
*os << "ACE_INLINE void" << be_nl;
- *os << fname << "::copy (" << nodename << "_slice *_tao_to, "
- << "const " << nodename << "_slice *_tao_from)" << be_nl;
+ *os << fname << "::copy (" << be_idt << be_idt_nl
+ << nodename << "_slice *_tao_to," << be_nl
+ << "const " << nodename << "_slice *_tao_from" << be_uidt_nl
+ << ")" << be_uidt_nl;
*os << "{" << be_idt_nl;
*os << nodename << "_copy (_tao_to, _tao_from);" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
// in, inout, out, and _retn
- os->indent ();
*os << "ACE_INLINE const " << nodename << "_slice *" << be_nl;
*os << fname << "::in (void) const" << be_nl;
*os << "{" << be_idt_nl;
- *os << "return ACE_const_cast (const " << nodename
- << "_slice *, this->ptr_);" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "return ACE_const_cast (" << be_idt << be_idt_nl
+ << "const " << nodename
+ << "_slice *," << be_nl
+ << "this->ptr_" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
- os->indent ();
- if (node->size_type () == be_decl::FIXED)
+ if (node->size_type () == AST_Type::FIXED)
{
*os << "ACE_INLINE " << nodename << "_slice *" << be_nl;
}
@@ -311,28 +340,25 @@ be_visitor_array_ci::gen_var_impl (be_array *node)
*os << fname << "::inout (void)" << be_nl;
*os << "{" << be_idt_nl;
*os << "return this->ptr_;" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
- os->indent ();
*os << "ACE_INLINE " << nodename << "_slice * &" << be_nl;
*os << fname << "::out (void)" << be_nl;
*os << "{" << be_idt_nl;
*os << nodename << "_free (this->ptr_);" << be_nl;
*os << "this->ptr_ = (" << nodename << "_slice *)0;" << be_nl;
*os << "return this->ptr_;" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
- os->indent ();
*os << "ACE_INLINE " << nodename << "_slice *" << be_nl;
*os << fname << "::_retn (void)" << be_nl;
*os << "{" << be_idt_nl;
*os << nodename << "_slice *tmp = this->ptr_;" << be_nl;
*os << "this->ptr_ = (" << nodename << "_slice *)0;" << be_nl;
*os << "return tmp;" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
// the additional ptr () member function
- os->indent ();
*os << "ACE_INLINE " << nodename << "_slice *" << be_nl;
*os << fname << "::ptr (void) const" << be_nl;
*os << "{" << be_idt_nl;
@@ -352,15 +378,26 @@ be_visitor_array_ci::gen_out_impl (be_array *node)
char lname [NAMEBUFSIZE]; // local names of the out class
// save the node's local name and full name in a buffer for quick use later
// on
- ACE_OS::memset (nodename, '\0', NAMEBUFSIZE);
- ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
- ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
+ ACE_OS::memset (nodename,
+ '\0',
+ NAMEBUFSIZE);
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
+ ACE_OS::memset (lname,
+ '\0',
+ NAMEBUFSIZE);
if (this->ctx_->tdef ())
{
// typedefed node
- ACE_OS::sprintf (nodename, "%s", node->full_name ());
- ACE_OS::sprintf (fname, "%s_out", node->full_name ());
- ACE_OS::sprintf (lname, "%s_out",
+ ACE_OS::sprintf (nodename,
+ "%s",
+ node->full_name ());
+ ACE_OS::sprintf (fname,
+ "%s_out",
+ node->full_name ());
+ ACE_OS::sprintf (lname,
+ "%s_out",
node->local_name ()->get_string ());
}
else
@@ -370,43 +407,56 @@ be_visitor_array_ci::gen_out_impl (be_array *node)
// our local name. This needs to be inserted after the parents's name
if (node->is_nested ())
{
- be_decl *parent = be_scope::narrow_from_scope (node->defined_in ())->decl ();
- ACE_OS::sprintf (nodename, "%s::_%s", parent->full_name (),
+ be_decl *parent =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
+ ACE_OS::sprintf (nodename,
+ "%s::_%s",
+ parent->full_name (),
node->local_name ()->get_string ());
- ACE_OS::sprintf (fname, "%s::_%s_out", parent->full_name (),
+ ACE_OS::sprintf (fname,
+ "%s::_%s_out",
+ parent->full_name (),
node->local_name ()->get_string ());
- ACE_OS::sprintf (lname, "_%s_out",
+ ACE_OS::sprintf (lname,
+ "_%s_out",
node->local_name ()->get_string ());
}
else
{
- ACE_OS::sprintf (nodename, "_%s", node->full_name ());
- ACE_OS::sprintf (fname, "_%s_out", node->full_name ());
- ACE_OS::sprintf (lname, "_%s_out",
+ ACE_OS::sprintf (nodename,
+ "_%s",
+ node->full_name ());
+ ACE_OS::sprintf (fname,
+ "_%s_out",
+ node->full_name ());
+ ACE_OS::sprintf (lname,
+ "_%s_out",
node->local_name ()->get_string ());
}
}
- // generate the out implementation in the inline file
+ // Generate the out implementation in the inline file.
- os->indent (); // start with whatever was our current indent level
+ os->indent ();
+
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
*os << "// *************************************************************"
<< be_nl;
*os << "// Inline operations for class " << fname << be_nl;
- *os << "// *************************************************************\n\n";
+ *os << "// *************************************************************"
+ << be_nl << be_nl;
- // constr from a pointer to slice
- os->indent ();
+ // Constructor from a pointer to slice.
*os << "ACE_INLINE" << be_nl;
*os << fname << "::" << lname << " (" << nodename << "_slice *&p)" << be_nl;
*os << " : ptr_ (p)" << be_nl;
*os << "{" << be_idt_nl;
*os << "this->ptr_ = 0;" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
// constructor from _var &
- os->indent ();
*os << "ACE_INLINE" << be_nl;
*os << fname << "::" << lname << " (" << nodename
<< "_var &p) // constructor from _var" << be_nl;
@@ -414,19 +464,17 @@ be_visitor_array_ci::gen_out_impl (be_array *node)
*os << "{" << be_idt_nl;
*os << nodename << "_free (this->ptr_);" << be_nl;
*os << "this->ptr_ = 0;" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
// copy constructor
- os->indent ();
*os << "ACE_INLINE" << be_nl;
*os << fname << "::" << lname << " (const " << fname
<< " &p) // copy constructor" << be_nl;
*os << " : ptr_ (ACE_const_cast ("
<< fname << "&,p).ptr_)" << be_nl;
- *os << "{}\n\n";
+ *os << "{}" << be_nl << be_nl;
// assignment operator from _out &
- os->indent ();
*os << "ACE_INLINE " << fname << " &" << be_nl;
*os << fname << "::operator= (const " << fname
<< " &p)" << be_nl;
@@ -434,39 +482,35 @@ be_visitor_array_ci::gen_out_impl (be_array *node)
*os << "this->ptr_ = ACE_const_cast ("
<< fname << "&,p).ptr_;" << be_nl;
*os << "return *this;" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
// assignment from _var is not allowed
// assignment operator from _ptr
- os->indent ();
*os << "ACE_INLINE " << fname << " &" << be_nl;
*os << fname << "::operator= (" << nodename
<< "_slice *p)" << be_nl;
*os << "{" << be_idt_nl;
*os << "this->ptr_ = p;" << be_nl;
*os << "return *this;" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
// other extra methods - cast operator ()
- os->indent ();
*os << "ACE_INLINE " << be_nl;
*os << fname << "::operator " << nodename
<< "_slice *&() // cast" << be_nl;
*os << "{" << be_idt_nl;
*os << "return this->ptr_;" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
// ptr function
- os->indent ();
*os << "ACE_INLINE " << nodename << "_slice *&" << be_nl;
*os << fname << "::ptr (void) // ptr" << be_nl;
*os << "{" << be_idt_nl;
*os << "return this->ptr_;" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
// operator [] instead of ->
- os->indent ();
*os << "ACE_INLINE " << nodename << "_slice &" << be_nl;
*os << fname << "::operator[] (CORBA::ULong index)" << be_nl;
*os << "{" << be_idt_nl;
@@ -482,22 +526,35 @@ be_visitor_array_ci::gen_forany_impl (be_array *node)
if (node->is_local ())
return 0;
- TAO_OutStream *os = this->ctx_->stream (); // output stream
+ TAO_OutStream *os = this->ctx_->stream ();
char nodename [NAMEBUFSIZE]; // node name
char fname [NAMEBUFSIZE]; // to hold the full and
- char lname [NAMEBUFSIZE]; // local names of the var
- // save the node's local name and full name in a buffer for quick use later
+ char lname [NAMEBUFSIZE]; // local names of the forany
+
+ // Save the node's local name and full name in a buffer for quick use later
// on
- ACE_OS::memset (nodename, '\0', NAMEBUFSIZE);
- ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
- ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
+ ACE_OS::memset (nodename,
+ '\0',
+ NAMEBUFSIZE);
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
+ ACE_OS::memset (lname,
+ '\0',
+ NAMEBUFSIZE);
+
if (this->ctx_->tdef ())
{
// typedefed node
- ACE_OS::sprintf (nodename, "%s", node->full_name ());
- ACE_OS::sprintf (fname, "%s_forany", node->full_name ());
- ACE_OS::sprintf (lname, "%s_forany",
+ ACE_OS::sprintf (nodename,
+ "%s",
+ node->full_name ());
+ ACE_OS::sprintf (fname,
+ "%s_forany",
+ node->full_name ());
+ ACE_OS::sprintf (lname,
+ "%s_forany",
node->local_name ()->get_string ());
}
else
@@ -507,19 +564,30 @@ be_visitor_array_ci::gen_forany_impl (be_array *node)
// our local name. This needs to be inserted after the parents's name
if (node->is_nested ())
{
- be_decl *parent = be_scope::narrow_from_scope (node->defined_in ())->decl ();
- ACE_OS::sprintf (nodename, "%s::_%s", parent->full_name (),
+ be_decl *parent =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
+ ACE_OS::sprintf (nodename,
+ "%s::_%s",
+ parent->full_name (),
node->local_name ()->get_string ());
- ACE_OS::sprintf (fname, "%s::_%s_forany", parent->full_name (),
+ ACE_OS::sprintf (fname,
+ "%s::_%s_forany",
+ parent->full_name (),
node->local_name ()->get_string ());
- ACE_OS::sprintf (lname, "_%s_forany",
+ ACE_OS::sprintf (lname,
+ "_%s_forany",
node->local_name ()->get_string ());
}
else
{
- ACE_OS::sprintf (nodename, "_%s", node->full_name ());
- ACE_OS::sprintf (fname, "_%s_forany", node->full_name ());
- ACE_OS::sprintf (lname, "_%s_forany",
+ ACE_OS::sprintf (nodename,
+ "_%s",
+ node->full_name ());
+ ACE_OS::sprintf (fname,
+ "_%s_forany",
+ node->full_name ());
+ ACE_OS::sprintf (lname,
+ "_%s_forany",
node->local_name ()->get_string ());
}
}
@@ -528,101 +596,109 @@ be_visitor_array_ci::gen_forany_impl (be_array *node)
os->indent (); // start with whatever was our current indent level
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
*os << "// *************************************************************"
<< be_nl;
*os << "// Inline operations for class " << fname << be_nl;
- *os << "// *************************************************************\n\n";
+ *os << "// *************************************************************"
+ << be_nl << be_nl;
// default constr
*os << "ACE_INLINE" << be_nl;
*os << fname << "::" << lname <<
- " (void) // default constructor" << be_nl;
+ " (void)" << be_nl;
*os << " " << ": ptr_ (0)," << be_nl;
*os << " nocopy_ (0)" << be_nl;
- *os << "{}\n\n";
+ *os << "{}" << be_nl << be_nl;
// constr from a _slice *
- os->indent ();
*os << "ACE_INLINE" << be_nl;
- *os << fname << "::" << lname << " (" << nodename << "_slice *p, "
- << "CORBA::Boolean nocopy)" << be_nl;
+ *os << fname << "::" << lname << " (" << be_idt << be_idt_nl
+ << nodename << "_slice *p," << be_nl
+ << "CORBA::Boolean nocopy" << be_uidt_nl
+ << ")" << be_uidt_nl;
*os << " : ptr_ (p)," << be_nl;
*os << " nocopy_ (nocopy)" << be_nl;
- *os << "{}\n\n";
+ *os << "{}" << be_nl << be_nl;
// copy constructor (deep copy)
- os->indent ();
*os << "ACE_INLINE" << be_nl;
- *os << fname << "::" << lname << " (const " << fname
- << " &p) // copy constructor" << be_nl;
- *os << "{" << be_idt_nl;
- *os << "this->ptr_ = " << nodename << "_dup (ACE_const_cast (const "
- << nodename << "_slice *, p.ptr_));" << be_nl;
+ *os << fname << "::" << lname << " (" << be_idt << be_idt_nl
+ << "const " << fname << " &p" << be_uidt_nl
+ << ")" << be_uidt_nl;
+ *os << "{" << be_idt_nl;
+ *os << "this->ptr_ =" << be_idt_nl
+ << nodename << "_dup (" << be_idt << be_idt_nl
+ << "ACE_const_cast (" << be_idt << be_idt_nl
+ << "const " << nodename << "_slice *," << be_nl
+ << "p.ptr_" << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl;
*os << "this->nocopy_ = p.nocopy_;" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
// destructor
- os->indent ();
*os << "ACE_INLINE" << be_nl;
- *os << fname << "::~" << lname << " (void) // destructor" << be_nl;
- *os << "{" << be_nl;
- *os << " // don't do anything" << be_nl;
- *os << "}\n\n";
+ *os << fname << "::~" << lname << " (void)" << be_nl;
+ *os << "{" << be_idt_nl;
+ *os << "// don't do anything" << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
// assignment operator
- os->indent ();
*os << "ACE_INLINE " << fname << " &" << be_nl;
*os << fname << "::operator= (" << nodename
<< "_slice *p)" << be_nl;
*os << "{" << be_idt_nl;
- *os << "// is what we own the same that is being assigned to us?"
+ *os << "// Is what we own the same that is being assigned to us?"
<< be_nl;
- *os << "if (this->ptr_ != p)" << be_nl;
+ *os << "if (this->ptr_ != p)" << be_idt_nl;
*os << "{" << be_idt_nl;
- *os << "// delete our stuff and assume ownership of p" << be_nl;
+ *os << "// Delete our stuff and assume ownership of p." << be_nl;
*os << nodename << "_free (this->ptr_);" << be_nl;
*os << "this->ptr_ = p;" << be_uidt_nl;
- *os << "}" << be_nl;
+ *os << "}" << be_uidt_nl << be_nl;
*os << "return *this;" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
// assignment operator from _forany
- os->indent ();
*os << "ACE_INLINE " << fname << " &" << be_nl;
*os << fname << "::operator= (const " << fname
<< " &p)" << be_nl;
*os << "{" << be_idt_nl;
- *os << "if (this != &p)" << be_nl;
+ *os << "if (this != &p)" << be_idt_nl;
*os << "{" << be_idt_nl;
- *os << "// not assigning to ourselves" << be_nl;
- *os << nodename << "_free (this->ptr_); // free old stuff" << be_nl;
- *os << "// deep copy" << be_nl;
- *os << "this->ptr_ = " << nodename << "_dup (ACE_const_cast (const "
- << nodename << "_slice *, p.ptr_));" << be_nl;
+ *os << nodename << "_free (this->ptr_);" << be_nl;
+ *os << "// Deep copy." << be_nl;
+ *os << "this->ptr_ =" << be_idt_nl
+ << nodename << "_dup (" << be_idt << be_idt_nl
+ << "ACE_const_cast (" << be_idt << be_idt_nl
+ << "const " << nodename << "_slice *," << be_nl
+ << "p.ptr_" << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl;
*os << "this->nocopy_ = p.nocopy_;" << be_uidt_nl;
- *os << "}" << be_nl;
+ *os << "}" << be_uidt_nl << be_nl;
*os << "return *this;" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
// other extra methods - cast operators ()
- os->indent ();
*os << "ACE_INLINE " << be_nl;
*os << fname << "::operator " << nodename
- << "_slice * const &() const // cast" << be_nl;
+ << "_slice * const &() const" << be_nl;
*os << "{" << be_idt_nl;
*os << "return this->ptr_;" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
- os->indent ();
*os << "ACE_INLINE " << be_nl;
*os << fname << "::operator " << nodename
- << "_slice *&() // cast " << be_nl;
+ << "_slice *&()" << be_nl;
*os << "{" << be_idt_nl;
*os << "return this->ptr_;" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
// two operator []s instead of ->
- os->indent ();
*os << "ACE_INLINE " << be_nl;
*os << "const " << nodename << "_slice &" << be_nl;
*os << fname << "::operator[] (CORBA::ULong index) const" << be_nl;
@@ -632,63 +708,60 @@ be_visitor_array_ci::gen_forany_impl (be_array *node)
// not accept one, but will do it implicitly with a temporary.
// It's only a problem with multidimensional arrays.
#if defined (ACE_HAS_BROKEN_IMPLICIT_CONST_CAST)
- *os << "return ACE_const_cast (const " << nodename
- << "_slice &, this->ptr_[index]);" << be_uidt_nl;
+ *os << "return ACE_const_cast (" << be_idt << be_idt_nl
+ << "const " << nodename << "_slice &," << be_nl
+ << "this->ptr_[index]" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl;
#else
*os << "const " << nodename << "_slice &tmp = this->ptr_[index];" << be_nl;
*os << "return tmp;" << be_uidt_nl;
#endif /* ACE_HAS_BROKEN_IMPLICIT_CONST_CAST */
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
- os->indent ();
*os << "ACE_INLINE " << be_nl;
*os << nodename << "_slice &" << be_nl;
*os << fname << "::operator[] (CORBA::ULong index)" << be_nl;
*os << "{" << be_idt_nl;
*os << "return this->ptr_[index];" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
// in, inout, out, and _retn
- os->indent ();
*os << "ACE_INLINE const " << nodename << "_slice *" << be_nl;
*os << fname << "::in (void) const" << be_nl;
*os << "{" << be_idt_nl;
- *os << "return ACE_const_cast (const " << nodename
- << "_slice *, this->ptr_);" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "return ACE_const_cast (" << be_idt << be_idt_nl
+ << "const " << nodename << "_slice *," << be_nl
+ << "this->ptr_" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
- os->indent ();
*os << "ACE_INLINE " << nodename << "_slice *" << be_nl;
*os << fname << "::inout (void)" << be_nl;
*os << "{" << be_idt_nl;
*os << "return this->ptr_;" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
- os->indent ();
*os << "ACE_INLINE " << nodename << "_slice * &" << be_nl;
*os << fname << "::out (void)" << be_nl;
*os << "{" << be_idt_nl;
*os << "return this->ptr_;" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
- os->indent ();
*os << "ACE_INLINE " << nodename << "_slice *" << be_nl;
*os << fname << "::_retn (void)" << be_nl;
*os << "{" << be_idt_nl;
*os << "return this->ptr_;" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
// the additional ptr () member function
- os->indent ();
*os << "ACE_INLINE " << nodename << "_slice *" << be_nl;
*os << fname << "::ptr (void) const" << be_nl;
*os << "{" << be_idt_nl;
*os << "return this->ptr_;" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
// the additional nocopy member function
- os->indent ();
*os << "ACE_INLINE CORBA::Boolean" << be_nl;
*os << fname << "::nocopy (void) const" << be_nl;
*os << "{" << be_idt_nl;
diff --git a/TAO/TAO_IDL/be/be_visitor_array/array_cs.cpp b/TAO/TAO_IDL/be/be_visitor_array/array_cs.cpp
index 23048045acc..8040f161617 100644
--- a/TAO/TAO_IDL/be/be_visitor_array/array_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array/array_cs.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_array.h"
-
-ACE_RCSID(be_visitor_array, array_cs, "$Id$")
-
+ACE_RCSID (be_visitor_array,
+ array_cs,
+ "$Id$")
// ************************************************************************
// visitor for array declaration in client stubs
@@ -43,7 +38,6 @@ 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 ();
- be_type *bt;
unsigned long i;
// Nothing to do if we are imported or code is already generated.
@@ -55,7 +49,7 @@ int be_visitor_array_cs::visit_array (be_array *node)
this->ctx_->node (node);
// Retrieve the type.
- bt = be_type::narrow_from_decl (node->base_type ());
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
if (!bt)
{
@@ -114,23 +108,32 @@ int be_visitor_array_cs::visit_array (be_array *node)
os->indent ();
- *os << "void " << fname << "_forany"
- << "::_tao_any_destructor (void *_tao_void_pointer)" << be_nl
- << "{" << be_idt_nl
- << lname << "_slice *tmp = ACE_static_cast ("
- << lname << "_slice*, _tao_void_pointer);" << be_nl
- << lname << "_free (tmp);" << be_uidt_nl
- << "}\n\n";
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ if (!node->is_local ())
+ {
+ *os << "void " << fname << "_forany"
+ << "::_tao_any_destructor (void *_tao_void_pointer)" << be_nl
+ << "{" << be_idt_nl
+ << lname << "_slice *tmp = ACE_static_cast ("
+ << lname << "_slice*, _tao_void_pointer);" << be_nl
+ << lname << "_free (tmp);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
// dup method.
*os << fname << "_slice *" << be_nl
<< fname << "_dup (const " << fname
<< "_slice *_tao_src_array)" << be_nl;
*os << "{" << be_idt_nl;
- *os << fname << "_slice *_tao_dup_array = " << fname
- << "_alloc ();" << be_nl;
- *os << "if (!_tao_dup_array) return (" << fname
- << "_slice *)0;" << be_nl;
+ *os << fname << "_slice *_tao_dup_array =" << be_idt_nl
+ << fname << "_alloc ();" << be_uidt_nl << be_nl;
+ *os << "if (!_tao_dup_array)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return (" << fname
+ << "_slice *)0;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
*os << fname << "_copy (_tao_dup_array, _tao_src_array);" << be_nl;
*os << "return _tao_dup_array;" << be_uidt_nl;
*os << "}\n\n";
@@ -177,13 +180,17 @@ int be_visitor_array_cs::visit_array (be_array *node)
// copy method.
os->indent ();
*os << "void " << be_nl;
- *os << fname << "_copy (" << fname << "_slice * _tao_to, "
- << "const " << fname << "_slice *_tao_from)" << be_nl;
+ *os << fname << "_copy (" << be_idt << be_idt_nl
+ << fname << "_slice * _tao_to," << be_nl
+ << "const " << fname << "_slice *_tao_from" << be_uidt_nl
+ << ")" << be_uidt_nl;
*os << "{" << be_idt_nl;
- *os << "// copy each individual element" << be_nl;
+ *os << "// Copy each individual element." << be_nl;
+
+ unsigned long ndims = node->n_dims ();
// Generate nested loops for as many dimensions as there are.
- for (i = 0; i < node->n_dims (); i++)
+ for (i = 0; i < ndims; ++i)
{
// Retrieve the ith dimension value.
AST_Expression *expr = node->dims ()[i];
@@ -201,7 +208,8 @@ int be_visitor_array_cs::visit_array (be_array *node)
{
// Generate a loop for each dimension.
*os << "for (CORBA::ULong i" << i << " = 0; i" << i << " < "
- << expr->ev ()->u.ulval << "; i" << i << "++)" << be_idt_nl;
+ << expr->ev ()->u.ulval << "; ++i" << i << ")" << be_idt_nl
+ << "{" << be_idt_nl;
}
else
{
@@ -253,7 +261,7 @@ int be_visitor_array_cs::visit_array (be_array *node)
*os << "_copy (_tao_to";
- for (i = 0; i < node->n_dims (); i++)
+ for (i = 0; i < ndims; ++i)
{
*os << "[i" << i << "]";
}
@@ -261,7 +269,7 @@ int be_visitor_array_cs::visit_array (be_array *node)
*os << ", ";
*os << "_tao_from";
- for (i = 0; i < node->n_dims (); i++)
+ for (i = 0; i < ndims; ++i)
{
*os << "[i" << i << "]";
}
@@ -275,7 +283,7 @@ int be_visitor_array_cs::visit_array (be_array *node)
*os << "_tao_to";
- for (i = 0; i < node->n_dims (); i++)
+ for (i = 0; i < ndims; ++i)
{
*os << "[i" << i << "]";
}
@@ -283,18 +291,20 @@ int be_visitor_array_cs::visit_array (be_array *node)
*os << " = ";
*os << "_tao_from";
- for (i = 0; i < node->n_dims (); i++)
+ for (i = 0; i < ndims; ++i)
{
*os << "[i" << i << "]";
}
*os << ";";
}
- for (i = 0; i < node->n_dims (); i++)
+
+ for (i = 0; i < ndims; ++i)
{
- // Decrement indentation as many times as the number of dimensions.
- *os << be_uidt;
+ // Add closing braces as many times as the number of dimensions.
+ *os << be_uidt_nl << "}" << be_uidt;
}
+
*os << be_uidt_nl << "}\n\n";
// If we contain an anonymous sequence,
@@ -314,6 +324,5 @@ int be_visitor_array_cs::visit_array (be_array *node)
}
node->cli_stub_gen (1);
-
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ch.cpp
index 26c010a1011..551ff95a687 100644
--- a/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ch.cpp
@@ -19,15 +19,11 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_array.h"
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_array, cdr_op_ch, "$Id$")
+#include "be_visitor_sequence/cdr_op_ch.h"
+ACE_RCSID (be_visitor_array,
+ cdr_op_ch,
+ "$Id$")
// ***************************************************************************
// Array visitor for generating CDR operator declarations in the client header
@@ -77,8 +73,7 @@ be_visitor_array_cdr_op_ch::visit_array (be_array *node)
// Generate the CDR << and >> operator declarations.
*os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator<< (TAO_OutputCDR &, const ";
- // @@ TODO: this should be done in the node, it is absurd to repeat
- // this code all over the visitors!!!!
+
if (!this->ctx_->tdef ())
{
be_scope* scope = be_scope::narrow_from_scope (node->defined_in ());
diff --git a/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp
index d013f66bf35..1d781d2d4b5 100644
--- a/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp
@@ -19,14 +19,11 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_array.h"
-
-ACE_RCSID(be_visitor_array, cdr_op_ci, "$Id$")
+ACE_RCSID (be_visitor_array,
+ cdr_op_ci,
+ "$Id$")
+#include "be_visitor_sequence/cdr_op_ci.h"
// ***************************************************************************
// Array visitor for generating CDR operator declarations in the client
@@ -60,15 +57,13 @@ be_visitor_array_cdr_op_ci::visit_array (be_array *node)
}
else
{
- TAO_OutStream *os = this->ctx_->stream ();
-
if (node->cli_inline_cdr_op_gen () || node->imported ())
{
return 0;
}
- // Retrieve the base type.
be_type *bt = be_type::narrow_from_decl (node->base_type ());
+ TAO_OutStream *os = this->ctx_->stream ();
if (!bt)
{
@@ -117,18 +112,24 @@ be_visitor_array_cdr_op_ci::visit_array (be_array *node)
else
{
// For anonymous arrays ...
- // we have to generate a name for us that has an underscope prepended to
- // our local name. This needs to be inserted after the parents's name.
+ // We have to generate a name for us that has an underscope prepended
+ // to our local name. This needs to be inserted after the parents's
+ // name.
if (node->is_nested ())
{
- be_decl *parent = be_scope::narrow_from_scope (node->defined_in ())->decl ();
- ACE_OS::sprintf (fname, "%s::_%s", parent->full_name (),
+ be_decl *parent =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
+ ACE_OS::sprintf (fname,
+ "%s::_%s",
+ parent->full_name (),
node->local_name ()->get_string ());
}
else
{
- ACE_OS::sprintf (fname, "_%s", node->full_name ());
+ ACE_OS::sprintf (fname,
+ "_%s",
+ node->full_name ());
}
}
@@ -139,9 +140,10 @@ be_visitor_array_cdr_op_ci::visit_array (be_array *node)
// Set the sub state as generating code for the output operator.
this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_OUTPUT);
-
- *os << "ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &strm, "
- << "const " << fname << "_forany &_tao_array)" << be_nl
+ *os << "ACE_INLINE CORBA::Boolean operator<< (" << be_idt << be_idt_nl
+ << "TAO_OutputCDR &strm," << be_nl
+ << "const " << fname << "_forany &_tao_array" << be_uidt_nl
+ << ")" << be_uidt_nl
<< "{" << be_idt_nl;
if (bt->accept (this) == -1)
@@ -159,9 +161,10 @@ be_visitor_array_cdr_op_ci::visit_array (be_array *node)
os->indent ();
this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_INPUT);
-
- *os << "ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &strm, "
- << fname << "_forany &_tao_array)" << be_nl
+ *os << "ACE_INLINE CORBA::Boolean operator>> (" << be_idt << be_idt_nl
+ << "TAO_InputCDR &strm," << be_nl
+ << fname << "_forany &_tao_array" << be_uidt_nl
+ << ")" << be_uidt_nl
<< "{" << be_idt_nl;
if (bt->accept (this) == -1)
@@ -202,6 +205,18 @@ be_visitor_array_cdr_op_ci::visit_interface_fwd (be_interface_fwd *node)
}
int
+be_visitor_array_cdr_op_ci::visit_valuetype (be_valuetype *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array_cdr_op_ci::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ return this->visit_node (node);
+}
+
+int
be_visitor_array_cdr_op_ci::visit_predefined_type (be_predefined_type *node)
{
TAO_OutStream *os = this->ctx_->stream ();
@@ -209,6 +224,7 @@ be_visitor_array_cdr_op_ci::visit_predefined_type (be_predefined_type *node)
switch (node->pt ())
{
case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
case AST_PredefinedType::PT_any:
// Let the helper handle this.
return this->visit_node (node);
@@ -217,8 +233,8 @@ be_visitor_array_cdr_op_ci::visit_predefined_type (be_predefined_type *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_array_cdr_op_ci::"
"visit_predefined_type - "
- "Bad primitive type\n"
- ), -1);
+ "Bad primitive type\n"),
+ -1);
default:
// All other primitive types. Handle them as shown below.
break;
@@ -226,8 +242,8 @@ be_visitor_array_cdr_op_ci::visit_predefined_type (be_predefined_type *node)
// We get here if the "type" of individual elements of the array is a
// primitive type. In this case, we treat the array as a single dimensional
- // array (even though it was multi-dimensional), and pass the total length of
- // the array as a cross product of the dimensions.
+ // array (even though it was multi-dimensional), and pass the total length
+ // of the array as a cross product of the dimensions.
unsigned long i;
@@ -399,14 +415,16 @@ be_visitor_array_cdr_op_ci::visit_predefined_type (be_predefined_type *node)
-1);
}
- // Generate a product of all the dimensions. This will be the total length of
- // the "unfolded" single dimensional array.
- for (i = 0; i < array->n_dims (); ++i)
+ unsigned long ndims = array->n_dims ();
+
+ // Generate a product of all the dimensions. This will be the total length
+ // of the "unfolded" single dimensional array.
+ for (i = 0; i < ndims; ++i)
{
// Retrieve the ith dimension value.
AST_Expression *expr = array->dims ()[i];
- if ((expr == NULL) || ((expr != NULL) && (expr->ev () == NULL)))
+ if ((expr == 0) || ((expr != 0) && (expr->ev () == 0)))
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_array_cdr_op_ci::"
@@ -506,12 +524,14 @@ be_visitor_array_cdr_op_ci::visit_node (be_type *bt)
// Initialize a boolean variable.
*os << "CORBA::Boolean _tao_marshal_flag = 1;" << be_nl;
+ unsigned long ndims = node->n_dims ();
+
// We get here if the "type" of individual elements of the array is not a
// primitive type. In this case, we are left with no other alternative but to
// encode/decode element by element.
- // Generate nested loops for as many dimensions as there are.
- for (i = 0; i < node->n_dims (); i++)
+ // generate nested loops for as many dimensions as there are
+ for (i = 0; i < ndims; ++i)
{
// Retrieve the ith dimension value.
AST_Expression *expr = node->dims ()[i];
@@ -528,8 +548,8 @@ be_visitor_array_cdr_op_ci::visit_node (be_type *bt)
if (expr->ev ()->et == AST_Expression::EV_ulong)
{
// Generate a loop for each dimension.
- *os << be_nl << "for (CORBA::ULong i" << i << " = 0; i"
- << i << " < "
+ *os << be_nl << "for (CORBA::ULong i" << i
+ << " = 0; i" << i << " < "
<< expr->ev ()->u.ulval << " && _tao_marshal_flag; i" << i
<< "++)" << be_idt_nl;
}
@@ -558,7 +578,7 @@ be_visitor_array_cdr_op_ci::visit_node (be_type *bt)
*os << "_tao_marshal_flag = (strm >> tmp);" << be_nl;
*os << bt->name () << "_copy (_tao_array";
- for (i = 0; i < node->n_dims (); i++)
+ for (i = 0; i < ndims; ++i)
{
*os << "[i" << i << "]";
}
@@ -584,6 +604,8 @@ be_visitor_array_cdr_op_ci::visit_node (be_type *bt)
case AST_Decl::NT_wstring:
case AST_Decl::NT_interface:
case AST_Decl::NT_interface_fwd:
+ case AST_Decl::NT_valuetype:
+ case AST_Decl::NT_valuetype_fwd:
*os << ".out ()";
break;
case AST_Decl::NT_pre_defined:
@@ -602,7 +624,10 @@ be_visitor_array_cdr_op_ci::visit_node (be_type *bt)
-1);
}
- if (pt->pt () == AST_PredefinedType::PT_pseudo)
+ AST_PredefinedType::PredefinedType pdt = pt->pt ();
+
+ if (pdt == AST_PredefinedType::PT_pseudo
+ || pdt == AST_PredefinedType::PT_object)
{
*os << ".out ()";
}
@@ -627,7 +652,7 @@ be_visitor_array_cdr_op_ci::visit_node (be_type *bt)
*os << bt->name () << "_var tmp_var ("
<< bt->name () << "_dup (_tao_array";
- for (i = 0; i < node->n_dims (); i++)
+ for (i = 0; i < ndims; ++i)
{
*os << "[i" << i << "]";
}
@@ -641,7 +666,7 @@ be_visitor_array_cdr_op_ci::visit_node (be_type *bt)
*os << "_tao_marshal_flag = (strm << ";
*os << "_tao_array ";
- for (i = 0; i < node->n_dims (); i++)
+ for (i = 0; i < ndims; ++i)
{
*os << "[i" << i << "]";
}
@@ -654,6 +679,8 @@ be_visitor_array_cdr_op_ci::visit_node (be_type *bt)
case AST_Decl::NT_wstring:
case AST_Decl::NT_interface:
case AST_Decl::NT_interface_fwd:
+ case AST_Decl::NT_valuetype:
+ case AST_Decl::NT_valuetype_fwd:
*os << ".in ()";
break;
case AST_Decl::NT_pre_defined:
@@ -672,7 +699,10 @@ be_visitor_array_cdr_op_ci::visit_node (be_type *bt)
-1);
}
- if (pt->pt () == AST_PredefinedType::PT_pseudo)
+ AST_PredefinedType::PredefinedType pdt = pt->pt ();
+
+ if (pdt == AST_PredefinedType::PT_pseudo
+ || pdt == AST_PredefinedType::PT_object)
{
*os << ".in ()";
}
@@ -695,7 +725,7 @@ be_visitor_array_cdr_op_ci::visit_node (be_type *bt)
-1);
}
- for (i = 0; i < node->n_dims (); ++i)
+ for (i = 0; i < ndims; ++i)
{
// Decrement indentation as many times as the number of dimensions.
*os << be_uidt;
diff --git a/TAO/TAO_IDL/be/be_visitor_array/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_array/cdr_op_cs.cpp
index 32ab61bb987..750f5f9bcfd 100644
--- a/TAO/TAO_IDL/be/be_visitor_array/cdr_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array/cdr_op_cs.cpp
@@ -19,11 +19,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_array.h"
+ACE_RCSID (be_visitor_array,
+ cdr_op_cs,
+ "$Id$")
// ***************************************************************************
// Array visitor for generating CDR operator declarations in the client
diff --git a/TAO/TAO_IDL/be/be_visitor_attribute.cpp b/TAO/TAO_IDL/be/be_visitor_attribute.cpp
index 7b11a6294c2..b85b330d9a0 100644
--- a/TAO/TAO_IDL/be/be_visitor_attribute.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_attribute.cpp
@@ -18,14 +18,19 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_attribute.h"
+#include "be_operation.h"
+#include "be_predefined_type.h"
+#include "be_argument.h"
+#include "utl_identifier.h"
#include "be_visitor_attribute.h"
+#include "be_visitor_context.h"
+#include "be_visitor_operation.h"
-// include all the individual files
#include "be_visitor_attribute/attribute.cpp"
-ACE_RCSID(be, be_visitor_attribute, "$Id$")
+ACE_RCSID (be,
+ be_visitor_attribute,
+ "$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp
index d888053524e..6c9264184ce 100644
--- a/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_attribute.h"
-
-ACE_RCSID(be_visitor_attribute, attribute, "$Id$")
-
+ACE_RCSID (be_visitor_attribute,
+ attribute,
+ "$Id$")
// 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
@@ -65,29 +60,30 @@ be_visitor_attribute::~be_visitor_attribute (void)
int
be_visitor_attribute::visit_attribute (be_attribute *node)
{
- this->ctx_->node (node); // save the node
- this->ctx_->attribute (node); // save this attribute node
+ this->ctx_->node (node);
+ this->ctx_->attribute (node);
// first the "get" operation
- be_operation *op = new be_operation (node->field_type (),
- AST_Operation::OP_noflags,
- node->name (),
- node->is_local (),
- node->is_abstract ());
- op->set_name ((UTL_IdList *) node->name ()->copy ());
- op->set_defined_in (node->defined_in ());
+ be_operation get_op (node->field_type (),
+ AST_Operation::OP_noflags,
+ node->name (),
+ node->is_local (),
+ node->is_abstract ());
+
+ get_op.set_name ((UTL_IdList *) node->name ()->copy ());
+ get_op.set_defined_in (node->defined_in ());
// Get the strategy from the attribute and hand it over
- // to the operation
- delete op->set_strategy (node->get_get_strategy ());
+ // to the operation.
+ delete get_op.set_strategy (node->get_get_strategy ());
be_visitor_context ctx (*this->ctx_);
+ int status = 1;
- // this switch statement eliminates the need for different classes that have
- // exactly the same code except different states.
switch (this->ctx_->state ())
{
+ // These two cases are the only ones that could involved a strategy.
case TAO_CodeGen::TAO_ATTRIBUTE_CH:
ctx.state (TAO_CodeGen::TAO_OPERATION_CH);
break;
@@ -95,61 +91,119 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
ctx.state (TAO_CodeGen::TAO_OPERATION_CS);
break;
case TAO_CodeGen::TAO_ATTRIBUTE_SH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_SH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_SH);
+ be_visitor_operation_sh visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_IH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_IH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_IH);
+ be_visitor_operation_ih visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_SS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_SS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_SS);
+ be_visitor_operation_ss visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_IS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_IS);
- break;
-
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_IS);
+ be_visitor_operation_is visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_BASE_PROXY_IMPL_CH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_BASE_PROXY_IMPL_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_BASE_PROXY_IMPL_CH);
+ be_visitor_operation_base_proxy_impl_ch visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_PROXY_IMPL_XH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_PROXY_IMPL_XH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_PROXY_IMPL_XH);
+ be_visitor_operation_proxy_impl_xh visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_REMOTE_PROXY_IMPL_CS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_REMOTE_PROXY_IMPL_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_REMOTE_PROXY_IMPL_CS);
+ be_visitor_operation_remote_proxy_impl_cs visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_THRU_POA_PROXY_IMPL_SS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_THRU_POA_PROXY_IMPL_SS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_THRU_POA_PROXY_IMPL_SS);
+ be_visitor_operation_thru_poa_proxy_impl_ss visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_DIRECT_PROXY_IMPL_SS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_DIRECT_PROXY_IMPL_SS);
- break;
-
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_DIRECT_PROXY_IMPL_SS);
+ be_visitor_operation_direct_proxy_impl_ss visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_SMART_PROXY_CH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_SMART_PROXY_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_SMART_PROXY_CH);
+ be_visitor_operation_smart_proxy_ch visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_SMART_PROXY_CS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_SMART_PROXY_CS);
- break;
- case TAO_CodeGen::TAO_ATTRIBUTE_INTERCEPTORS_CH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_SMART_PROXY_CS);
+ be_visitor_operation_smart_proxy_cs visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_INTERCEPTORS_CS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_CS);
+ be_visitor_operation_interceptors_cs visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_INTERCEPTORS_SH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_SH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_SH);
+ be_visitor_operation_interceptors_sh visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_INTERCEPTORS_SS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_SS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_SS);
+ be_visitor_operation_interceptors_ss visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_TIE_SH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_TIE_SH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_TIE_SH);
+ be_visitor_operation_tie_sh visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_TIE_SI:
- ctx.state (TAO_CodeGen::TAO_OPERATION_TIE_SI);
- break;
-
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_TIE_SI);
+ be_visitor_operation_tie_si visitor (&ctx);
+ status = get_op.accept (&visitor);
+ break;
+ }
default:
- // error
+ // Error.
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_attribute::"
"visit_attribute - "
@@ -157,34 +211,24 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
-1);
}
- // Change the state depending on the kind of node strategy
- ctx.state (op->next_state (ctx.state ()));
-
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || !op || (op->accept (visitor) == -1))
+ if (status == -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 visitor;
- visitor = 0;
-
- if (op->has_extra_code_generation (ctx.state ()))
+ else if (status == 1)
{
- // Change the state depending on the kind of node strategy
- ctx.state (op->next_state (ctx.state (), 1));
+ // Change the state depending on the kind of node strategy.
+ ctx.state (get_op.next_state (ctx.state ()));
be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || !op || (op->accept (visitor) == -1))
+
+ if (!visitor || (get_op.accept (visitor) == -1))
{
delete visitor;
- delete op;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_attribute::"
"visit_attribute - "
@@ -194,45 +238,69 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
delete visitor;
visitor = 0;
- }
- delete op;
+ if (get_op.has_extra_code_generation (ctx.state ()))
+ {
+ // Change the state depending on the kind of node strategy.
+ ctx.state (get_op.next_state (ctx.state (), 1));
+ be_visitor *visitor = tao_cg->make_visitor (&ctx);
+
+ if (!visitor || (get_op.accept (visitor) == -1))
+ {
+ delete visitor;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_attribute::"
+ "visit_attribute - "
+ "codegen for get_attribute failed\n"),
+ -1);
+ }
+
+ delete visitor;
+ visitor = 0;
+ }
+ }
// Do nothing for readonly attributes.
if (node->readonly ())
- return 0;
+ {
+ return 0;
+ }
- // Create the set method.
+ status = 1;
- // the return type is "void"
- be_predefined_type *rt =
- new be_predefined_type (AST_PredefinedType::PT_void,
- new UTL_ScopedName (new Identifier ("void"),
- 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 ());
- arg->set_name ((UTL_IdList *) node->name ()->copy ());
- // create the operation
- op = new be_operation (rt,
- AST_Operation::OP_noflags,
- node->name (),
- node->is_local (),
- node->is_abstract ());
- op->set_name ((UTL_IdList *) node->name ()->copy ());
- op->set_defined_in (node->defined_in ());
- op->add_argument_to_scope (arg);
+ // Create the set method.
+ Identifier id ("void");
+ UTL_ScopedName sn (&id,
+ 0);
+
+ // The return type is "void".
+ be_predefined_type rt (AST_PredefinedType::PT_void,
+ &sn);
+ // Argument type is the same as the attribute type.
+ be_argument arg (AST_Argument::dir_IN,
+ node->field_type (),
+ node->name ());
+ arg.set_name ((UTL_IdList *) node->name ()->copy ());
+ // Create the operation.
+ be_operation set_op (&rt,
+ AST_Operation::OP_noflags,
+ node->name (),
+ node->is_local (),
+ node->is_abstract ());
+ set_op.set_name ((UTL_IdList *) node->name ()->copy ());
+ set_op.set_defined_in (node->defined_in ());
+ set_op.be_add_argument (&arg);
// Get the strategy from the attribute and hand it over
// to the operation, thereby deleting the old one.
- delete op->set_strategy (node->get_set_strategy ());
+ delete set_op.set_strategy (node->get_set_strategy ());
ctx = *this->ctx_;
- // this switch statement eliminates the need for different classes that have
- // exactly the same code except different states.
+ status = 1;
+
switch (this->ctx_->state ())
{
+ // These two cases are the only ones that could involved a strategy.
case TAO_CodeGen::TAO_ATTRIBUTE_CH:
ctx.state (TAO_CodeGen::TAO_OPERATION_CH);
break;
@@ -240,60 +308,119 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
ctx.state (TAO_CodeGen::TAO_OPERATION_CS);
break;
case TAO_CodeGen::TAO_ATTRIBUTE_SH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_SH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_SH);
+ be_visitor_operation_sh visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_IH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_IH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_IH);
+ be_visitor_operation_ih visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_SS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_SS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_SS);
+ be_visitor_operation_ss visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_IS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_IS);
- break;
-
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_IS);
+ be_visitor_operation_is visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_BASE_PROXY_IMPL_CH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_BASE_PROXY_IMPL_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_BASE_PROXY_IMPL_CH);
+ be_visitor_operation_base_proxy_impl_ch visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_PROXY_IMPL_XH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_PROXY_IMPL_XH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_PROXY_IMPL_XH);
+ be_visitor_operation_proxy_impl_xh visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_REMOTE_PROXY_IMPL_CS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_REMOTE_PROXY_IMPL_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_REMOTE_PROXY_IMPL_CS);
+ be_visitor_operation_remote_proxy_impl_cs visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_THRU_POA_PROXY_IMPL_SS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_THRU_POA_PROXY_IMPL_SS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_THRU_POA_PROXY_IMPL_SS);
+ be_visitor_operation_thru_poa_proxy_impl_ss visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_DIRECT_PROXY_IMPL_SS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_DIRECT_PROXY_IMPL_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;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_DIRECT_PROXY_IMPL_SS);
+ be_visitor_operation_direct_proxy_impl_ss visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_SMART_PROXY_CH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_SMART_PROXY_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_SMART_PROXY_CH);
+ be_visitor_operation_smart_proxy_ch visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_SMART_PROXY_CS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_SMART_PROXY_CS);
- break;
- case TAO_CodeGen::TAO_ATTRIBUTE_INTERCEPTORS_CH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_SMART_PROXY_CS);
+ be_visitor_operation_smart_proxy_cs visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_INTERCEPTORS_CS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_CS);
+ be_visitor_operation_interceptors_cs visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_INTERCEPTORS_SH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_SH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_SH);
+ be_visitor_operation_interceptors_sh visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ATTRIBUTE_INTERCEPTORS_SS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_SS);
- break;
-
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_SS);
+ be_visitor_operation_interceptors_ss visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ATTRIBUTE_TIE_SH:
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_TIE_SH);
+ be_visitor_operation_tie_sh visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ATTRIBUTE_TIE_SI:
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_TIE_SI);
+ be_visitor_operation_tie_si visitor (&ctx);
+ status = set_op.accept (&visitor);
+ break;
+ }
default:
- // error
+ // Error.
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_attribute::"
"visit_attribute - "
@@ -301,51 +428,56 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
-1);
}
+ if (status == 0)
+ {
+ return 0;
+ }
+ else if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_attribute::"
+ "visit_attribute - "
+ "codegen for get_attribute failed\n"),
+ -1);
+ }
// Change the state depending on the kind of node strategy
- ctx.state (op->next_state (ctx.state ()));
+ ctx.state (set_op.next_state (ctx.state ()));
+ be_visitor *visitor = tao_cg->make_visitor (&ctx);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || !op || (op->accept (visitor) == -1))
+ if (!visitor || (set_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 visitor;
visitor = 0;
- if (op->has_extra_code_generation (ctx.state ()))
+ if (set_op.has_extra_code_generation (ctx.state ()))
{
// Change the state depending on the kind of node strategy
- ctx.state (op->next_state (ctx.state (), 1));
+ ctx.state (set_op.next_state (ctx.state (), 1));
visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || !op || (op->accept (visitor) == -1))
+
+ if (!visitor || (set_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 visitor;
visitor = 0;
}
-
- delete op;
- delete rt;
- delete arg;
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_component.cpp b/TAO/TAO_IDL/be/be_visitor_component.cpp
new file mode 100644
index 00000000000..baa86583374
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component.cpp
@@ -0,0 +1,27 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_component.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for Component
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#include "be_visitor_component.h"
+#include "be_visitor_context.h"
+
+ACE_RCSID (be,
+ be_visitor_component,
+ "$Id$")
+
diff --git a/TAO/TAO_IDL/be/be_visitor_component_fwd.cpp b/TAO/TAO_IDL/be/be_visitor_component_fwd.cpp
new file mode 100644
index 00000000000..97746d88aa2
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component_fwd.cpp
@@ -0,0 +1,27 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_component_fwd.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for forward declared Component
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#include "be_visitor_component_fwd.h"
+#include "be_visitor_context.h"
+
+ACE_RCSID (be,
+ be_visitor_component_fwd,
+ "$Id$")
+
diff --git a/TAO/TAO_IDL/be/be_visitor_constant.cpp b/TAO/TAO_IDL/be/be_visitor_constant.cpp
index 0281cbccf4d..9144be5d367 100644
--- a/TAO/TAO_IDL/be/be_visitor_constant.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_constant.cpp
@@ -18,15 +18,19 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_constant.h"
+#include "be_module.h"
+#include "be_helper.h"
+#include "be_extern.h"
+#include "utl_identifier.h"
#include "be_visitor_constant.h"
+#include "be_visitor_context.h"
-// include all the individual files
#include "be_visitor_constant/constant_ch.cpp"
#include "be_visitor_constant/constant_cs.cpp"
-ACE_RCSID(be, be_visitor_constant, "$Id$")
+ACE_RCSID (be,
+ be_visitor_constant,
+ "$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_constant/constant_ch.cpp b/TAO/TAO_IDL/be/be_visitor_constant/constant_ch.cpp
index 89879fdbb8c..a0a8c24240e 100644
--- a/TAO/TAO_IDL/be/be_visitor_constant/constant_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_constant/constant_ch.cpp
@@ -18,13 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_constant.h"
-
-ACE_RCSID(be_visitor_constant, constant_ch, "$Id$")
+ACE_RCSID (be_visitor_constant,
+ constant_ch,
+ "$Id$")
// ********************************************************************
@@ -45,18 +41,42 @@ be_visitor_constant_ch::~be_visitor_constant_ch (void)
int
be_visitor_constant_ch::visit_constant (be_constant *node)
{
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
TAO_OutStream *os = this->ctx_->stream ();
- if (!node->cli_hdr_gen () && !node->imported ())
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // 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.
+
+ if (be_global->gen_inline_constants ())
+ {
+ if (node->et () == AST_Expression::EV_enum)
+ {
+ *os << node->enum_full_name ();
+ }
+ else
+ {
+ *os << node->exprtype_to_string ();
+ }
+
+ *os << " const "
+ << node->local_name () << " = "
+ << node->constant_value ();
+ }
+ // Is our enclosing scope a module? We need this check because for
+ // platforms that support namespaces, the constant must be declared
+ // extern.
+ else
{
- // 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.
-
- // 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))
+ AST_Decl::NodeType nt = node->defined_in ()->scope_node_type ();
+
+ if (node->is_nested () && nt == AST_Decl::NT_module)
{
*os << "TAO_NAMESPACE_STORAGE_CLASS ";
}
@@ -65,20 +85,29 @@ be_visitor_constant_ch::visit_constant (be_constant *node)
*os << "static ";
}
- *os << "const " << node->exprtype_to_string ()
- << " " << node->local_name ();
+ *os << "const ";
- if (!node->is_nested ())
+ if (node->et () == AST_Expression::EV_enum)
{
- // We were defined at the outermost scope. So we put the value in the
- // header itself.
- *os << " = " << node->constant_value ();
+ *os << node->enum_full_name ();
+ }
+ else
+ {
+ *os << node->exprtype_to_string ();
}
- *os << ";" << be_nl << be_nl;
+ *os << " " << node->local_name ();
- node->cli_hdr_gen (I_TRUE);
+ 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 << ";" << be_nl << be_nl;
+
+ 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
index 90f67a8af36..db20c61b3c8 100644
--- a/TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp
@@ -18,13 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_constant.h"
-
-ACE_RCSID(be_visitor_constant, constant_cs, "$Id$")
+ACE_RCSID (be_visitor_constant,
+ constant_cs,
+ "$Id$")
// ********************************************************************
@@ -47,7 +43,9 @@ be_visitor_constant_cs::visit_constant (be_constant *node)
{
TAO_OutStream *os = this->ctx_->stream ();
- if (!node->cli_stub_gen () && !node->imported ())
+ if (!node->cli_stub_gen ()
+ && !node->imported ()
+ && !be_global->gen_inline_constants ())
{
if (node->is_nested ())
{
@@ -55,32 +53,59 @@ be_visitor_constant_cs::visit_constant (be_constant *node)
{
*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))
+ 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 - "
+ "be_visitor_constant_cs::"
+ "visit_constant - "
"Error parsing nested name\n"),
-1);
}
- *os << "TAO_NAMESPACE_DEFINE (const "
- << node->exprtype_to_string () << ", "
- << node->local_name () << ", "
+
+ *os << "TAO_NAMESPACE_DEFINE (const ";
+
+ if (node->et () == AST_Expression::EV_enum)
+ {
+ *os << node->enum_full_name ();
+ }
+ else
+ {
+ *os << node->exprtype_to_string ();
+ }
+
+ *os << ", " << 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 - "
+ "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 () << " "
+ // For those constants not defined in the outer most scope,
+ // they get assigned to their values in the impl file.
+ os->indent ();
+
+ *os << "const ";
+
+ if (node->et () == AST_Expression::EV_enum)
+ {
+ *os << node->enum_full_name ();
+ }
+ else
+ {
+ *os << node->exprtype_to_string ();
+ }
+
+ *os << " "
<< node->name () << " = " << node->constant_value ()
<< ";\n\n";
}
diff --git a/TAO/TAO_IDL/be/be_visitor_context.cpp b/TAO/TAO_IDL/be/be_visitor_context.cpp
index 8102f332f78..42b0791edc4 100644
--- a/TAO/TAO_IDL/be/be_visitor_context.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_context.cpp
@@ -18,11 +18,32 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-ACE_RCSID(be, be_visitor_context, "$Id$")
+#include "be_argument.h"
+#include "be_array.h"
+#include "be_attribute.h"
+#include "be_constant.h"
+#include "be_enum.h"
+#include "be_enum_val.h"
+#include "be_exception.h"
+#include "be_field.h"
+#include "be_interface.h"
+#include "be_interface_fwd.h"
+#include "be_module.h"
+#include "be_operation.h"
+#include "be_predefined_type.h"
+#include "be_root.h"
+#include "be_sequence.h"
+#include "be_string.h"
+#include "be_structure.h"
+#include "be_typedef.h"
+#include "be_union.h"
+#include "be_union_branch.h"
+
+#include "be_visitor_context.h"
+
+ACE_RCSID (be,
+ be_visitor_context,
+ "$Id$")
// constructor
@@ -231,284 +252,368 @@ be_visitor_context::interface (void) const
// ****************************************************************
-// return the node as argument if possible
be_argument *
be_visitor_context::be_node_as_argument (void)
{
- if (this->node_)
- return be_argument::narrow_from_decl (this->node_);
+ if (this->node_ != 0)
+ {
+ return be_argument::narrow_from_decl (this->node_);
+ }
else
- return (be_argument *)0;
+ {
+ return 0;
+ }
}
-// return the node as array if possible
be_array *
be_visitor_context::be_node_as_array (void)
{
- if (this->node_)
- return be_array::narrow_from_decl (this->node_);
+ if (this->node_ != 0)
+ {
+ return be_array::narrow_from_decl (this->node_);
+ }
else
- return (be_array *)0;
+ {
+ return 0;
+ }
}
-// return the node as attribute if possible
be_attribute *
be_visitor_context::be_node_as_attribute (void)
{
- if (this->node_)
- return be_attribute::narrow_from_decl (this->node_);
+ if (this->node_ != 0)
+ {
+ return be_attribute::narrow_from_decl (this->node_);
+ }
else
- return (be_attribute *)0;
+ {
+ return 0;
+ }
}
-// return the node as constant if possible
be_constant *
be_visitor_context::be_node_as_constant (void)
{
- if (this->node_)
- return be_constant::narrow_from_decl (this->node_);
+ if (this->node_ != 0)
+ {
+ return be_constant::narrow_from_decl (this->node_);
+ }
else
- return (be_constant *)0;
+ {
+ return 0;
+ }
}
-// return the node as enum if possible
be_enum *
be_visitor_context::be_node_as_enum (void)
{
- if (this->node_)
- return be_enum::narrow_from_decl (this->node_);
+ if (this->node_ != 0)
+ {
+ return be_enum::narrow_from_decl (this->node_);
+ }
else
- return (be_enum *)0;
+ {
+ return 0;
+ }
}
-// return the node as enum_val if possible
be_enum_val *
be_visitor_context::be_node_as_enum_val (void)
{
- if (this->node_)
- return be_enum_val::narrow_from_decl (this->node_);
+ if (this->node_ != 0)
+ {
+ return be_enum_val::narrow_from_decl (this->node_);
+ }
else
+ {
+ return 0;
+ }
return (be_enum_val *)0;
}
-// return the node as exception if possible
be_exception *
be_visitor_context::be_node_as_exception (void)
{
- if (this->node_)
- return be_exception::narrow_from_decl (this->node_);
+ if (this->node_ != 0)
+ {
+ return be_exception::narrow_from_decl (this->node_);
+ }
else
- return (be_exception *)0;
+ {
+ return 0;
+ }
}
-// return the node as field if possible
be_field *
be_visitor_context::be_node_as_field (void)
{
- if (this->node_)
- return be_field::narrow_from_decl (this->node_);
+ if (this->node_ != 0)
+ {
+ return be_field::narrow_from_decl (this->node_);
+ }
else
- return (be_field *)0;
+ {
+ return 0;
+ }
}
-// return the node as interface if possible
be_interface *
be_visitor_context::be_node_as_interface (void)
{
- if (this->node_)
- return be_interface::narrow_from_decl (this->node_);
+ if (this->node_ != 0)
+ {
+ return be_interface::narrow_from_decl (this->node_);
+ }
else
- return (be_interface *)0;
+ {
+ return 0;
+ }
}
-// return the node as interface_fwd if possible
be_interface_fwd *
be_visitor_context::be_node_as_interface_fwd (void)
{
- if (this->node_)
- return be_interface_fwd::narrow_from_decl (this->node_);
+ if (this->node_ != 0)
+ {
+ return be_interface_fwd::narrow_from_decl (this->node_);
+ }
else
- return (be_interface_fwd *)0;
+ {
+ return 0;
+ }
}
-// return the node as module if possible
be_module *
be_visitor_context::be_node_as_module (void)
{
- if (this->node_)
- return be_module::narrow_from_decl (this->node_);
+ if (this->node_ != 0)
+ {
+ return be_module::narrow_from_decl (this->node_);
+ }
else
- return (be_module *)0;
+ {
+ return 0;
+ }
}
-// return the node as operation if possible
be_operation *
be_visitor_context::be_node_as_operation (void)
{
- if (this->node_)
- return be_operation::narrow_from_decl (this->node_);
+ if (this->node_ != 0)
+ {
+ return be_operation::narrow_from_decl (this->node_);
+ }
else
- return (be_operation *)0;
+ {
+ return 0;
+ }
}
-// return the node as predefined_type if possible
be_predefined_type *
be_visitor_context::be_node_as_predefined_type (void)
{
- if (this->node_)
- return be_predefined_type::narrow_from_decl (this->node_);
+ if (this->node_ != 0)
+ {
+ return be_predefined_type::narrow_from_decl (this->node_);
+ }
else
- return (be_predefined_type *)0;
+ {
+ return 0;
+ }
}
-// return the node as root if possible
be_root *
be_visitor_context::be_node_as_root (void)
{
- if (this->node_)
- return be_root::narrow_from_decl (this->node_);
+ if (this->node_ != 0)
+ {
+ return be_root::narrow_from_decl (this->node_);
+ }
else
- return (be_root *)0;
+ {
+ return 0;
+ }
}
-// return the node as sequence if possible
be_sequence *
be_visitor_context::be_node_as_sequence (void)
{
- if (this->node_)
- return be_sequence::narrow_from_decl (this->node_);
+ if (this->node_ != 0)
+ {
+ return be_sequence::narrow_from_decl (this->node_);
+ }
else
- return (be_sequence *)0;
+ {
+ return 0;
+ }
}
-// return the node as string if possible
be_string *
be_visitor_context::be_node_as_string (void)
{
- if (this->node_)
- return be_string::narrow_from_decl (this->node_);
+ if (this->node_ != 0)
+ {
+ return be_string::narrow_from_decl (this->node_);
+ }
else
- return (be_string *)0;
+ {
+ return 0;
+ }
}
-// return the node as structure if possible
be_structure *
be_visitor_context::be_node_as_structure (void)
{
- if (this->node_)
- return be_structure::narrow_from_decl (this->node_);
+ if (this->node_ != 0)
+ {
+ return be_structure::narrow_from_decl (this->node_);
+ }
else
- return (be_structure *)0;
+ {
+ return 0;
+ }
}
-// return the node as typedef if possible
be_typedef *
be_visitor_context::be_node_as_typedef (void)
{
- if (this->node_)
- return be_typedef::narrow_from_decl (this->node_);
+ if (this->node_ != 0)
+ {
+ return be_typedef::narrow_from_decl (this->node_);
+ }
else
- return (be_typedef *)0;
+ {
+ return 0;
+ }
}
-// return the node as union if possible
be_union *
be_visitor_context::be_node_as_union (void)
{
- if (this->node_)
- return be_union::narrow_from_decl (this->node_);
+ if (this->node_ != 0)
+ {
+ return be_union::narrow_from_decl (this->node_);
+ }
else
- return (be_union *)0;
+ {
+ return 0;
+ }
}
-// return the node as union_branch if possible
be_union_branch *
be_visitor_context::be_node_as_union_branch (void)
{
- if (this->node_)
- return be_union_branch::narrow_from_decl (this->node_);
+ if (this->node_ != 0)
+ {
+ return be_union_branch::narrow_from_decl (this->node_);
+ }
else
- return (be_union_branch *)0;
+ {
+ return 0;
+ }
}
-// for scope
-
-// return the scope as enum if possible
be_enum *
be_visitor_context::be_scope_as_enum (void)
{
- if (this->scope_)
- return be_enum::narrow_from_decl (this->scope_);
+ if (this->scope_ != 0)
+ {
+ return be_enum::narrow_from_decl (this->scope_);
+ }
else
- return (be_enum *)0;
+ {
+ return 0;
+ }
}
-// return the scope as exception if possible
be_exception *
be_visitor_context::be_scope_as_exception (void)
{
- if (this->scope_)
- return be_exception::narrow_from_decl (this->scope_);
+ if (this->scope_ != 0)
+ {
+ return be_exception::narrow_from_decl (this->scope_);
+ }
else
- return (be_exception *)0;
+ {
+ return 0;
+ }
}
-// return the scope as interface if possible
be_interface *
be_visitor_context::be_scope_as_interface (void)
{
- if (this->scope_)
- return be_interface::narrow_from_decl (this->scope_);
+ if (this->scope_ != 0)
+ {
+ return be_interface::narrow_from_decl (this->scope_);
+ }
else
+ {
+ return 0;
+ }
return (be_interface *)0;
}
-// return the scope as module if possible
be_module *
be_visitor_context::be_scope_as_module (void)
{
- if (this->scope_)
- return be_module::narrow_from_decl (this->scope_);
+ if (this->scope_ != 0)
+ {
+ return be_module::narrow_from_decl (this->scope_);
+ }
else
- return (be_module *)0;
+ {
+ return 0;
+ }
}
-// return the scope as operation if possible
be_operation *
be_visitor_context::be_scope_as_operation (void)
{
- if (this->scope_)
- return be_operation::narrow_from_decl (this->scope_);
+ if (this->scope_ != 0)
+ {
+ return be_operation::narrow_from_decl (this->scope_);
+ }
else
- return (be_operation *)0;
+ {
+ return 0;
+ }
}
-// return the scope as root if possible
be_root *
be_visitor_context::be_scope_as_root (void)
{
- if (this->scope_)
- return be_root::narrow_from_decl (this->scope_);
+ if (this->scope_ != 0)
+ {
+ return be_root::narrow_from_decl (this->scope_);
+ }
else
- return (be_root *)0;
+ {
+ return 0;
+ }
}
-// return the scope as structure if possible
be_structure *
be_visitor_context::be_scope_as_structure (void)
{
- if (this->scope_)
- return be_structure::narrow_from_decl (this->scope_);
+ if (this->scope_ != 0)
+ {
+ return be_structure::narrow_from_decl (this->scope_);
+ }
else
- return (be_structure *)0;
+ {
+ return 0;
+ }
}
-// return the scope as union if possible
be_union *
be_visitor_context::be_scope_as_union (void)
{
- if (this->scope_)
- return be_union::narrow_from_decl (this->scope_);
+ if (this->scope_ != 0)
+ {
+ return be_union::narrow_from_decl (this->scope_);
+ }
else
- return (be_union *)0;
+ {
+ return 0;
+ }
}
diff --git a/TAO/TAO_IDL/be/be_visitor_decl.cpp b/TAO/TAO_IDL/be/be_visitor_decl.cpp
index d2c25510d90..5fc92908f1b 100644
--- a/TAO/TAO_IDL/be/be_visitor_decl.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_decl.cpp
@@ -19,13 +19,15 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
#include "be_visitor_decl.h"
+#include "be_visitor_sequence.h"
+#include "be_visitor_context.h"
+#include "be_typedef.h"
+#include "be_type.h"
-ACE_RCSID(be, be_visitor_decl, "$Id$")
+ACE_RCSID (be,
+ be_visitor_decl,
+ "$Id$")
// Root visitor for client header
@@ -52,28 +54,51 @@ be_visitor_decl::gen_anonymous_base_type (be_type *bt,
// In case our container was typedef'd.
ctx.tdef (0);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
+ int status = 0;
+
+ switch (cg_state)
+ {
+ case TAO_CodeGen::TAO_SEQUENCE_CH:
+ {
+ be_visitor_sequence_ch visitor (&ctx);
+ status = bt->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_SEQUENCE_CI:
+ {
+ be_visitor_sequence_ci visitor (&ctx);
+ status = bt->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_SEQUENCE_CS:
+ {
+ be_visitor_sequence_cs visitor (&ctx);
+ status = bt->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CS:
+ {
+ be_visitor_sequence_cdr_op_cs visitor (&ctx);
+ status = bt->accept (&visitor);
+ break;
+ }
+ default:
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_decl::"
"gen_anonymous_base_type - "
- "bad visitor to anonymous abase type\n"),
+ "bad context state\n"),
-1);
- }
+ }
- if (bt->accept (visitor) == -1)
+ if (status == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_decl::"
"gen_anonymous_base_type - "
"anonymous base type codegen failed\n"),
-1);
}
-
- delete visitor;
}
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_enum.cpp b/TAO/TAO_IDL/be/be_visitor_enum.cpp
index aaef1a06f60..152bd0f7d54 100644
--- a/TAO/TAO_IDL/be/be_visitor_enum.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_enum.cpp
@@ -18,13 +18,14 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_enum.h"
+#include "be_enum_val.h"
+#include "be_helper.h"
+#include "be_extern.h"
#include "be_visitor_enum.h"
+#include "be_visitor_context.h"
-// include all the individual files
#include "be_visitor_enum/enum_ch.cpp"
#include "be_visitor_enum/enum_cs.cpp"
#include "be_visitor_enum/any_op_ch.cpp"
@@ -32,4 +33,6 @@
#include "be_visitor_enum/cdr_op_ch.cpp"
#include "be_visitor_enum/cdr_op_ci.cpp"
-ACE_RCSID(be, be_visitor_enum, "$Id$")
+ACE_RCSID (be,
+ be_visitor_enum,
+ "$Id$")
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
index a81ec6f40c5..39c00c5a786 100644
--- a/TAO/TAO_IDL/be/be_visitor_enum/any_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_enum/any_op_ch.cpp
@@ -18,13 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_enum.h"
-
-ACE_RCSID(be_visitor_enum, any_op_ch, "$Id$")
-
+ACE_RCSID (be_visitor_enum,
+ any_op_ch,
+ "$Id$")
// ***************************************************************************
// Enum visitor for generating Any operator declarations in the client header
@@ -51,14 +47,16 @@ be_visitor_enum_any_op_ch::visit_enum (be_enum *node)
TAO_OutStream *os = this->ctx_->stream ();
- // generate the Any <<= and >>= operators
- os->indent ();
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Generate the Any <<= and >>= operators.
*os << be_global->stub_export_macro () << " void"
<< " operator<<= (CORBA::Any &, " << node->name ()
<< ");" << be_nl;
*os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator>>= (const CORBA::Any &, "
- << node->name () << " &);\n";
+ << node->name () << " &);" << be_nl << be_nl;
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
index f49d76d9de4..334c8cccd83 100644
--- a/TAO/TAO_IDL/be/be_visitor_enum/any_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_enum/any_op_cs.cpp
@@ -18,13 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_enum.h"
-
-ACE_RCSID(be_visitor_enum, any_op_cs, "$Id$")
-
+ACE_RCSID (be_visitor_enum,
+ any_op_cs,
+ "$Id$")
// ***************************************************************************
// Enum visitor for generating Any operator declarations in the client
@@ -52,8 +48,8 @@ be_visitor_enum_any_op_cs::visit_enum (be_enum *node)
TAO_OutStream *os = this->ctx_->stream ();
- // generate the Any <<= and >>= operator declarations
- // Any <<= and >>= operators
+ // Generate the Any <<= and >>= operator declarations
+ // Any <<= and >>= operators.
os->indent ();
*os << "void operator<<= (CORBA::Any &_tao_any, "
<< node->name () << " _tao_elem)" << be_nl
diff --git a/TAO/TAO_IDL/be/be_visitor_enum/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_enum/cdr_op_ch.cpp
index c0c2e045d92..a0161e9cb06 100644
--- a/TAO/TAO_IDL/be/be_visitor_enum/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_enum/cdr_op_ch.cpp
@@ -18,22 +18,17 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_enum.h"
-
-ACE_RCSID(be_visitor_enum, cdr_op_ch, "$Id$")
+ACE_RCSID (be_visitor_enum,
+ cdr_op_ch,
+ "$Id$")
// ***************************************************************************
// Enum visitor for generating Cdr operator declarations in the client header
// ***************************************************************************
-be_visitor_enum_cdr_op_ch::be_visitor_enum_cdr_op_ch
-(be_visitor_context *ctx)
- : be_visitor_scope (ctx)
+be_visitor_enum_cdr_op_ch::be_visitor_enum_cdr_op_ch (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
{
}
@@ -45,7 +40,9 @@ int
be_visitor_enum_cdr_op_ch::visit_enum (be_enum *node)
{
if (node->cli_hdr_cdr_op_gen () || node->imported ())
- return 0;
+ {
+ return 0;
+ }
TAO_OutStream *os = this->ctx_->stream ();
@@ -54,7 +51,7 @@ be_visitor_enum_cdr_op_ch::visit_enum (be_enum *node)
os->indent ();
*os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator<< (TAO_OutputCDR &, const " << node->name ()
- << " &); // " << be_nl;
+ << " &);" << be_nl;
*os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator>> (TAO_InputCDR &, "
<< node->name () << " &);\n";
diff --git a/TAO/TAO_IDL/be/be_visitor_enum/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_enum/cdr_op_ci.cpp
index e8c9f0c5bc8..cab73d5328c 100644
--- a/TAO/TAO_IDL/be/be_visitor_enum/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_enum/cdr_op_ci.cpp
@@ -18,12 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_enum.h"
-
-ACE_RCSID(be_visitor_enum, cdr_op_ci, "$Id$")
+ACE_RCSID (be_visitor_enum,
+ cdr_op_ci,
+ "$Id$")
// ***************************************************************************
@@ -32,7 +29,7 @@ ACE_RCSID(be_visitor_enum, cdr_op_ci, "$Id$")
// ***************************************************************************
be_visitor_enum_cdr_op_ci::be_visitor_enum_cdr_op_ci (be_visitor_context *ctx)
- : be_visitor_scope (ctx)
+ : be_visitor_decl (ctx)
{
}
diff --git a/TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp b/TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp
index e6c6bd01342..61cae521526 100644
--- a/TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp
@@ -18,13 +18,11 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_visitor_typecode/typecode_decl.h"
-#include "be_visitor_enum.h"
-
-ACE_RCSID(be_visitor_enum, enum_ch, "$Id$")
+ACE_RCSID (be_visitor_enum,
+ enum_ch,
+ "$Id$")
// ********************************************************************
@@ -45,56 +43,60 @@ be_visitor_enum_ch::~be_visitor_enum_ch (void)
int
be_visitor_enum_ch::visit_enum (be_enum *node)
{
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
TAO_OutStream *os = this->ctx_->stream ();
// Comma to be generated by the scope visitor.
this->ctx_->comma (1);
- if (!node->cli_hdr_gen () && !node->imported ())
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "enum " << node->local_name () << be_nl;
+ *os << "{" << be_idt_nl;
+
+ 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 << be_uidt_nl;
+ *os << "};" << be_nl << be_nl;
+
+ // As per the ORBOS spec, we need the following typedef
+ *os << "typedef " << node->local_name () << " &" << node->local_name ()
+ << "_out;" << be_nl << be_nl;
+
+ if (!node->is_local ())
{
- *os << "enum " << node->local_name () << be_nl;
- *os << "{" << be_idt_nl;
-
- 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 << be_uidt_nl;
- *os << "};" << be_nl << be_nl;
-
- // As per the ORBOS spec, we need the following typedef
- *os << "typedef " << node->local_name () << " &" << node->local_name ()
- << "_out;" << be_nl;
-
- if (!node->is_local ())
+ // 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_typecode_decl visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
- // 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_enum_ch::"
- "visit_enum - "
- "TypeCode declaration failed\n"
- ),
- -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);
}
+ node->cli_hdr_gen (I_TRUE);
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
index e846ec8b439..72ef3b80356 100644
--- a/TAO/TAO_IDL/be/be_visitor_enum/enum_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_enum/enum_cs.cpp
@@ -18,13 +18,11 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_visitor_typecode/typecode_defn.h"
-#include "be_visitor_enum.h"
-
-ACE_RCSID(be_visitor_enum, enum_cs, "$Id$")
+ACE_RCSID (be_visitor_enum,
+ enum_cs,
+ "$Id$")
// ********************************************************************
@@ -47,24 +45,22 @@ be_visitor_enum_cs::visit_enum (be_enum *node)
{
if (!node->cli_stub_gen () && !node->imported () && !node->is_local ())
{
- // 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);
ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ be_visitor_typecode_defn visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_enum_cs::"
"visit_enum - "
- "TypeCode definition failed\n"
- ), -1);
+ "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 953fae623d1..872abd3895f 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception.cpp
@@ -18,13 +18,27 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_field.h"
+#include "be_exception.h"
+#include "be_typedef.h"
+#include "be_enum.h"
+#include "be_interface.h"
+#include "be_interface_fwd.h"
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
+#include "be_array.h"
+#include "be_predefined_type.h"
+#include "be_string.h"
+#include "be_sequence.h"
+#include "be_structure.h"
+#include "be_union.h"
+#include "be_helper.h"
+#include "be_extern.h"
#include "be_visitor_exception.h"
+#include "be_visitor_context.h"
+#include "be_visitor_field.h"
-// include all the individual files
#include "be_visitor_exception/exception.cpp"
#include "be_visitor_exception/exception_ch.cpp"
#include "be_visitor_exception/exception_ci.cpp"
@@ -37,4 +51,6 @@
#include "be_visitor_exception/cdr_op_ci.cpp"
#include "be_visitor_exception/cdr_op_cs.cpp"
-ACE_RCSID(be, be_visitor_exception, "$Id$")
+ACE_RCSID (be,
+ be_visitor_exception,
+ "$Id$")
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
index 996f9714687..4a1c5f1b35a 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/any_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/any_op_ch.cpp
@@ -18,13 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_exception.h"
-
-ACE_RCSID(be_visitor_exception, any_op_ch, "$Id$")
-
+ACE_RCSID (be_visitor_exception,
+ any_op_ch,
+ "$Id$")
// ***************************************************************************
// Exception visitor for generating Any operator declarations in the client header
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
index e5289aa8d14..d53cb630aa0 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp
@@ -18,13 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_exception.h"
-
-ACE_RCSID(be_visitor_exception, any_op_cs, "$Id$")
-
+ACE_RCSID (be_visitor_exception,
+ any_op_cs,
+ "$Id$")
// ***************************************************************************
// Exception visitor for generating Any operator declarations in the client
@@ -53,8 +49,6 @@ be_visitor_exception_any_op_cs::visit_exception (be_exception *node)
TAO_OutStream *os = this->ctx_->stream ();
- os->indent ();
-
*os << be_nl
<< "// TAO_IDL - Generated from " << be_nl
<< "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ch.cpp
index 342fcc6a103..4fb5a4f291f 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ch.cpp
@@ -19,20 +19,17 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_exception.h"
-
-ACE_RCSID(be_visitor_exception, cdr_op_ch, "$Id$")
+ACE_RCSID (be_visitor_exception,
+ cdr_op_ch,
+ "$Id$")
// ***************************************************************************
// Exception visitor for generating CDR operator declarations in the client header
// ***************************************************************************
-be_visitor_exception_cdr_op_ch::be_visitor_exception_cdr_op_ch
-(be_visitor_context *ctx)
+be_visitor_exception_cdr_op_ch::be_visitor_exception_cdr_op_ch (
+ be_visitor_context *ctx
+ )
: be_visitor_exception (ctx)
{
}
@@ -44,15 +41,16 @@ be_visitor_exception_cdr_op_ch::~be_visitor_exception_cdr_op_ch (void)
int
be_visitor_exception_cdr_op_ch::visit_exception (be_exception *node)
{
- if (node->cli_hdr_cdr_op_gen () ||
- node->imported () ||
- node->is_local ())
- return 0;
+ if (node->cli_hdr_cdr_op_gen () || node->imported () || node->is_local ())
+ {
+ return 0;
+ }
TAO_OutStream *os = this->ctx_->stream ();
- // generate the CDR << and >> operator declarations
+ // Generate the CDR << and >> operator declarations.
os->indent ();
+
*os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator<< (TAO_OutputCDR &, const " << node->name ()
<< " &);" << be_nl;
@@ -61,15 +59,16 @@ be_visitor_exception_cdr_op_ch::visit_exception (be_exception *node)
<< node->name () << " &);\n";
- // set the substate as generating code for the types defined in our scope
+ // Set the substate as generating code for the types defined in our scope.
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
- // 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_cdr_op_ch::"
"visit_exception - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
*os << be_nl;
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ci.cpp
index d658c19371c..0d7b253b307 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ci.cpp
@@ -18,22 +18,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_exception.h"
-#include "be_visitor_field.h"
-
-ACE_RCSID(be_visitor_exception, cdr_op_ci, "$Id$")
+ACE_RCSID (be_visitor_exception,
+ cdr_op_ci,
+ "$Id$")
// ***************************************************************************
// Exception visitor for generating CDR operator declarations in the client
// stubs file
// ***************************************************************************
-be_visitor_exception_cdr_op_ci::be_visitor_exception_cdr_op_ci
-(be_visitor_context *ctx)
+be_visitor_exception_cdr_op_ci::be_visitor_exception_cdr_op_ci (
+ be_visitor_context *ctx
+ )
: be_visitor_exception (ctx)
{
}
@@ -46,8 +42,8 @@ int
be_visitor_exception_cdr_op_ci::visit_exception (be_exception *node)
{
// already generated and/or we are imported. Don't do anything.
- if (node->cli_inline_cdr_op_gen ()
- || node->imported ()
+ if (node->cli_inline_cdr_op_gen ()
+ || node->imported ()
|| node->is_local ())
{
return 0;
@@ -62,7 +58,6 @@ be_visitor_exception_cdr_op_ci::visit_exception (be_exception *node)
// Set the substate as generating code for the types defined in our scope.
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
- // All we have to do is to visit the scope and generate code.
if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -74,67 +69,86 @@ be_visitor_exception_cdr_op_ci::visit_exception (be_exception *node)
// Set the sub state as generating code for the output operator.
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_OUTPUT);
- *os << "ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &strm, "
- << "const " << node->name () << " &_tao_aggregate)" << be_nl
+
+ *os << "ACE_INLINE" << be_nl
+ << "CORBA::Boolean operator<< (" << be_idt << be_idt_nl
+ << "TAO_OutputCDR &strm," << be_nl
+ << "const " << node->name () << " &_tao_aggregate" << be_uidt_nl
+ << ")" << be_uidt_nl
<< "{" << be_idt_nl;
// Do we have any members?
if (node->nmembers () > 0)
{
- be_visitor_context* new_ctx =
- new be_visitor_context (*this->ctx_);
- be_visitor_cdr_op_field_decl field_decl (new_ctx);
+ be_visitor_context new_ctx (*this->ctx_);
+ be_visitor_cdr_op_field_decl field_decl (&new_ctx);
field_decl.visit_scope (node);
// some members
- *os << "// first marshal the repository ID" << be_nl
- << "if (strm << _tao_aggregate._rep_id ())" << be_nl
+ *os << "// First marshal the repository ID." << be_nl
+ << "if (strm << _tao_aggregate._rep_id ())" << be_idt_nl
<< "{" << be_idt_nl
- << "// now marshal the members (if any)" << be_nl
+ << "// Now marshal the members (if any)." << be_nl
<< "if (" << be_idt_nl;
- // 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_cdr_op_ci::"
"visit_exception - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
- *os << be_uidt_nl << ")"
+
+ *os << be_uidt_nl << " )"
<< be_idt_nl
+ << "{" << be_idt_nl
<< "return 1;" << be_uidt_nl
+ << "}" << be_uidt_nl
<< "else" << be_idt_nl
- << "return 0;" << be_uidt << be_uidt_nl
- << "}" << be_nl
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}" << be_uidt_nl
<< "else" << be_idt_nl
- << "return 0;" << be_uidt << be_uidt_nl;
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl;
}
else
{
- // no members
- *os << "// first marshal the repository ID" << be_nl
+ // No members.
+ *os << "// First marshal the repository ID." << be_nl
<< "if (strm << _tao_aggregate._rep_id ())" << be_idt_nl
+ << "{" << be_idt_nl
<< "return 1;" << be_uidt_nl
+ << "}" << be_uidt_nl
<< "else" << be_idt_nl
- << "return 0;" << be_uidt << be_uidt_nl;
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl;
}
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
- // set the substate as generating code for the input operator
+ // Set the substate as generating code for the input operator.
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_INPUT);
- *os << "ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &";
+
+ *os << "ACE_INLINE" << be_nl
+ << "CORBA::Boolean operator>> (" << be_idt << be_idt_nl
+ << "TAO_InputCDR &";
if (node->nmembers () > 0)
{
- *os << "strm,"
- << node->name () << " &_tao_aggregate)" << be_nl;
+ *os << "strm," << be_nl
+ << node->name () << " &_tao_aggregate" << be_uidt_nl
+ << ")" << be_uidt_nl;
}
else
{
- *os << ","
- << node->name () << "&)" << be_nl;
+ *os << "," << be_nl
+ << node->name () << "&" << be_uidt_nl
+ << ")" << be_uidt_nl;
}
*os << "{" << be_idt_nl;
@@ -145,19 +159,17 @@ be_visitor_exception_cdr_op_ci::visit_exception (be_exception *node)
// caller, and they invoke this method only to demarshal the
// members. While the marshaling method encodes both...
- // do we have any members?
+ // Do we have any members?
if (node->nmembers () > 0)
{
- be_visitor_context* new_ctx =
- new be_visitor_context (*this->ctx_);
- be_visitor_cdr_op_field_decl field_decl (new_ctx);
+ be_visitor_context new_ctx (*this->ctx_);
+ be_visitor_cdr_op_field_decl field_decl (&new_ctx);
field_decl.visit_scope (node);
- // some members
- *os << "// now marshal the members" << be_nl
+ // Some members.
+ *os << "// Demarshal the members." << be_nl
<< "if (" << be_idt_nl;
- // all we have to do is to visit the scope and generate code
if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -169,16 +181,20 @@ be_visitor_exception_cdr_op_ci::visit_exception (be_exception *node)
*os << be_uidt_nl << ")"
<< be_idt_nl
+ << "{" << be_idt_nl
<< "return 1;" << be_uidt_nl
+ << "}" << be_uidt_nl
<< "else" << be_idt_nl
- << "return 0;" << be_uidt << be_uidt_nl;
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl;
}
else
{
*os << "return 1;" << be_uidt_nl;
}
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
node->cli_inline_cdr_op_gen (1);
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_cs.cpp
index fe2f0d85230..117cb7a9dc5 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_cs.cpp
@@ -18,16 +18,13 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+ACE_RCSID (be_visitor_exception,
+ cdr_op_cs,
+ "$Id$")
-#include "be_visitor_exception.h"
-#include "be_visitor_field.h"
-
-ACE_RCSID(be_visitor_exception, cdr_op_cs, "$Id$")
-
-be_visitor_exception_cdr_op_cs::be_visitor_exception_cdr_op_cs (be_visitor_context *ctx)
+be_visitor_exception_cdr_op_cs::be_visitor_exception_cdr_op_cs (
+ be_visitor_context *ctx
+ )
: be_visitor_exception (ctx)
{
}
@@ -39,24 +36,24 @@ be_visitor_exception_cdr_op_cs::~be_visitor_exception_cdr_op_cs (void)
int
be_visitor_exception_cdr_op_cs::visit_exception (be_exception *node)
{
- if (node->cli_stub_cdr_op_gen () ||
- node->imported () ||
- node->is_local ())
- return 0;
+ if (node->cli_stub_cdr_op_gen ()
+ || node->imported ()
+ || node->is_local ())
+ {
+ return 0;
+ }
- // set the substate as generating code for the types defined in our
- // scope
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
- // 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_cdr_op_cs::"
"visit_exception - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
-
node->cli_stub_cdr_op_gen (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
index 78725dac850..314fdec7bbe 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/ctor_assign.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/ctor_assign.cpp
@@ -19,13 +19,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_exception.h"
-
-ACE_RCSID(be_visitor_exception, ctor_assign, "$Id$")
-
+ACE_RCSID (be_visitor_exception,
+ ctor_assign,
+ "$Id$")
// ************************************************************************
// Used for the body of the assignment operator and the copy constructor.
@@ -99,7 +95,7 @@ be_visitor_exception_ctor_assign::visit_array (be_array *node)
TAO_OutStream *os = this->ctx_->stream ();
be_decl *bd = this->ctx_->node ();
- os->indent ();
+ *os << be_nl;
if (ACE_OS::strcmp (bd->flat_name (), node->flat_name ()) != 0)
{
@@ -116,13 +112,13 @@ be_visitor_exception_ctor_assign::visit_array (be_array *node)
{
// Constructor from member args.
*os << "_copy (this->" << bd->local_name ()
- << ", _tao_" << bd->local_name () << ");\n";
+ << ", _tao_" << bd->local_name () << ");";
}
else
{
// Copy constructor and assignment operator.
*os << "_copy (this->" << bd->local_name ()
- << ", _tao_excp." << bd->local_name () << ");\n";
+ << ", _tao_excp." << bd->local_name () << ");";
}
return 0;
@@ -134,17 +130,17 @@ be_visitor_exception_ctor_assign::visit_enum (be_enum *)
TAO_OutStream *os = this->ctx_->stream ();
be_decl *bd = this->ctx_->node ();
- os->indent ();
+ *os << be_nl;
if (this->ctx_->exception ()) // Special constructor.
{
*os << "this->" << bd->local_name () << " = _tao_"
- << bd->local_name () << ";\n";
+ << bd->local_name () << ";";
}
else
{
*os << "this->" << bd->local_name () << " = _tao_excp."
- << bd->local_name () << ";\n";
+ << bd->local_name () << ";";
}
return 0;
@@ -156,17 +152,17 @@ be_visitor_exception_ctor_assign::visit_interface (be_interface *node)
TAO_OutStream *os = this->ctx_->stream ();
be_decl *bd = this->ctx_->node ();
- os->indent ();
+ *os << be_nl;
if (this->ctx_->exception ()) // Special constructor.
{
*os << "this->" << bd->local_name () << " = " << node->name ()
- << "::_duplicate (_tao_" << bd->local_name () << ");\n";
+ << "::_duplicate (_tao_" << bd->local_name () << ");";
}
else
{
*os << "this->" << bd->local_name () << " = " << node->name ()
- << "::_duplicate (_tao_excp." << bd->local_name () << ".in ());\n";
+ << "::_duplicate (_tao_excp." << bd->local_name () << ".in ());";
}
return 0;
@@ -179,18 +175,87 @@ int be_visitor_exception_ctor_assign::visit_interface_fwd (
TAO_OutStream *os = this->ctx_->stream ();
be_decl *bd = this->ctx_->node ();
- os->indent ();
+ *os << be_nl;
if (this->ctx_->exception ()) // Special constructor.
{
*os << "this->" << bd->local_name () << " = " << node->name ()
- << "::_duplicate (_tao_" << bd->local_name () << ");\n";
+ << "::_duplicate (_tao_" << bd->local_name () << ");";
}
else
{
*os << "this->" << bd->local_name () << " = " << node->name ()
- << "::_duplicate (_tao_excp." << bd->local_name () << ".in ());\n";
+ << "::_duplicate (_tao_excp." << bd->local_name () << ".in ());";
+ }
+ return 0;
+}
+
+int
+be_visitor_exception_ctor_assign::visit_valuetype (be_valuetype *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_decl *bd = this->ctx_->node ();
+
+ *os << be_nl;
+
+ if (this->ctx_->exception ()) // Special constructor.
+ {
+ *os << "CORBA::add_ref (" << be_idt << be_idt_nl
+ << "ACE_const_cast (" << be_idt << be_idt_nl
+ << node->name () << " *," << be_nl
+ << "_tao_" << bd->local_name () << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << ");" << be_uidt_nl;
+ *os << "this->" << bd->local_name () << " = _tao_"
+ << bd->local_name () << ";";
+ }
+ else
+ {
+ *os << "CORBA::add_ref (" << be_idt << be_idt_nl
+ << "ACE_const_cast (" << be_idt << be_idt_nl
+ << node->name () << " *," << be_nl
+ << "_tao_excp." << bd->local_name () << ".in ()" << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << ");" << be_uidt_nl;
+ *os << "this->" << bd->local_name () << " = _tao_excp."
+ << bd->local_name () << ".in ();";
}
+
+ return 0;
+}
+
+int be_visitor_exception_ctor_assign::visit_valuetype_fwd (
+ be_valuetype_fwd *node
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_decl *bd = this->ctx_->node ();
+
+ *os << be_nl;
+
+ if (this->ctx_->exception ()) // Special constructor.
+ {
+ *os << "CORBA::add_ref (" << be_idt << be_idt_nl
+ << "ACE_const_cast (" << be_idt << be_idt_nl
+ << node->name () << " *," << be_nl
+ << "_tao_" << bd->local_name () << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << ");" << be_uidt_nl;
+ *os << "this->" << bd->local_name () << " = _tao_"
+ << bd->local_name () << ";";
+ }
+ else
+ {
+ *os << "CORBA::add_ref (" << be_idt << be_idt_nl
+ << "ACE_const_cast (" << be_idt << be_idt_nl
+ << node->name () << " *," << be_nl
+ << "_tao_excp." << bd->local_name () << ".in ()" << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << ");" << be_uidt_nl;
+ *os << "this->" << bd->local_name () << " = _tao_excp."
+ << bd->local_name () << ".in ();";
+ }
+
return 0;
}
@@ -200,36 +265,38 @@ int be_visitor_exception_ctor_assign::visit_predefined_type (
{
TAO_OutStream *os = this->ctx_->stream ();
be_decl *bd = this->ctx_->node ();
+ AST_PredefinedType::PredefinedType pt = node->pt ();
- os->indent ();
+ *os << be_nl;
// Check if the type is an any.
- if (node->pt () == AST_PredefinedType::PT_any)
+ if (pt == AST_PredefinedType::PT_any)
{
if (this->ctx_->exception ()) // Special constructor.
{
*os << "this->" << bd->local_name () << " = _tao_"
- << bd->local_name () << ";\n";
+ << bd->local_name () << ";";
}
else
{
*os << "this->" << bd->local_name () << " = _tao_excp."
- << bd->local_name () << ";\n";
+ << bd->local_name () << ";";
}
}
- else if (node->pt () == AST_PredefinedType::PT_pseudo)
+ else if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
{
if (this->ctx_->exception ()) // Special constructor.
{
*os << "this->" << bd->local_name () << " = "
<< node->name () << "::_duplicate (_tao_"
- << bd->local_name () << ");\n";
+ << bd->local_name () << ");";
}
else
{
*os << "this->" << bd->local_name () << " = "
<< node->name () << "::_duplicate (_tao_excp."
- << bd->local_name () << ".in ());\n";
+ << bd->local_name () << ".in ());";
}
}
else // Simple predefined types.
@@ -237,12 +304,12 @@ int be_visitor_exception_ctor_assign::visit_predefined_type (
if (this->ctx_->exception ()) // Special constructor.
{
*os << "this->" << bd->local_name () << " = _tao_"
- << bd->local_name () << ";\n";
+ << bd->local_name () << ";";
}
else
{
*os << "this->" << bd->local_name () << " = _tao_excp."
- << bd->local_name () << ";\n";
+ << bd->local_name () << ";";
}
}
@@ -254,17 +321,17 @@ int be_visitor_exception_ctor_assign::visit_sequence (be_sequence *)
TAO_OutStream *os = this->ctx_->stream ();
be_decl *bd = this->ctx_->node ();
- os->indent ();
+ *os << be_nl;
if (this->ctx_->exception ()) // Special constructor.
{
*os << "this->" << bd->local_name () << " = _tao_" << bd->local_name ()
- << ";\n";
+ << ";";
}
else
{
*os << "this->" << bd->local_name () << " = _tao_excp."
- << bd->local_name () << ";\n";
+ << bd->local_name () << ";";
}
return 0;
@@ -275,7 +342,7 @@ int be_visitor_exception_ctor_assign::visit_string (be_string *node)
TAO_OutStream *os = this->ctx_->stream ();
be_decl *bd = this->ctx_->node ();
- os->indent ();
+ *os << be_nl;
if (this->ctx_->exception ()) // Special constructor.
{
@@ -283,13 +350,13 @@ int be_visitor_exception_ctor_assign::visit_string (be_string *node)
{
*os << "this->" << bd->local_name ()
<< " = CORBA::string_dup (_tao_"
- << bd->local_name () << ");\n";
+ << bd->local_name () << ");";
}
else
{
*os << "this->" << bd->local_name ()
<< " = CORBA::wstring_dup (_tao_"
- << bd->local_name () << ");\n";
+ << bd->local_name () << ");";
}
}
else
@@ -298,13 +365,13 @@ int be_visitor_exception_ctor_assign::visit_string (be_string *node)
{
*os << "this->" << bd->local_name ()
<< " = CORBA::string_dup (_tao_excp."
- << bd->local_name () << ".in ());\n";
+ << bd->local_name () << ".in ());";
}
else
{
*os << "this->" << bd->local_name ()
<< " = CORBA::wstring_dup (_tao_excp."
- << bd->local_name () << ".in ());\n";
+ << bd->local_name () << ".in ());";
}
}
@@ -316,17 +383,17 @@ int be_visitor_exception_ctor_assign::visit_structure (be_structure *)
TAO_OutStream *os = this->ctx_->stream ();
be_decl *bd = this->ctx_->node ();
- os->indent ();
+ *os << be_nl;
if (this->ctx_->exception ()) // Special constructor.
{
*os << "this->" << bd->local_name () << " = _tao_" << bd->local_name ()
- << ";\n";
+ << ";";
}
else
{
*os << "this->" << bd->local_name () << " = _tao_excp."
- << bd->local_name () << ";\n";
+ << bd->local_name () << ";";
}
return 0;
@@ -337,17 +404,17 @@ int be_visitor_exception_ctor_assign::visit_union (be_union *)
TAO_OutStream *os = this->ctx_->stream ();
be_decl *bd = this->ctx_->node ();
- os->indent ();
+ *os << be_nl;
if (this->ctx_->exception ()) // Special constructor.
{
*os << "this->" << bd->local_name () << " = _tao_" << bd->local_name ()
- << ";\n";
+ << ";";
}
else
{
*os << "this->" << bd->local_name () << " = _tao_excp."
- << bd->local_name () << ";\n";
+ << bd->local_name () << ";";
}
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/exception.cpp b/TAO/TAO_IDL/be/be_visitor_exception/exception.cpp
index 71f9590bb4b..47d295c7a0f 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/exception.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/exception.cpp
@@ -18,16 +18,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+ACE_RCSID (be_visitor_exception,
+ exception,
+ "$Id$")
-#include "be_visitor_exception.h"
-ACE_RCSID(be_visitor_exception, exception, "$Id$")
-
-
-// generic struct visitor
+// Generic exception visitor.
be_visitor_exception::be_visitor_exception (be_visitor_context *ctx)
: be_visitor_scope (ctx)
{
@@ -37,74 +33,88 @@ be_visitor_exception::~be_visitor_exception (void)
{
}
-// visit the Exception node and its scope
+// Visit the Exception node and its scope.
int
be_visitor_exception::visit_exception (be_exception *)
{
- return -1; // must be overriden
+ // Must be overriden.
+ return -1;
}
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
+ // 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
+ ctx.node (node);
+ int status = 0;
- // this switch is acceptable rather than having derived visitors overriding
+ // 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;
+ {
+ ctx.state (TAO_CodeGen::TAO_FIELD_CH);
+ be_visitor_field_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_EXCEPTION_CI:
- ctx.state (TAO_CodeGen::TAO_FIELD_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_FIELD_CI);
+ be_visitor_field_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_EXCEPTION_CS:
- ctx.state (TAO_CodeGen::TAO_FIELD_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_FIELD_CS);
+ be_visitor_field_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_FIELD_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_FIELD_CDR_OP_CH);
+ be_visitor_field_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_FIELD_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_FIELD_CDR_OP_CI);
+ be_visitor_field_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_FIELD_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_FIELD_CDR_OP_CS);
+ be_visitor_field_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_exception::"
"visit_field - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_exception::"
"visit_field - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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
index bd9a64347cb..5894e7b4d1a 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp
@@ -18,14 +18,11 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_exception.h"
#include "be_visitor_typecode/typecode_decl.h"
-ACE_RCSID(be_visitor_exception, exception_ch, "$Id$")
-
+ACE_RCSID (be_visitor_exception,
+ exception_ch,
+ "$Id$")
// ******************************************************
// For client header.
@@ -43,103 +40,107 @@ 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 = 0;
-
- if (!node->cli_hdr_gen () && !node->imported ())
+ if (node->cli_hdr_gen () || node->imported ())
{
- os = this->ctx_->stream ();
- os->gen_ifdef_macro (node->flat_name ());
+ return 0;
+ }
- *os << "class " << be_global->stub_export_macro ()
- << " " << node->local_name ()
- << " : public CORBA::UserException" << be_nl;
- *os << "{" << be_nl
- << "public:" << be_idt_nl;
+ TAO_OutStream *os = this->ctx_->stream ();
- // Generate code for field members.
- if (this->visit_scope (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_exception_ch::"
- "visit_exception - "
- "codegen for scope failed\n"), -1);
- }
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
- *os << be_nl;
+ os->gen_ifdef_macro (node->flat_name ());
- // Constructors and destructor.
- *os << node->local_name () << " (void);" << be_nl
- << node->local_name () << " (const " << node->local_name ()
- << " &);" << be_nl
- << "~" << node->local_name () << " (void);\n" << be_nl;
+ *os << "class " << be_global->stub_export_macro ()
+ << " " << node->local_name ()
+ << " : public CORBA::UserException" << be_nl;
+ *os << "{" << be_nl
+ << "public:" << be_idt_nl;
- // Assignment operator.
- *os << node->local_name () << " &operator= (const "
- << node->local_name () << " &);\n" << be_nl;
+ // Generate code for field members.
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_ch::"
+ "visit_exception - "
+ "codegen for scope failed\n"),
+ -1);
+ }
- *os << "static void _tao_any_destructor (void*);\n" << be_nl;
+ *os << be_nl;
- *os << "static " << node->local_name ()
- << " *_downcast (CORBA::Exception *);" << be_nl;
+ // Constructors and destructor.
+ *os << node->local_name () << " (void);" << be_nl
+ << node->local_name () << " (const " << node->local_name ()
+ << " &);" << be_nl
+ << "~" << node->local_name () << " (void);\n" << be_nl;
- *os << "static CORBA::Exception *_alloc (void);\n" << be_nl;
+ // Assignment operator.
+ *os << node->local_name () << " &operator= (const "
+ << node->local_name () << " &);\n" << be_nl;
- *os << "virtual CORBA::Exception *"
- << "_tao_duplicate (void) const;\n" << be_nl
- << "virtual void _raise (void);\n" << be_nl
- << "virtual void _tao_encode (" << be_idt << be_idt_nl
- << "TAO_OutputCDR &" << be_nl
- << "ACE_ENV_ARG_DECL_NOT_USED" << be_uidt_nl
- << ") const;" << be_uidt_nl << be_nl
- << "virtual void _tao_decode (" << be_idt << be_idt_nl
- << "TAO_InputCDR &" << be_nl
- << "ACE_ENV_ARG_DECL_NOT_USED" << be_uidt_nl
- << ");" << be_uidt_nl << be_nl;
+ *os << "static void _tao_any_destructor (void*);\n" << 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_exception_ctor visitor (&ctx);
-
- if (visitor.visit_exception (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_exception::"
- "visit_exception - "
- "codegen for ctor failed\n"),
- -1);
- }
- }
+ *os << "static " << node->local_name ()
+ << " *_downcast (CORBA::Exception *);" << be_nl;
+
+ *os << "static CORBA::Exception *_alloc (void);\n" << be_nl;
+
+ *os << "virtual CORBA::Exception *"
+ << "_tao_duplicate (void) const;\n" << be_nl
+ << "virtual void _raise (void);\n" << be_nl
+ << "virtual void _tao_encode (" << be_idt << be_idt_nl
+ << "TAO_OutputCDR &" << be_nl
+ << "ACE_ENV_ARG_DECL_NOT_USED" << be_uidt_nl
+ << ") const;" << be_uidt_nl << be_nl
+ << "virtual void _tao_decode (" << be_idt << be_idt_nl
+ << "TAO_InputCDR &" << be_nl
+ << "ACE_ENV_ARG_DECL_NOT_USED" << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
- if (be_global->tc_support ())
+ // 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_exception_ctor visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
- *os << be_nl <<"virtual CORBA::TypeCode_ptr _type (void) const;";
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception::"
+ "visit_exception - "
+ "codegen for ctor failed\n"),
+ -1);
}
+ }
+
+ if (be_global->tc_support ())
+ {
+ *os << be_nl <<"virtual CORBA::TypeCode_ptr _type (void) const;";
+ }
+
+ *os << be_uidt_nl << "};" << be_nl << be_nl;
- *os << be_uidt_nl << "};\n\n";
+ if (be_global->tc_support ())
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL);
+ be_visitor_typecode_decl visitor (&ctx);
- if (be_global->tc_support ())
+ if (node->accept (&visitor) == -1)
{
- be_visitor_context ctx (*this->ctx_);
- ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL);
- be_visitor_typecode_decl visitor (&ctx);
-
- if (visitor.visit_exception (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_exception_ch::"
- "visit_exception - "
- "TypeCode declaration failed\n"),
- -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);
}
+ 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
index 7f7a34758b1..dd6ffb31917 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/exception_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/exception_ci.cpp
@@ -18,13 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_exception.h"
-
-ACE_RCSID(be_visitor_exception, exception_ci, "$Id$")
+ACE_RCSID (be_visitor_exception,
+ exception_ci,
+ "$Id$")
// ******************************************************
@@ -43,27 +39,30 @@ 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
+ TAO_OutStream *os = this->ctx_->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
+ // 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);
+ "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
index bb5d9ac87b9..50498fa9201 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp
@@ -18,18 +18,16 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_exception.h"
#include "be_visitor_typecode/typecode_defn.h"
-ACE_RCSID(be_visitor_exception, exception_cs, "$Id$")
-
+ACE_RCSID (be_visitor_exception,
+ exception_cs,
+ "$Id$")
// ***************************************************************************
// For client stubs.
// ***************************************************************************
+
be_visitor_exception_cs::be_visitor_exception_cs (be_visitor_context *ctx)
: be_visitor_exception (ctx)
{
@@ -42,325 +40,319 @@ 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 = 0;
+ if (node->cli_stub_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ os->indent ();
- if (!node->cli_stub_gen () && !node->imported ())
+ // Generate stub code required of any anonymous types of members.
+ if (this->visit_scope (node) == -1)
{
- os = this->ctx_->stream ();
- os->indent ();
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception::"
+ "visit_exception -"
+ "code for stub failed\n"),
+ -1);
+ }
+
+ *os << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Default constructor.
+ *os << "// Default constructor." << be_nl;
+ *os << node->name () << "::" << node->local_name ()
+ << " (void)" << be_idt_nl;
+ *os << ": CORBA_UserException (" << be_idt << be_idt << be_idt_nl
+ << "\"" << node->repoID () << "\"," << be_nl
+ << "\"" << node->local_name () << "\"" << be_uidt_nl
+ << ")" << be_uidt << be_uidt << be_uidt_nl;
+ *os << "{" << be_nl;
+ *os << "}" << be_nl << be_nl;
+
+ // Destructor.
+ *os << "// Destructor - all members are of self managing types."
+ << be_nl;
+ *os << node->name () << "::~" << node->local_name ()
+ << " (void)" << be_nl;
+ *os << "{" << be_nl;
+ *os << "}" << be_nl << be_nl;
+
+ // Copy constructor.
+ *os << "// Copy constructor." << be_nl;
+ *os << node->name () << "::" << node->local_name () << " (const ::"
+ << node->name () << " &_tao_excp)" << be_idt_nl;
+ *os << ": CORBA_UserException (" << be_idt << be_idt << be_idt_nl
+ << "_tao_excp._rep_id ()," << be_nl
+ << "_tao_excp._name ()" << be_uidt_nl
+ << ")" << be_uidt << be_uidt << be_uidt_nl;
+ *os << "{";
+
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS);
+
+ if (node->nmembers () > 0)
+ {
+ *os << be_idt;
- // Generate stub code required of any anonymous types of members.
- if (this->visit_scope (node) == -1)
+ // Assign each individual member.
+ be_visitor_exception_ctor_assign visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_exception::"
+ "(%N:%l) be_visitor_exception_cs::"
"visit_exception -"
- "code for stub failed\n"),
+ "codegen for scope failed\n"),
-1);
}
+ }
- *os << "// TAO_IDL - Generated from " << be_nl
- << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ *os << be_uidt_nl
+ << "}" << be_nl << be_nl;
- // Default constructor.
- *os << "// Default constructor." << be_nl;
- *os << node->name () << "::" << node->local_name ()
- << " (void)" << be_idt_nl;
- *os << ": CORBA_UserException (" << be_idt << be_idt << be_idt_nl
- << "\"" << node->repoID () << "\"," << be_nl
- << "\"" << node->local_name () << "\"" << be_uidt_nl
- << ")" << be_uidt << be_uidt << be_uidt_nl;
- *os << "{" << be_nl;
- *os << "}" << be_nl << be_nl;
+ // Assignment operator.
+ *os << "// Assignment operator." << be_nl;
+ *os << node->name () << "&" << be_nl;
+ *os << node->name () << "::operator= (const ::"
+ << node->name () << " &_tao_excp)" << be_nl
+ << "{" << be_idt_nl
+ << "this->CORBA_UserException::operator= "
+ << "(_tao_excp);";
- // Destructor.
- *os << "// Destructor - all members are of self managing types."
- << be_nl;
- *os << node->name () << "::~" << node->local_name ()
- << " (void)" << be_nl;
- *os << "{" << be_nl;
- *os << "}" << be_nl << be_nl;
+ // Assign each individual member.
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS);
+ be_visitor_exception_ctor_assign visitor (&ctx);
- // Copy constructor.
- *os << "// Copy constructor." << be_nl;
- *os << node->name () << "::" << node->local_name () << " (const ::"
- << node->name () << " &_tao_excp)" << be_idt_nl;
- *os << ": CORBA_UserException (" << be_idt << be_idt << be_idt_nl
- << "_tao_excp._rep_id ()," << be_nl
- << "_tao_excp._name ()" << be_uidt_nl
- << ")" << be_uidt << be_uidt << be_uidt_nl;
- *os << "{\n";
-
- be_visitor_context ctx (*this->ctx_);
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS);
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_cs::"
+ "visit_exception -"
+ "codegen for scope failed\n"),
+ -1);
+ }
- if (node->nmembers () > 0)
+ *os << be_nl
+ << "return *this;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "void "
+ << node->name ()
+ << "::_tao_any_destructor (void *_tao_void_pointer)" << be_nl
+ << "{" << be_idt_nl
+ << node->local_name () << " *tmp = ACE_static_cast ("
+ << node->local_name () << "*, _tao_void_pointer);" << be_nl
+ << "delete tmp;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << node->name () << " *" << be_nl;
+ *os << node->name () << "::_downcast (CORBA::Exception *exc)" << be_nl;
+ *os << "{" << be_idt_nl;
+ *os << "if (!ACE_OS::strcmp (\"" << node->repoID ()
+ << "\", exc->_rep_id ()))" << be_idt_nl;
+ *os << "{" << be_idt_nl;
+ *os << "return ACE_dynamic_cast (" << node->local_name ()
+ << " *, exc);" << be_uidt_nl;
+ *os << "}" << be_uidt_nl;
+ *os << "else" << be_idt_nl;
+ *os << "{" << be_idt_nl;
+ *os << "return 0;" << be_uidt_nl;
+ *os << "}" << be_uidt << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
+
+ // Generate the _alloc method.
+ *os << "CORBA::Exception *" << node->name ()
+ << "::_alloc (void)" << be_nl;
+ *os << "{" << be_idt_nl;
+ *os << "CORBA::Exception *retval = 0;" << be_nl
+ << "ACE_NEW_RETURN (retval, ::" << node->name ()
+ << ", 0);" << be_nl
+ << "return retval;" << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
+
+ *os << "CORBA::Exception *" << be_nl
+ << node->name () << "::_tao_duplicate (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "CORBA::Exception *result;" << be_nl
+ << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
+ << "result," << be_nl
+ << "::" << node->name () << " (*this)," << be_nl
+ << "0" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << "return result;" << be_uidt_nl
+ << "}\n" << be_nl;
+
+ *os << "void " << node->name () << "::_raise ()" << be_nl
+ << "{" << be_idt_nl
+ << "TAO_RAISE (*this);" << be_uidt_nl
+ << "}\n" << be_nl;
+
+ *os << "void " << node->name ()
+ << "::_tao_encode (" << be_idt << be_idt_nl;
+
+ if (!node->is_local ())
+ {
+ *os << "TAO_OutputCDR &cdr" << be_nl
+ << "ACE_ENV_ARG_DECL" << be_uidt_nl
+ << ") const" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "if (cdr << *this)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+
+ if (be_global->use_raw_throw ())
+ {
+ *os << "throw CORBA::MARSHAL ();" << be_uidt_nl;
+ }
+ else
{
- *os << be_idt;
-
- be_visitor_exception_ctor_assign cc_visitor (&ctx);
-
- // Visits scope and generates assignment line in copy constructor.
- if (cc_visitor.visit_exception (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_exception_cs::"
- "visit_exception -"
- "codegen for scope failed\n"),
- -1);
- }
-
- *os << be_uidt;
- os->decr_indent ();
+ *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl;
}
*os << "}" << be_nl << be_nl;
+ }
+ else
+ {
+ *os << "TAO_OutputCDR &" << be_nl
+ << "ACE_ENV_ARG_DECL" << be_uidt_nl
+ << ") const" << be_uidt_nl
+ << "{" << be_idt_nl;
- // Assignment operator.
- *os << "// Assignment operator." << be_nl;
- *os << node->name () << "&" << be_nl;
- *os << node->name () << "::operator= (const ::"
- << node->name () << " &_tao_excp)" << be_nl
- << "{" << be_idt_nl
- << "this->CORBA_UserException::operator= "
- << "(_tao_excp);\n";
-
- // Assign each individual member.
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS);
- be_visitor_exception_ctor_assign ao_visitor (&ctx);
-
- // Visits scope and generates line in assignment operator.
- if (ao_visitor.visit_exception (node) == -1)
+ if (be_global->use_raw_throw ())
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_exception_cs::"
- "visit_exception -"
- "codegen for scope failed\n"),
- -1);
+ *os << "throw CORBA::MARSHAL ();" << be_uidt_nl;
+ }
+ else
+ {
+ *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl;
}
- os->indent ();
- *os << "return *this;" << be_uidt_nl
- << "}" << be_nl << be_nl;
-
- *os << "void "
- << node->name ()
- << "::_tao_any_destructor (void *_tao_void_pointer)" << be_nl
- << "{" << be_idt_nl
- << node->local_name () << " *tmp = ACE_static_cast ("
- << node->local_name () << "*, _tao_void_pointer);" << be_nl
- << "delete tmp;" << be_uidt_nl
- << "}" << be_nl << be_nl;
-
- *os << node->name () << " *" << be_nl;
- *os << node->name () << "::_downcast (CORBA::Exception *exc)" << be_nl;
- *os << "{" << be_idt_nl;
- *os << "if (!ACE_OS::strcmp (\"" << node->repoID ()
- << "\", exc->_rep_id ()))" << be_idt_nl;
- *os << "{" << be_idt_nl;
- *os << "return ACE_dynamic_cast (" << node->local_name ()
- << " *, exc);" << be_uidt_nl;
- *os << "}" << be_uidt_nl;
- *os << "else" << be_idt_nl;
- *os << "{" << be_idt_nl;
- *os << "return 0;" << be_uidt_nl;
- *os << "}" << be_uidt << be_uidt_nl;
*os << "}" << be_nl << be_nl;
+ }
- // Generate the _alloc method.
- *os << "CORBA::Exception *" << node->name ()
- << "::_alloc (void)" << be_nl;
- *os << "{" << be_idt_nl;
- *os << "CORBA::Exception *retval = 0;" << be_nl
- << "ACE_NEW_RETURN (retval, ::" << node->name ()
- << ", 0);" << be_nl
- << "return retval;" << be_uidt_nl;
- *os << "}" << be_nl << be_nl;
+ *os << "void " << node->name ()
+ << "::_tao_decode (" << be_idt << be_idt_nl;
- *os << "CORBA::Exception *" << be_nl
- << node->name () << "::_tao_duplicate (void) const" << be_nl
+ if (!node->is_local ())
+ {
+ *os << "TAO_InputCDR &cdr" << be_nl
+ << "ACE_ENV_ARG_DECL" << be_uidt_nl
+ << ")" << be_uidt_nl
<< "{" << be_idt_nl
- << "CORBA::Exception *result;" << be_nl
- << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
- << "result," << be_nl
- << "::" << node->name () << " (*this)," << be_nl
- << "0" << be_uidt_nl
- << ");" << be_uidt_nl
- << "return result;" << be_uidt_nl
- << "}\n" << be_nl;
-
- *os << "void " << node->name () << "::_raise ()" << be_nl
+ << "if (cdr >> *this)" << be_idt_nl
<< "{" << be_idt_nl
- << "TAO_RAISE (*this);" << be_uidt_nl
- << "}\n" << be_nl;
-
- *os << "void " << node->name ()
- << "::_tao_encode (" << be_idt << be_idt_nl;
+ << "return;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
- if (!node->is_local ())
+ if (be_global->use_raw_throw ())
{
- *os << "TAO_OutputCDR &cdr" << be_nl
- << "ACE_ENV_ARG_DECL" << be_uidt_nl
- << ") const" << be_uidt_nl
- << "{" << be_idt_nl
- << "if (cdr << *this)" << be_idt_nl
- << "{" << be_idt_nl
- << "return;" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl;
-
- if (be_global->use_raw_throw ())
- {
- *os << "throw CORBA::MARSHAL ();" << be_uidt_nl;
- }
- else
- {
- *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl;
- }
-
- *os << "}" << be_nl << be_nl;
+ *os << "throw CORBA::MARSHAL ();" << be_uidt_nl;
}
else
{
- *os << "TAO_OutputCDR &" << be_nl
- << "ACE_ENV_ARG_DECL" << be_uidt_nl
- << ") const" << be_uidt_nl
- << "{" << be_idt_nl;
-
- if (be_global->use_raw_throw ())
- {
- *os << "throw CORBA::MARSHAL ();" << be_uidt_nl;
- }
- else
- {
- *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl;
- }
-
- *os << "}" << be_nl << be_nl;
+ *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl;
}
- *os << "void " << node->name ()
- << "::_tao_decode (" << be_idt << be_idt_nl;
+ *os << "}" << be_nl << be_nl;
+ }
+ else
+ {
+ *os << "TAO_InputCDR &" << be_nl
+ << "ACE_ENV_ARG_DECL" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
- if (!node->is_local ())
+ if (be_global->use_raw_throw ())
{
- *os << "TAO_InputCDR &cdr" << be_nl
- << "ACE_ENV_ARG_DECL" << be_uidt_nl
- << ")" << be_uidt_nl
- << "{" << be_idt_nl
- << "if (cdr >> *this)" << be_idt_nl
- << "{" << be_idt_nl
- << "return;" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl;
-
- if (be_global->use_raw_throw ())
- {
- *os << "throw CORBA::MARSHAL ();" << be_uidt_nl;
- }
- else
- {
- *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl;
- }
-
- *os << "}" << be_nl << be_nl;
+ *os << "throw CORBA::MARSHAL ();" << be_uidt_nl;
}
else
{
- *os << "TAO_InputCDR &" << be_nl
- << "ACE_ENV_ARG_DECL" << be_uidt_nl
- << ")" << be_uidt_nl
- << "{" << be_idt_nl;
-
- if (be_global->use_raw_throw ())
- {
- *os << "throw CORBA::MARSHAL ();" << be_uidt_nl;
- }
- else
- {
- *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl;
- }
-
- *os << "}" << be_nl << be_nl;
+ *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl;
}
- // Constructor taking all members. It exists only if there are any
- // members.
- if (node->member_count () > 0)
+ *os << "}" << be_nl << be_nl;
+ }
+
+ // 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);
+ be_visitor_exception_ctor ec_visitor (&ctx);
+
+ if (node->accept (&ec_visitor) == -1)
{
- // Generate the signature.
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_CS);
- be_visitor_exception_ctor con_visitor (&ctx);
-
- if (con_visitor.visit_exception (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_exception::"
- "visit_exception - "
- "codegen for ctor failed\n"),
- -1);
- }
-
- *os << " : CORBA_UserException ("
- << be_idt << be_idt << be_idt << be_idt_nl
- << "\"" << node->repoID () << "\"," << be_nl
- << "\"" << node->local_name () << "\"" << be_uidt_nl
- << ")" << be_uidt << be_uidt << be_uidt << be_uidt_nl;
- *os << "{\n";
-
- // Assign each individual member. We need yet another state.
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS);
-
- // Indicate that the special ctor is being generated.
- ctx.exception (1);
-
- be_visitor_exception_ctor_assign ca_visitor (&ctx);
-
- *os << be_idt;
-
- if (ca_visitor.visit_exception (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_exception_cs::"
- "visit_exception -"
- "codegen for scope failed\n"),
- -1);
- }
-
- os->decr_indent ();
- *os << "}\n\n";
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception::"
+ "visit_exception - "
+ "codegen for ctor failed\n"),
+ -1);
}
- if (be_global->tc_support ())
+ *os << " : CORBA_UserException ("
+ << be_idt << be_idt << be_idt << be_idt_nl
+ << "\"" << node->repoID () << "\"," << be_nl
+ << "\"" << node->local_name () << "\"" << be_uidt_nl
+ << ")" << be_uidt << be_uidt << be_uidt << be_uidt_nl;
+ *os << "{" << be_idt;
+
+ // Assign each individual member. We need yet another state.
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS);
+
+ // Indicate that the special ctor is being generated.
+ ctx.exception (1);
+
+ be_visitor_exception_ctor_assign eca_visitor (&ctx);
+
+ if (node->accept (&eca_visitor) == -1)
{
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN);
- ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
- be_visitor_typecode_defn tc_visitor (&ctx);
-
- if (tc_visitor.visit_exception (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_exception_cs::"
- "visit_exception - "
- "TypeCode definition failed\n"),
- -1);
- }
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_cs::"
+ "visit_exception -"
+ "codegen for scope failed\n"),
+ -1);
}
- if (be_global->tc_support ())
+ *os << be_uidt_nl << "}" << be_nl << be_nl;
+ }
+
+ if (be_global->tc_support ())
+ {
+ *os << "// TAO extension - the virtual _type method." << be_nl;
+ *os << "CORBA::TypeCode_ptr " << node->name ()
+ << "::_type (void) const" << be_nl;
+ *os << "{" << be_idt_nl;
+ *os << "return ::" << node->tc_name () << ";" << be_uidt_nl;
+ *os << "}" << be_nl;
+ }
+
+ if (be_global->tc_support ())
+ {
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN);
+ ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
+ be_visitor_typecode_defn visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
- *os << "\n// TAO extension - the virtual _type method." << be_nl;
- *os << "CORBA::TypeCode_ptr " << node->name ()
- << "::_type (void) const" << be_nl;
- *os << "{" << be_idt_nl;
- *os << "return ::" << node->tc_name () << ";" << be_uidt_nl;
- *os << "}" << be_nl << be_nl;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_cs::"
+ "visit_exception - "
+ "TypeCode definition failed\n"),
+ -1);
}
-
- node->cli_stub_gen (I_TRUE);
}
+ 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
index db7cb836e3a..cf497604458 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/exception_ctor.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/exception_ctor.cpp
@@ -18,21 +18,16 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_exception.h"
-
-ACE_RCSID(be_visitor_exception, exception_ctor, "$Id$")
+ACE_RCSID (be_visitor_exception,
+ exception_ctor,
+ "$Id$")
// ************************************************************************
// code to generate the special ctor
// ************************************************************************
-be_visitor_exception_ctor::be_visitor_exception_ctor
-(be_visitor_context *ctx)
+be_visitor_exception_ctor::be_visitor_exception_ctor (be_visitor_context *ctx)
: be_visitor_scope (ctx)
{
}
@@ -59,8 +54,6 @@ int be_visitor_exception_ctor::visit_exception (be_exception *node)
TAO_OutStream *os = this->ctx_->stream ();
this->ctx_->node (node);
- os->indent ();
-
if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH)
{
*os << node->local_name ();
@@ -119,19 +112,23 @@ int be_visitor_exception_ctor::visit_field (be_field *node)
}
*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;
+ TAO_OutStream *os = this->ctx_->stream ();
be_type *bt;
+
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
*os << "const ";
@@ -139,10 +136,14 @@ int be_visitor_exception_ctor::visit_array (be_array *node)
if (this->ctx_->state () != TAO_CodeGen::TAO_EXCEPTION_CTOR_CH
&& !tdef)
- *os << this->ctx_->scope ()->full_name () << "::";
+ {
+ *os << this->ctx_->scope ()->full_name () << "::";
+ }
if (!tdef)
- *os << "_";
+ {
+ *os << "_";
+ }
*os << bt->nested_type_name (this->ctx_->scope ());
@@ -151,113 +152,218 @@ int be_visitor_exception_ctor::visit_array (be_array *node)
int be_visitor_exception_ctor::visit_enum (be_enum *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
-
- // set the right type;
+ TAO_OutStream *os = this->ctx_->stream ();
be_type *bt;
+
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH)
- *os << bt->nested_type_name (this->ctx_->scope ());
+ {
+ *os << bt->nested_type_name (this->ctx_->scope ());
+ }
else
- *os << bt->name ();
+ {
+ *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;
+ TAO_OutStream *os = this->ctx_->stream ();
be_type *bt;
+
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH)
- *os << "const " << bt->nested_type_name (this->ctx_->scope (), "_ptr ");
+ {
+ *os << "const " << bt->nested_type_name (this->ctx_->scope (), "_ptr");
+ }
else
- *os << "const " << bt->name () << "_ptr ";
+ {
+ *os << "const " << bt->name () << "_ptr";
+ }
+
return 0;
}
int be_visitor_exception_ctor::visit_interface_fwd (be_interface_fwd *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ 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_EXCEPTION_CTOR_CH)
+ {
+ *os << "const " << bt->nested_type_name (this->ctx_->scope (), "_ptr");
+ }
+ else
+ {
+ *os << "const " << bt->name () << "_ptr";
+ }
- // set the right type;
+ return 0;
+}
+
+int be_visitor_exception_ctor::visit_valuetype (be_valuetype *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
be_type *bt;
+
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH)
- *os << "const " << bt->nested_type_name (this->ctx_->scope (), "_ptr ");
+ {
+ *os << "const " << bt->nested_type_name (this->ctx_->scope (), " *");
+ }
else
- *os << "const " << bt->name () << "_ptr ";
+ {
+ *os << "const " << bt->name () << " *";
+ }
+
return 0;
}
-int be_visitor_exception_ctor::visit_predefined_type (be_predefined_type *node)
+int be_visitor_exception_ctor::visit_valuetype_fwd (be_valuetype_fwd *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
- // set the right type;
+ 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_predefined_type (be_predefined_type *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
be_type *bt;
+
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
+
+ AST_PredefinedType::PredefinedType pt = node->pt ();
- // check if the type is an any
- if (node->pt () == AST_PredefinedType::PT_any)
+ if (pt == AST_PredefinedType::PT_any)
{
if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH)
- *os << "const " << bt->nested_type_name (this->ctx_->scope ());
+ {
+ *os << "const " << bt->nested_type_name (this->ctx_->scope ());
+ }
else
- *os << "const " << bt->name ();
+ {
+ *os << "const " << bt->name ();
+ }
+
*os << " &";
+
return 0;
- } // end of if
- else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object
+ }
+ else if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
{
if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH)
- *os << "const " << bt->nested_type_name (this->ctx_->scope (), "_ptr ");
+ {
+ *os << "const " << bt->nested_type_name (this->ctx_->scope (),
+ "_ptr ");
+ }
else
- *os << "const " << bt->name () << "_ptr ";
- } // end else if
- else // simple predefined types
+ {
+ *os << "const " << bt->name () << "_ptr ";
+ }
+ }
+ else
{
if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH)
- *os << bt->nested_type_name (this->ctx_->scope ());
+ {
+ *os << bt->nested_type_name (this->ctx_->scope ());
+ }
else
- *os << bt->name ();
- } // end of else
+ {
+ *os << bt->name ();
+ }
+ }
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;
+ TAO_OutStream *os = this->ctx_->stream ();
be_type *bt;
+
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH)
- *os << "const " << bt->nested_type_name (this->ctx_->scope ());
+ {
+ *os << "const " << bt->nested_type_name (this->ctx_->scope ());
+ }
else
- *os << "const " << bt->name ();
+ {
+ *os << "const " << bt->name ();
+ }
+
*os << " &";
+
return 0;
}
@@ -279,45 +385,64 @@ int be_visitor_exception_ctor::visit_string (be_string *node)
int be_visitor_exception_ctor::visit_structure (be_structure *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
-
- // set the right type;
+ TAO_OutStream *os = this->ctx_->stream ();
be_type *bt;
+
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH)
- *os << "const " << bt->nested_type_name (this->ctx_->scope ());
+ {
+ *os << "const " << bt->nested_type_name (this->ctx_->scope ());
+ }
else
- *os << "const " << bt->name ();
+ {
+ *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;
+ TAO_OutStream *os = this->ctx_->stream ();
be_type *bt;
+
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH)
- *os << "const " << bt->nested_type_name (this->ctx_->scope ());
+ {
+ *os << "const " << bt->nested_type_name (this->ctx_->scope ());
+ }
else
- *os << "const " << bt->name ();
+ {
+ *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,
@@ -326,6 +451,7 @@ int be_visitor_exception_ctor::visit_typedef (be_typedef *node)
"accept on primitive type failed\n"),
-1);
}
+
this->ctx_->alias (0);
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_factory.cpp b/TAO/TAO_IDL/be/be_visitor_factory.cpp
index 52b6c1fa471..2a228ffe01d 100644
--- a/TAO/TAO_IDL/be/be_visitor_factory.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_factory.cpp
@@ -10,761 +10,135 @@
//
// = DESCRIPTION
// Defines a factory that returns a specialized visitor object based on the
-// code generation state. This factory creates all the commonly used
-// visitors that are not affected by decisions such as whether we use
-// compiled marshaling or interpretive marshaling.
+// code generation state. This factory creates visitors associated with
+// Asynchronous Messaging Invocations (AMI) since, because of implied IDL,
+// state is not locally known at visitor creation time.
//
// = AUTHOR
// Aniruddha Gokhale
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "ast_argument.h"
-// individual visitors included only here
#include "be_visitor_factory.h"
-
-#include "be_visitor_argument.h"
-#include "be_visitor_array.h"
-#include "be_visitor_attribute.h"
-#include "be_visitor_constant.h"
-#include "be_visitor_enum.h"
-#include "be_visitor_exception.h"
-#include "be_visitor_field.h"
-#include "be_visitor_interface.h"
-#include "be_visitor_interface_fwd.h"
-#include "be_visitor_valuetype.h"
-#include "be_visitor_valuetype_fwd.h"
-#include "be_visitor_module.h"
-#include "be_visitor_operation.h"
-#include "be_visitor_root.h"
-#include "be_visitor_sequence.h"
-#include "be_visitor_structure.h"
-#include "be_visitor_typecode.h"
-#include "be_visitor_typedef.h"
-#include "be_visitor_union.h"
-#include "be_visitor_union_branch.h"
-
-ACE_RCSID(be, be_visitor_factory, "$Id$")
-
-
- // The BASE abstract visitor factory
- TAO_Visitor_Factory::TAO_Visitor_Factory (void)
+#include "be_visitor_context.h"
+
+#include "be_visitor_decl.h"
+#include "be_visitor_scope.h"
+#include "be_visitor_interface/interface.h"
+#include "be_visitor_interface/interface_ch.h"
+#include "be_visitor_interface/ami_interface_ch.h"
+#include "be_visitor_valuetype/valuetype.h"
+#include "be_visitor_valuetype/valuetype_ch.h"
+#include "be_visitor_valuetype/valuetype_obv_ch.h"
+#include "be_visitor_valuetype/valuetype_obv_cs.h"
+#include "be_visitor_valuetype/ami_exception_holder_ch.h"
+#include "be_visitor_valuetype/ami_exception_holder_cs.h"
+#include "be_visitor_operation/operation.h"
+#include "be_visitor_operation/operation_ch.h"
+#include "be_visitor_operation/operation_cs.h"
+#include "be_visitor_operation/ami_ch.h"
+#include "be_visitor_operation/ami_cs.h"
+#include "be_visitor_operation/ami_handler_reply_stub_operation_ch.h"
+#include "be_visitor_operation/ami_handler_reply_stub_operation_cs.h"
+#include "be_visitor_operation/ami_exception_holder_operation_cs.h"
+
+ACE_RCSID (be,
+ be_visitor_factory,
+ "$Id$")
+
+TAO_Visitor_Factory::TAO_Visitor_Factory (void)
{
}
-// destructor
TAO_Visitor_Factory::~TAO_Visitor_Factory (void)
{
}
-// The concrete visitor factory for visitors irrespective of the the marshaling
-// approaches used.
-//
-// This common visitor factory also deals with a 2nd level of code-generation
-// choices that the user has requested. This involves enabling/disabling
-// support for specific type of kind, e.g., generation of TypeCodes or Any
-// operators or Real C++ exception suport.
-TAO_Common_Visitor_Factory::TAO_Common_Visitor_Factory (void)
-{
-}
-
-// destructor
-TAO_Common_Visitor_Factory::~TAO_Common_Visitor_Factory (void)
-{
-}
-
be_visitor *
-TAO_Common_Visitor_Factory::make_visitor (be_visitor_context *ctx)
+TAO_Visitor_Factory::make_visitor (be_visitor_context *ctx)
{
- TAO_CodeGen::CG_STATE st = ctx->state ();
- // create a new context so that ownership issues are not confused. This newly
- // created context is a copy of what was sent by the caller. The newly
- // created visitor will own this new copy.
- be_visitor_context *new_ctx = new be_visitor_context (*ctx);
- switch (st)
- {
- case TAO_CodeGen::TAO_ROOT_CH:
- return new be_visitor_root_ch (new_ctx);
- case TAO_CodeGen::TAO_ROOT_CI:
- return new be_visitor_root_ci (new_ctx);
- case TAO_CodeGen::TAO_ROOT_CS:
- return new be_visitor_root_cs (new_ctx);
- case TAO_CodeGen::TAO_ROOT_SH:
- return new be_visitor_root_sh (new_ctx);
- case TAO_CodeGen::TAO_ROOT_SI:
- return new be_visitor_root_si (new_ctx);
- case TAO_CodeGen::TAO_ROOT_SS:
- return new be_visitor_root_ss (new_ctx);
- case TAO_CodeGen::TAO_ROOT_IH:
- return new be_visitor_root_ih (new_ctx);
- case TAO_CodeGen::TAO_ROOT_IS:
- return new be_visitor_root_is (new_ctx);
- case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
- case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
- // this is the starting point for generation of all Any operators. If we
- // have the any support enabled, then go ahead
- if (be_global->any_support ())
- return new be_visitor_root_any_op (new_ctx);
- else
- // return a NO_OP visitor
- return new be_visitor_decl (new_ctx);
-
- case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
- case TAO_CodeGen::TAO_ROOT_CDR_OP_CI:
- case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
- return new be_visitor_root_cdr_op (new_ctx);
-
- case TAO_CodeGen::TAO_MODULE_CH:
- return new be_visitor_module_ch (new_ctx);
-
- case TAO_CodeGen::TAO_MODULE_SH:
- return new be_visitor_module_sh (new_ctx);
-
- case TAO_CodeGen::TAO_MODULE_IH:
- return new be_visitor_module_ih (new_ctx);
-
- case TAO_CodeGen::TAO_MODULE_CI:
- case TAO_CodeGen::TAO_MODULE_CS:
- case TAO_CodeGen::TAO_MODULE_SI:
- case TAO_CodeGen::TAO_MODULE_SS:
- case TAO_CodeGen::TAO_MODULE_IS:
- return new be_visitor_module (new_ctx);
-
- case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
- case TAO_CodeGen::TAO_MODULE_ANY_OP_CS:
- return new be_visitor_module_any_op (new_ctx);
-
- case TAO_CodeGen::TAO_MODULE_CDR_OP_CH:
- case TAO_CodeGen::TAO_MODULE_CDR_OP_CI:
- case TAO_CodeGen::TAO_MODULE_CDR_OP_CS:
- return new be_visitor_module_cdr_op (new_ctx);
+ be_visitor *retval = 0;
+ switch (ctx->state ())
+ {
case TAO_CodeGen::TAO_INTERFACE_CH:
- return new be_visitor_interface_ch (new_ctx);
-
- case TAO_CodeGen::TAO_INTERFACE_CI:
- return new be_visitor_interface_ci (new_ctx);
-
- case TAO_CodeGen::TAO_INTERFACE_CS:
- return new be_visitor_interface_cs (new_ctx);
-
- case TAO_CodeGen::TAO_INTERFACE_SH:
- return new be_visitor_interface_sh (new_ctx);
-
- case TAO_CodeGen::TAO_INTERFACE_IH:
- return new be_visitor_interface_ih (new_ctx);
-
- case TAO_CodeGen::TAO_INTERFACE_SI:
- return new be_visitor_interface_si (new_ctx);
-
- case TAO_CodeGen::TAO_INTERFACE_SS:
- return new be_visitor_interface_ss (new_ctx);
-
- case TAO_CodeGen::TAO_INTERFACE_IS:
- return new be_visitor_interface_is (new_ctx);
-
- case TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_CH:
- return new be_visitor_interface_proxy_brokers_ch (new_ctx);
-
- case TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_BROKER_CH:
- return new be_visitor_interface_base_proxy_broker_ch (new_ctx);
-
- case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_BROKER_CH:
- return new be_visitor_interface_remote_proxy_broker_ch (new_ctx);
-
- case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_BROKER_CS:
- return new be_visitor_interface_remote_proxy_broker_cs (new_ctx);
-
- case TAO_CodeGen::TAO_INTERFACE_STRATEGIZED_PROXY_BROKER_SH:
- return new be_visitor_interface_strategized_proxy_broker_sh (new_ctx);
-
- case TAO_CodeGen::TAO_INTERFACE_STRATEGIZED_PROXY_BROKER_SS:
- return new be_visitor_interface_strategized_proxy_broker_ss (new_ctx);
-
- case TAO_CodeGen::TAO_INTERFACE_PROXY_IMPLS_CH:
- return new be_visitor_interface_proxy_impls_ch (new_ctx);
-
- case TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_IMPL_CH:
- return new be_visitor_interface_base_proxy_impl_ch (new_ctx);
-
- case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_IMPL_CH:
- return new be_visitor_interface_remote_proxy_impl_ch (new_ctx);
-
- case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_IMPL_CS:
- return new be_visitor_interface_remote_proxy_impl_cs (new_ctx);
-
- case TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SH:
- return new be_visitor_interface_thru_poa_proxy_impl_sh (new_ctx);
-
- case TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SS:
- return new be_visitor_interface_thru_poa_proxy_impl_ss (new_ctx);
-
- case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH:
- return new be_visitor_interface_direct_proxy_impl_sh (new_ctx);
-
- case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS:
- return new be_visitor_interface_direct_proxy_impl_ss (new_ctx);
-
- case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH:
- return new be_visitor_interface_any_op_ch (new_ctx);
- case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS:
- return new be_visitor_interface_any_op_cs (new_ctx);
- case TAO_CodeGen::TAO_INTERFACE_TIE_SH:
- return new be_visitor_interface_tie_sh (new_ctx);
- case TAO_CodeGen::TAO_INTERFACE_TIE_SI:
- return new be_visitor_interface_tie_si (new_ctx);
- case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CH:
- return new be_visitor_interface_cdr_op_ch (new_ctx);
- case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CI:
- return new be_visitor_interface_cdr_op_ci (new_ctx);
- case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CS:
- return new be_visitor_interface_cdr_op_cs (new_ctx);
- case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
- return new be_visitor_interface_smart_proxy_ch (new_ctx);
- case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
- return new be_visitor_interface_smart_proxy_cs (new_ctx);
- case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CH:
- return new be_visitor_interface_interceptors_ch (new_ctx);
- case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CS:
- return new be_visitor_interface_interceptors_cs (new_ctx);
- case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SH:
- return new be_visitor_interface_interceptors_sh (new_ctx);
- case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SS:
- return new be_visitor_interface_interceptors_ss (new_ctx);
- case TAO_CodeGen::TAO_INTERFACE_FWD_CH:
- return new be_visitor_interface_fwd_ch (new_ctx);
- case TAO_CodeGen::TAO_INTERFACE_FWD_CI:
- return new be_visitor_interface_fwd_ci (new_ctx);
-
- case TAO_CodeGen::TAO_INTERFACE_FWD_CDR_OP_CH:
- return new be_visitor_interface_fwd_cdr_op_ch (new_ctx);
- case TAO_CodeGen::TAO_INTERFACE_FWD_CDR_OP_CI:
- return new be_visitor_interface_fwd_cdr_op_ci (new_ctx);
- case TAO_CodeGen::TAO_INTERFACE_FWD_CDR_OP_CS:
- return new be_visitor_decl (new_ctx); // noop
- case TAO_CodeGen::TAO_INTERFACE_FWD_ANY_OP_CH:
- return new be_visitor_interface_fwd_any_op_ch (new_ctx);
-
- // Valuetype-related visitors
-
- case TAO_CodeGen::TAO_VALUETYPE_CH:
- return new be_visitor_valuetype_ch (new_ctx);
- case TAO_CodeGen::TAO_VALUETYPE_CS:
- return new be_visitor_valuetype_cs (new_ctx);
- case TAO_CodeGen::TAO_VALUETYPE_CI:
- return new be_visitor_valuetype_ci (new_ctx);
-
- case TAO_CodeGen::TAO_VALUETYPE_FWD_CH:
- return new be_visitor_valuetype_fwd_ch (new_ctx);
- case TAO_CodeGen::TAO_VALUETYPE_FWD_CI:
- return new be_visitor_valuetype_fwd_ci (new_ctx);
-
- case TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CH:
- return new be_visitor_valuetype_fwd_cdr_op_ch (new_ctx);
- case TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CI:
- return new be_visitor_valuetype_fwd_cdr_op_ci (new_ctx);
-
+ ACE_NEW_RETURN (retval,
+ be_visitor_interface_ch (ctx),
+ 0);
+ break;
case TAO_CodeGen::TAO_VALUETYPE_OBV_CH:
- return new be_visitor_valuetype_obv_ch (new_ctx);
- case TAO_CodeGen::TAO_VALUETYPE_OBV_CI:
- return new be_visitor_valuetype_obv_ci (new_ctx);
+ ACE_NEW_RETURN (retval,
+ be_visitor_valuetype_obv_ch (ctx),
+ 0);
+ break;
case TAO_CodeGen::TAO_VALUETYPE_OBV_CS:
- return new be_visitor_valuetype_obv_cs (new_ctx);
-
- case TAO_CodeGen::TAO_FIELD_OBV_CH:
- return new be_visitor_valuetype_field_ch (new_ctx);
-
- case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IMPL_CH:
- case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IMPL_CS:
- case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_CH:
- case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_OBV_CH:
- return new be_visitor_obv_operation_arglist (new_ctx);
-
- case TAO_CodeGen::TAO_MODULE_OBV_CH:
- case TAO_CodeGen::TAO_MODULE_OBV_CI:
- case TAO_CodeGen::TAO_MODULE_OBV_CS:
- return new be_visitor_obv_module (new_ctx);
-
- case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CH:
- return new be_visitor_valuetype_cdr_op_ch (new_ctx);
- case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CI:
- return new be_visitor_valuetype_cdr_op_ci (new_ctx);
- case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CS:
- return new be_visitor_valuetype_cdr_op_cs (new_ctx);
-
- case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CH:
- return new be_visitor_valuetype_any_op_ch (new_ctx);
- case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CS:
- return new be_visitor_valuetype_any_op_cs (new_ctx);
-
- case TAO_CodeGen::TAO_VALUETYPE_INIT_CH:
- return new be_visitor_valuetype_init_ch (new_ctx);
- case TAO_CodeGen::TAO_VALUETYPE_INIT_CI:
- return new be_visitor_valuetype_init_ci (new_ctx);
- case TAO_CodeGen::TAO_VALUETYPE_INIT_CS:
- return new be_visitor_valuetype_init_cs (new_ctx);
-
- case TAO_CodeGen::TAO_VALUETYPE_INIT_ARGLIST_CH:
- return new be_visitor_valuetype_init_arglist_ch (new_ctx);
-
- case TAO_CodeGen::TAO_STRUCT_CH:
- return new be_visitor_structure_ch (new_ctx);
- case TAO_CodeGen::TAO_STRUCT_CS:
- return new be_visitor_structure_cs (new_ctx);
- case TAO_CodeGen::TAO_STRUCT_CI:
- return new be_visitor_structure_ci (new_ctx);
- case TAO_CodeGen::TAO_STRUCT_ANY_OP_CH:
- return new be_visitor_structure_any_op_ch (new_ctx);
- case TAO_CodeGen::TAO_STRUCT_ANY_OP_CS:
- return new be_visitor_structure_any_op_cs (new_ctx);
- case TAO_CodeGen::TAO_STRUCT_CDR_OP_CH:
- return new be_visitor_structure_cdr_op_ch (new_ctx);
- case TAO_CodeGen::TAO_STRUCT_CDR_OP_CI:
- return new be_visitor_structure_cdr_op_ci (new_ctx);
- case TAO_CodeGen::TAO_STRUCT_CDR_OP_CS:
- return new be_visitor_structure_cdr_op_cs (new_ctx);
-
- case TAO_CodeGen::TAO_CONSTANT_CH:
- return new be_visitor_constant_ch (new_ctx);
- case TAO_CodeGen::TAO_CONSTANT_CS:
- return new be_visitor_constant_cs (new_ctx);
-
- case TAO_CodeGen::TAO_ENUM_CH:
- return new be_visitor_enum_ch (new_ctx);
- case TAO_CodeGen::TAO_ENUM_CS:
- return new be_visitor_enum_cs (new_ctx);
- case TAO_CodeGen::TAO_ENUM_ANY_OP_CH:
- return new be_visitor_enum_any_op_ch (new_ctx);
- case TAO_CodeGen::TAO_ENUM_ANY_OP_CS:
- return new be_visitor_enum_any_op_cs (new_ctx);
- case TAO_CodeGen::TAO_ENUM_CDR_OP_CH:
- return new be_visitor_enum_cdr_op_ch (new_ctx);
- case TAO_CodeGen::TAO_ENUM_CDR_OP_CI:
- return new be_visitor_enum_cdr_op_ci (new_ctx);
- case TAO_CodeGen::TAO_ENUM_CDR_OP_CS:
- return new be_visitor_decl (new_ctx);
-
- case TAO_CodeGen::TAO_FIELD_CH:
- return new be_visitor_field_ch (new_ctx);
- case TAO_CodeGen::TAO_FIELD_CS:
- return new be_visitor_field_cs (new_ctx);
- case TAO_CodeGen::TAO_FIELD_CI:
- return new be_visitor_field_ci (new_ctx);
- case TAO_CodeGen::TAO_FIELD_CDR_OP_CH:
- return new be_visitor_field_cdr_op_ch (new_ctx);
- case TAO_CodeGen::TAO_FIELD_CDR_OP_CI:
- return new be_visitor_field_cdr_op_ci (new_ctx);
- case TAO_CodeGen::TAO_FIELD_CDR_OP_CS:
- return new be_visitor_field_cdr_op_cs (new_ctx);
-
- case TAO_CodeGen::TAO_UNION_CH:
- return new be_visitor_union_ch (new_ctx);
- case TAO_CodeGen::TAO_UNION_CI:
- return new be_visitor_union_ci (new_ctx);
- case TAO_CodeGen::TAO_UNION_CS:
- return new be_visitor_union_cs (new_ctx);
- case TAO_CodeGen::TAO_UNION_PUBLIC_CH:
- return new be_visitor_union_branch_public_ch (new_ctx);
- case TAO_CodeGen::TAO_UNION_PUBLIC_CI:
- return new be_visitor_union_branch_public_ci (new_ctx);
- case TAO_CodeGen::TAO_UNION_PUBLIC_CS:
- return new be_visitor_union_branch_public_cs (new_ctx);
- case TAO_CodeGen::TAO_UNION_PUBLIC_ASSIGN_CS:
- return new be_visitor_union_branch_public_assign_cs (new_ctx);
- case TAO_CodeGen::TAO_UNION_PUBLIC_RESET_CS:
- return new be_visitor_union_branch_public_reset_cs (new_ctx);
- case TAO_CodeGen::TAO_UNION_PUBLIC_ACCESS_CS:
- return new be_visitor_union_branch_public_access_cs (new_ctx);
- case TAO_CodeGen::TAO_UNION_PRIVATE_CH:
- return new be_visitor_union_branch_private_ch (new_ctx);
- case TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CH:
- return new be_visitor_union_discriminant_ch (new_ctx);
- case TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CI:
- return new be_visitor_union_discriminant_ci (new_ctx);
- case TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CS:
- return new be_visitor_union_discriminant_cs (new_ctx);
- case TAO_CodeGen::TAO_UNION_ANY_OP_CH:
- return new be_visitor_union_any_op_ch (new_ctx);
- case TAO_CodeGen::TAO_UNION_ANY_OP_CS:
+ ACE_NEW_RETURN (retval,
+ be_visitor_valuetype_obv_cs (ctx),
+ 0);
break;
- case TAO_CodeGen::TAO_UNION_CDR_OP_CH:
- return new be_visitor_union_cdr_op_ch (new_ctx);
- case TAO_CodeGen::TAO_UNION_CDR_OP_CI:
- return new be_visitor_union_cdr_op_ci (new_ctx);
- case TAO_CodeGen::TAO_UNION_CDR_OP_CS:
- return new be_visitor_union_cdr_op_cs (new_ctx);
- case TAO_CodeGen::TAO_UNION_BRANCH_CDR_OP_CH:
- return new be_visitor_union_branch_cdr_op_ch (new_ctx);
- case TAO_CodeGen::TAO_UNION_BRANCH_CDR_OP_CI:
- return new be_visitor_union_branch_cdr_op_ci (new_ctx);
- case TAO_CodeGen::TAO_UNION_BRANCH_CDR_OP_CS:
- return new be_visitor_union_branch_cdr_op_cs (new_ctx);
-
- case TAO_CodeGen::TAO_SEQUENCE_CH:
- return new be_visitor_sequence_ch (new_ctx);
- case TAO_CodeGen::TAO_SEQUENCE_CI:
- return new be_visitor_sequence_ci (new_ctx);
- case TAO_CodeGen::TAO_SEQUENCE_CS:
- return new be_visitor_sequence_cs (new_ctx);
- case TAO_CodeGen::TAO_SEQUENCE_BASE_CH:
- case TAO_CodeGen::TAO_SEQUENCE_BASE_CI:
- case TAO_CodeGen::TAO_SEQUENCE_BASE_CS:
- return new be_visitor_sequence_base (new_ctx);
- case TAO_CodeGen::TAO_SEQELEM_RETTYPE_CH:
- case TAO_CodeGen::TAO_SEQELEM_RETTYPE_CI:
- return new be_visitor_sequence_elemtype (new_ctx);
- case TAO_CodeGen::TAO_SEQUENCE_BUFFER_TYPE_CH:
- case TAO_CodeGen::TAO_SEQUENCE_BUFFER_TYPE_CI:
- case TAO_CodeGen::TAO_SEQUENCE_BUFFER_TYPE_CS:
- return new be_visitor_sequence_buffer_type (new_ctx);
- case TAO_CodeGen::TAO_SEQUENCE_ANY_OP_CH:
- return new be_visitor_sequence_any_op_ch (new_ctx);
- case TAO_CodeGen::TAO_SEQUENCE_ANY_OP_CS:
- return new be_visitor_sequence_any_op_cs (new_ctx);
- case TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CH:
- return new be_visitor_sequence_cdr_op_ch (new_ctx);
- case TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CI:
- return new be_visitor_sequence_cdr_op_ci (new_ctx);
- case TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CS:
- return new be_visitor_sequence_cdr_op_cs (new_ctx);
-
- case TAO_CodeGen::TAO_TYPEDEF_CH:
- return new be_visitor_typedef_ch (new_ctx);
- case TAO_CodeGen::TAO_TYPEDEF_CS:
- return new be_visitor_typedef_cs (new_ctx);
- case TAO_CodeGen::TAO_TYPEDEF_CI:
- return new be_visitor_typedef_ci (new_ctx);
- case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH:
- return new be_visitor_typedef_any_op_ch (new_ctx);
- case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS:
- return new be_visitor_typedef_any_op_cs (new_ctx);
- case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CH:
- return new be_visitor_typedef_cdr_op_ch (new_ctx);
- case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CI:
- return new be_visitor_typedef_cdr_op_ci (new_ctx);
- case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CS:
- return new be_visitor_typedef_cdr_op_cs (new_ctx);
-
- case TAO_CodeGen::TAO_TYPECODE_DECL:
- // Do we need TypeCode Support?
- if (be_global->tc_support ())
- return new be_visitor_typecode_decl (new_ctx);
- else
- // return a NO_OP visitor
- return new be_visitor_decl (new_ctx);
-
- case TAO_CodeGen::TAO_TYPECODE_DEFN:
- // Do we need TypeCode Support?
- if (be_global->tc_support ())
- return new be_visitor_typecode_defn (new_ctx);
- else
- // return a NO_OP visitor
- return new be_visitor_decl (new_ctx);
-
- case TAO_CodeGen::TAO_ATTRIBUTE_CH:
- case TAO_CodeGen::TAO_ATTRIBUTE_CS:
- case TAO_CodeGen::TAO_ATTRIBUTE_SH:
- case TAO_CodeGen::TAO_ATTRIBUTE_IH:
- case TAO_CodeGen::TAO_ATTRIBUTE_SS:
- case TAO_CodeGen::TAO_ATTRIBUTE_IS:
- case TAO_CodeGen::TAO_ATTRIBUTE_TIE_SH:
- case TAO_CodeGen::TAO_ATTRIBUTE_TIE_SI:
- case TAO_CodeGen::TAO_ATTRIBUTE_SMART_PROXY_CH:
- case TAO_CodeGen::TAO_ATTRIBUTE_SMART_PROXY_CS:
- case TAO_CodeGen::TAO_ATTRIBUTE_INTERCEPTORS_CH:
- case TAO_CodeGen::TAO_ATTRIBUTE_INTERCEPTORS_CS:
- case TAO_CodeGen::TAO_ATTRIBUTE_INTERCEPTORS_SH:
- case TAO_CodeGen::TAO_ATTRIBUTE_INTERCEPTORS_SS:
-
- case TAO_CodeGen::TAO_ATTRIBUTE_BASE_PROXY_IMPL_CH:
- case TAO_CodeGen::TAO_ATTRIBUTE_PROXY_IMPL_XH:
- case TAO_CodeGen::TAO_ATTRIBUTE_REMOTE_PROXY_IMPL_CS:
- case TAO_CodeGen::TAO_ATTRIBUTE_THRU_POA_PROXY_IMPL_SS:
- case TAO_CodeGen::TAO_ATTRIBUTE_DIRECT_PROXY_IMPL_SS:
- return new be_visitor_attribute (new_ctx);
-
- case TAO_CodeGen::TAO_EXCEPTION_CH:
- return new be_visitor_exception_ch (new_ctx);
- case TAO_CodeGen::TAO_EXCEPTION_CI:
- return new be_visitor_exception_ci (new_ctx);
- case TAO_CodeGen::TAO_EXCEPTION_CS:
- return new be_visitor_exception_cs (new_ctx);
- case TAO_CodeGen::TAO_EXCEPTION_CTOR_CH:
- case TAO_CodeGen::TAO_EXCEPTION_CTOR_CS:
- return new be_visitor_exception_ctor (new_ctx);
- case TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS:
- return new be_visitor_exception_ctor_assign (new_ctx);
- case TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CH:
- return new be_visitor_exception_any_op_ch (new_ctx);
- case TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CS:
- return new be_visitor_exception_any_op_cs (new_ctx);
- case TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CH:
- return new be_visitor_exception_cdr_op_ch (new_ctx);
- case TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CI:
- return new be_visitor_exception_cdr_op_ci (new_ctx);
- case TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CS:
- return new be_visitor_exception_cdr_op_cs (new_ctx);
-
- case TAO_CodeGen::TAO_ARRAY_CH:
- return new be_visitor_array_ch (new_ctx);
- case TAO_CodeGen::TAO_ARRAY_CI:
- return new be_visitor_array_ci (new_ctx);
- case TAO_CodeGen::TAO_ARRAY_CS:
- return new be_visitor_array_cs (new_ctx);
- case TAO_CodeGen::TAO_ARRAY_ANY_OP_CH:
- return new be_visitor_array_any_op_ch (new_ctx);
- case TAO_CodeGen::TAO_ARRAY_ANY_OP_CS:
- return new be_visitor_array_any_op_cs (new_ctx);
- case TAO_CodeGen::TAO_ARRAY_CDR_OP_CH:
- return new be_visitor_array_cdr_op_ch (new_ctx);
- case TAO_CodeGen::TAO_ARRAY_CDR_OP_CI:
- return new be_visitor_array_cdr_op_ci (new_ctx);
- case TAO_CodeGen::TAO_ARRAY_CDR_OP_CS:
- return new be_visitor_array_cdr_op_cs (new_ctx);
- default:
- // an error
- delete new_ctx;
- return 0;
- }
- return 0;
-}
-
-// The concrete visitor factory for operation visitors generating compiled
-// stubs and skeletons
-
-TAO_Compiled_Visitor_Factory::TAO_Compiled_Visitor_Factory (void)
-{
-}
-
-// destructor
-TAO_Compiled_Visitor_Factory::~TAO_Compiled_Visitor_Factory (void)
-{
-}
-
-be_visitor *
-TAO_Compiled_Visitor_Factory::make_visitor (be_visitor_context *ctx)
-{
- TAO_CodeGen::CG_STATE st = ctx->state ();
- // create a new context so that ownership issues are not confused. This newly
- // created context is a copy of what was sent by the caller. The newly
- // created visitor will own this new copy.
- be_visitor_context *new_ctx = new be_visitor_context (*ctx);
-
- switch (st)
- {
- case TAO_CodeGen::TAO_UNION_ANY_OP_CS:
- return new be_visitor_union_any_op_cs (new_ctx);
case TAO_CodeGen::TAO_OPERATION_CH:
- return new be_visitor_operation_ch (new_ctx);
+ ACE_NEW_RETURN (retval,
+ be_visitor_operation_ch (ctx),
+ 0);
+ break;
case TAO_CodeGen::TAO_OPERATION_CS:
- return new be_visitor_operation_cs (new_ctx);
- case TAO_CodeGen::TAO_OPERATION_SH:
- return new be_visitor_operation_sh (new_ctx);
- case TAO_CodeGen::TAO_OPERATION_SS:
- return new be_visitor_operation_ss (new_ctx);
- case TAO_CodeGen::TAO_OPERATION_IS:
- return new be_visitor_operation_is (new_ctx);
- case TAO_CodeGen::TAO_OPERATION_IH:
- return new be_visitor_operation_ih (new_ctx);
- case TAO_CodeGen::TAO_OPERATION_SMART_PROXY_CH:
- return new be_visitor_operation_smart_proxy_ch (new_ctx);
- case TAO_CodeGen::TAO_OPERATION_SMART_PROXY_CS:
- return new be_visitor_operation_smart_proxy_cs (new_ctx);
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_CH:
- return new be_visitor_operation_interceptors_ch (new_ctx);
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_CS:
- return new be_visitor_operation_interceptors_cs (new_ctx);
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_SH:
- return new be_visitor_operation_interceptors_sh (new_ctx);
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_SS:
- return new be_visitor_operation_interceptors_ss (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_BASE_PROXY_IMPL_CH:
- return new be_visitor_operation_base_proxy_impl_ch (new_ctx);
- case TAO_CodeGen::TAO_OPERATION_PROXY_IMPL_XH:
- return new be_visitor_operation_proxy_impl_xh (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_REMOTE_PROXY_IMPL_CS:
- return new be_visitor_operation_remote_proxy_impl_cs (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_THRU_POA_PROXY_IMPL_SS:
- return new be_visitor_operation_thru_poa_proxy_impl_ss (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_DIRECT_PROXY_IMPL_SS:
- return new be_visitor_operation_direct_proxy_impl_ss (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_RETTYPE_CH:
- case TAO_CodeGen::TAO_OPERATION_RETTYPE_SH:
- case TAO_CodeGen::TAO_OPERATION_RETTYPE_OTHERS:
- return new be_visitor_operation_rettype (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_RETTYPE_CH:
- return new be_visitor_operation_interceptors_info_rettype (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_RETVAL_DECL_CS:
- return new be_visitor_operation_rettype_vardecl_cs (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_RETVAL_PRE_INVOKE_CS:
- return new be_visitor_operation_rettype_pre_invoke_cs (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_RETVAL_INVOKE_CS:
- return new be_visitor_operation_rettype_marshal_ss (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_RETVAL_RETURN_CS:
- return new be_visitor_operation_rettype_return_cs (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_EXCEPTLIST_CS:
- return new be_visitor_operation_exceptlist_cs (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_EXCEPTLIST:
- return new be_visitor_operation_interceptors_exceptlist (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_RETVAL_DECL_SS:
- return new be_visitor_operation_rettype_vardecl_ss (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_RETVAL_MARSHAL_SS:
- return new be_visitor_operation_rettype_marshal_ss (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_RETVAL_ASSIGN_SS:
- return new be_visitor_operation_rettype_assign_ss (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_INVOKE_ARG_LIST:
- return new be_visitor_operation_inv_arglist (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_ARGLIST_CH:
- case TAO_CodeGen::TAO_OPERATION_ARGLIST_SH:
- case TAO_CodeGen::TAO_OPERATION_ARGLIST_IH:
- case TAO_CodeGen::TAO_OPERATION_ARGLIST_IS:
- case TAO_CodeGen::TAO_OPERATION_ARGLIST_COLLOCATED_SH:
- case TAO_CodeGen::TAO_OPERATION_ARGLIST_OTHERS:
-
- case TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XH:
- case TAO_CodeGen::TAO_OPERATION_ARGLIST_BASE_PROXY_IMPL_CH:
- case TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XS:
- return new be_visitor_operation_arglist (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_CH:
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_CS:
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_CH:
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_CS:
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARG_INFO_CS:
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_PARAMLIST:
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SH:
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SS:
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SH:
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SS:
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARG_INFO_SS:
- return new be_visitor_operation_interceptors_arglist (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_RESULT:
- return new be_visitor_operation_interceptors_result (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_ARG_PRE_INVOKE_CS:
- case TAO_CodeGen::TAO_OPERATION_ARG_POST_INVOKE_CS:
- case TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_SS:
- case TAO_CodeGen::TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS:
- case TAO_CodeGen::TAO_OPERATION_ARG_POST_UPCALL_SS:
- case TAO_CodeGen::TAO_OPERATION_ARG_DECL_SS:
- return new be_visitor_operation_argument (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_ARG_DEMARSHAL_SS:
- case TAO_CodeGen::TAO_OPERATION_ARG_MARSHAL_SS:
- return new be_compiled_visitor_operation_argument_marshal (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_TIE_SH:
- return new be_visitor_operation_tie_sh (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_TIE_SI:
- return new be_visitor_operation_tie_si (new_ctx);
-
- case TAO_CodeGen::TAO_OPERATION_ARG_INVOKE_CS:
- return new be_compiled_visitor_operation_argument_invoke (new_ctx);
-
- case TAO_CodeGen::TAO_ARGUMENT_ARGLIST_CH:
- case TAO_CodeGen::TAO_ARGUMENT_ARGLIST_SH:
- case TAO_CodeGen::TAO_ARGUMENT_ARGLIST_OTHERS:
- return new be_visitor_args_arglist (new_ctx);
-
- case TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_ARGLIST_CH:
- return new be_visitor_args_request_info_ch (new_ctx);
- case TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_INFO_ARGLIST_CH:
- return new be_visitor_args_request_info_arglist (new_ctx);
- case TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_ARGLIST_CS:
- case TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_INFO_ARGLIST_CS:
- return new be_visitor_args_request_info_cs (new_ctx);
- case TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_PARAMLIST:
- return new be_visitor_args_paramlist (new_ctx);
- case TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_RESULT:
- return new be_visitor_args_request_info_result (new_ctx);
- case TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_ARGLIST_SH:
- return new be_visitor_args_request_info_sh (new_ctx);
- case TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_ARGLIST_SS:
- case TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_INFO_ARGLIST_SS:
- return new be_visitor_args_request_info_ss (new_ctx);
-
- case TAO_CodeGen::TAO_ARGUMENT_PRE_INVOKE_CS:
- return new be_visitor_args_pre_invoke_cs (new_ctx);
-
- case TAO_CodeGen::TAO_ARGUMENT_INVOKE_CS:
- return new be_visitor_args_invoke_cs (new_ctx);
-
- case TAO_CodeGen::TAO_ARGUMENT_POST_INVOKE_CS:
- return new be_visitor_args_post_invoke_cs (new_ctx);
-
- case TAO_CodeGen::TAO_ARGUMENT_VARDECL_SS:
- return new be_visitor_args_vardecl_ss (new_ctx);
-
- case TAO_CodeGen::TAO_ARGUMENT_UPCALL_SS:
- case TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS:
- return new be_visitor_args_upcall_ss (new_ctx);
-
- case TAO_CodeGen::TAO_ARGUMENT_DEMARSHAL_SS:
- case TAO_CodeGen::TAO_ARGUMENT_MARSHAL_SS:
- return new be_visitor_args_marshal_ss (new_ctx);
-
- // AMI next generation visitors.
+ ACE_NEW_RETURN (retval,
+ be_visitor_operation_cs (ctx),
+ 0);
+ break;
case TAO_CodeGen::TAO_AMI_INTERFACE_CH:
- return new be_visitor_ami_interface_ch (new_ctx);
-
+ ACE_NEW_RETURN (retval,
+ be_visitor_ami_interface_ch (ctx),
+ 0);
+ break;
case TAO_CodeGen::TAO_AMI_HANDLER_REPLY_STUB_OPERATION_CH:
- return new be_visitor_operation_ami_handler_reply_stub_operation_ch (new_ctx);
-
+ ACE_NEW_RETURN (
+ retval,
+ be_visitor_operation_ami_handler_reply_stub_operation_ch (ctx),
+ 0
+ );
+ break;
case TAO_CodeGen::TAO_AMI_HANDLER_REPLY_STUB_OPERATION_CS:
- return new be_compiled_visitor_operation_ami_handler_reply_stub_operation_cs (new_ctx);
-
+ ACE_NEW_RETURN (
+ retval,
+ be_visitor_operation_ami_handler_reply_stub_operation_cs (ctx),
+ 0
+ );
+ break;
case TAO_CodeGen::TAO_AMI_SENDC_OPERATION_CH:
- return new be_visitor_operation_ami_ch (new_ctx);
-
+ ACE_NEW_RETURN (retval,
+ be_visitor_operation_ami_ch (ctx),
+ 0);
+ break;
case TAO_CodeGen::TAO_AMI_SENDC_OPERATION_CS:
- return new be_compiled_visitor_operation_ami_cs (new_ctx);
-
+ ACE_NEW_RETURN (retval,
+ be_visitor_operation_ami_cs (ctx),
+ 0);
+ break;
case TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_RAISE_OPERATION_CS:
- return new be_visitor_operation_ami_exception_holder_operation_cs (new_ctx);
-
+ ACE_NEW_RETURN (
+ retval,
+ be_visitor_operation_ami_exception_holder_operation_cs (ctx),
+ 0
+ );
+ break;
case TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_VALUETYPE_CH:
- return new be_visitor_valuetype_ami_exception_holder_ch (new_ctx);
-
+ ACE_NEW_RETURN (retval,
+ be_visitor_valuetype_ami_exception_holder_ch (ctx),
+ 0);
+ break;
case TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_VALUETYPE_CS:
- return new be_visitor_valuetype_ami_exception_holder_cs (new_ctx);
-
- // AMH ResponseHandler class visitors
- case TAO_CodeGen::TAO_INTERFACE_AMH_RH_CH:
- return new be_visitor_amh_rh_interface_sh (new_ctx);
- case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SH:
- return new be_visitor_amh_rh_interface_sh (new_ctx);
- case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SS:
- return new be_visitor_amh_rh_interface_ss (new_ctx);
- case TAO_CodeGen::TAO_OPERATION_AMH_RH_SH:
- return new be_visitor_amh_rh_operation_sh (new_ctx);
- case TAO_CodeGen::TAO_OPERATION_AMH_RH_SS:
- return new be_visitor_amh_rh_operation_ss (new_ctx);
-
+ ACE_NEW_RETURN (retval,
+ be_visitor_valuetype_ami_exception_holder_cs (ctx),
+ 0);
+ break;
default:
- // cannot handle it; delegate it to the common visitor factory
- delete new_ctx;
- return TAO_COMMON_VISITOR_FACTORY::instance ()->make_visitor (ctx);
+ // An error.
+ return 0;
}
+
+ return retval;
}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_field.cpp b/TAO/TAO_IDL/be/be_visitor_field.cpp
index b219838d510..4e7c67ef3c0 100644
--- a/TAO/TAO_IDL/be/be_visitor_field.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_field.cpp
@@ -17,13 +17,29 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_type.h"
+#include "be_field.h"
+#include "be_array.h"
+#include "be_typedef.h"
+#include "be_enum.h"
+#include "be_interface.h"
+#include "be_interface_fwd.h"
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
+#include "be_predefined_type.h"
+#include "be_sequence.h"
+#include "be_string.h"
+#include "be_structure.h"
+#include "be_union.h"
+#include "be_helper.h"
+#include "utl_identifier.h"
#include "be_visitor_field.h"
+#include "be_visitor_array.h"
+#include "be_visitor_structure.h"
+#include "be_visitor_union.h"
+#include "be_visitor_context.h"
-// 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"
@@ -31,4 +47,6 @@
#include "be_visitor_field/cdr_op_ci.cpp"
#include "be_visitor_field/cdr_op_cs.cpp"
-ACE_RCSID(be, be_visitor_field, "$Id$")
+ACE_RCSID (be,
+ be_visitor_field,
+ "$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_field/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_field/cdr_op_ch.cpp
index 35f083cec82..39808029877 100644
--- a/TAO/TAO_IDL/be/be_visitor_field/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_field/cdr_op_ch.cpp
@@ -18,127 +18,114 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_visitor_array/cdr_op_ch.h"
+#include "be_visitor_enum/cdr_op_ch.h"
+#include "be_visitor_sequence/cdr_op_ch.h"
+#include "be_visitor_structure/structure.h"
+#include "be_visitor_structure/cdr_op_ch.h"
+#include "be_visitor_union/union.h"
+#include "be_visitor_union/cdr_op_ch.h"
-#include "be_visitor_field.h"
-
-ACE_RCSID(be_visitor_field, cdr_op_ch, "$Id$")
+ACE_RCSID (be_visitor_field,
+ cdr_op_ch,
+ "$Id$")
// **********************************************
-// visitor for field in the client header file
+// Visitor for field in the client header file.
// **********************************************
-// constructor
+// Constructor.
be_visitor_field_cdr_op_ch::be_visitor_field_cdr_op_ch (be_visitor_context *ctx)
: be_visitor_decl (ctx)
{
}
-// destructor
+// Destructor.
be_visitor_field_cdr_op_ch::~be_visitor_field_cdr_op_ch (void)
{
}
-// visit the field node
+// Visit the field node.
int
be_visitor_field_cdr_op_ch::visit_field (be_field *node)
{
be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cdr_op_ch::"
"visit_field - "
- "Bad field type\n"
- ), -1);
+ "Bad field type\n"),
+ -1);
}
- this->ctx_->node (node); // save the node
+ this->ctx_->node (node);
+
if (bt->accept (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cdr_op_ch::"
"visit_field - "
- "codegen for field type failed\n"
- ), -1);
+ "codegen for field type failed\n"),
+ -1);
}
return 0;
}
-// =visit operations on all possible data types that a field can be
+// Visit operations on all possible data types that a field can be.
-// visit array type
int
be_visitor_field_cdr_op_ch::visit_array (be_array *node)
{
- // if not a typedef and we are defined in the use scope, we must be defined
+ // If not a typedef and we are defined in the use scope, we must be defined.
- if (!this->ctx_->alias () // not a typedef
+ if (!this->ctx_->alias ()
&& node->is_child (this->ctx_->scope ()))
{
- // this is the case for anonymous arrays.
+ // This is the case for anonymous arrays.
- // instantiate a visitor context with a copy of our context. This info
- // will be modified based on what type of node we are visiting
+ // 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
+ ctx.node (node);
- // first generate the struct declaration
+ // First generate the array declaration.
ctx.state (TAO_CodeGen::TAO_ARRAY_CDR_OP_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_field_cdr_op_ch::"
- "visit_array - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_array_cdr_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cdr_op_ch::"
"visit_array - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
return 0;
}
-// visit enum type
int
be_visitor_field_cdr_op_ch::visit_enum (be_enum *node)
{
- // if not a typedef and we are defined in the use scope, we must be defined
- if (!this->ctx_->alias () // not a typedef
+ // 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
+ // 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
+ ctx.node (node);
- // first generate the enum declaration
+ // First generate the enum declaration.
ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_field_cdr_op_ch::"
- "visit_enum - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_enum_cdr_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cdr_op_ch::"
@@ -146,38 +133,28 @@ be_visitor_field_cdr_op_ch::visit_enum (be_enum *node)
"codegen failed\n"
), -1);
}
- delete visitor;
}
return 0;
}
-// visit sequence type
int
be_visitor_field_cdr_op_ch::visit_sequence (be_sequence *node)
{
- // if not a typedef and we are defined in the use scope, we must be defined
+ // 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
+ // 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
+ ctx.node (node);
- // first generate the sequence declaration
+ // First generate the sequence declaration.
ctx.state (TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_field_cdr_op_ch::"
- "visit_sequence - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_sequence_cdr_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cdr_op_ch::"
@@ -185,13 +162,11 @@ be_visitor_field_cdr_op_ch::visit_sequence (be_sequence *node)
"codegen failed\n"
), -1);
}
- delete visitor;
}
return 0;
}
-// visit structure type
int
be_visitor_field_cdr_op_ch::visit_structure (be_structure *node)
{
@@ -208,16 +183,9 @@ be_visitor_field_cdr_op_ch::visit_structure (be_structure *node)
// first generate the struct declaration
ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_field_cdr_op_ch::"
- "visit_struct - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_structure_cdr_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cdr_op_ch::"
@@ -225,23 +193,22 @@ be_visitor_field_cdr_op_ch::visit_structure (be_structure *node)
"codegen failed\n"
), -1);
}
- delete visitor;
}
return 0;
}
-// visit typedefed type
int
be_visitor_field_cdr_op_ch::visit_typedef (be_typedef *node)
{
- // save the node for use in code generation and
+ // Save the node for use in code generation and
// indicate that the field of the field node
- // is a typedefed quantity
+ // is a typedefed quantity.
this->ctx_->alias (node);
- // make a decision based on the primitive base type
+ // 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,
@@ -250,6 +217,7 @@ be_visitor_field_cdr_op_ch::visit_typedef (be_typedef *node)
"Bad primitive type\n"
), -1);
}
+
this->ctx_->alias (0);
return 0;
}
@@ -258,28 +226,20 @@ be_visitor_field_cdr_op_ch::visit_typedef (be_typedef *node)
int
be_visitor_field_cdr_op_ch::visit_union (be_union *node)
{
- // if not a typedef and we are defined in the use scope, we must be defined
+ // 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
+ // 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
+ ctx.node (node);
- // first generate the enum declaration
+ // First generate the enum declaration.
ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_field_cdr_op_ch::"
- "visit_enum - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_union_cdr_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cdr_op_ch::"
@@ -287,7 +247,6 @@ be_visitor_field_cdr_op_ch::visit_union (be_union *node)
"codegen failed\n"
), -1);
}
- delete visitor;
}
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_field/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_field/cdr_op_ci.cpp
index 6bba94f290c..f98fbe7918e 100644
--- a/TAO/TAO_IDL/be/be_visitor_field/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_field/cdr_op_ci.cpp
@@ -18,13 +18,15 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_field.h"
-
-ACE_RCSID(be_visitor_field, cdr_op_ci, "$Id$")
+#include "be_visitor_array/cdr_op_ci.h"
+#include "be_visitor_enum/cdr_op_ci.h"
+#include "be_visitor_sequence/cdr_op_ci.h"
+#include "be_visitor_structure/cdr_op_ci.h"
+#include "be_visitor_union/cdr_op_ci.h"
+ACE_RCSID (be_visitor_field,
+ cdr_op_ci,
+ "$Id$")
// **********************************************
// Visitor for field in the client stubs file.
@@ -78,8 +80,6 @@ int
be_visitor_field_cdr_op_ci::visit_array (be_array *node)
{
TAO_OutStream *os = this->ctx_->stream ();
-
- // Retrieve the field node.
be_field *f = this->ctx_->be_node_as_field ();
if (f == 0)
@@ -97,7 +97,9 @@ be_visitor_field_cdr_op_ci::visit_array (be_array *node)
// Save the node's local name and full name in a buffer for quick
// use later on.
- ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
if (this->ctx_->alias () == 0 // Not a typedef.
&& node->is_child (this->ctx_->scope ()))
@@ -137,10 +139,12 @@ be_visitor_field_cdr_op_ci::visit_array (be_array *node)
case TAO_CodeGen::TAO_CDR_INPUT:
*os << "(strm >> "
<< "_tao_aggregate_" << f->local_name () << ")";
+
return 0;
case TAO_CodeGen::TAO_CDR_OUTPUT:
*os << "(strm << "
<< "_tao_aggregate_" << f->local_name () << ")";
+
return 0;
case TAO_CodeGen::TAO_CDR_SCOPE:
// This is done in cdr_op_cs and hacked into *.i.
@@ -171,18 +175,9 @@ be_visitor_field_cdr_op_ci::visit_array (be_array *node)
// First generate the declaration.
ctx.state (TAO_CodeGen::TAO_ARRAY_CDR_OP_CI);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_array_cdr_op_ci visitor (&ctx);
- if (visitor == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_field_cdr_op_ci::"
- "visit_array - "
- "Bad visitor\n"),
- -1);
- }
-
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cdr_op_ci::"
@@ -190,8 +185,6 @@ be_visitor_field_cdr_op_ci::visit_array (be_array *node)
"codegen failed\n"),
-1);
}
-
- delete visitor;
}
return 0;
@@ -221,9 +214,11 @@ be_visitor_field_cdr_op_ci::visit_enum (be_enum *node)
{
case TAO_CodeGen::TAO_CDR_INPUT:
*os << "(strm >> _tao_aggregate." << f->local_name () << ")";
+
return 0;
case TAO_CodeGen::TAO_CDR_OUTPUT:
*os << "(strm << _tao_aggregate." << f->local_name () << ")";
+
return 0;
case TAO_CodeGen::TAO_CDR_SCOPE:
// Proceed further.
@@ -251,18 +246,9 @@ be_visitor_field_cdr_op_ci::visit_enum (be_enum *node)
// Generate the typcode for enums.
ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CI);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
-
- if (visitor == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_field_cdr_op_ci::"
- "visit_enum - "
- "Bad visitor\n"),
- -1);
- }
+ be_visitor_enum_cdr_op_ci visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cdr_op_ci::"
@@ -270,8 +256,6 @@ be_visitor_field_cdr_op_ci::visit_enum (be_enum *node)
"codegen failed\n"),
-1);
}
-
- delete visitor;
}
return 0;
@@ -282,16 +266,15 @@ int
be_visitor_field_cdr_op_ci::visit_interface (be_interface *)
{
TAO_OutStream *os = this->ctx_->stream ();
-
- // Retrieve the field node.
be_field *f = this->ctx_->be_node_as_field ();
+
if (!f)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cdr_op_ci::"
"visit_interface - "
- "cannot retrieve field node\n"
- ), -1);
+ "cannot retrieve field node\n"),
+ -1);
}
// Check what is the code generations substate. Are we generating code for
@@ -300,12 +283,14 @@ be_visitor_field_cdr_op_ci::visit_interface (be_interface *)
{
case TAO_CodeGen::TAO_CDR_INPUT:
*os << "(strm >> _tao_aggregate." << f->local_name () << ".out ())";
+
break;
case TAO_CodeGen::TAO_CDR_OUTPUT:
*os << "(strm << _tao_aggregate." << f->local_name () << ".in ())";
+
break;
case TAO_CodeGen::TAO_CDR_SCOPE:
- // Nothing to be done because an interface cannit be declared inside a
+ // Nothing to be done because an interface cannot be declared inside a
// structure.
break;
default:
@@ -344,12 +329,14 @@ be_visitor_field_cdr_op_ci::visit_interface_fwd (be_interface_fwd *)
{
case TAO_CodeGen::TAO_CDR_INPUT:
*os << "(strm >> _tao_aggregate." << f->local_name () << ".out ())";
+
break;
case TAO_CodeGen::TAO_CDR_OUTPUT:
*os << "(strm << _tao_aggregate." << f->local_name () << ".in ())";
+
break;
case TAO_CodeGen::TAO_CDR_SCOPE:
- // Nothing to be done because an interface cannit be declared inside a
+ // Nothing to be done because an interface cannot be declared inside a
// structure.
break;
default:
@@ -364,6 +351,96 @@ be_visitor_field_cdr_op_ci::visit_interface_fwd (be_interface_fwd *)
return 0;
}
+// Visit value type.
+int
+be_visitor_field_cdr_op_ci::visit_valuetype (be_valuetype *)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_field *f = this->ctx_->be_node_as_field ();
+
+ if (!f)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_cdr_op_ci::"
+ "visit_valuetype - "
+ "cannot retrieve field node\n"),
+ -1);
+ }
+
+ // Check what is the code generations substate. Are we generating code for
+ // the in/out operators for our parent or for us?
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ *os << "(strm >> _tao_aggregate." << f->local_name () << ".out ())";
+
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "(strm << _tao_aggregate." << f->local_name () << ".in ())";
+
+ break;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Nothing to be done because a valuetype cannot be declared inside a
+ // structure.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_cdr_op_ci::"
+ "visit_valuetype - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+// Visit value forward type.
+int
+be_visitor_field_cdr_op_ci::visit_valuetype_fwd (be_valuetype_fwd *)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the field node.
+ be_field *f = this->ctx_->be_node_as_field ();
+
+ if (f == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_cdr_op_ci::"
+ "visit_valuetype_fwd - "
+ "cannot retrieve field node\n"),
+ -1);
+ }
+
+ // Check what is the code generations substate. Are we generating code for
+ // the in/out operators for our parent or for us?
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ *os << "(strm >> _tao_aggregate." << f->local_name () << ".out ())";
+
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "(strm << _tao_aggregate." << f->local_name () << ".in ())";
+
+ break;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Nothing to be done because a valuetype cannot be declared inside a
+ // structure.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_cdr_op_ci::"
+ "visit_valuetype_fwd - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
// Visit predefined type.
int
be_visitor_field_cdr_op_ci::visit_predefined_type (be_predefined_type *node)
@@ -488,9 +565,11 @@ be_visitor_field_cdr_op_ci::visit_sequence (be_sequence *node)
{
case TAO_CodeGen::TAO_CDR_INPUT:
*os << "(strm >> _tao_aggregate." << f->local_name () << ")";
+
return 0;
case TAO_CodeGen::TAO_CDR_OUTPUT:
*os << "(strm << _tao_aggregate." << f->local_name () << ")";
+
return 0;
case TAO_CodeGen::TAO_CDR_SCOPE:
// Proceed further.
@@ -520,17 +599,9 @@ be_visitor_field_cdr_op_ci::visit_sequence (be_sequence *node)
// Generate the inline code for structs.
ctx.state (TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CI);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_field_cdr_op_ci::"
- "visit_sequence - "
- "Bad visitor\n"),
- -1);
- }
+ be_visitor_sequence_cdr_op_ci visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cdr_op_ci::"
@@ -538,8 +609,6 @@ be_visitor_field_cdr_op_ci::visit_sequence (be_sequence *node)
"codegen failed\n"),
-1);
}
-
- delete visitor;
}
return 0;
@@ -569,9 +638,11 @@ be_visitor_field_cdr_op_ci::visit_string (be_string *)
{
case TAO_CodeGen::TAO_CDR_INPUT:
*os << "(strm >> _tao_aggregate." << f->local_name () << ".out ())";
+
break;
case TAO_CodeGen::TAO_CDR_OUTPUT:
*os << "(strm << _tao_aggregate." << f->local_name () << ".in ())";
+
break;
case TAO_CodeGen::TAO_CDR_SCOPE:
// Nothing to be done.
@@ -612,9 +683,11 @@ be_visitor_field_cdr_op_ci::visit_structure (be_structure *node)
{
case TAO_CodeGen::TAO_CDR_INPUT:
*os << "(strm >> _tao_aggregate." << f->local_name () << ")";
+
return 0;
case TAO_CodeGen::TAO_CDR_OUTPUT:
*os << "(strm << _tao_aggregate." << f->local_name () << ")";
+
return 0;
case TAO_CodeGen::TAO_CDR_SCOPE:
// Proceed further.
@@ -643,18 +716,9 @@ be_visitor_field_cdr_op_ci::visit_structure (be_structure *node)
// Generate the inline code for structs.
ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CI);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
-
- if (visitor == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_field_cdr_op_ci::"
- "visit_struct - "
- "Bad visitor\n"),
- -1);
- }
+ be_visitor_structure_cdr_op_ci visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cdr_op_ci::"
@@ -662,8 +726,6 @@ be_visitor_field_cdr_op_ci::visit_structure (be_structure *node)
"codegen failed\n"),
-1);
}
-
- delete visitor;
}
return 0;
@@ -717,9 +779,11 @@ be_visitor_field_cdr_op_ci::visit_union (be_union *node)
{
case TAO_CodeGen::TAO_CDR_INPUT:
*os << "(strm >> _tao_aggregate." << f->local_name () << ")";
+
return 0;
case TAO_CodeGen::TAO_CDR_OUTPUT:
*os << "(strm << _tao_aggregate." << f->local_name () << ")";
+
return 0;
case TAO_CodeGen::TAO_CDR_SCOPE:
// Proceed further.
@@ -748,18 +812,9 @@ be_visitor_field_cdr_op_ci::visit_union (be_union *node)
// Generate the inline code for union.
ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CI);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_union_cdr_op_ci visitor (&ctx);
- if (visitor == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_field_cdr_op_ci::"
- "visit_union - "
- "Bad visitor\n"),
- -1);
- }
-
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cdr_op_ci::"
@@ -767,62 +822,6 @@ be_visitor_field_cdr_op_ci::visit_union (be_union *node)
"codegen failed\n"),
-1);
}
-
- delete visitor;
- }
-
- return 0;
-}
-
-// Visit structure type.
-int
-be_visitor_field_cdr_op_ci::visit_valuetype (be_valuetype *node)
-{
- TAO_OutStream *os = this->ctx_->stream ();
-
- // retrieve the field node.
- be_field *f = this->ctx_->be_node_as_field ();
-
- if (f == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_field_cdr_op_ci::"
- "visit_valuetype - "
- "cannot retrieve field node\n"),
- -1);
- }
-
- // Check what is the code generations substate. Are we generating code for
- // the in/out operators for our parent or for us?
- switch (this->ctx_->sub_state ())
- {
- case TAO_CodeGen::TAO_CDR_INPUT:
- *os << "(strm >> _tao_aggregate." << f->local_name () << ".out ())";
- return 0;
- case TAO_CodeGen::TAO_CDR_OUTPUT:
- *os << "(strm << _tao_aggregate." << f->local_name () << ".in ())";
- return 0;
- case TAO_CodeGen::TAO_CDR_SCOPE:
- // Proceed further.
- break;
- default:
- // Error.
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_field_cdr_op_ci::"
- "visit_structure - "
- "bad sub state\n"),
- -1);
- }
-
- if (node->node_type () != AST_Decl::NT_typedef // Not a typedef.
- && node->is_child (this->ctx_->scope ())) // Node is defined inside
- // the structure.
- {
- // Valuetype cannot be declared inside any structured type
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_field_cdr_op_ci::"
- "visit_valuetype - logic error. Please report.\n"),
- -1);
}
return 0;
@@ -896,7 +895,9 @@ be_visitor_cdr_op_field_decl::visit_array (be_array *node)
// the full_name with or without the underscore and use it later on.
char fname [NAMEBUFSIZE];
- ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
if (this->ctx_->alias () == 0 // Not a typedef.
&& node->is_child (this->ctx_->scope ()))
@@ -942,6 +943,7 @@ be_visitor_cdr_op_field_decl::visit_array (be_array *node)
<< "_tao_aggregate." << f->local_name () << be_uidt_nl
<< ")" << be_uidt << be_uidt_nl
<< ");" << be_uidt_nl;
+
break;
case TAO_CodeGen::TAO_CDR_SCOPE:
default:
diff --git a/TAO/TAO_IDL/be/be_visitor_field/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_field/cdr_op_cs.cpp
index 93f25b43b70..d62b67833e5 100644
--- a/TAO/TAO_IDL/be/be_visitor_field/cdr_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_field/cdr_op_cs.cpp
@@ -18,133 +18,86 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_visitor_array/cdr_op_cs.h"
+#include "be_visitor_sequence/cdr_op_cs.h"
+#include "be_visitor_structure/cdr_op_cs.h"
+#include "be_visitor_union/cdr_op_cs.h"
-#include "be_visitor_field.h"
-
-ACE_RCSID(be_visitor_field, cdr_op_cs, "$Id$")
+ACE_RCSID (be_visitor_field,
+ cdr_op_cs,
+ "$Id$")
// **********************************************
// visitor for field in the client stubs file
// **********************************************
-// constructor
-be_visitor_field_cdr_op_cs::be_visitor_field_cdr_op_cs (be_visitor_context *ctx)
+be_visitor_field_cdr_op_cs::be_visitor_field_cdr_op_cs (
+ be_visitor_context *ctx
+ )
: be_visitor_decl (ctx)
{
}
-// destructor
be_visitor_field_cdr_op_cs::~be_visitor_field_cdr_op_cs (void)
{
}
-// visit the field node
int
be_visitor_field_cdr_op_cs::visit_field (be_field *node)
{
be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cdr_op_cs::"
"visit_field - "
- "Bad field type\n"
- ), -1);
+ "Bad field type\n"),
+ -1);
}
- this->ctx_->node (node); // save the node
+ this->ctx_->node (node);
+
if (bt->accept (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cdr_op_cs::"
"visit_field - "
- "codegen for field type failed\n"
- ), -1);
+ "codegen for field type failed\n"),
+ -1);
}
+
return 0;
}
-// visit array
int
be_visitor_field_cdr_op_cs::visit_array (be_array *node)
{
- if (!this->ctx_->alias () // not a typedef
+ if (!this->ctx_->alias ()
&& node->is_child (this->ctx_->scope ()))
{
- // this is the case for anonymous arrays. Generate the <<, >> operators
- // for the type defined by the anonymous array
-
- // 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_);
-
- // set the node to be the node being visited. The scope
- // is still the same
ctx.node (node);
-
- // first generate the declaration
ctx.state (TAO_CodeGen::TAO_ARRAY_CDR_OP_CS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_field_cdr_op_cs::"
- "visit_array - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_array_cdr_op_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cdr_op_cs::"
"visit_array - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
+
return 0;
}
-// visit enum type
int
be_visitor_field_cdr_op_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_CDR_OP_CS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_field_cdr_op_ci::"
- "visit_enum - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_field_cdr_op_ci::"
- "visit_enum - "
- "codegen failed\n"
- ), -1);
- }
- delete visitor;
- }
return 0;
}
@@ -154,135 +107,87 @@ be_visitor_field_cdr_op_cs::visit_sequence (be_sequence *node)
if (node->node_type () != AST_Decl::NT_typedef
&& node->is_child (this->ctx_->scope ()))
{
- // Anonymous sequence
- // instantiate a visitor context with a copy of our context. This info
- // will be modified based on what type of node we are visiting
-
- // set the node to be the node being visited. The scope is
- // still the same
be_visitor_context ctx (*this->ctx_);
ctx.node (node);
-
- // generate the code for sequences
ctx.state (TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_field_cdr_op_cs::"
- "visit_sequence - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_sequence_cdr_op_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cdr_op_cs::"
"visit_sequence - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
+
return 0;
}
-// visit structure type
int
be_visitor_field_cdr_op_cs::visit_structure (be_structure *node)
{
if (node->node_type () != AST_Decl::NT_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_);
- // set the node to be the node being visited. The scope is
- // still the same
ctx.node (node);
-
- // generate the inline code for structs
ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_field_cdr_op_cs::"
- "visit_struct - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_structure_cdr_op_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cdr_op_cs::"
"visit_struct - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
+
return 0;
}
-// visit typedef type
int
be_visitor_field_cdr_op_cs::visit_typedef (be_typedef *node)
{
- // save the typedef node for use in code generation as we visit the
- // base type
this->ctx_->alias (node);
-
- // 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_field_cdr_op_cs::"
"visit_typedef - "
- "Bad primitive type\n"
- ), -1);
+ "Bad primitive type\n"),
+ -1);
}
this->ctx_->alias (0);
return 0;
}
-// visit union type
int
be_visitor_field_cdr_op_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
+ if (node->node_type () != AST_Decl::NT_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
-
- // generate the inline code for union
+ ctx.node (node);
ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_field_cdr_op_cs::"
- "visit_union - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_union_cdr_op_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cdr_op_cs::"
"visit_union - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp b/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp
index d1aabf2214f..31c468d4e9f 100644
--- a/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp
@@ -18,39 +18,32 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_field.h"
-
-ACE_RCSID(be_visitor_field, field_ch, "$Id$")
+#include "be_visitor_enum/enum_ch.h"
+#include "be_visitor_sequence/sequence_ch.h"
+#include "nr_extern.h"
+ACE_RCSID (be_visitor_field,
+ field_ch,
+ "$Id$")
// **********************************************
-// visitor for field in the client header file
+// 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 = this->ctx_->stream ();
- be_type *bt;
-
- // First generate the type information.
- bt = be_type::narrow_from_decl (node->field_type ());
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
if (!bt)
{
@@ -78,9 +71,8 @@ be_visitor_field_ch::visit_field (be_field *node)
return 0;
}
-// =Visit operations on all possible data types that a field can be.
+// 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)
{
@@ -110,18 +102,9 @@ be_visitor_field_ch::visit_array (be_array *node)
// First generate the array declaration
ctx.state (TAO_CodeGen::TAO_ARRAY_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_array_ch visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_field_ch::"
- "visit_array - "
- "Bad visitor\n"),
- -1);
- }
-
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_ch::"
@@ -130,8 +113,6 @@ be_visitor_field_ch::visit_array (be_array *node)
-1);
}
- delete visitor;
-
// Having defined all array type and its supporting operations, now
// generate the actual variable that is a field of the structure.
*os << "_" << bt->local_name ();
@@ -159,7 +140,6 @@ be_visitor_field_ch::visit_array (be_array *node)
return 0;
}
-// Visit enum type.
int
be_visitor_field_ch::visit_enum (be_enum *node)
{
@@ -186,18 +166,9 @@ be_visitor_field_ch::visit_enum (be_enum *node)
// 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);
- }
+ be_visitor_enum_ch visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_ch::"
@@ -205,8 +176,6 @@ be_visitor_field_ch::visit_enum (be_enum *node)
"codegen failed\n"),
-1);
}
-
- delete visitor;
}
// This was a typedefed array.
@@ -229,7 +198,6 @@ be_visitor_field_ch::visit_enum (be_enum *node)
return 0;
}
-// Visit interface type.
int
be_visitor_field_ch::visit_interface (be_interface *node)
{
@@ -265,7 +233,6 @@ be_visitor_field_ch::visit_interface (be_interface *node)
return 0;
}
-// Visit interface forward type.
int
be_visitor_field_ch::visit_interface_fwd (be_interface_fwd *node)
{
@@ -301,7 +268,6 @@ be_visitor_field_ch::visit_interface_fwd (be_interface_fwd *node)
return 0;
}
-// Visit valuetype type.
int
be_visitor_field_ch::visit_valuetype (be_valuetype *node)
{
@@ -337,7 +303,6 @@ be_visitor_field_ch::visit_valuetype (be_valuetype *node)
return 0;
}
-// Visit valuetype forward type.
int
be_visitor_field_ch::visit_valuetype_fwd (be_valuetype_fwd *node)
{
@@ -373,7 +338,6 @@ be_visitor_field_ch::visit_valuetype_fwd (be_valuetype_fwd *node)
return 0;
}
-// Visit predefined type.
int
be_visitor_field_ch::visit_predefined_type (be_predefined_type *node)
{
@@ -389,26 +353,27 @@ be_visitor_field_ch::visit_predefined_type (be_predefined_type *node)
bt = node;
}
- // If not a typedef and we are defined in the use scope, we must be defined.
- if (node->pt () == AST_PredefinedType::PT_pseudo)
+ if (node->pt () == AST_PredefinedType::PT_object)
+ {
+ *os << bt->name () << "_var";
+ }
+ else if (node->pt () == AST_PredefinedType::PT_pseudo)
{
- // Check if we are dealing with a CORBA::Object,
- if (!ACE_OS::strcmp (node->local_name ()->get_string (), "Object"))
+ // This was a typedefed array.
+ // ACE_NESTED_CLASS macro generated by nested_type_name
+ // is necessary if the struct, union, or valuetype containing this
+ // field was not defined inside a module. In such a case, VC++
+ // complains that the non-module scope is not yet fully defined.
+ UTL_Scope *holds_container = this->ctx_->scope ()->defined_in ();
+ AST_Decl *hc_decl = ScopeAsDecl (holds_container);
+
+ if (hc_decl->node_type () != AST_Decl::NT_module)
{
- *os << bt->name () << "_var";
+ *os << bt->nested_type_name (this->ctx_->scope (), "_var");
}
else
{
- // ACE_NESTED_CLASS macro generated by nested_type_name
- // is not necessary in all cases.
- if (bt->defined_in ()->scope_node_type () == AST_Decl::NT_interface)
- {
- *os << bt->nested_type_name (this->ctx_->scope (), "_var");
- }
- else
- {
- *os << bt->name () << "_var";
- }
+ *os << bt->name () << "_var";
}
}
else
@@ -434,7 +399,6 @@ be_visitor_field_ch::visit_predefined_type (be_predefined_type *node)
return 0;
}
-// Visit sequence type.
int
be_visitor_field_ch::visit_sequence (be_sequence *node)
{
@@ -450,29 +414,17 @@ be_visitor_field_ch::visit_sequence (be_sequence *node)
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
+ if (!this->ctx_->alias ()
&& 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);
// 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);
- }
+ be_visitor_sequence_ch visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_ch::"
@@ -481,24 +433,17 @@ be_visitor_field_ch::visit_sequence (be_sequence *node)
-1);
}
- delete visitor;
-
// If we are being reused by valutype, this would get generated
// in the private section of the OBV_xx class, so we must
// generate the typedef for that case elsewhere.
if (this->ctx_->scope ()->node_type () != AST_Decl::NT_interface)
{
- // Generate the anonymous sequence member typedef
- // but we must protect against certain versions of g++.
- // This provides a consistent name to use instead of the
- // implementation-specific name.
+ // Generate the anonymous sequence member typedef.
be_decl *bs = this->ctx_->scope ();
- *os << "\n#if !defined (__GNUC__) || !defined (ACE_HAS_GNUG_PRE_2_8)"
- << be_nl
- << "typedef " << bt->nested_type_name (bs)
+
+ *os << "typedef " << bt->nested_type_name (bs)
<< " _" << this->ctx_->node ()->local_name ()
- << "_seq;\n";
- *os << "#endif /* ! __GNUC__ || ACE_HAS_GNUG_PRE_2_8 */\n" << be_nl;
+ << "_seq;" << be_nl;
}
}
@@ -527,15 +472,11 @@ be_visitor_field_ch::visit_sequence (be_sequence *node)
return 0;
}
-// Visit string type.
int
be_visitor_field_ch::visit_string (be_string *node)
{
- TAO_OutStream *os; // output stream
-
- os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream ();
- // Set the right type.
if (node->width () == (long) sizeof (char))
{
*os << "TAO_String_Manager";
@@ -548,7 +489,6 @@ be_visitor_field_ch::visit_string (be_string *node)
return 0;
}
-// Visit structure type.
int
be_visitor_field_ch::visit_structure (be_structure *node)
{
@@ -564,29 +504,16 @@ be_visitor_field_ch::visit_structure (be_structure *node)
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);
- // First generate the struct declaration.
ctx.state (TAO_CodeGen::TAO_STRUCT_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_structure_ch 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)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_ch::"
@@ -594,8 +521,6 @@ be_visitor_field_ch::visit_structure (be_structure *node)
"codegen failed\n"),
-1);
}
-
- delete visitor;
}
// This was a typedefed array.
@@ -657,29 +582,16 @@ be_visitor_field_ch::visit_union (be_union *node)
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
+ if (!this->ctx_->alias ()
&& 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);
- // First generate the union declaration.
ctx.state (TAO_CodeGen::TAO_UNION_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_union_ch visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_field_ch::"
- "visit_union - "
- "Bad visitor\n"),
- -1);
- }
-
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_ch::"
@@ -687,8 +599,6 @@ be_visitor_field_ch::visit_union (be_union *node)
"codegen failed\n"),
-1);
}
-
- delete visitor;
}
// This was a typedefed array.
diff --git a/TAO/TAO_IDL/be/be_visitor_field/field_ci.cpp b/TAO/TAO_IDL/be/be_visitor_field/field_ci.cpp
index 57d2daa7690..027f32549d7 100644
--- a/TAO/TAO_IDL/be/be_visitor_field/field_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_field/field_ci.cpp
@@ -18,238 +18,167 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_visitor_array/array_ci.h"
+#include "be_visitor_sequence/sequence_ci.h"
+#include "be_visitor_structure/structure_ci.h"
+#include "be_visitor_union/union_ci.h"
-#include "be_visitor_field.h"
+ACE_RCSID (be_visitor_field,
+ field_ci,
+ "$Id$")
-ACE_RCSID(be_visitor_field, field_ci, "$Id$")
-
-// **********************************************
-// 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)
{
be_type *bt =
be_type::narrow_from_decl (node->field_type ());
- // first generate the type information
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_ci::"
"visit_field - "
- "Bad field type\n"
- ), -1);
+ "Bad field type\n"),
+ -1);
}
- this->ctx_->node (node); // save the node
+ this->ctx_->node (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);
+ "codegen for field type failed\n"),
+ -1);
}
+
return 0;
}
-// =visit operations on all possible data types that a field can be
+// Visit operations on all possible data types that a field can be
-// visit array
int
be_visitor_field_ci::visit_array (be_array *node)
{
- // if not a typedef and we are defined in the use scope, we must be defined
-
- if (!this->ctx_->alias () // not a typedef
+ if (!this->ctx_->alias ()
&& node->is_child (this->ctx_->scope ()))
{
- // this is the case for anonymous arrays.
-
- // 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.node (node);
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_field_ci::"
- "visit_array - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_array_ci visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_ci::"
"visit_array - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
+
return 0;
}
-// visit sequence
int
be_visitor_field_ci::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
+ if (node->node_type () != AST_Decl::NT_typedef
+ && node->is_child (this->ctx_->scope ()))
{
- // anonymous sequence
-
- // 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.node (node);
ctx.state (TAO_CodeGen::TAO_SEQUENCE_CI);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_field_ci::"
- "visit_sequence - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_sequence_ci visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_ci::"
"visit_sequence - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
+
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
+ if (node->node_type () != AST_Decl::NT_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
-
- // generate the inline code for structs
+ ctx.node (node);
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)
+ be_visitor_structure_ci visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_ci::"
"visit_struct - "
- "codegen failed\n"
- ), -1);
+ "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
+ this->ctx_->alias (node);
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);
+ "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
+ if (node->node_type () != AST_Decl::NT_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
-
- // generate the inline code for union
+ ctx.node (node);
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_union - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_union_ci visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_ci::"
"visit_union - "
- "codegen failed\n"
- ), -1);
+ "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
index 756c8aa123b..9664770cbf9 100644
--- a/TAO/TAO_IDL/be/be_visitor_field/field_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_field/field_cs.cpp
@@ -18,268 +18,193 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_visitor_array/array_cs.h"
+#include "be_visitor_enum/enum_cs.h"
+#include "be_visitor_sequence/sequence_cs.h"
+#include "be_visitor_structure/structure_cs.h"
+#include "be_visitor_union/union_cs.h"
-#include "be_visitor_field.h"
-
-ACE_RCSID(be_visitor_field, field_cs, "$Id$")
+ACE_RCSID (be_visitor_field,
+ field_cs,
+ "$Id$")
// **********************************************
-// visitor for field in the client stubs file
+// 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)
{
- // first generate the type information
be_type *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);
+ "Bad field type\n"),
+ -1);
}
- this->ctx_->node (node); // save the node
+ this->ctx_->node (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);
+ "codegen for field type failed\n"),
+ -1);
}
+
return 0;
}
-// visit array
int
be_visitor_field_cs::visit_array (be_array *node)
{
- // if not a typedef and we are defined in the use scope, we must be
- // defined
-
- if (!this->ctx_->alias () // not a typedef
+ if (!this->ctx_->alias ()
&& node->is_child (this->ctx_->scope ()))
{
- // this is the case for anonymous arrays.
-
- // 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.node (node);
ctx.state (TAO_CodeGen::TAO_ARRAY_CS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_field_cs::"
- "visit_array - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_array_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cs::"
"visit_array - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
+
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
+ if (node->node_type () != AST_Decl::NT_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
-
- // generate the typcode for enums
+ ctx.node (node);
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)
+ be_visitor_enum_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cs::"
"visit_enum - "
- "codegen failed\n"
- ), -1);
+ "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
+ if (node->node_type () != AST_Decl::NT_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
-
- // generate the inline code for structs
+ ctx.node (node);
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)
+ be_visitor_sequence_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cs::"
"visit_sequence - "
- "codegen failed\n"
- ), -1);
+ "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
+ if (node->node_type () != AST_Decl::NT_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
-
- // generate the inline code for structs
+ ctx.node (node);
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)
+ be_visitor_structure_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cs::"
"visit_struct - "
- "codegen failed\n"
- ), -1);
+ "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
+ this->ctx_->alias (node);
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);
+ "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
+ if (node->node_type () != AST_Decl::NT_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
-
- // generate the inline code for union
+ ctx.node (node);
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)
+ be_visitor_union_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_cs::"
"visit_union - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_home.cpp b/TAO/TAO_IDL/be/be_visitor_home.cpp
new file mode 100644
index 00000000000..4d887c5377f
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_home.cpp
@@ -0,0 +1,27 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_home.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for a component home.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#include "be_visitor_home.h"
+#include "be_visitor_context.h"
+
+ACE_RCSID (be,
+ be_visitor_home,
+ "$Id$")
+
diff --git a/TAO/TAO_IDL/be/be_visitor_interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface.cpp
index 3334d14f4fa..b517d8d5492 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface.cpp
@@ -1,5 +1,6 @@
// $Id$
//
+/* -*- c++ -*- */
// ============================================================================
//
// = LIBRARY
@@ -16,13 +17,38 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_argument.h"
+#include "be_interface.h"
+#include "be_attribute.h"
+#include "be_constant.h"
+#include "be_enum.h"
+#include "be_exception.h"
+#include "be_operation.h"
+#include "be_structure.h"
+#include "be_structure_fwd.h"
+#include "be_union.h"
+#include "be_union_fwd.h"
+#include "be_typedef.h"
+#include "be_predefined_type.h"
+#include "be_helper.h"
+#include "be_extern.h"
+#include "be_argument.h"
+#include "utl_identifier.h"
#include "be_visitor_interface.h"
+#include "be_visitor_interface.h"
+#include "be_visitor_attribute.h"
+#include "be_visitor_constant.h"
+#include "be_visitor_enum.h"
+#include "be_visitor_exception.h"
+#include "be_visitor_structure.h"
+#include "be_visitor_structure_fwd.h"
+#include "be_visitor_typedef.h"
+#include "be_visitor_union.h"
+#include "be_visitor_union_fwd.h"
+#include "be_visitor_operation.h"
+#include "be_visitor_context.h"
-// include all the individual files
#include "be_visitor_interface/interface.cpp"
#include "be_visitor_interface/interface_ch.cpp"
#include "be_visitor_interface/interface_ci.cpp"
@@ -32,10 +58,6 @@
#include "be_visitor_interface/interface_si.cpp"
#include "be_visitor_interface/interface_ss.cpp"
#include "be_visitor_interface/interface_is.cpp"
-// #include "be_visitor_interface/thru_poa_collocated_sh.cpp"
-// #include "be_visitor_interface/thru_poa_collocated_ss.cpp"
-// #include "be_visitor_interface/direct_collocated_sh.cpp"
-// #include "be_visitor_interface/direct_collocated_ss.cpp"
#include "be_visitor_interface/tie_sh.cpp"
#include "be_visitor_interface/tie_si.cpp"
#include "be_visitor_interface/any_op_ch.cpp"
@@ -46,7 +68,6 @@
#include "be_visitor_interface/smart_proxy_ch.cpp"
#include "be_visitor_interface/smart_proxy_cs.cpp"
#include "be_visitor_interface/ami_interface_ch.cpp"
-#include "be_visitor_interface/interceptors_ch.cpp"
#include "be_visitor_interface/interceptors_cs.cpp"
#include "be_visitor_interface/interceptors_sh.cpp"
#include "be_visitor_interface/interceptors_ss.cpp"
@@ -76,4 +97,6 @@
#include "be_visitor_interface/amh_rh_ss.cpp"
#include "be_visitor_interface/amh_rh_sh.cpp"
-ACE_RCSID(be, be_visitor_interface, "$Id$")
+ACE_RCSID (be,
+ be_visitor_interface,
+ "$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_ch.cpp
index cc633dc5b03..24c03a490fe 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/amh_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_ch.cpp
@@ -11,14 +11,13 @@
*/
//=============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_interface.h"
+ACE_RCSID (be_visitor_interface,
+ amh_ch,
+ "$Id$")
-ACE_RCSID(be_visitor_amh_interface, interface, "$Id$")
-
-be_visitor_amh_interface_ch::be_visitor_amh_interface_ch (be_visitor_context *ctx)
+be_visitor_amh_interface_ch::be_visitor_amh_interface_ch (
+ be_visitor_context *ctx
+ )
: be_visitor_interface (ctx)
{
}
@@ -114,17 +113,13 @@ be_visitor_amh_interface_ch::visit_interface (be_interface *node)
// Generate the body.
*os << "{" << be_nl
- << "public:" << be_nl
+ << "public:" << be_idt_nl
- // Generate the _ptr_type and _var_type typedefs
- // but we must protect against certain versions of g++.
- << "#if !defined(__GNUC__) || !defined (ACE_HAS_GNUG_PRE_2_8)"
- << be_idt_nl
+ // Generate the _ptr_type and _var_type typedefs.
<< "typedef " << node->local_name () << "_ptr _ptr_type;"
<< be_nl
<< "typedef " << node->local_name () << "_var _var_type;"
- << be_uidt_nl
- << "#endif /* ! __GNUC__ || g++ >= 2.8 */\n" << be_idt_nl;
+ << be_nl;
// Generate code for the interface definition by traversing thru the
// elements of its scope. We depend on the front-end to have made sure
@@ -139,6 +134,5 @@ be_visitor_amh_interface_ch::visit_interface (be_interface *node)
}
node->cli_hdr_gen (I_TRUE);
-
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_sh.cpp
index f7c3359823c..943f5c9f8a1 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_sh.cpp
@@ -11,15 +11,14 @@
*/
//=============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_interface.h"
-
-#include "be_visitor_operation/amh_rh_sh.h"
-
-be_visitor_amh_rh_interface_sh::be_visitor_amh_rh_interface_sh
-(be_visitor_context *ctx): be_visitor_interface_sh (ctx)
+ACE_RCSID (be_visitor_interface,
+ amh_rh_ss,
+ "$Id$")
+
+be_visitor_amh_rh_interface_sh::be_visitor_amh_rh_interface_sh (
+ be_visitor_context *ctx
+ )
+ : be_visitor_interface_sh (ctx)
{
}
@@ -38,7 +37,6 @@ int
be_visitor_amh_rh_interface_sh::visit_interface (be_interface *node)
{
TAO_OutStream *os = this->ctx_->stream ();
-
os->indent ();
// Generate the skeleton class name, use the AMH-node name as a
@@ -46,12 +44,14 @@ be_visitor_amh_rh_interface_sh::visit_interface (be_interface *node)
ACE_CString rh_base_class_name = node->local_name ();
// ...and prepend either the "TAO_" prefix...
ACE_CString rh_skel_class_name = "TAO_";
+
if (!node->is_nested ())
{
// ...or the "POA_TAO_" prefix if we are in the global
// namespace....
rh_skel_class_name = "POA_TAO_";
}
+
rh_skel_class_name += rh_base_class_name.c_str ();
*os << "class " << rh_skel_class_name.c_str () << ";" << be_nl;
@@ -92,5 +92,6 @@ be_visitor_amh_rh_interface_sh::visit_interface (be_interface *node)
}
*os << be_uidt_nl << "};\n\n";
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_ss.cpp
index b5840ed3f26..7ca7785afff 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_ss.cpp
@@ -11,14 +11,13 @@
*/
//=============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+ACE_RCSID (be_visitor_interface,
+ amh_rh_ss,
+ "$Id$")
-#include "be_visitor_interface.h"
-#include "be_visitor_operation/amh_rh_ss.h"
-
-be_visitor_amh_rh_interface_ss::be_visitor_amh_rh_interface_ss (be_visitor_context *ctx)
+be_visitor_amh_rh_interface_ss::be_visitor_amh_rh_interface_ss (
+ be_visitor_context *ctx
+ )
: be_visitor_interface_ss (ctx)
{
}
@@ -38,7 +37,9 @@ int
be_visitor_amh_rh_interface_ss::visit_interface (be_interface *node)
{
if (node->srv_skel_gen () || node->imported ())
- return 0;
+ {
+ return 0;
+ }
TAO_OutStream *os = this->ctx_->stream ();
@@ -52,20 +53,20 @@ be_visitor_amh_rh_interface_ss::visit_interface (be_interface *node)
node->compute_full_name (rh_skel_prefix.c_str(), "", buf);
ACE_CString rh_skel_full_scope_name ("POA_");
rh_skel_full_scope_name += buf;
- delete[] buf;
+ delete [] buf;
ACE_CString rh_skel_class_name_prefix (rh_skel_prefix.c_str ());
+
if (!node->is_nested ())
{
// ...or the "POA_TAO_" prefix if we are in the global
// namespace....
rh_skel_class_name_prefix = "POA_TAO_";
}
- //node->compute_full_name (rh_skel_class_name_prefix.c_str(), "", buf);
+
ACE_CString rh_skel_class_name (rh_skel_class_name_prefix);
rh_skel_class_name += node->local_name ();
- // constructor
*os << be_nl << "// TAO_IDL - Generated from "
<< __FILE__ << ":" << __LINE__ << be_nl;
@@ -89,7 +90,7 @@ be_visitor_amh_rh_interface_ss::visit_interface (be_interface *node)
*os << "}\n\n";
- // generate code for elements in the scope (e.g., operations)
+ // Generate code for elements in the scope (e.g., operations)
// We'll rely on the base class (be_visitor_scope) to do the
// right thing for us.
if (this->visit_scope (node) == -1)
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp
index 2d01cd2ee3b..4d690cdb2b6 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp
@@ -11,12 +11,9 @@
*/
//=============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface.h"
-#include "be_visitor_operation.h"
+ACE_RCSID (be_visitor_interface,
+ amh_sh,
+ "$Id$")
be_visitor_amh_interface_sh::be_visitor_amh_interface_sh (
be_visitor_context *ctx
@@ -29,10 +26,10 @@ be_visitor_amh_interface_sh::~be_visitor_amh_interface_sh (void)
{
}
-/** The node is the original interface node but we 'tweak' with the
- local_name and the the operation signatures to generate the AMH
- skeleton on the 'fly'.
-*/
+// The node is the original interface node but we 'tweak' with the
+// local_name and the the operation signatures to generate the AMH
+// skeleton on the 'fly'.
+
int
be_visitor_amh_interface_sh::visit_interface (be_interface *node)
{
@@ -47,10 +44,8 @@ be_visitor_amh_interface_sh::visit_interface (be_interface *node)
return 0;
}
- TAO_OutStream *os = this->ctx_->stream (); // output stream
-
- ACE_CString class_name; // holds the class name
-
+ TAO_OutStream *os = this->ctx_->stream ();
+ ACE_CString class_name;
os->indent ();
// We shall have a POA_ prefix only if we are at the topmost level.
@@ -366,7 +361,7 @@ be_visitor_amh_interface_sh::add_amh_operation (be_operation *node,
original_arg->name ()),
-1);
- operation->add_argument_to_scope (arg);
+ operation->be_add_argument (arg);
}
}
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp
index a8a079ffe3e..8f33e20956a 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp
@@ -10,14 +10,13 @@
*/
//=============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+ACE_RCSID (be_visitor_interface,
+ amh_ss,
+ "$Id$")
-#include "be_visitor_interface.h"
-#include "be_visitor_operation.h"
-
-be_visitor_amh_interface_ss::be_visitor_amh_interface_ss (be_visitor_context *ctx)
+be_visitor_amh_interface_ss::be_visitor_amh_interface_ss (
+ be_visitor_context *ctx
+ )
: be_visitor_interface_ss (ctx)
{
}
@@ -45,7 +44,9 @@ be_visitor_amh_interface_ss::visit_interface (be_interface *node)
{
// Do not generate AMH classes for any sort of implied IDL.
if (node->original_interface () != 0)
- return 0;
+ {
+ return 0;
+ }
return be_visitor_interface_ss::visit_interface (node);
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/ami_interface_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/ami_interface_ch.cpp
index ba0bc444b7e..11c5e47e19c 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/ami_interface_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/ami_interface_ch.cpp
@@ -19,20 +19,17 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface.h"
-
-ACE_RCSID(be_visitor_interface, ami_interface_ch, "$Id$")
-
+ACE_RCSID (be_visitor_interface,
+ ami_interface_ch,
+ "$Id$")
// ******************************************************
// Interface visitor for client header
// ******************************************************
-be_visitor_ami_interface_ch::be_visitor_ami_interface_ch (be_visitor_context *ctx)
+be_visitor_ami_interface_ch::be_visitor_ami_interface_ch (
+ be_visitor_context *ctx
+ )
: be_visitor_interface (ctx)
{
}
@@ -54,8 +51,6 @@ be_visitor_ami_interface_ch::visit_interface (be_interface *node)
// Grab the stream.
TAO_OutStream *os = this->ctx_->stream ();
-
-
os->gen_ifdef_macro (node->replacement ()->flat_name (), "_ptr");
// Forward declaration.
@@ -67,6 +62,5 @@ be_visitor_ami_interface_ch::visit_interface (be_interface *node)
<< "_ptr;" << be_nl << be_nl;
os->gen_endif ();
-
return 0;
}
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
index 21f9a83a58e..c0ddcab6ee3 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/any_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/any_op_ch.cpp
@@ -19,13 +19,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_interface.h"
-
-ACE_RCSID(be_visitor_interface, any_op_ch, "$Id$")
-
+ACE_RCSID (be_visitor_interface,
+ any_op_ch,
+ "$Id$")
// ***************************************************************************
// Interface visitor for generating Any operator declarations in the client header
@@ -52,6 +48,9 @@ be_visitor_interface_any_op_ch::visit_interface (be_interface *node)
TAO_OutStream *os = this->ctx_->stream ();
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Generate the Any <<= and >>= operator declarations.
os->indent ();
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
index 66b6abd68e3..2f4284fd450 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp
@@ -17,13 +17,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_interface.h"
-
-ACE_RCSID(be_visitor_interface, any_op_cs, "$Id$")
-
+ACE_RCSID (be_visitor_interface,
+ any_op_cs,
+ "$Id$")
// ***************************************************************************
// Interface visitor for generating Any operator declarations in the client
@@ -51,124 +47,54 @@ be_visitor_interface_any_op_cs::visit_interface (be_interface *node)
TAO_OutStream *os = this->ctx_->stream ();
- os->indent ();
-
- // Generate the Any <<= and >>= operator declarations.
-
- *os << be_nl
- << "// TAO_IDL - Generated from " << be_nl
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
<< "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
- // Copying insertion.
- *os << "void operator<<= (" << be_idt << be_idt_nl
- << "CORBA::Any &_tao_any," << be_nl
- << node->full_name () << "_ptr _tao_elem" << be_uidt_nl
- << ")" << be_uidt_nl
- << "{" << be_idt_nl;
-
if (!node->is_local ())
{
- *os << "TAO_OutputCDR stream;" << be_nl << be_nl
+ // Generate the Any <<= and >>= operator declarations
+ // Any <<= and >>= operators.
+ *os << "void" << be_nl
+ << "operator<<= (" << be_idt << be_idt_nl
+ << "CORBA::Any &_tao_any," << be_nl
+ << node->full_name () << "_ptr _tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "TAO_OutputCDR stream;" << be_nl
<< "if (stream << _tao_elem)" << be_idt_nl
- << "{" << be_idt_nl;
- }
-
- *os << "_tao_any._tao_replace (" << be_idt << be_idt_nl
- << node->tc_name () << ", " << be_nl;
-
- if (!node->is_local ())
- {
- *os << "TAO_ENCAP_BYTE_ORDER," << be_nl
- << "stream.begin ()," << be_nl;
- }
-
- *os << "1," << be_nl
- << node->full_name () << "::_duplicate (_tao_elem)," << be_nl
- << node->name () << "::_tao_any_destructor" << be_uidt_nl
- << ");" << be_uidt;
-
- if (node->is_local ())
- {
- *os << be_nl << be_nl
- << "_tao_any.contains_local (1);";
- }
-
- *os << be_uidt_nl;
-
- if (!node->is_local ())
- {
- *os << "}" << be_uidt << be_uidt_nl;
- }
-
- *os << "}\n" << be_nl;
-
- // Non-copying insertion.
- *os << "void operator<<= (" << be_idt << be_idt_nl
- << "CORBA::Any &_tao_any," << be_nl
- << node->full_name () << "_ptr *_tao_elem" << be_uidt_nl
- << ")" << be_uidt_nl
- << "{" << be_idt_nl;
-
- if (!node->is_local ())
- {
- *os << "TAO_OutputCDR stream;" << be_nl << be_nl
- << "if (stream << *_tao_elem)" << be_idt_nl
- << "{" << be_idt_nl;
- }
-
- *os << "_tao_any._tao_replace (" << be_idt << be_idt_nl
- << node->tc_name () << ", " << be_nl;
-
- if (!node->is_local ())
- {
- *os << "TAO_ENCAP_BYTE_ORDER," << be_nl
- << "stream.begin ()," << be_nl;
- }
-
- *os << "1," << be_nl
- << "*_tao_elem," << be_nl
- << node->name () << "::_tao_any_destructor" << be_uidt_nl
- << ");" << be_uidt;
-
- if (node->is_local ())
- {
- *os << be_nl << be_nl
- << "_tao_any.contains_local (1);";
- }
-
- *os << be_uidt_nl;
-
- if (!node->is_local ())
- {
- *os << "}" << be_uidt << be_uidt_nl;
- }
-
- *os << "}\n" << be_nl;
-
- // Exraction.
- *os << "CORBA::Boolean operator>>= (" << be_idt << be_idt_nl
- << "const CORBA::Any &_tao_any," << be_nl
- << node->full_name () << "_ptr &_tao_elem" << be_uidt_nl
- << ")" << be_uidt_nl
- << "{" << be_idt_nl
- << "ACE_TRY_NEW_ENV" << be_nl
- << "{" << be_idt_nl
- << "_tao_elem = " << node->full_name () << "::_nil ();" << be_nl
- << "CORBA::TypeCode_var type = _tao_any.type ();" << be_nl << be_nl
- << "CORBA::Boolean result =" << be_idt_nl
- << "type->equivalent (" << be_idt << be_idt_nl
- << node->tc_name () << be_nl
- << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
- << ");" << be_uidt << be_uidt_nl
- << "ACE_TRY_CHECK;" << be_nl << be_nl
- << "if (!result)" << be_idt_nl
- << "{" << be_idt_nl
- << "return 0; // not equivalent" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl;
-
- if (!node->is_local ())
- {
- *os << "TAO_InputCDR stream (" << be_idt << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_any._tao_replace (" << be_idt << be_idt_nl
+ << node->tc_name () << ", " << be_nl
+ << "TAO_ENCAP_BYTE_ORDER," << be_nl
+ << "stream.begin ()," << be_nl
+ << "1," << be_nl
+ << node->full_name () << "::_duplicate (_tao_elem)," << be_nl
+ << node->name () << "::_tao_any_destructor" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "CORBA::Boolean" << be_nl
+ << "operator>>= (" << be_idt << be_idt_nl
+ << "const CORBA::Any &_tao_any," << be_nl
+ << node->full_name () << "_ptr &_tao_elem" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "ACE_TRY_NEW_ENV" << be_nl
+ << "{" << be_idt_nl
+ << "_tao_elem = " << node->full_name () << "::_nil ();" << be_nl
+ << "CORBA::TypeCode_var type = _tao_any.type ();" << be_nl << be_nl
+ << "CORBA::Boolean result =" << be_idt_nl
+ << "type->equivalent (" << be_idt << be_idt_nl
+ << node->tc_name () << be_nl
+ << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "ACE_TRY_CHECK;" << be_nl << be_nl
+ << "if (!result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return 0; // not equivalent" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "TAO_InputCDR stream (" << be_idt << be_idt_nl
<< "_tao_any._tao_get_cdr ()," << be_nl
<< "_tao_any._tao_byte_order ()" << be_uidt_nl
<< ");" << be_uidt_nl << be_nl
@@ -181,50 +107,58 @@ be_visitor_interface_any_op_cs::visit_interface (be_interface *node)
<< node->name () << "::_tao_any_destructor" << be_uidt_nl
<< ");" << be_uidt_nl << be_nl
<< "return 1;" << be_uidt_nl
- << "}" << be_uidt << be_uidt_nl;
+ << "}" << be_uidt << be_uidt_nl
+ << "}" << be_nl
+ << "ACE_CATCHANY" << be_nl
+ << "{" << be_idt_nl
+ << "_tao_elem = " << node->full_name () << "::_nil ();" << be_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_nl
+ << "ACE_ENDTRY;" << be_nl
+ << "_tao_elem = " << node->full_name () << "::_nil ();" << be_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
+
+ *os << "#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || \\"
+ << be_idt_nl
+ << " defined (ACE_HAS_GNU_REPO)" << be_nl;
+
+ if (node->is_abstract ())
+ {
+ *os << "template class TAO_Abstract_Manager<";
}
else
{
- *os << "_tao_elem =" << be_idt_nl
- << "ACE_reinterpret_cast (" << be_idt << be_idt_nl
- << node->name () << "_ptr," << be_nl
- << "ACE_const_cast (void *, _tao_any.value ())" << be_uidt_nl
- << ");" << be_uidt << be_uidt_nl << be_nl
- << "return 1;" << be_uidt_nl;
+ *os << "template class TAO_Object_Manager<";
}
- *os << "}" << be_nl
- << "ACE_CATCHANY" << be_nl
- << "{" << be_nl
- << "}" << be_nl
- << "ACE_ENDTRY;";
-
- *os << be_nl << be_nl
- << "_tao_elem = " << node->full_name () << "::_nil ();" << be_nl
- << "return 0;";
+ *os << node->full_name () << ","
+ << node->full_name () << "_var>;" << be_uidt_nl
+ << "#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)" << be_nl;
- *os << be_uidt_nl
- << "}\n\n";
+ if (node->is_abstract ())
+ {
+ *os << "# pragma instantiate TAO_Abstract_Manager<";
+ }
+ else
+ {
+ *os << "# pragma instantiate TAO_Object_Manager<";
+ }
- *os << "#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || \\"
- << be_idt << be_idt_nl
- << "defined (ACE_HAS_GNU_REPO)" << be_uidt_nl
- << "template class TAO_Object_Manager<"
- << node->full_name () << ","
- << node->full_name () << "_var>;" << be_uidt_nl
- << "#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)" << be_nl
- << "# pragma instantiate TAO_Object_Manager<"
- << node->full_name () << ","
- << node->full_name () << "_var>" << be_nl
+ *os << node->full_name () << ","
+ << node->full_name () << "_var>" << be_uidt_nl
<< "#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */\n\n";
// All we have to do is to visit the scope and generate code.
- if (this->visit_scope (node) == -1)
+ if (!node->is_local ())
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_interface::visit_interface - "
- "codegen for scope failed\n"),
- -1);
+ 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);
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/base_proxy_broker_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/base_proxy_broker_ch.cpp
index 67068688a0d..2de0f8bf792 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/base_proxy_broker_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/base_proxy_broker_ch.cpp
@@ -1,37 +1,40 @@
//$Id$
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+ACE_RCSID (be_visitor_interface,
+ base_proxy_broker_ch,
+ "$Id$")
-#include "be_visitor_interface.h"
-
-ACE_RCSID (be_visitor_interface, base_proxy_broker_ch, "$Id$")
-
-be_visitor_interface_base_proxy_broker_ch::be_visitor_interface_base_proxy_broker_ch (be_visitor_context *ctx)
+be_visitor_interface_base_proxy_broker_ch::
+be_visitor_interface_base_proxy_broker_ch (be_visitor_context *ctx)
: be_visitor_interface (ctx)
{
// No-Op.
}
-be_visitor_interface_base_proxy_broker_ch::~be_visitor_interface_base_proxy_broker_ch (void)
+be_visitor_interface_base_proxy_broker_ch::
+~be_visitor_interface_base_proxy_broker_ch (void)
{
// No-Op.
}
int
-be_visitor_interface_base_proxy_broker_ch::visit_interface (be_interface *node)
+be_visitor_interface_base_proxy_broker_ch::visit_interface (
+ be_interface *node
+ )
{
TAO_OutStream *os = this->ctx_->stream ();
*os << be_nl
- << "///////////////////////////////////////////////////////////////////////" << be_nl
+ << "///////////////////////////////////////////////////////////////////////"
+ << be_nl
<< "// Base Proxy Broker Declaration " << be_nl
<< "//" << be_nl << be_nl;
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Generate the class declaration.
- os->indent ();
*os << "class " << be_global->stub_export_macro () << " "
<< node->base_proxy_broker_name () << be_nl << "{" << be_nl
<< "public:"
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/base_proxy_impl_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/base_proxy_impl_ch.cpp
index 3fab08b2919..9717c686dda 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/base_proxy_impl_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/base_proxy_impl_ch.cpp
@@ -1,21 +1,21 @@
-//$Id$
+//
+// $Id$
+//
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+ACE_RCSID (be_visitor_interface,
+ base_proxy_impl_ch,
+ "$Id$")
-#include "be_visitor_interface.h"
-
-ACE_RCSID (be_visitor_interface, base_proxy_impl_ch, "$Id$")
-
-be_visitor_interface_base_proxy_impl_ch::be_visitor_interface_base_proxy_impl_ch (be_visitor_context *ctx)
+be_visitor_interface_base_proxy_impl_ch::
+be_visitor_interface_base_proxy_impl_ch (be_visitor_context *ctx)
: be_visitor_interface (ctx)
{
// No-Op.
}
-be_visitor_interface_base_proxy_impl_ch::~be_visitor_interface_base_proxy_impl_ch (void)
+be_visitor_interface_base_proxy_impl_ch::
+~be_visitor_interface_base_proxy_impl_ch (void)
{
// No-Op.
}
@@ -25,43 +25,59 @@ be_visitor_interface_base_proxy_impl_ch::visit_interface (be_interface *node)
{
TAO_OutStream *os = this->ctx_->stream ();
- // os->indent ();
-
*os << be_nl
- << "///////////////////////////////////////////////////////////////////////" << be_nl
+ << "///////////////////////////////////////////////////////////////////////"
+ << be_nl
<< "// Base Proxy Impl. Declaration" << be_nl
<< "//" << be_nl << be_nl;
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Generate Class Declaration.
*os << "class " << be_global->stub_export_macro ()
<< " " << node->base_proxy_impl_name () << be_idt_nl
<< ": ";
- if (node->n_inherits () > 0)
+ int n_parents = node->n_inherits ();
+ int has_concrete_parent = 0;
+
+ if (n_parents > 0)
{
*os << be_idt;
- for (int i = 0; i < node->n_inherits (); i++)
+ for (int i = 0; i < n_parents; ++i)
{
be_interface *inherited =
be_interface::narrow_from_decl (node->inherits ()[i]);
- *os << "public virtual ";
- *os << inherited->full_base_proxy_impl_name ();
+ if (inherited->is_abstract ())
+ {
+ continue;
+ }
- if (i < node->n_inherits () - 1)
+ if (has_concrete_parent == 1)
{
// Node is the case of multiple
// inheritance, so put a comma.
*os << ", " << be_nl;
}
+
+ *os << "public virtual ";
+ *os << inherited->full_base_proxy_impl_name ();
+
+ has_concrete_parent = 1;
}
- *os << be_uidt << be_uidt_nl; // idt = 0
+ if (has_concrete_parent == 1)
+ {
+ *os << be_uidt << be_uidt_nl;
+ }
}
- else
+
+ if (has_concrete_parent == 0)
{
- *os << "public virtual TAO_Object_Proxy_Impl" << be_uidt_nl;
+ *os << "public virtual TAO_Object_Proxy_Impl" << be_uidt << be_uidt_nl;
}
*os << "{" << be_nl << "public:"
@@ -76,7 +92,8 @@ be_visitor_interface_base_proxy_impl_ch::visit_interface (be_interface *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interface_base_proxy_impl_ch::"
"visit_interface - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
*os << be_uidt_nl;
@@ -91,5 +108,61 @@ be_visitor_interface_base_proxy_impl_ch::visit_interface (be_interface *node)
<< "// End Base Proxy Impl. Declaration" << be_nl
<< "///////////////////////////////////////////////////////////////////////"
<< be_nl << be_nl;
+
return 0;
}
+
+int
+be_visitor_interface_base_proxy_impl_ch::gen_abstract_ops_helper (
+ be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os
+ )
+{
+ if (node == base)
+ {
+ return 0;
+ }
+
+ AST_Decl *d = 0;
+ be_visitor_context ctx;
+ ctx.stream (os);
+
+ for (UTL_ScopeActiveIterator si (base, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ d = si.item ();
+
+ if (d == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_base_proxy_impl_ch"
+ "::abstract_base_ops_helper - "
+ "bad node in this scope\n"),
+ -1);
+ }
+
+ if (d->node_type () == AST_Decl::NT_op)
+ {
+ UTL_ScopedName item_new_name (d->local_name (),
+ 0);
+
+ AST_Operation *op = AST_Operation::narrow_from_decl (d);
+ be_operation new_op (op->return_type (),
+ op->flags (),
+ &item_new_name,
+ op->is_local (),
+ op->is_abstract ());
+ new_op.set_defined_in (node);
+ be_visitor_interface::add_abstract_op_args (op,
+ new_op);
+ ctx.state (TAO_CodeGen::TAO_OPERATION_BASE_PROXY_IMPL_CH);
+ be_visitor_operation_base_proxy_impl_ch op_visitor (&ctx);
+ op_visitor.visit_operation (&new_op);
+ }
+ }
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ch.cpp
index 5c1b9c100c6..22b6bd53d8a 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ch.cpp
@@ -19,20 +19,17 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface.h"
-
-ACE_RCSID(be_visitor_interface, cdr_op_ch, "$Id$")
+ACE_RCSID (be_visitor_interface,
+ cdr_op_ch,
+ "$Id$")
// ***************************************************************************
// Interface visitor for generating CDR operator declarations in the client header
// ***************************************************************************
-be_visitor_interface_cdr_op_ch::be_visitor_interface_cdr_op_ch
-(be_visitor_context *ctx)
+be_visitor_interface_cdr_op_ch::be_visitor_interface_cdr_op_ch (
+ be_visitor_context *ctx
+ )
: be_visitor_interface (ctx)
{
}
@@ -45,15 +42,19 @@ int
be_visitor_interface_cdr_op_ch::visit_interface (be_interface *node)
{
// No CDR operations for locality constraint interfaces.
- if (node->cli_hdr_cdr_op_gen () ||
- node->imported () ||
- node->is_local ())
- return 0;
+ if (node->cli_hdr_cdr_op_gen () || node->imported () || node->is_local ())
+ {
+ return 0;
+ }
TAO_OutStream *os = this->ctx_->stream ();
- // generate the CDR << and >> operator declarations
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Generate the CDR << and >> operator declarations.
os->indent ();
+
*os << be_global->stub_export_macro () << " CORBA::Boolean "
<< "operator<< (TAO_OutputCDR &, const " << node->full_name ()
<< "_ptr );" << be_nl;
@@ -61,20 +62,18 @@ be_visitor_interface_cdr_op_ch::visit_interface (be_interface *node)
<< "operator>> (TAO_InputCDR &, "
<< node->full_name () << "_ptr &);\n";
-
- // set the substate as generating code for the types defined in our scope
+ // Set the substate as generating code for the types defined in our scope.
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
- // 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_cdr_op_ch::"
"visit_interface - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
-
node->cli_hdr_cdr_op_gen (1);
-
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ci.cpp
index ac2d4b52d17..a46d835851e 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ci.cpp
@@ -18,21 +18,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface.h"
-
-ACE_RCSID(be_visitor_interface, cdr_op_ci, "$Id$")
+ACE_RCSID (be_visitor_interface,
+ cdr_op_ci,
+ "$Id$")
// ***************************************************************************
// Interface visitor for generating CDR operator declarations in the client
// stubs file
// ***************************************************************************
-be_visitor_interface_cdr_op_ci::be_visitor_interface_cdr_op_ci
-(be_visitor_context *ctx)
+be_visitor_interface_cdr_op_ci::be_visitor_interface_cdr_op_ci (
+ be_visitor_context *ctx
+ )
: be_visitor_interface (ctx)
{
}
@@ -59,7 +56,7 @@ be_visitor_interface_cdr_op_ci::visit_interface (be_interface *node)
// First generate code for our children. The reason we do this first is
// because the inlined code for our children must be available before
- // it in our parent, but we must forward declare the parent
+ // it is seen in our parent, but we must forward declare the parent
// we use operators, so code like this:
//
// // IDL
@@ -71,8 +68,10 @@ be_visitor_interface_cdr_op_ci::visit_interface (be_interface *node)
// defined).
//
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Generate the CDR << and >> operator declarations.
- os->indent ();
*os << be_global->stub_export_macro ()
<< " CORBA::Boolean operator<< ("
<< be_idt << be_idt_nl
@@ -100,7 +99,8 @@ be_visitor_interface_cdr_op_ci::visit_interface (be_interface *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interface_cdr_op_ci"
"::visit_interface - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
node->cli_inline_cdr_op_gen (1);
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp
index f3c743a6dfa..b25161cd35a 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp
@@ -18,16 +18,13 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+ACE_RCSID (be_visitor_interface,
+ cdr_op_cs,
+ "$Id$")
-#include "be_visitor_interface.h"
-
-ACE_RCSID(be_visitor_interface, cdr_op_cs, "$Id$")
-
-be_visitor_interface_cdr_op_cs::be_visitor_interface_cdr_op_cs
-(be_visitor_context *ctx)
+be_visitor_interface_cdr_op_cs::be_visitor_interface_cdr_op_cs (
+ be_visitor_context *ctx
+ )
: be_visitor_interface (ctx)
{
}
@@ -50,6 +47,7 @@ be_visitor_interface_cdr_op_cs::visit_interface (be_interface *node)
// Set the substate as generating code for the types defined in our scope.
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
+
// Visit the scope and generate code.
if (this->visit_scope (node) == -1)
{
@@ -61,6 +59,9 @@ be_visitor_interface_cdr_op_cs::visit_interface (be_interface *node)
TAO_OutStream *os = this->ctx_->stream ();
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Set the sub state as generating code for the output operator.
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_OUTPUT);
@@ -69,7 +70,17 @@ be_visitor_interface_cdr_op_cs::visit_interface (be_interface *node)
<< "const " << node->full_name () << "_ptr _tao_objref" << be_uidt_nl
<< ")" << be_uidt_nl
<< "{" << be_idt_nl;
- *os << "CORBA::Object_ptr _tao_corba_obj = _tao_objref;" << be_nl;
+
+ if (node->is_abstract ())
+ {
+ *os << "CORBA::AbstractBase_ptr";
+ }
+ else
+ {
+ *os << "CORBA::Object_ptr";
+ }
+
+ *os << " _tao_corba_obj = _tao_objref;" << be_nl;
*os << "return (strm << _tao_corba_obj);" << be_uidt_nl
<< "}\n\n";
@@ -83,16 +94,53 @@ be_visitor_interface_cdr_op_cs::visit_interface (be_interface *node)
<< "{" << be_idt_nl;
*os << "ACE_TRY_NEW_ENV" << be_nl
<< "{" << be_idt_nl;
- *os << "CORBA::Object_var obj;" << be_nl;
+
+ if (node->is_abstract ())
+ {
+ *os << "CORBA::AbstractBase_var obj;" << be_nl << be_nl;
+ }
+ else
+ {
+ *os << "CORBA::Object_var obj;" << be_nl << be_nl;
+ }
+
*os << "if ((strm >> obj.inout ()) == 0)" << be_idt_nl
+ << "{" << be_idt_nl
<< "return 0;" << be_uidt_nl
- << "// narrow to the right type" << be_nl;
- *os << "_tao_objref =" << be_idt_nl
- << node->full_name () << "::_unchecked_narrow ("
- << be_idt << be_idt_nl
- << "obj.in ()" << be_nl
- << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
- << ");" << be_uidt << be_uidt_nl;
+ << "}" << be_uidt_nl << be_nl
+ << "// Narrow to the right type." << be_nl;
+
+ if (node->is_abstract ())
+ {
+ *os << "if (obj->_is_objref ())" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_objref =" << be_idt_nl
+ << node->full_name () << "::_unchecked_narrow ("
+ << be_idt << be_idt_nl
+ << "obj.in ()" << be_nl
+ << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "else" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_objref =" << be_idt_nl
+ << node->full_name () << "::_unchecked_narrow ("
+ << be_idt << be_idt_nl
+ << "obj._retn ()" << be_nl
+ << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+ }
+ else
+ {
+ *os << "_tao_objref =" << be_idt_nl
+ << node->full_name () << "::_unchecked_narrow ("
+ << be_idt << be_idt_nl
+ << "obj.in ()" << be_nl
+ << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl;
+ }
+
*os << "ACE_TRY_CHECK;" << be_nl;
*os << "return 1;" << be_uidt_nl;
*os << "}" << be_nl
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp
index 877a0abbf10..a00dbf149c2 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp
@@ -1,44 +1,49 @@
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+//
+// $Id$
+//
-#include "be_visitor_interface.h"
+ACE_RCSID (be_visitor_interface,
+ direct_proxy_impl_sh,
+ "$Id$")
-ACE_RCSID (be_visitor_interface, direct_proxy_broker_impl_sh, "$Id$")
-
-be_visitor_interface_direct_proxy_impl_sh::be_visitor_interface_direct_proxy_impl_sh (be_visitor_context *ctx)
+be_visitor_interface_direct_proxy_impl_sh::
+be_visitor_interface_direct_proxy_impl_sh (be_visitor_context *ctx)
: be_visitor_interface (ctx)
{
// No-Op.
}
-
-be_visitor_interface_direct_proxy_impl_sh::~be_visitor_interface_direct_proxy_impl_sh (void)
+be_visitor_interface_direct_proxy_impl_sh::
+~be_visitor_interface_direct_proxy_impl_sh (void)
{
// No-Op.
}
int
-be_visitor_interface_direct_proxy_impl_sh::visit_interface (be_interface *node)
+be_visitor_interface_direct_proxy_impl_sh::visit_interface (
+ be_interface *node
+ )
{
TAO_OutStream *os = this->ctx_->stream ();
- // os->gen_ifdef_macro (node->flat_name (), "DIRECT_PROXY_IMPL_");
os->decr_indent (0);
*os << be_nl
- << "///////////////////////////////////////////////////////////////////////" << be_nl
+ << "///////////////////////////////////////////////////////////////////////"
+ << be_nl
<< "// Direct Impl. Declaration" << be_nl
<< "//" << be_nl << be_nl;
// Generate Class Declaration.
*os << "class " << be_global->skel_export_macro ()
<< " " << node->direct_proxy_impl_name ();
- *os << " : " << be_idt_nl << "public virtual " << node->full_base_proxy_impl_name ()
+ *os << " : " << be_idt_nl << "public virtual "
+ << node->full_base_proxy_impl_name ()
<< "," << be_nl << "public virtual " << "TAO_Direct_Object_Proxy_Impl";
if (node->n_inherits () > 0)
{
*os << "," << be_nl;
+
for (int i = 0; i < node->n_inherits (); i++)
{
be_interface *inherited =
@@ -46,13 +51,14 @@ be_visitor_interface_direct_proxy_impl_sh::visit_interface (be_interface *node)
*os << "public virtual ";
*os << inherited->full_direct_proxy_impl_name ();
- if (i < node->n_inherits () - 1) // node is the case of multiple
- // inheritance, so put a comma
+
+ if (i < node->n_inherits () - 1)
{
*os << ", ";
}
+
*os << be_nl;
- } // end of for loop
+ }
}
*os << be_uidt_nl;
@@ -69,7 +75,8 @@ be_visitor_interface_direct_proxy_impl_sh::visit_interface (be_interface *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) direct_proxy_impl_sh::"
"visit_interface - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
*os << "};" << be_uidt << be_nl << be_nl;
@@ -78,7 +85,61 @@ be_visitor_interface_direct_proxy_impl_sh::visit_interface (be_interface *node)
<< "// Direct Proxy Impl. Declaration" << be_nl
<< "///////////////////////////////////////////////////////////////////////"
<< be_nl << be_nl;
- // os->gen_endif ();
+
return 0;
+}
+
+int
+be_visitor_interface_direct_proxy_impl_sh::gen_abstract_ops_helper (
+ be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os
+ )
+{
+ if (node == base)
+ {
+ return 0;
+ }
+
+ AST_Decl *d = 0;
+ be_visitor_context ctx;
+ ctx.stream (os);
+
+ for (UTL_ScopeActiveIterator si (base, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ d = si.item ();
+
+ if (d == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_thru_poa_proxy_"
+ "impl_sh::abstract_base_ops_helper - "
+ "bad node in this scope\n"),
+ -1);
+ }
+
+ if (d->node_type () == AST_Decl::NT_op)
+ {
+ UTL_ScopedName item_new_name (d->local_name (),
+ 0);
+
+ AST_Operation *op = AST_Operation::narrow_from_decl (d);
+ be_operation new_op (op->return_type (),
+ op->flags (),
+ &item_new_name,
+ op->is_local (),
+ op->is_abstract ());
+ new_op.set_defined_in (node);
+ be_visitor_interface::add_abstract_op_args (op,
+ new_op);
+ ctx.state (TAO_CodeGen::TAO_OPERATION_PROXY_IMPL_XH);
+ be_visitor_operation_proxy_impl_xh op_visitor (&ctx);
+ op_visitor.visit_operation (&new_op);
+ }
+ }
+ return 0;
}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_ss.cpp
index 1572fc0390b..1ba64f475f6 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_ss.cpp
@@ -1,47 +1,45 @@
+//
//$Id$
+//
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+ACE_RCSID (be_visitor_interface,
+ direct_proxy_impl_ss,
+ "$Id$")
-#include "be_visitor_interface.h"
-
-ACE_RCSID(be_visitor_interface, direct_proxy_impl_ss, "$Id$")
-
-be_visitor_interface_direct_proxy_impl_ss::be_visitor_interface_direct_proxy_impl_ss (be_visitor_context *ctx)
+be_visitor_interface_direct_proxy_impl_ss::
+be_visitor_interface_direct_proxy_impl_ss (be_visitor_context *ctx)
: be_visitor_interface (ctx)
{
// No-Op.
}
-be_visitor_interface_direct_proxy_impl_ss::~be_visitor_interface_direct_proxy_impl_ss (void)
+be_visitor_interface_direct_proxy_impl_ss::
+~be_visitor_interface_direct_proxy_impl_ss (void)
{
// No-Op.
}
int
-be_visitor_interface_direct_proxy_impl_ss::visit_interface (be_interface *node)
+be_visitor_interface_direct_proxy_impl_ss::visit_interface (
+ be_interface *node
+ )
{
TAO_OutStream *os = this->ctx_->stream ();
this->ctx_->node (node);
os->indent ();
+
*os << be_nl
- << "///////////////////////////////////////////////////////////////////////" << be_nl
+ << "///////////////////////////////////////////////////////////////////////"
+ << be_nl
<< "// Direct Proxy Implementation" << be_nl
<< "//" << be_nl << be_nl;
-
// Ctor Implementation
*os << node->full_direct_proxy_impl_name () << "::"
<< node->direct_proxy_impl_name () << " (void)"
<< be_nl << "{}" << be_nl << be_nl;
- /*
- // Dtor Implementation
- *os << node->full_direct_proxy_impl_name () << "::"
- << "~" << node->direct_proxy_impl_name () << " (void)"
- << be_nl << "{}" << be_nl << be_nl;
- */
+
if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -56,5 +54,72 @@ be_visitor_interface_direct_proxy_impl_ss::visit_interface (be_interface *node)
<< "// End Direct Proxy Implementation" << be_nl
<< "///////////////////////////////////////////////////////////////////////"
<< be_nl;
+
return 0;
}
+
+int
+be_visitor_interface_direct_proxy_impl_ss::gen_abstract_ops_helper (
+ be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os
+ )
+{
+ if (node == base)
+ {
+ return 0;
+ }
+
+ AST_Decl *d = 0;
+ be_visitor_context ctx;
+ ctx.stream (os);
+
+ for (UTL_ScopeActiveIterator si (base, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ d = si.item ();
+
+ if (d == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_direct_proxy"
+ "_impl_ss::abstract_base_ops_helper - "
+ "bad node in this scope\n"),
+ -1);
+ }
+
+ if (d->node_type () == AST_Decl::NT_op)
+ {
+ UTL_ScopedName *item_new_name = 0;
+ ACE_NEW_RETURN (item_new_name,
+ UTL_ScopedName (d->local_name ()->copy (),
+ 0),
+ -1);
+
+ UTL_ScopedName *base = (UTL_ScopedName *)node->name ()->copy ();
+ base->nconc (item_new_name);
+
+ AST_Operation *op = AST_Operation::narrow_from_decl (d);
+ be_operation new_op (op->return_type (),
+ op->flags (),
+ 0,
+ op->is_local (),
+ op->is_abstract ());
+ new_op.set_defined_in (node);
+ be_visitor_interface::add_abstract_op_args (op,
+ new_op);
+ new_op.set_name (base);
+ ctx.state (TAO_CodeGen::TAO_OPERATION_DIRECT_PROXY_IMPL_SS);
+ be_visitor_operation_direct_proxy_impl_ss op_visitor (&ctx);
+ op_visitor.visit_operation (&new_op);
+
+ base->destroy ();
+ delete base;
+ base = 0;
+ }
+ }
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interceptors_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interceptors_ch.cpp
deleted file mode 100644
index 1976a1499ab..00000000000
--- a/TAO/TAO_IDL/be/be_visitor_interface/interceptors_ch.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// $Id$
-//
-// ============================================================================
-//
-// = LIBRARY
-// TAO IDL
-//
-// = FILENAME
-// interceptors_ch.cpp
-//
-// = DESCRIPTION
-// This provides code generation for interceptor classes for an
-// interface in the client header.
-//
-// = AUTHOR
-// Kirthika Parameswaran <kirthika@cs.wustl.edu>
-//
-// ============================================================================
-
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface.h"
-
-ACE_RCSID(be_visitor_interface, interceptors_ch, "$Id$")
-
-
-// ************************************************************
-// interceptor class in header
-// ************************************************************
-
-
-be_visitor_interface_interceptors_ch::be_visitor_interface_interceptors_ch
-(be_visitor_context *ctx)
- : be_visitor_interface (ctx)
-{
-}
-
-be_visitor_interface_interceptors_ch::~be_visitor_interface_interceptors_ch (void)
-{
-}
-
-int be_visitor_interface_interceptors_ch::visit_interface (be_interface *)
-{
- return 0;
-}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interceptors_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interceptors_cs.cpp
index b5cc2b9adc7..d22df743fd8 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interceptors_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interceptors_cs.cpp
@@ -18,34 +18,33 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface.h"
-
-ACE_RCSID(be_visitor_interface, interceptors_cs, "$Id$")
-
+ACE_RCSID (be_visitor_interface,
+ interceptors_cs,
+ "$Id$")
// ************************************************************
// interceptor class in header
// ************************************************************
-
-be_visitor_interface_interceptors_cs::be_visitor_interface_interceptors_cs
-(be_visitor_context *ctx)
+be_visitor_interface_interceptors_cs::be_visitor_interface_interceptors_cs (
+ be_visitor_context *ctx
+ )
: be_visitor_interface (ctx)
{
}
-be_visitor_interface_interceptors_cs::~be_visitor_interface_interceptors_cs (void)
+be_visitor_interface_interceptors_cs::~be_visitor_interface_interceptors_cs (
+ void
+ )
{
}
int be_visitor_interface_interceptors_cs::visit_interface (be_interface *node)
{
if (node->is_local ())
- return 0;
+ {
+ return 0;
+ }
TAO_OutStream *os = this->ctx_->stream ();
@@ -53,7 +52,11 @@ int be_visitor_interface_interceptors_cs::visit_interface (be_interface *node)
// elements of its scope. We depend on the front-end to have made sure
// that only legal syntactic elements appear in our scope.
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
+
os->indent ();
+
*os << "\n#if (TAO_HAS_INTERCEPTORS == 1)" << be_nl;
// Generate code for the interface definition by traversing thru the
@@ -67,11 +70,79 @@ int be_visitor_interface_interceptors_cs::visit_interface (be_interface *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interface_ch::"
"visit_interface - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
*os << "#endif /* TAO_HAS_INTERCEPTORS */\n";
return 0;
+}
+
+int
+be_visitor_interface_interceptors_cs::gen_abstract_ops_helper (
+ be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os
+ )
+{
+ if (node == base)
+ {
+ return 0;
+ }
+
+ AST_Decl *d = 0;
+ be_visitor_context ctx;
+ ctx.stream (os);
+
+ for (UTL_ScopeActiveIterator si (base, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ d = si.item ();
+
+ if (d == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_interceptors_cs::"
+ "abstract_base_ops_helper - "
+ "bad node in this scope\n"),
+ -1);
+ }
+
+ AST_Decl::NodeType nt = d->node_type ();
+
+ if (d->node_type () == AST_Decl::NT_op)
+ {
+ UTL_ScopedName *item_new_name = 0;
+ ACE_NEW_RETURN (item_new_name,
+ UTL_ScopedName (d->local_name ()->copy (),
+ 0),
+ -1);
+
+ UTL_ScopedName *base = (UTL_ScopedName *)node->name ()->copy ();
+ base->nconc (item_new_name);
+
+ AST_Operation *op = AST_Operation::narrow_from_decl (d);
+ be_operation new_op (op->return_type (),
+ op->flags (),
+ 0,
+ op->is_local (),
+ op->is_abstract ());
+ new_op.set_defined_in (node);
+ be_visitor_interface::add_abstract_op_args (op,
+ new_op);
+ new_op.set_name (base);
+ ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_CS);
+ be_visitor_operation_interceptors_cs op_visitor (&ctx);
+ op_visitor.visit_operation (&new_op);
+
+ base->destroy ();
+ delete base;
+ base = 0;
+ }
+ }
+ return 0;
}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interceptors_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interceptors_sh.cpp
index 4177f137a55..9171ffc89b7 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interceptors_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interceptors_sh.cpp
@@ -18,27 +18,25 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface.h"
-
-ACE_RCSID(be_visitor_interface, interceptors_sh, "$Id$")
-
+ACE_RCSID (be_visitor_interface,
+ interceptors_sh,
+ "$Id$")
// ************************************************************
// interceptor class in header
// ************************************************************
-be_visitor_interface_interceptors_sh::be_visitor_interface_interceptors_sh
-(be_visitor_context *ctx)
+be_visitor_interface_interceptors_sh::be_visitor_interface_interceptors_sh (
+ be_visitor_context *ctx
+ )
: be_visitor_interface (ctx)
{
}
-be_visitor_interface_interceptors_sh::~be_visitor_interface_interceptors_sh (void)
+be_visitor_interface_interceptors_sh::~be_visitor_interface_interceptors_sh (
+ void
+ )
{
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interceptors_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interceptors_ss.cpp
index 2ff6cc66b4d..6860fc7faf7 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interceptors_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interceptors_ss.cpp
@@ -18,27 +18,24 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface.h"
-
-ACE_RCSID(be_visitor_interface, interceptors_ss, "$Id$")
-
+ACE_RCSID (be_visitor_interface,
+ interceptors_ss,
+ "$Id$")
// ************************************************************
// interceptor class in header
// ************************************************************
-
-be_visitor_interface_interceptors_ss::be_visitor_interface_interceptors_ss
-(be_visitor_context *ctx)
+be_visitor_interface_interceptors_ss::be_visitor_interface_interceptors_ss (
+ be_visitor_context *ctx
+ )
: be_visitor_interface (ctx)
{
}
-be_visitor_interface_interceptors_ss::~be_visitor_interface_interceptors_ss (void)
+be_visitor_interface_interceptors_ss::~be_visitor_interface_interceptors_ss (
+ void
+ )
{
}
@@ -51,6 +48,9 @@ int be_visitor_interface_interceptors_ss::visit_interface (be_interface *node)
TAO_OutStream *os = this->ctx_->stream ();
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// 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.
@@ -66,10 +66,77 @@ int be_visitor_interface_interceptors_ss::visit_interface (be_interface *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interface_ch::"
"visit_interface - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
*os << "#endif /* TAO_HAS_INTERCEPTORS */\n";
return 0;
}
+
+int
+be_visitor_interface_interceptors_ss::gen_abstract_ops_helper (
+ be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os
+ )
+{
+ if (node == base)
+ {
+ return 0;
+ }
+
+ AST_Decl *d = 0;
+ be_visitor_context ctx;
+ ctx.stream (os);
+
+ for (UTL_ScopeActiveIterator si (base, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ d = si.item ();
+
+ if (d == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_interceptors_ss::"
+ "abstract_base_ops_helper - "
+ "bad node in this scope\n"),
+ -1);
+ }
+
+ if (d->node_type () == AST_Decl::NT_op)
+ {
+ UTL_ScopedName *item_new_name = 0;
+ ACE_NEW_RETURN (item_new_name,
+ UTL_ScopedName (d->local_name ()->copy (),
+ 0),
+ -1);
+
+ UTL_ScopedName *base = (UTL_ScopedName *)node->name ()->copy ();
+ base->nconc (item_new_name);
+
+ AST_Operation *op = AST_Operation::narrow_from_decl (d);
+ be_operation new_op (op->return_type (),
+ op->flags (),
+ 0,
+ op->is_local (),
+ op->is_abstract ());
+ new_op.set_defined_in (node);
+ be_visitor_interface::add_abstract_op_args (op,
+ new_op);
+ new_op.set_name (base);
+ ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_SS);
+ be_visitor_operation_interceptors_ss op_visitor (&ctx);
+ op_visitor.visit_operation (&new_op);
+
+ base->destroy ();
+ delete base;
+ base = 0;
+ }
+ }
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp
index 1ccc1b815d2..9947f290e92 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp
@@ -18,20 +18,16 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface.h"
-
-ACE_RCSID(be_visitor_interface, interface, "$Id$")
+ACE_RCSID (be_visitor_interface,
+ interface,
+ "$Id$")
// ******************************************************
// Generic Interface visitor
// ******************************************************
be_visitor_interface::be_visitor_interface (be_visitor_context *ctx)
- : be_visitor_scope (ctx)
+ : be_visitor_scope (ctx)
{
}
@@ -39,7 +35,7 @@ be_visitor_interface::~be_visitor_interface (void)
{
}
-// this method must be overridden by the derived interface visitors
+// This method must be overridden by the derived interface visitors.
int
be_visitor_interface::visit_interface (be_interface *)
{
@@ -47,35 +43,156 @@ be_visitor_interface::visit_interface (be_interface *)
}
int
+be_visitor_interface::visit_scope (be_scope *node)
+{
+ if (this->be_visitor_scope::visit_scope (node) == -1)
+ {
+ return -1;
+ }
+
+ be_interface *intf = be_interface::narrow_from_scope (node);
+
+ if (intf == 0)
+ {
+ return 0;
+ }
+
+ if (intf->is_abstract ())
+ {
+ return 0;
+ }
+
+ if (! intf->has_mixed_parentage ())
+ {
+ return 0;
+ }
+
+ be_interface::tao_code_emitter helper = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ helper =
+ be_visitor_interface_ch::gen_abstract_ops_helper;
+ break;
+ case TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_IMPL_CH:
+ helper =
+ be_visitor_interface_base_proxy_impl_ch::gen_abstract_ops_helper;
+ break;
+ case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_IMPL_CH:
+ helper =
+ be_visitor_interface_remote_proxy_impl_ch::gen_abstract_ops_helper;
+ break;
+ case TAO_CodeGen::TAO_INTERFACE_CS:
+ helper =
+ be_visitor_interface_cs::gen_abstract_ops_helper;
+ break;
+ case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_IMPL_CS:
+ helper =
+ be_visitor_interface_remote_proxy_impl_cs::gen_abstract_ops_helper;
+ break;
+ case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CS:
+ helper =
+ be_visitor_interface_interceptors_cs::gen_abstract_ops_helper;
+ break;
+ case TAO_CodeGen::TAO_INTERFACE_SH:
+ helper =
+ be_visitor_interface_sh::gen_abstract_ops_helper;
+ break;
+ case TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SH:
+ helper =
+ be_visitor_interface_thru_poa_proxy_impl_sh::gen_abstract_ops_helper;
+ break;
+ case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH:
+ helper =
+ be_visitor_interface_direct_proxy_impl_sh::gen_abstract_ops_helper;
+ break;
+ case TAO_CodeGen::TAO_INTERFACE_SS:
+ helper =
+ be_visitor_interface_ss::gen_abstract_ops_helper;
+ break;
+ case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SS:
+ helper =
+ be_visitor_interface_interceptors_ss::gen_abstract_ops_helper;
+ break;
+ case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS:
+ helper =
+ be_visitor_interface_direct_proxy_impl_ss::gen_abstract_ops_helper;
+ break;
+ case TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SS:
+ helper =
+ be_visitor_interface_thru_poa_proxy_impl_ss::gen_abstract_ops_helper;
+ break;
+ default:
+ break;
+ }
+
+ if (helper == 0)
+ {
+ return 0;
+ }
+
+ int status =
+ intf->traverse_inheritance_graph (helper,
+ this->ctx_->stream (),
+ I_TRUE);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_*::"
+ "visit_scope - "
+ "traversal of inheritance graph failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
be_visitor_interface::is_amh_rh_node (be_interface *node)
{
//If, is implied-IDL
- if (node->original_interface () != 0)
- {
- // and the name starts with AMH
- if (ACE_OS::strncmp (node->local_name (), "AMH", 3) == 0)
- {
- // then it is an AMH node
- return 1;
- }
- }
+ if (node->original_interface () != 0)
+ {
+ // and the name starts with AMH
+ if (ACE_OS::strncmp (node->local_name (), "AMH", 3) == 0)
+ {
+ // then it is an AMH node.
+ return 1;
+ }
+ }
+
return 0;
}
-// =all common visit methods for interface visitor
+void
+be_visitor_interface::add_abstract_op_args (AST_Operation *old_op,
+ be_operation &new_op)
+{
+ AST_Decl *d = 0;
+
+ for (UTL_ScopeActiveIterator si (old_op, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ d = si.item ();
+ new_op.add_to_scope (d);
+ }
+
+ new_op.be_add_exceptions (old_op->exceptions ());
+}
+
+// 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
+ // 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
+ ctx.node (node);
- // 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:
@@ -102,9 +219,6 @@ be_visitor_interface::visit_attribute (be_attribute *node)
case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_SMART_PROXY_CS);
break;
- case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CH:
- ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_INTERCEPTORS_CH);
- break;
case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CS:
ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_INTERCEPTORS_CS);
break;
@@ -120,19 +234,14 @@ be_visitor_interface::visit_attribute (be_attribute *node)
case TAO_CodeGen::TAO_INTERFACE_TIE_SI:
ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_TIE_SI);
break;
-
-
case TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_IMPL_CH:
ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_BASE_PROXY_IMPL_CH);
break;
-
-
case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_IMPL_CH:
case TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SH:
case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH:
ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_PROXY_IMPL_XH);
break;
-
case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_IMPL_CS:
ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_REMOTE_PROXY_IMPL_CS);
break;
@@ -156,7 +265,6 @@ be_visitor_interface::visit_attribute (be_attribute *node)
case TAO_CodeGen::TAO_INTERFACE_PROXY_IMPLS_SH:
case TAO_CodeGen::TAO_INTERFACE_PROXY_IMPLS_SS:
case TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_IMPL_CS:
-
case TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_CH:
case TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_CS:
case TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_SH:
@@ -167,8 +275,6 @@ be_visitor_interface::visit_attribute (be_attribute *node)
case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_BROKER_CS:
case TAO_CodeGen::TAO_INTERFACE_STRATEGIZED_PROXY_BROKER_SH:
case TAO_CodeGen::TAO_INTERFACE_STRATEGIZED_PROXY_BROKER_SS:
-
-
case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH:
case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS:
case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CH:
@@ -182,55 +288,51 @@ be_visitor_interface::visit_attribute (be_attribute *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interface::"
"visit_attribute - "
- "Bad context state\n: " ),
+ "Bad context state\n: "),
-1);
}
}
- 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);
- }
+ // Same visitor for all the above cases where an action is taken.
+ be_visitor_attribute visitor (&ctx);
- // let the node accept this visitor
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interface::"
"visit_attribute - "
- "failed to accept visitor\n"
- ), -1);
+ "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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_INTERFACE_CH:
- ctx.state (TAO_CodeGen::TAO_CONSTANT_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_CONSTANT_CH);
+ be_visitor_constant_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CS:
- ctx.state (TAO_CodeGen::TAO_CONSTANT_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_CONSTANT_CS);
+ be_visitor_constant_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH:
case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS:
case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CH:
@@ -238,7 +340,6 @@ be_visitor_interface::visit_constant (be_constant *node)
case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CS:
case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
- case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CH:
case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CS:
case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SH:
case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SS:
@@ -250,7 +351,6 @@ be_visitor_interface::visit_constant (be_constant *node)
case TAO_CodeGen::TAO_INTERFACE_SS:
case TAO_CodeGen::TAO_INTERFACE_TIE_SH:
case TAO_CodeGen::TAO_INTERFACE_TIE_SI:
-
case TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_CH:
case TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_CS:
case TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_SH:
@@ -273,81 +373,86 @@ be_visitor_interface::visit_constant (be_constant *node)
case TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SS:
case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH:
case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS:
-
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SH:
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SS:
- return 0; // nothing to be done
-
- default:
+ return 0; // nothing to be done
+ default:
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interface::"
"visit_constant - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interface::"
"visit_constant - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_INTERFACE_CH:
- ctx.state (TAO_CodeGen::TAO_ENUM_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_CH);
+ be_visitor_enum_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CS:
- ctx.state (TAO_CodeGen::TAO_ENUM_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_CS);
+ be_visitor_enum_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CH);
+ be_visitor_enum_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CS);
+ be_visitor_enum_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CH);
+ be_visitor_enum_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CI);
- break;
- case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CI);
+ be_visitor_enum_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CS:
case TAO_CodeGen::TAO_INTERFACE_CI:
case TAO_CodeGen::TAO_INTERFACE_SH:
case TAO_CodeGen::TAO_INTERFACE_IH:
@@ -356,7 +461,6 @@ be_visitor_interface::visit_enum (be_enum *node)
case TAO_CodeGen::TAO_INTERFACE_SS:
case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
- case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CH:
case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CS:
case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SH:
case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SS:
@@ -388,8 +492,7 @@ be_visitor_interface::visit_enum (be_enum *node)
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SH:
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SS:
- return 0; // nothing to be done
-
+ return 0; // nothing to be done
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -400,26 +503,15 @@ be_visitor_interface::visit_enum (be_enum *node)
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interface::"
"visit_enum - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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;
}
@@ -427,41 +519,70 @@ be_visitor_interface::visit_enum (be_enum *node)
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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_INTERFACE_CH:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CH);
+ be_visitor_exception_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CI:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CI);
+ be_visitor_exception_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CS:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CS);
+ be_visitor_exception_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CH);
+ be_visitor_exception_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CS);
+ be_visitor_exception_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CH);
+ be_visitor_exception_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CI);
+ be_visitor_exception_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CS);
+ be_visitor_exception_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_SH:
case TAO_CodeGen::TAO_INTERFACE_IH:
case TAO_CodeGen::TAO_INTERFACE_IS:
@@ -469,7 +590,6 @@ be_visitor_interface::visit_exception (be_exception *node)
case TAO_CodeGen::TAO_INTERFACE_SS:
case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
- case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CH:
case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CS:
case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SH:
case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SS:
@@ -501,8 +621,7 @@ be_visitor_interface::visit_exception (be_exception *node)
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SH:
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SS:
- return 0; // nothing to be done
-
+ return 0; // nothing to be done
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -513,26 +632,15 @@ be_visitor_interface::visit_exception (be_exception *node)
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interface::"
"visit_exception - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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;
}
@@ -541,17 +649,16 @@ int
be_visitor_interface::visit_operation (be_operation *node)
{
- // instantiate a visitor context with a copy of our context. This info
+ // Instantiate a visitor context with a copy of our context. This info
// will be modified ased 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
+ ctx.node (node);
+ int status = 1;
switch (this->ctx_->state ())
{
+ // These first two cases may have the context state changed
+ // by a strategy, so we use the visitor factory below.
case TAO_CodeGen::TAO_INTERFACE_CH:
ctx.state (TAO_CodeGen::TAO_OPERATION_CH);
break;
@@ -559,70 +666,133 @@ be_visitor_interface::visit_operation (be_operation *node)
ctx.state (TAO_CodeGen::TAO_OPERATION_CS);
break;
case TAO_CodeGen::TAO_INTERFACE_SH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_SH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_SH);
+ be_visitor_operation_sh visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_IH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_IH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_IH);
+ be_visitor_operation_ih visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_SS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_SS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_SS);
+ be_visitor_operation_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_IS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_IS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_IS);
+ be_visitor_operation_is visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_TIE_SH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_TIE_SH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_TIE_SH);
+ be_visitor_operation_tie_sh visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_TIE_SI:
- ctx.state (TAO_CodeGen::TAO_OPERATION_TIE_SI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_TIE_SI);
+ be_visitor_operation_tie_si visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_SMART_PROXY_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_SMART_PROXY_CH);
+ be_visitor_operation_smart_proxy_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_SMART_PROXY_CS);
- break;
- case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_SMART_PROXY_CS);
+ be_visitor_operation_smart_proxy_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_CS);
+ be_visitor_operation_interceptors_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_SH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_SH);
+ be_visitor_operation_interceptors_sh visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_SS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_SS);
+ be_visitor_operation_interceptors_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_IMPL_CH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_BASE_PROXY_IMPL_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_BASE_PROXY_IMPL_CH);
+ be_visitor_operation_base_proxy_impl_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_IMPL_CH:
case TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SH:
case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_PROXY_IMPL_XH);
- break;
-
- // AMH stuff
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_PROXY_IMPL_XH);
+ be_visitor_operation_proxy_impl_xh visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_AMH_RH_SH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_AMH_RH_SH);
+ be_visitor_amh_rh_operation_sh visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_AMH_RH_SS);
- break;
-
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_AMH_RH_SS);
+ be_visitor_amh_rh_operation_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_IMPL_CS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_REMOTE_PROXY_IMPL_CS);
- break;
-
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_REMOTE_PROXY_IMPL_CS);
+ be_visitor_operation_remote_proxy_impl_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_THRU_POA_PROXY_IMPL_SS);
- break;
-
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_THRU_POA_PROXY_IMPL_SS);
+ be_visitor_operation_thru_poa_proxy_impl_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_DIRECT_PROXY_IMPL_SS);
- break;
-
+ {
+ ctx.state (TAO_CodeGen::TAO_OPERATION_DIRECT_PROXY_IMPL_SS);
+ be_visitor_operation_direct_proxy_impl_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH:
case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS:
case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CH:
@@ -641,30 +811,44 @@ be_visitor_interface::visit_operation (be_operation *node)
}
}
- // Change the state depending on the kind of node strategy
+ if (status == 0)
+ {
+ return 0;
+ }
+ else if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface::"
+ "visit_operation - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ // Change the state depending on the kind of node strategy.
ctx.state (node->next_state (ctx.state ()));
- // grab the appropriate visitor
+ // 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);
+ "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);
+ "failed to accept visitor\n"),
+ -1);
}
+
delete visitor;
visitor = 0;
@@ -673,29 +857,30 @@ be_visitor_interface::visit_operation (be_operation *node)
// the node.
if (node->has_extra_code_generation (ctx.state ()))
{
- // Change the state depending on the kind of node strategy
+ // Change the state depending on the kind of node strategy.
ctx.state (node->next_state (ctx.state (), 1));
- // grab the appropriate visitor
+ // Grab the appropriate 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);
+ "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);
+ "failed to accept visitor\n"),
+ -1);
}
+
delete visitor;
visitor = 0;
}
@@ -703,45 +888,73 @@ be_visitor_interface::visit_operation (be_operation *node)
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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_INTERFACE_CH:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CH);
+ be_visitor_structure_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CI:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CI);
+ be_visitor_structure_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CS:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CS);
+ be_visitor_structure_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CH);
+ be_visitor_structure_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CS);
+ be_visitor_structure_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CH);
+ be_visitor_structure_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CI);
+ be_visitor_structure_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CS);
+ be_visitor_structure_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_SH:
case TAO_CodeGen::TAO_INTERFACE_IH:
case TAO_CodeGen::TAO_INTERFACE_IS:
@@ -749,7 +962,6 @@ be_visitor_interface::visit_structure (be_structure *node)
case TAO_CodeGen::TAO_INTERFACE_SS:
case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
- case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CH:
case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CS:
case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SH:
case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SS:
@@ -787,73 +999,176 @@ be_visitor_interface::visit_structure (be_structure *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interface::"
"visit_structure - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interface::"
"visit_structure - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept visitor\n"),
+ -1);
}
- // let the node accept this visitor
- if (node->accept (visitor) == -1)
+ return 0;
+}
+
+int
+be_visitor_interface::visit_structure_fwd (be_structure_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);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_FWD_CH);
+ be_visitor_structure_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_INTERFACE_CI:
+ case TAO_CodeGen::TAO_INTERFACE_CS:
+ case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH:
+ case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS:
+ case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CH:
+ case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CI:
+ case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CS:
+ case TAO_CodeGen::TAO_INTERFACE_SH:
+ case TAO_CodeGen::TAO_INTERFACE_IH:
+ case TAO_CodeGen::TAO_INTERFACE_IS:
+ case TAO_CodeGen::TAO_INTERFACE_SI:
+ case TAO_CodeGen::TAO_INTERFACE_SS:
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
+ case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CS:
+ case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SH:
+ case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SS:
+ case TAO_CodeGen::TAO_INTERFACE_TIE_SH:
+ case TAO_CodeGen::TAO_INTERFACE_TIE_SI:
+
+ case TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_CH:
+ case TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_CS:
+ case TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_SH:
+ case TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_SS:
+ case TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_BROKER_CH:
+ case TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_BROKER_CS:
+ case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_BROKER_CH:
+ case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_BROKER_CS:
+ case TAO_CodeGen::TAO_INTERFACE_STRATEGIZED_PROXY_BROKER_SH:
+ case TAO_CodeGen::TAO_INTERFACE_STRATEGIZED_PROXY_BROKER_SS:
+ case TAO_CodeGen::TAO_INTERFACE_PROXY_IMPLS_CH:
+ case TAO_CodeGen::TAO_INTERFACE_PROXY_IMPLS_CS:
+ case TAO_CodeGen::TAO_INTERFACE_PROXY_IMPLS_SH:
+ case TAO_CodeGen::TAO_INTERFACE_PROXY_IMPLS_SS:
+ case TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_IMPL_CH:
+ case TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_IMPL_CS:
+ case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_IMPL_CH:
+ case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_IMPL_CS:
+ case TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SH:
+ case TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SS:
+ case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH:
+ case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS:
+
+ case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SH:
+ case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SS:
+ return 0; // nothing to be done
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface::"
+ "visit_structure_fwd - "
+ "Bad context state\n"),
+ -1);
+ }
+ }
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interface::"
- "visit_structure - "
- "failed to accept visitor\n"
- ), -1);
+ "visit_structure_fwd - "
+ "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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_INTERFACE_CH:
- ctx.state (TAO_CodeGen::TAO_UNION_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CH);
+ be_visitor_union_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CI:
- ctx.state (TAO_CodeGen::TAO_UNION_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CI);
+ be_visitor_union_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CS:
- ctx.state (TAO_CodeGen::TAO_UNION_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CS);
+ be_visitor_union_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CH);
+ be_visitor_union_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CS);
+ be_visitor_union_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CH);
+ be_visitor_union_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CI);
+ be_visitor_union_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CS);
+ be_visitor_union_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_SH:
case TAO_CodeGen::TAO_INTERFACE_IH:
case TAO_CodeGen::TAO_INTERFACE_IS:
@@ -861,7 +1176,6 @@ be_visitor_interface::visit_union (be_union *node)
case TAO_CodeGen::TAO_INTERFACE_SS:
case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
- case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CH:
case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CS:
case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SH:
case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SS:
@@ -893,79 +1207,182 @@ be_visitor_interface::visit_union (be_union *node)
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SH:
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SS:
- return 0; // nothing to be done
+ return 0; // nothing to be done
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interface::"
"visit_union - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interface::"
"visit_union - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept visitor\n"),
+ -1);
}
- // let the node accept this visitor
- if (node->accept (visitor) == -1)
+ return 0;
+}
+
+int
+be_visitor_interface::visit_union_fwd (be_union_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);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_FWD_CH);
+ be_visitor_union_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_INTERFACE_CI:
+ case TAO_CodeGen::TAO_INTERFACE_CS:
+ case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH:
+ case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS:
+ case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CH:
+ case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CI:
+ case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CS:
+ case TAO_CodeGen::TAO_INTERFACE_SH:
+ case TAO_CodeGen::TAO_INTERFACE_IH:
+ case TAO_CodeGen::TAO_INTERFACE_IS:
+ case TAO_CodeGen::TAO_INTERFACE_SI:
+ case TAO_CodeGen::TAO_INTERFACE_SS:
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
+ case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CS:
+ case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SH:
+ case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SS:
+ case TAO_CodeGen::TAO_INTERFACE_TIE_SH:
+ case TAO_CodeGen::TAO_INTERFACE_TIE_SI:
+
+ case TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_CH:
+ case TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_CS:
+ case TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_SH:
+ case TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_SS:
+ case TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_BROKER_CH:
+ case TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_BROKER_CS:
+ case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_BROKER_CH:
+ case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_BROKER_CS:
+ case TAO_CodeGen::TAO_INTERFACE_STRATEGIZED_PROXY_BROKER_SH:
+ case TAO_CodeGen::TAO_INTERFACE_STRATEGIZED_PROXY_BROKER_SS:
+ case TAO_CodeGen::TAO_INTERFACE_PROXY_IMPLS_CH:
+ case TAO_CodeGen::TAO_INTERFACE_PROXY_IMPLS_CS:
+ case TAO_CodeGen::TAO_INTERFACE_PROXY_IMPLS_SH:
+ case TAO_CodeGen::TAO_INTERFACE_PROXY_IMPLS_SS:
+ case TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_IMPL_CH:
+ case TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_IMPL_CS:
+ case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_IMPL_CH:
+ case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_IMPL_CS:
+ case TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SH:
+ case TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SS:
+ case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH:
+ case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS:
+
+ case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SH:
+ case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SS:
+ return 0; // nothing to be done
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface::"
+ "visit_union_fwd - "
+ "Bad context state\n"),
+ -1);
+ }
+ }
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interface::"
- "visit_union - "
- "failed to accept visitor\n"
- ), -1);
+ "visit_union_fwd - "
+ "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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_INTERFACE_CH:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CH);
+ be_visitor_typedef_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CI:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CI);
+ be_visitor_typedef_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CS:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CS);
+ be_visitor_typedef_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH);
+ be_visitor_typedef_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS);
+ be_visitor_typedef_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CH);
+ be_visitor_typedef_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CI);
+ be_visitor_typedef_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CS);
+ be_visitor_typedef_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_INTERFACE_SH:
case TAO_CodeGen::TAO_INTERFACE_IH:
case TAO_CodeGen::TAO_INTERFACE_IS:
@@ -973,7 +1390,6 @@ be_visitor_interface::visit_typedef (be_typedef *node)
case TAO_CodeGen::TAO_INTERFACE_SS:
case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
- case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CH:
case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CS:
case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SH:
case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SS:
@@ -1005,36 +1421,25 @@ be_visitor_interface::visit_typedef (be_typedef *node)
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SH:
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SS:
- return 0; // nothing to be done
+ return 0; // nothing to be done
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interface::"
"visit_typedef - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interface::"
"visit_typedef - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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
index ff4e5e6e007..467b7c46f93 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
@@ -18,14 +18,11 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_interface.h"
#include "be_visitor_typecode/typecode_decl.h"
-ACE_RCSID(be_visitor_interface, interface_ch, "$Id$")
-
+ACE_RCSID (be_visitor_interface,
+ interface_ch,
+ "$Id$")
// ******************************************************
// Interface visitor for client header
@@ -43,336 +40,466 @@ be_visitor_interface_ch::~be_visitor_interface_ch (void)
int
be_visitor_interface_ch::visit_interface (be_interface *node)
{
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
TAO_OutStream *os = this->ctx_->stream ();
long i;
- // If not already generated and not imported.
- if (!node->cli_hdr_gen () && !node->imported ())
- {
- // == STEP 1: generate the class name and class names we inherit ==
+ // == STEP 1: generate the class name and class names we inherit ==
- // Generate the ifdefined macro for the _ptr type.
- os->gen_ifdef_macro (node->flat_name (),
- "_ptr");
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
+ // Generate the ifdefined macro for the _ptr type.
+ os->gen_ifdef_macro (node->flat_name (),
+ "_ptr");
- // The following two are required to be under the ifdef macro to avoid
- // multiple declarations.
- // Forward declaration.
- *os << "class " << node->local_name () << ";" << be_nl;
- // Generate the _ptr declaration.
- *os << "typedef " << node->local_name () << " *"
- << node->local_name () << "_ptr;" << be_nl;
+ // The following two are required to be under the ifdef macro to avoid
+ // multiple declarations.
- os->gen_endif ();
+ // Forward declaration.
+ *os << "class " << node->local_name () << ";" << be_nl;
+ // Generate the _ptr declaration.
+ *os << "typedef " << node->local_name () << " *"
+ << node->local_name () << "_ptr;" << be_nl;
- // Generate the ifdefined macro for the var type.
- os->gen_ifdef_macro (node->flat_name (), "_var");
+ os->gen_endif ();
- // 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);
- }
+ // Generate the ifdefined macro for the var type.
+ os->gen_ifdef_macro (node->flat_name (), "_var");
- os->gen_endif ();
+ // 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);
+ }
- // Generate the ifdef macro for the _out class.
- os->gen_ifdef_macro (node->flat_name (),
- "_out");
+ os->gen_endif ();
- // Generate the _out declaration.
- 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 ifdef macro for the _out class.
+ os->gen_ifdef_macro (node->flat_name (),
+ "_out");
- // Generate the endif macro.
- os->gen_endif ();
+ // Generate the _out declaration.
+ 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);
+ }
- *os << "// *************************************************************"
- << be_nl
- << "// " << node->name () << be_nl
- << "// TAO_IDL - Generated from" << be_nl
- << "// " << __FILE__ << ":" << __LINE__ << be_nl
- << "// *************************************************************"
+ // Generate the endif macro.
+ os->gen_endif ();
+
+ // The above code could have been executed by the forward declaration
+ // as long as it wasn't imported. The code below can only be
+ // executed by an interface definition, also non-imported.
+ if (node->imported ())
+ {
+ return 0;
+ }
+
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Now the interface definition itself.
+ os->gen_ifdef_macro (node->flat_name ());
+
+ if (!node->is_local () && !node->is_abstract ())
+ {
+ // Forward class declaration
+ *os << "// Forward Classes Declaration." << be_nl
+ << "class " << node->base_proxy_impl_name () << ";" << be_nl
+ << "class " << node->remote_proxy_impl_name () << ";" << be_nl
+ << "class " << node->base_proxy_broker_name () << ";" << be_nl
+ << "class " << node->remote_proxy_broker_name () << ";"
<< be_nl << be_nl;
+ }
- // Now the interface definition itself.
- os->gen_ifdef_macro (node->flat_name ());
+ // Now generate the class definition.
+ *os << "class " << be_global->stub_export_macro ()
+ << " " << node->local_name () << be_idt_nl
+ << ": " ;
- if (!node->is_local ())
- {
- // Forward class declaration
- *os << "// Forward Classes Declaration." << be_nl
- << "class " << node->base_proxy_impl_name () << ";" << be_nl
- << "class " << node->remote_proxy_impl_name () << ";" << be_nl
- << "class " << node->base_proxy_broker_name () << ";" << be_nl
- << "class " << node->remote_proxy_broker_name () << ";"
- << be_nl << be_nl;
- }
+ long nparents = node->n_inherits ();
+ int has_concrete_parent = 0;
- // Now generate the class definition.
- *os << "class " << be_global->stub_export_macro ()
- << " " << node->local_name () << be_idt_nl
- << ": " ;
+ // If node interface inherits from other interfaces.
+ if (nparents > 0)
+ {
+ *os << be_idt;
- // If node interface inherits from other interfaces.
- if (node->n_inherits () > 0)
+ for (i = 0; i < nparents; ++i)
{
- *os << be_idt;
+ if (! node->inherits ()[i]->is_abstract ())
+ {
+ has_concrete_parent = 1;
+ }
+
+ *os << "public virtual "
+ << node->inherits ()[i]->name ();
- for (i = 0; i < node->n_inherits (); i++)
+ if (i < nparents - 1)
{
- *os << "public virtual "
- << node->inherits ()[i]->name ();
-
- if (i < node->n_inherits () - 1)
- {
- // Node has multiple inheritance, so put a comma.
- *os << "," << be_nl;
- }
+ // Node has multiple inheritance, so put a comma.
+ *os << "," << be_nl;
}
+ }
+ if (has_concrete_parent == 1 || node->is_abstract ())
+ {
*os << be_uidt << be_uidt_nl;
}
- else
+ else if (! node->is_abstract ())
{
- // We do not inherit from anybody, hence we do so from the base
- // CORBA::Object class.
- *os << "public virtual CORBA_Object" << be_uidt_nl;
+ *os << "," << be_nl;
}
+ }
+ else if (node->is_abstract ())
+ {
+ *os << "public virtual CORBA::AbstractBase" << be_uidt_nl;
+ }
- // Generate the body.
+ if (has_concrete_parent == 0 && ! node->is_abstract ())
+ {
+ *os << "public virtual CORBA::Object";
+
+ if (nparents > 0)
+ {
+ *os << be_uidt;
+ }
+
+ *os << be_uidt_nl;
+ }
- *os << "{" << be_nl
- << "public:" << be_nl
+ // Generate the body.
- // Generate the _ptr_type and _var_type typedefs
- // but we must protect against certain versions of g++.
- << "#if !defined(__GNUC__) || !defined (ACE_HAS_GNUG_PRE_2_8)"
- << be_idt_nl
- << "typedef " << node->local_name () << "_ptr _ptr_type;"
- << be_nl
- << "typedef " << node->local_name () << "_var _var_type;"
- << be_uidt_nl
- << "#endif /* ! __GNUC__ || g++ >= 2.8 */\n" << be_idt_nl;
-
- // Generate the static variable that we use for narrowing.
- *os << "static int _tao_class_id;" << be_nl << be_nl;
-
- // Generate the static _duplicate, _narrow, and _nil operations.
- *os << "// The static operations." << be_nl
- << "static " << node->local_name () << "_ptr " << "_duplicate ("
- << node->local_name () << "_ptr obj);" << be_nl << be_nl
- << "static " << node->local_name () << "_ptr "
- << "_narrow (" << be_idt << be_idt_nl
- << "CORBA::Object_ptr obj" << be_nl
- << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
- << ");" << be_uidt_nl << be_nl;
+ *os << "{" << be_nl
+ << "public:" << be_idt_nl
+
+ // Generate the _ptr_type and _var_type typedefs.
+ << "typedef " << node->local_name () << "_ptr _ptr_type;"
+ << be_nl
+ << "typedef " << node->local_name () << "_var _var_type;"
+ << be_nl;
+
+ // Generate the static variable that we use for narrowing.
+ *os << "static int _tao_class_id;" << be_nl << be_nl;
+
+ // Generate the static _duplicate, _narrow, and _nil operations.
+ *os << "// The static operations." << be_nl
+ << "static " << node->local_name () << "_ptr " << "_duplicate ("
+ << node->local_name () << "_ptr obj);" << be_nl << be_nl
+ << "static " << node->local_name () << "_ptr "
+ << "_narrow (" << be_idt << be_idt_nl;
+
+ if (node->is_abstract ())
+ {
+ *os << "CORBA::AbstractBase_ptr obj" << be_nl;
+ }
+ else
+ {
+ *os << "CORBA::Object_ptr obj" << be_nl;
+ }
+
+ *os << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // There's no need for an _unchecked_narrow for locality
+ // constrained object.
+ *os << "static " << node->local_name () << "_ptr "
+ << "_unchecked_narrow (" << be_idt << be_idt_nl;
+
+ if (node->is_abstract ())
+ {
+ *os << "CORBA::AbstractBase_ptr obj" << be_nl;
+ }
+ else
+ {
+ *os << "CORBA::Object_ptr obj" << be_nl;
+ }
- // There's no need for an _unchecked_narrow for locality
- // constrained object.
- *os << "static " << node->local_name () << "_ptr "
- << "_unchecked_narrow (" << be_idt << be_idt_nl
- << "CORBA::Object_ptr obj" << be_nl
+ *os << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // This method is defined in the header file to workaround old
+ // g++ problems.
+ *os << "static " << node->local_name () << "_ptr _nil (void)"
+ << be_idt_nl << "{" << be_idt_nl
+ << "return (" << node->local_name ()
+ << "_ptr)0;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+
+ if (node->is_abstract ())
+ {
+ *os << "static foo_ptr _downcast (CORBA::AbstractBase_ptr abs);"
+ << be_nl << be_nl;
+ }
+
+ // No Any operator for local interfaces.
+ if (! node->is_local () && be_global->any_support ())
+ {
+ *os << "static void _tao_any_destructor (void*);" << be_nl << be_nl;
+ }
+
+ // 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);
+ }
+
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // If we inherit from both CORBA::Object and CORBA::AbstractBase,
+ // we have to override _add_ref() to avoid ambiguity, because it is
+ // called in _tao_Queryinterface().
+ if (node->has_mixed_parentage ())
+ {
+ *os << "virtual void _add_ref (void);" << be_nl << be_nl;
+ }
+
+ // The _is_a method
+ if (! node->is_local ())
+ {
+ *os << "virtual CORBA::Boolean _is_a (" << be_idt << be_idt_nl
+ << "const char *type_id" << be_nl
<< "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
<< ");" << be_uidt_nl << be_nl;
+ }
- // This method is defined in the header file to workaround old
- // g++ problems.
- *os << "static " << node->local_name () << "_ptr _nil (void)"
- << be_idt_nl << "{" << be_idt_nl
- << "return (" << node->local_name ()
- << "_ptr)0;" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl;
+ // The _tao_QueryInterface method.
+ *os << "virtual void *_tao_QueryInterface (ptr_arith_t type);"
+ << be_nl << be_nl;
- *os << "static void _tao_any_destructor (void*);" << be_nl << be_nl;
+ // The _interface_repository_id method.
+ *os << "virtual const char* _interface_repository_id (void) const;";
- // 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 (node->is_abstract ())
+ {
+ *os << be_nl << be_nl
+ << "virtual void *_tao_obv_narrow (ptr_arith_t type_id);";
+ }
- 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);
- }
+ if (! node->is_local () && ! node->is_abstract ())
+ {
+ // Add the Proxy Broker member variable.
+ *os << be_uidt_nl
+ << "private:" << be_idt_nl
+ << node->base_proxy_broker_name () << " *"
+ << "the" << node->base_proxy_broker_name ()
+ << "_;";
+ }
- // The _is_a method
- if (! node->is_local ())
- {
- *os << "virtual CORBA::Boolean _is_a (" << be_idt << be_idt_nl
- << "const CORBA::Char *type_id" << be_nl
- << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
- << ");" << be_uidt_nl << be_nl;
- }
+ *os << be_uidt_nl << be_nl
+ << "protected:" << be_idt_nl;
- // The _tao_QueryInterface method.
- *os << "virtual void *_tao_QueryInterface (ptr_arith_t type);"
+ if (! node->is_local () && ! node->is_abstract ())
+ {
+ // Generate the "protected" constructor so that users cannot
+ // instantiate us.
+
+ *os << node->local_name () << " (int collocated = 0);"
<< be_nl << be_nl;
- // The _interface_repository_id method.
- *os << "virtual const char* _interface_repository_id (void) const;\n"
- << be_uidt_nl;
+ *os << "// These methods travese the inheritance tree and set the"
+ << be_nl
+ << "// parents piece of the given class in the right mode"
+ << be_nl
+ << "virtual void " << node->flat_name ()
+ << "_setup_collocation (int collocated);" << be_nl << be_nl;
+ }
+ else
+ {
+ // Protected default constructor for abstract interfaces.
+ *os << node->local_name () << " (void);" << be_nl;
- if (!node->is_local ())
- {
- // Add the Proxy Broker member variable.
- *os << "private:" << be_idt_nl
- << node->base_proxy_broker_name () << " *"
- << "the" << node->base_proxy_broker_name ()
- << "_;" << be_nl << be_uidt_nl;
- }
+ // Protected copy constructor for abstract interfaces.
+ *os << node->local_name () << " (const "
+ << node->local_name () << " &);" << be_nl;
+ }
- *os << "protected:" << be_idt_nl;
+ // Local interfaces don't support stub objects.
+ if (! node->is_local ())
+ {
+ *os << node->local_name ()
+ << " (" << be_idt << be_idt_nl << "TAO_Stub *objref, " << be_nl
+ << "CORBA::Boolean _tao_collocated = 0," << be_nl
+ << "TAO_Abstract_ServantBase *servant = 0" << be_uidt_nl
+ << ");" << be_uidt_nl;
+ }
- if (!node->is_local ())
- {
- // Generate the "protected" constructor so that users cannot
- // instantiate us.
-
- *os << node->local_name () << " (int collocated = 0);"
- << be_nl << be_nl;
-
- *os << "// These methods travese the inheritance tree and set the"
- << be_nl
- << "// parents piece of the given class in the right mode"
- << be_nl
- << "virtual void " << node->flat_name ()
- << "_setup_collocation (int collocated);" << be_nl << be_nl;
- }
- else
- {
- *os << node->local_name () << " (void);" << be_nl << be_nl;
- }
+ // Protected destructor.
+ *os << "virtual ~" << node->local_name () << " (void);";
- // Local interfaces don't support stub objects.
- if (! node->is_local ())
- {
- *os << node->local_name ()
- << " (" << be_idt << be_idt_nl << "TAO_Stub *objref, " << be_nl
- << "CORBA::Boolean _tao_collocated = 0," << be_nl
- << "TAO_Abstract_ServantBase *servant = 0" << be_uidt_nl
- << ");" << be_uidt_nl << be_nl;
-
- // Friends declarations.
- *os << "friend class " << node->remote_proxy_impl_name () << ";"
- << be_nl
- << "friend class " << node->thru_poa_proxy_impl_name () << ";"
- << be_nl
- << "friend class " << node->direct_proxy_impl_name () << ";"
- << be_nl << be_nl;
- }
- // Protected destructor.
- *os << "virtual ~" << node->local_name () << " (void);"
- << be_uidt_nl << be_nl;
+ if (! node->is_abstract ())
+ {
+ // Friends declarations.
+ *os << be_nl << be_nl
+ << "friend class " << node->remote_proxy_impl_name () << ";"
+ << be_nl
+ << "friend class " << node->thru_poa_proxy_impl_name () << ";"
+ << be_nl
+ << "friend class " << node->direct_proxy_impl_name () << ";";
+ }
+
+ // Private copy constructor and assignment operator. These are not
+ // allowed, hence they are private.
+ *os << be_uidt_nl << be_nl
+ << "private:" << be_idt_nl;
- // private copy constructor and assignment operator. These are not
- // allowed, hence they are private.
- *os << "private:" << be_idt_nl;
+ // Abstract interfaces have a *protected* copy constructor.
+ if (! node->is_abstract ())
+ {
*os << node->local_name () << " (const "
- << node->local_name () << " &);"
- << be_nl
- << "void operator= (const " << node->local_name () << " &);";
+ << node->local_name () << " &);" << be_nl;
+ }
+
+ *os << "void operator= (const " << node->local_name () << " &);";
+
+ // Generate the embedded RequestInfo classes per operation.
+ // This is to be used by interceptors.
+ be_visitor *visitor = 0;
+ be_visitor_context ctx (*this->ctx_);
- // Generate the embedded RequestInfo classes per operation.
- // This is to be used by interceptors.
- be_visitor_context ctx (*this->ctx_);
+ ctx = *this->ctx_;
- // Interceptor related classes.
- ctx.state (TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CH);
- be_visitor_interface_interceptors_ch interceptor_visitor (&ctx);
+ *os << be_uidt_nl;
+ *os << "};" << be_nl << be_nl;
- if (node->accept (&interceptor_visitor) == -1)
+ // Don't support smart proxies for local interfaces.
+ // @@@ (JP) This is TODO for abstract interfaces.
+ if (! node->is_local () && ! node->is_abstract ())
+ {
+ // Smart Proxy related classes.
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH);
+ be_visitor_interface_smart_proxy_ch sp_visitor (&ctx);
+
+ if (node->accept (&sp_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_interface_ch::"
"visit_interface - "
- "codegen for interceptor classes failed\n"),
+ "codegen for smart proxy classes failed\n"),
-1);
}
+ // Proxy Implementation Declaration.
ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_PROXY_IMPLS_CH);
+ be_visitor_interface_proxy_impls_ch spi_visitor (&ctx);
- *os << be_uidt_nl;
- *os << "};" << be_nl << be_nl;
-
- // Don't support smart proxies for local interfaces.
- if (! node->is_local ())
+ if (node->accept (&spi_visitor) == -1)
{
- // Smart Proxy related classes.
- ctx.state (TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH);
- be_visitor_interface_smart_proxy_ch sp_visitor (&ctx);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ch::"
+ "visit_interface - "
+ "codegen for Proxy Broker classes failed\n"),
+ -1);
+ }
- if (node->accept (&sp_visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_ch::"
- "visit_interface - "
- "codegen for smart proxy classes failed\n"),
- -1);
- }
+ // Proxy Broker Declaration.
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_CH);
+ be_visitor_interface_proxy_brokers_ch pb_visitor (&ctx);
- // Proxy Implementation Declaration.
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_INTERFACE_PROXY_IMPLS_CH);
- be_visitor_interface_proxy_impls_ch spi_visitor (&ctx);
+ if (node->accept (&pb_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ch::"
+ "visit_interface - "
+ "codegen for Proxy Broker classes failed\n"),
+ -1);
+ }
+ }
- if (node->accept (&spi_visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_ch::"
- "visit_interface - "
- "codegen for Proxy Broker classes failed\n"),
- -1);
- }
+ os->gen_endif ();
- // Proxy Broker Declaration.
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_CH);
- be_visitor_interface_proxy_brokers_ch pb_visitor (&ctx);
+ if (be_global->tc_support ())
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL);
+ be_visitor_typecode_decl td_visitor (&ctx);
- if (node->accept (&pb_visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_ch::"
- "visit_interface - "
- "codegen for Proxy Broker classes failed\n"),
- -1);
- }
+ if (node->accept (&td_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_ch::"
+ "visit_interface - "
+ "TypeCode declaration failed\n"),
+ -1);
}
+ }
- os->gen_endif ();
+ node->cli_hdr_gen (I_TRUE);
+ return 0;
+}
- if (be_global->tc_support ())
- {
- ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL);
- be_visitor_typecode_decl td_visitor (&ctx);
+int
+be_visitor_interface_ch::gen_abstract_ops_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os)
+{
+ if (node == base)
+ {
+ return 0;
+ }
- if (node->accept (&td_visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_interface_ch::"
- "visit_interface - "
- "TypeCode declaration failed\n"),
- -1);
- }
+ AST_Decl *d = 0;
+ be_visitor_context ctx;
+ ctx.stream (os);
+
+ for (UTL_ScopeActiveIterator si (base, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ d = si.item ();
+
+ if (d == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_interface::"
+ "abstract_base_ops_helper - "
+ "bad node in this scope\n"),
+ -1);
}
- node->cli_hdr_gen (I_TRUE);
+ if (d->node_type () == AST_Decl::NT_op)
+ {
+ UTL_ScopedName item_new_name (d->local_name (),
+ 0);
+
+ AST_Operation *op = AST_Operation::narrow_from_decl (d);
+ be_operation new_op (op->return_type (),
+ op->flags (),
+ &item_new_name,
+ op->is_local (),
+ op->is_abstract ());
+ new_op.set_defined_in (node);
+ be_visitor_interface::add_abstract_op_args (op,
+ new_op);
+ ctx.state (TAO_CodeGen::TAO_OPERATION_CH);
+ be_visitor_operation_ch op_visitor (&ctx);
+ op_visitor.visit_operation (&new_op);
+ }
}
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
index 2c44fb86a4e..af50193a815 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp
@@ -18,18 +18,15 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface.h"
-
-ACE_RCSID(be_visitor_interface, interface_ci, "$Id$")
+ACE_RCSID (be_visitor_interface,
+ interface_ci,
+ "$Id$")
// **************************************************
// Interface visitor for client inline
// **************************************************
+
be_visitor_interface_ci::be_visitor_interface_ci (be_visitor_context *ctx)
: be_visitor_interface (ctx)
{
@@ -67,10 +64,41 @@ be_visitor_interface_ci::visit_interface (be_interface *node)
TAO_OutStream *os = this->ctx_->stream ();
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
+
os->gen_ifdef_macro (node->flat_name (), "");
- // Generate the constructor from stub and servant.
- node->gen_stub_ctor (os);
+ if (node->is_abstract ())
+ {
+ *os << "ACE_INLINE" << be_nl
+ << node->name () << "::" << node->local_name ()
+ << " (void)" << be_idt_nl
+ << ": CORBA_AbstractBase ()" << be_uidt_nl
+ << "{}" << be_nl << be_nl;
+
+ *os << "ACE_INLINE" << be_nl
+ << node->name () << "::" << node->local_name ()
+ << " (const " << node->local_name () << " &rhs)" << be_idt_nl
+ << ": CORBA_AbstractBase (rhs)" << be_uidt_nl
+ << "{}" << be_nl << be_nl;
+
+ *os << "ACE_INLINE" << be_nl
+ << node->name () << "::" << node->local_name ()
+ << " (" << be_idt << be_idt_nl
+ << "TAO_Stub *objref," << be_nl
+ << "CORBA::Boolean _tao_collocated," << be_nl
+ << "TAO_Abstract_ServantBase *servant" << be_uidt_nl
+ << ")" << be_nl
+ << ": CORBA_AbstractBase (objref, _tao_collocated, servant)"
+ << be_uidt_nl
+ << "{}" << be_nl;
+ }
+ else
+ {
+ // Generate the constructor from stub and servant.
+ node->gen_stub_ctor (os);
+ }
os->gen_endif ();
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
index 98120e67045..3d712b05e18 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
@@ -18,14 +18,11 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_interface.h"
#include "be_visitor_typecode/typecode_defn.h"
-ACE_RCSID(be_visitor_interface, interface_cs, "$Id$")
-
+ACE_RCSID (be_visitor_interface,
+ interface_cs,
+ "$Id$")
// ************************************************************
// Interface visitor for client stubs
@@ -62,8 +59,7 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
TAO_OutStream *os = this->ctx_->stream ();
- *os << be_nl;
- *os << "// TAO_IDL - Generated from " << be_nl
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
<< "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
// Initialize the static narrrowing helper variable.
@@ -103,9 +99,18 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
*os << node->full_name () << "_ptr" << be_nl
<< "tao_" << node->flat_name ()
- << "_narrow (" << be_idt << be_idt_nl
- << "CORBA::Object *p" << be_nl
- << "ACE_ENV_ARG_DECL" << be_uidt_nl
+ << "_narrow (" << be_idt << be_idt_nl;
+
+ if (node->is_abstract ())
+ {
+ *os << "CORBA::AbstractBase *p" << be_nl;
+ }
+ else
+ {
+ *os << "CORBA::Object *p" << be_nl;
+ }
+
+ *os << "ACE_ENV_ARG_DECL" << be_uidt_nl
<< ")" << be_uidt_nl
<< "{" << be_idt_nl
<< "return " << node->full_name ()
@@ -113,8 +118,16 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
<< be_uidt_nl
<< "}" << be_nl << be_nl;
- *os << "CORBA::Object *" << be_nl
- << "tao_" << node->flat_name ()
+ if (node->is_abstract ())
+ {
+ *os << "CORBA::AbstractBase *" << be_nl;
+ }
+ else
+ {
+ *os << "CORBA::Object *" << be_nl;
+ }
+
+ *os << "tao_" << node->flat_name ()
<< "_upcast (" << be_idt << be_idt_nl
<< "void *src" << be_uidt_nl
<< ")" << be_uidt_nl
@@ -125,6 +138,23 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
<< "return *tmp;" << be_uidt_nl
<< "}" << be_nl << be_nl;
+ if (node->has_mixed_parentage ())
+ {
+ *os << "void" << be_nl
+ << "CORBA::release (" << node->name () << "_ptr p)" << be_nl
+ << "{" << be_idt_nl
+ << "CORBA::AbstractBase_ptr abs = p;" << be_nl
+ << "CORBA::release (abs);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "CORBA::Boolean" << be_nl
+ << "CORBA::is_nil (" << node->name () << "_ptr p)" << be_nl
+ << "{" << be_idt_nl
+ << "CORBA::Object_ptr obj = p;" << be_nl
+ << "return CORBA::is_nil (obj);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
+
// Generate the _var class.
if (node->gen_var_impl () == -1)
{
@@ -152,9 +182,9 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
// the implementation of said operations.
ctx.state (TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CS);
- be_visitor_interface_interceptors_cs interceptor_visitor (&ctx);
+ be_visitor_interface_interceptors_cs ii_visitor (&ctx);
- if (node->accept (&interceptor_visitor) == -1)
+ if (node->accept (&ii_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_interface_cs::"
@@ -163,13 +193,13 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
-1);
}
- if (!node->is_local ())
+ if (!node->is_local () && ! node->is_abstract ())
{
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_IMPL_CS);
- be_visitor_interface_remote_proxy_impl_cs rpi_visitor (&ctx);
+ be_visitor_interface_remote_proxy_impl_cs irpi_visitor (&ctx);
- if (node->accept (&rpi_visitor) == -1)
+ if (node->accept (&irpi_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_interface_cs::"
@@ -180,9 +210,9 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_BROKER_CS);
- be_visitor_interface_remote_proxy_broker_cs rpb_visitor (&ctx);
+ be_visitor_interface_remote_proxy_broker_cs irpb_visitor (&ctx);
- if (node->accept (&rpb_visitor) == -1)
+ if (node->accept (&irpb_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_interface_cs::"
@@ -192,233 +222,212 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
}
}
- // Generation location info.
- *os << be_nl;
- *os << "// TAO_IDL - Generated from " << be_nl
- << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
-
- *os << node->name () << "::" << node->local_name ();
-
- if (!node->is_local ())
- {
- *os << " (int collocated)" << be_nl
- << "{" << be_idt_nl
- << "this->" << node->flat_name ()
- << "_setup_collocation (collocated);" << be_uidt_nl
- << be_uidt << "}" << be_nl << be_nl;
- }
- else
- {
- *os << " (void)" << be_nl
- << "{}" << be_nl << be_nl;
- }
-
- *os << node->name () << "::~" << node->local_name ()
- << " (void)" << be_nl;
- *os << "{}" << be_nl << be_nl;
-
- if (!node->is_local ())
+ if (! node->is_abstract ())
{
- // Collocation setup method.
- *os << "void" << be_nl
- << node->name () << "::" << node->flat_name ()
- << "_setup_collocation (int collocated)" << be_nl
- << "{" << be_idt_nl
- << "if (collocated)" << be_idt_nl
- << "this->the" << node->base_proxy_broker_name ()
- << "_ =" << be_idt_nl
- << "::" << node->flat_client_enclosing_scope ()
- << node->base_proxy_broker_name ()
- << "_Factory_function_pointer (this);"
- << be_uidt << be_uidt_nl
- << "else" << be_idt_nl
- << "this->the" << node->base_proxy_broker_name ()
- << "_ =" << be_idt_nl
- << "::" << node->full_remote_proxy_broker_name ()
- << "::the" << node->remote_proxy_broker_name ()
- << " ();" << be_uidt << be_uidt;
-
- // Now we setup the immediate parents.
- int n_parents = node->n_inherits ();
+ // Generate the destructor and default constructor.
+ *os << be_nl;
+ *os << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ *os << node->name () << "::" << node->local_name ();
- if (n_parents > 0)
+ if (!node->is_local ())
{
- *os << be_nl;
+ *os << " (int collocated)" << be_nl
+ << "{" << be_idt_nl
+ << "this->" << node->flat_name ()
+ << "_setup_collocation (collocated);" << be_uidt_nl
+ << be_uidt << "}" << be_nl << be_nl;
+ }
+ else
+ {
+ *os << " (void)" << be_nl
+ << "{}" << be_nl << be_nl;
+ }
- for (int i = 0; i < n_parents; i++)
+ if (!node->is_local ())
+ {
+ // Collocation setup method.
+ *os << "void" << be_nl
+ << node->name () << "::" << node->flat_name ()
+ << "_setup_collocation (int collocated)" << be_nl
+ << "{" << be_idt_nl
+ << "if (collocated)" << be_idt_nl
+ << "this->the" << node->base_proxy_broker_name ()
+ << "_ =" << be_idt_nl
+ << "::" << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Factory_function_pointer (this);"
+ << be_uidt << be_uidt_nl
+ << "else" << be_idt_nl
+ << "this->the" << node->base_proxy_broker_name ()
+ << "_ =" << be_idt_nl
+ << "::" << node->full_remote_proxy_broker_name ()
+ << "::the" << node->remote_proxy_broker_name ()
+ << " ();" << be_uidt << be_uidt;
+
+ // Now we setup the immediate parents.
+ int n_parents = node->n_inherits ();
+ int has_concrete_parent = 0;
+
+ if (n_parents > 0)
{
- be_interface *inherited =
- be_interface::narrow_from_decl (node->inherits ()[i]);
+ for (int i = 0; i < n_parents; ++i)
+ {
+ be_interface *inherited =
+ be_interface::narrow_from_decl (node->inherits ()[i]);
- *os << be_nl
- << "this->" << inherited->flat_name ()
- << "_setup_collocation" << " (collocated);";
+ if (inherited->is_abstract ())
+ {
+ continue;
+ }
- if (i == n_parents - 1)
- {
- *os << be_uidt_nl;
- }
- else
- {
- *os << be_nl;
+ if (has_concrete_parent == 0)
+ {
+ *os << be_nl;
+ }
+
+ has_concrete_parent = 1;
+
+ *os << be_nl
+ << "this->" << inherited->flat_name ()
+ << "_setup_collocation" << " (collocated);";
}
}
- }
- else
- {
- *os << be_uidt_nl;
- }
- *os << "}" << be_nl << be_nl;
+ *os << be_uidt_nl << "}";
+ }
}
- // Then generate the code for the static methods.
- *os << "void "
- << node->name ()
- << "::_tao_any_destructor (void *_tao_void_pointer)" << be_nl
- << "{" << be_idt_nl
- << node->local_name () << " *tmp = ACE_static_cast ("
- << node->local_name () << "*, _tao_void_pointer);" << be_nl
- << "CORBA::release (tmp);" << be_uidt_nl
- << "}\n" << be_nl;
-
- // The _narrow method.
- *os << node->full_name () << "_ptr " << node->full_name ()
- << "::_narrow (" << be_idt << be_idt_nl
- << "CORBA::Object_ptr obj" << be_nl
- << "ACE_ENV_ARG_DECL" << be_uidt_nl
- << ")" << be_uidt_nl
- << "{" << be_idt_nl;
+ *os << be_nl << be_nl
+ << node->name () << "::~" << node->local_name ()
+ << " (void)" << be_nl;
+ *os << "{}" << be_nl << be_nl;
- // Local interfaces have slightly different _narrow implementation.
+ // Then generate the code for the static methods
+ // Local interfaces don't have any operators.
if (! node->is_local ())
{
- // Remote _narrow implementation.
- *os << "if (CORBA::is_nil (obj))" << be_idt_nl
- << "return " << bt->nested_type_name (this->ctx_->scope ())
- << "::_nil ();" << be_uidt_nl;
+ *os << "void " << be_nl
+ << node->name ()
+ << "::_tao_any_destructor (void *_tao_void_pointer)" << be_nl
+ << "{" << be_idt_nl
+ << node->local_name () << " *tmp = ACE_static_cast ("
+ << node->local_name () << "*, _tao_void_pointer);" << be_nl
+ << "CORBA::release (tmp);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
- *os << "if (! obj->_is_local ())" << be_idt_nl
+ if (node->has_mixed_parentage ())
+ {
+ *os << "void" << be_nl
+ << node->name () << "::_add_ref (void)" << be_nl
<< "{" << be_idt_nl
- << "CORBA::Boolean is_a = obj->_is_a (\""
- << node->repoID () << "\" ACE_ENV_ARG_PARAMETER);" << be_nl
- << "ACE_CHECK_RETURN (" << bt->nested_type_name (this->ctx_->scope ())
- << "::_nil ());" << be_nl
- << "if (is_a == 0)" << be_idt_nl
- << "return " << bt->nested_type_name (this->ctx_->scope ())
- << "::_nil ();" << be_uidt << be_uidt_nl
- << "}" << be_uidt_nl;
+ << "this->CORBA_Object::_add_ref ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
}
- *os << "return " << bt->nested_type_name (this->ctx_->scope ())
- << "::_unchecked_narrow (obj ACE_ENV_ARG_PARAMETER);" << be_uidt_nl
- << "}" << be_nl << be_nl;
+ // The _narrow method
- // The _unchecked_narrow method
+ *os << node->full_name () << "_ptr" << be_nl << node->full_name ()
+ << "::_narrow (" << be_idt << be_idt_nl;
- *os << node->full_name () << "_ptr " << be_nl
- << node->full_name () << "::_unchecked_narrow ("
- << be_idt << be_idt_nl
- << "CORBA::Object_ptr obj" << be_nl
- << "ACE_ENV_ARG_DECL_NOT_USED" << be_uidt_nl
- << ")" << be_uidt_nl
- << "{" << be_idt_nl
- << "if (CORBA::is_nil (obj))" << be_idt_nl
- << "return " << bt->nested_type_name (this->ctx_->scope ())
- << "::_nil ();" << be_uidt_nl;
+ if (node->is_abstract ())
+ {
+ *os << "CORBA::AbstractBase_ptr obj" << be_nl;
+ }
+ else
+ {
+ *os << "CORBA::Object_ptr obj" << be_nl;
+ }
+ *os << "ACE_ENV_ARG_DECL" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
+ // Local interfaces have slightly different _narrow implementation.
if (! node->is_local ())
{
- // Remote _uncheck_narrow implementation.
- *os << "if (! obj->_is_local ())" << be_idt_nl
+ // Remote _narrow implementation.
+ *os << "if (CORBA::is_nil (obj))" << be_idt_nl
<< "{" << be_idt_nl
- << "TAO_Stub* stub = obj->_stubobj ();" << be_nl
- << "if (stub)" << be_idt_nl
- << "stub->_incr_refcnt ();" << be_uidt_nl
- // Declare the default proxy.
- << bt->nested_type_name (this->ctx_->scope ())
- << "_ptr default_proxy = "
- << bt->nested_type_name (this->ctx_->scope ())
- <<"::_nil ();\n\n";
-
- // If the policy didtates that the proxy be collocated, use the
- // function to create one.
- os->indent ();
- *os << "if (" << be_idt << be_idt_nl // 2 idt
- << "!CORBA::is_nil (stub->servant_orb_var ().ptr ()) &&" << be_nl
- << "stub->servant_orb_var ()->orb_core ()->optimize_collocation_objects () &&"
- << be_nl
- << "obj->_is_collocated () &&" << be_nl
- << node->flat_client_enclosing_scope () << node->base_proxy_broker_name ()
- << "_Factory_function_pointer != 0" << be_uidt_nl << ")" // 1 idt
- << be_nl << "{" // 0 idt
- << be_idt_nl // 1 idt
- << "ACE_NEW_RETURN (" << be_idt << be_idt_nl // 2 idt
- << "default_proxy," << be_nl
- << "::" << bt->name ()
- << " (" << be_idt << be_idt_nl // 3 idt
- << "stub," << be_nl
- << "1," << be_nl
- << "obj->_servant ()" << be_uidt_nl << ")," << be_uidt_nl
- << bt->nested_type_name (this->ctx_->scope ())
- << "::_nil ()" << be_uidt_nl << ");"
- << be_uidt << be_uidt_nl // 1 idt
- << "}" << be_uidt_nl << be_nl; // 0 idt
+ << "return " << bt->nested_type_name (this->ctx_->scope ())
+ << "::_nil ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+ if (! node->is_abstract ())
+ {
+ *os << "if (! obj->_is_local ())" << be_idt_nl
+ << "{" << be_idt_nl;
+ }
- // The default proxy will either be returned else be transformed to
- // a smart one!
- *os << "if (CORBA::is_nil (default_proxy))" << be_idt_nl
- << "{" << be_idt_nl
- << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
- << "default_proxy," << be_nl
- << "::" << bt->name () << " (" << be_idt << be_idt_nl
- << "stub," << be_nl
- << "0," << be_nl
- << "obj->_servant ()" << be_uidt_nl
- << ")," << be_uidt_nl
- << bt->nested_type_name (this->ctx_->scope ())
- << "::_nil ()" << be_uidt_nl
+ *os << "CORBA::Boolean is_a =" << be_idt_nl
+ << "obj->_is_a (" << be_idt << be_idt_nl
+ << "\"" << node->repoID () << "\"" << be_nl
+ << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
<< ");" << be_uidt << be_uidt_nl
- << "}" << be_uidt_nl << be_nl;
+ << "ACE_CHECK_RETURN (" << bt->nested_type_name (this->ctx_->scope ())
+ << "::_nil ());" << be_nl << be_nl
+ << "if (is_a == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return " << bt->nested_type_name (this->ctx_->scope ())
+ << "::_nil ();" << be_uidt_nl;
- if (be_global->gen_smart_proxies ())
+ if (node->is_abstract ())
{
- *os << "return TAO_" << node->flat_name ()
- << "_PROXY_FACTORY_ADAPTER::instance ()->create_proxy (default_proxy);"
- << be_uidt_nl;
+ *os << "}" << be_uidt_nl;
}
else
{
- *os << "return default_proxy;" << be_uidt_nl;
+ *os << "}" << be_uidt << be_uidt_nl;
+ *os << "}" << be_uidt_nl;
}
- *os << "}" << be_uidt_nl
- << "else " << be_idt_nl;
+ *os << be_nl;
+ }
+
+ *os << "return " << bt->nested_type_name (this->ctx_->scope ())
+ << "::_unchecked_narrow (obj ACE_ENV_ARG_PARAMETER);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ if (node->is_abstract ())
+ {
+ this->gen_abstract_unchecked_narrow (node,
+ bt,
+ os);
}
else
{
- *os << be_idt;
+ this->gen_concrete_unchecked_narrow (node,
+ bt,
+ os);
}
- *os << "return" << be_idt_nl
- << "ACE_reinterpret_cast" << be_idt_nl
- <<"(" << be_idt_nl
- << node->local_name () << "_ptr," << be_idt_nl
- << "obj->_tao_QueryInterface" << be_idt_nl
- << "(" << be_idt_nl
- << "ACE_reinterpret_cast" << be_idt_nl
- << "(" << be_idt_nl
- << "ptr_arith_t," << be_nl
- << "&" << node->local_name ()
- << "::_tao_class_id" << be_uidt_nl
- << ")" << be_uidt << be_uidt_nl
- << ")" << be_uidt << be_uidt << be_uidt_nl
- << ");" << be_uidt << be_uidt << be_uidt << be_uidt_nl;
-
- *os << "}\n" << be_nl;
-
+ if (node->is_abstract ())
+ {
+ *os << node->full_name () << "_ptr" << be_nl
+ << node->full_name ()
+ << "::_downcast (CORBA::AbstractBase_ptr abs)" << be_nl
+ << "{" << be_idt_nl
+ << "if (CORBA::is_nil (abs))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return " << node->local_name () << "::_nil ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "return (" << node->local_name ()
+ << "_ptr) abs->_tao_obv_narrow ((ptr_arith_t) &_downcast);"
+ << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "void *" << be_nl
+ << node->full_name ()
+ << "::_tao_obv_narrow (ptr_arith_t type_id)" << be_nl
+ << "{" << be_idt_nl
+ << "if (type_id == (ptr_arith_t) &_downcast)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return this;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
// The _duplicate method
*os << node->full_name () << "_ptr" << be_nl
@@ -426,28 +435,34 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
<< bt->nested_type_name (this->ctx_->scope ())
<< "_ptr obj)" << be_nl
<< "{" << be_idt_nl
- << "if (!CORBA::is_nil (obj))" << be_idt_nl
+ << "if (! CORBA::is_nil (obj))" << be_idt_nl
+ << "{" << be_idt_nl
<< "obj->_add_ref ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
<< "return obj;" << be_uidt_nl
<< "}" << be_nl << be_nl;
- // generate the is_a method. _is_a is not supported on local objects.
+ // Generate the is_a method (not supported on local objects).
if (! node->is_local ())
{
os->indent ();
- *os << "CORBA::Boolean " << node->full_name ()
- << "::_is_a ("
- << "const CORBA::Char *value ACE_ENV_ARG_DECL)"
- << be_nl
+
+ *os << "CORBA::Boolean" << be_nl
+ << node->full_name () << "::_is_a (" << be_idt << be_idt_nl
+ << "const char *value" << be_nl
+ << "ACE_ENV_ARG_DECL" << be_uidt_nl
+ << ")" << be_uidt_nl
<< "{\n";
os->incr_indent ();
- *os << "if (\n";
+ *os << "if (" << be_idt << be_idt_nl;
- os->incr_indent (0);
+ int status =
+ node->traverse_inheritance_graph (be_interface::is_a_helper,
+ os);
- if (node->traverse_inheritance_graph (be_interface::is_a_helper, os) == -1)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interface_cs::"
@@ -455,25 +470,67 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
"_is_a method codegen failed\n"), -1);
}
- os->indent ();
- *os << "(!ACE_OS::strcmp ((char *)value, \"IDL:omg.org/CORBA/Object:1.0\")))\n";
- *os << " return 1; // success using local knowledge\n";
- os->decr_indent ();
- *os << "else" << be_nl;
- *os << " return this->CORBA_Object::_is_a (value ACE_ENV_ARG_PARAMETER);\n";
- os->decr_indent ();
- *os << "}\n\n";
+ if (node->is_abstract () || node->has_mixed_parentage ())
+ {
+ *os << "!ACE_OS::strcmp (" << be_idt << be_idt_nl
+ << "(char *)value," << be_nl
+ << "\"IDL:omg.org/CORBA/AbstractBase:1.0\"" << be_uidt_nl
+ << ")";
+ }
+
+ if (node->has_mixed_parentage ())
+ {
+ *os << " ||" << be_uidt_nl;
+ }
+ else if (node->is_abstract ())
+ {
+ *os << be_uidt << be_uidt_nl;
+ }
+
+ if (! node->is_abstract ())
+ {
+ *os << "!ACE_OS::strcmp (" << be_idt << be_idt_nl
+ << "(char *)value," << be_nl
+ << "\"IDL:omg.org/CORBA/Object:1.0\"" << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl;
+ }
+
+ *os << " )" << be_nl
+ << "{" << be_idt_nl
+ << "return 1; // success using local knowledge" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "else" << be_idt_nl
+ << "{" << be_idt_nl;
+
+ if (node->is_abstract ())
+ {
+ *os << "return 0;" << be_uidt_nl;
+ }
+ else
+ {
+ *os << "return this->CORBA_Object::_is_a (" << be_idt << be_idt_nl
+ << "value" << be_nl
+ << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl;
+ }
+
+ *os << "}" << be_uidt << be_uidt_nl
+ << "}\n\n";
}
// Generating _tao_QueryInterface method.
os->indent ();
+
*os << "void *" << node->full_name ()
<< "::_tao_QueryInterface (ptr_arith_t type)" << be_nl
<< "{" << be_idt_nl
- << "void *retv = 0;" << be_nl
+ << "void *retv = 0;" << be_nl << be_nl
<< "if ";
- if (node->traverse_inheritance_graph (be_interface::queryinterface_helper, os) == -1)
+ if (node->traverse_inheritance_graph (
+ be_interface::queryinterface_helper,
+ os
+ ) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interface_cs::"
@@ -482,26 +539,56 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
-1);
}
- *os << "(type == ACE_reinterpret_cast (ptr_arith_t, &CORBA::Object::_tao_class_id))"
- << be_idt_nl << "retv = ACE_reinterpret_cast (void *," << be_idt_nl
- << "ACE_static_cast (CORBA::Object_ptr, this));" << be_uidt_nl << be_uidt_nl
- << "if (retv)" << be_idt_nl
+ *os << "(type == ACE_reinterpret_cast ("
+ << be_idt << be_idt << be_idt << be_idt << be_idt << be_idt_nl
+ << " ptr_arith_t," << be_nl;
+
+ if (node->is_abstract ())
+ {
+ *os << " &CORBA::AbstractBase";
+ }
+ else
+ {
+ *os << " &CORBA::Object";
+ }
+
+ *os << "::_tao_class_id)" << be_uidt_nl
+ << " )" << be_uidt << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_idt_nl
+ << "retv =" << be_idt_nl
+ << "ACE_reinterpret_cast (" << be_idt << be_idt_nl
+ << "void *," << be_nl
+ << "ACE_static_cast (";
+
+ if (node->is_abstract ())
+ {
+ *os << "CORBA::AbstractBase_ptr";
+ }
+ else
+ {
+ *os << "CORBA::Object_ptr";
+ }
+
+ *os << ", this)" << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+
+ *os << "if (retv != 0)" << be_idt_nl
+ << "{" << be_idt_nl
<< "this->_add_ref ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
<< "return retv;" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
- os->indent ();
*os << "const char* " << node->full_name ()
<< "::_interface_repository_id (void) const"
<< be_nl
<< "{" << be_idt_nl
<< "return \"" << node->repoID ()
<< "\";" << be_uidt_nl
- << "}\n\n";
-
- os->decr_indent (0);
+ << "}" << be_uidt_nl << be_nl;
- // generate code for the elements of the interface
+ // Generate code for the elements of the interface.
if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -511,22 +598,25 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
-1);
}
-
- // Smart Proxy classes.
- if (! node->is_local ())
+ if (! node->is_abstract ())
{
- be_visitor_context ctx (*this->ctx_);
+ // Smart Proxy classes.
+ if (! node->is_local ())
+ {
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor *visitor = 0;
- ctx.state (TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS);
- be_visitor_interface_smart_proxy_cs visitor (&ctx);
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS);
+ be_visitor_interface_smart_proxy_cs isp_visitor (&ctx);
- if (node->accept (&visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_cs::"
- "visit_interface - "
- "codegen for smart proxy classes failed\n"),
- -1);
+ if (node->accept (&isp_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_cs::"
+ "visit_interface - "
+ "codegen for smart proxy classes failed\n"),
+ -1);
+ }
}
}
@@ -534,9 +624,9 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
{
ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN);
ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
- be_visitor_typecode_defn td_visitor (&ctx);
+ be_visitor_typecode_defn tc_visitor (&ctx);
- if (node->accept (&td_visitor) == -1)
+ if (node->accept (&tc_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interface_cs::"
@@ -548,3 +638,227 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
return 0;
}
+
+int
+be_visitor_interface_cs::gen_abstract_ops_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os)
+{
+ if (node == base)
+ {
+ return 0;
+ }
+
+ AST_Decl *d = 0;
+ be_visitor_context ctx;
+ ctx.stream (os);
+
+ for (UTL_ScopeActiveIterator si (base, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ d = si.item ();
+
+ if (d == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_cs::"
+ "abstract_base_ops_helper - "
+ "bad node in this scope\n"),
+ -1);
+ }
+
+ if (d->node_type () == AST_Decl::NT_op)
+ {
+ UTL_ScopedName *item_new_name = 0;
+ ACE_NEW_RETURN (item_new_name,
+ UTL_ScopedName (d->local_name ()->copy (),
+ 0),
+ -1);
+
+ UTL_ScopedName *base = (UTL_ScopedName *)node->name ()->copy ();
+ base->nconc (item_new_name);
+
+ AST_Operation *op = AST_Operation::narrow_from_decl (d);
+ be_operation new_op (op->return_type (),
+ op->flags (),
+ 0,
+ op->is_local (),
+ op->is_abstract ());
+ new_op.set_defined_in (node);
+ be_visitor_interface::add_abstract_op_args (op,
+ new_op);
+ new_op.set_name (base);
+ ctx.state (TAO_CodeGen::TAO_OPERATION_CS);
+ be_visitor_operation_cs op_visitor (&ctx);
+ op_visitor.visit_operation (&new_op);
+
+ base->destroy ();
+ delete base;
+ base = 0;
+ }
+ }
+
+ return 0;
+}
+
+void
+be_visitor_interface_cs::gen_concrete_unchecked_narrow (be_interface *node,
+ be_type *bt,
+ TAO_OutStream *os)
+{
+ *os << node->full_name () << "_ptr " << be_nl
+ << node->full_name () << "::_unchecked_narrow ("
+ << be_idt << be_idt_nl
+ << "CORBA::Object_ptr obj" << be_nl
+ << "ACE_ENV_ARG_DECL_NOT_USED" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "if (CORBA::is_nil (obj))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return " << bt->nested_type_name (this->ctx_->scope ())
+ << "::_nil ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+
+
+ if (! node->is_local ())
+ {
+ // Remote _unchecked_narrow implementation.
+ *os << "if (! obj->_is_local ())" << be_idt_nl
+ << "{" << be_idt_nl
+ << "TAO_Stub* stub = obj->_stubobj ();" << be_nl << be_nl
+ << "if (stub != 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "stub->_incr_refcnt ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+
+ // Declare the default proxy.
+ *os << bt->nested_type_name (this->ctx_->scope ())
+ << "_ptr default_proxy = "
+ << bt->nested_type_name (this->ctx_->scope ())
+ <<"::_nil ();" << be_nl << be_nl;
+
+ // If the policy didtates that the proxy be collocated, use the
+ // function to create one.
+ *os << "if (" << be_idt << be_idt_nl
+ << "!CORBA::is_nil (stub->servant_orb_var ().ptr ()) &&" << be_nl
+ << "stub->servant_orb_var ()->orb_core ()->optimize_collocation_objects () &&"
+ << be_nl
+ << "obj->_is_collocated () &&" << be_nl
+ << node->flat_client_enclosing_scope () << node->base_proxy_broker_name ()
+ << "_Factory_function_pointer != 0" << be_uidt_nl << ")"
+ << be_nl << "{"
+ << be_idt_nl
+ << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
+ << "default_proxy," << be_nl
+ << "::" << bt->name ()
+ << " (" << be_idt << be_idt_nl
+ << "stub," << be_nl
+ << "1," << be_nl
+ << "obj->_servant ()" << be_uidt_nl << ")," << be_uidt_nl
+ << bt->nested_type_name (this->ctx_->scope ())
+ << "::_nil ()" << be_uidt_nl << ");"
+ << be_uidt << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+
+
+ // The default proxy will either be returned else be transformed to
+ // a smart one!
+ *os << "if (CORBA::is_nil (default_proxy))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
+ << "default_proxy," << be_nl
+ << "::" << bt->name () << " (" << be_idt << be_idt_nl
+ << "stub," << be_nl
+ << "0," << be_nl
+ << "obj->_servant ()" << be_uidt_nl
+ << ")," << be_uidt_nl
+ << bt->nested_type_name (this->ctx_->scope ())
+ << "::_nil ()" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+
+ if (be_global->gen_smart_proxies ())
+ {
+ *os << "return TAO_" << node->flat_name ()
+ << "_PROXY_FACTORY_ADAPTER::instance ()->create_proxy (default_proxy);"
+ << be_uidt_nl;
+ }
+ else
+ {
+ *os << "return default_proxy;" << be_uidt_nl;
+ }
+
+ *os << "}" << be_uidt_nl
+ << "else " << be_idt_nl;
+ }
+ else
+ {
+ *os << be_idt;
+ }
+
+ // Local _unchecked_narrow.
+ *os << "return" << be_idt_nl
+ << "ACE_reinterpret_cast (" << be_idt << be_idt_nl
+ << node->local_name () << "_ptr," << be_nl
+ << "obj->_tao_QueryInterface (" << be_idt << be_idt_nl
+ << "ACE_reinterpret_cast (" << be_idt << be_idt_nl
+ << "ptr_arith_t," << be_nl
+ << "&" << node->local_name () << "::_tao_class_id" << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt << be_uidt_nl;
+
+ *os << "}" << be_nl << be_nl;
+}
+
+void
+be_visitor_interface_cs::gen_abstract_unchecked_narrow (be_interface *node,
+ be_type *bt,
+ TAO_OutStream *os)
+{
+ *os << node->full_name () << "_ptr " << be_nl
+ << node->full_name () << "::_unchecked_narrow ("
+ << be_idt << be_idt_nl
+ << "CORBA::AbstractBase_ptr obj" << be_nl
+ << "ACE_ENV_ARG_DECL_NOT_USED" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "if (CORBA::is_nil (obj))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return " << bt->nested_type_name (this->ctx_->scope ())
+ << "::_nil ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+
+ // Declare the default proxy.
+ *os << bt->nested_type_name (this->ctx_->scope ())
+ << "_ptr default_proxy = "
+ << bt->nested_type_name (this->ctx_->scope ())
+ <<"::_nil ();" << be_nl << be_nl;
+
+ *os << "if (obj->_is_objref ())" << be_idt_nl
+ << "{" << be_idt_nl;
+
+ *os << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
+ << "default_proxy," << be_nl
+ << "::" << bt->name () << " (" << be_idt << be_idt_nl
+ << "obj->_stubobj ()," << be_nl
+ << "0," << be_nl
+ << "obj->_servant ()" << be_uidt_nl
+ << ")," << be_uidt_nl
+ << bt->nested_type_name (this->ctx_->scope ())
+ << "::_nil ()" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_uidt_nl;
+
+ *os << "else" << be_idt_nl
+ << "{" << be_idt_nl
+ << "default_proxy = " << bt->name () << "::_downcast (obj);"
+ << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+
+ *os << "return default_proxy;" << be_uidt_nl;
+
+ *os << "}" << be_nl << be_nl;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ih.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ih.cpp
index d1b29aa441b..f47b5821a39 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ih.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ih.cpp
@@ -16,16 +16,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface.h"
-
-ACE_RCSID(be_visitor_interface, interface_ih, "$Id$")
+ACE_RCSID (be_visitor_interface,
+ interface_ih,
+ "$Id$")
// ************************************************************
-// Interface visitor for implementation header
+// Interface visitor for implementation header.
// ************************************************************
be_visitor_interface_ih::be_visitor_interface_ih (be_visitor_context *ctx)
@@ -40,30 +36,34 @@ be_visitor_interface_ih::~be_visitor_interface_ih (void)
int
be_visitor_interface_ih::visit_interface (be_interface *node)
{
- TAO_OutStream *os; // output stream
- static char namebuf [NAMEBUFSIZE]; // holds the class name
+ TAO_OutStream *os = this->ctx_->stream ();
+ static char namebuf [NAMEBUFSIZE];
if (node->impl_hdr_gen () || node->imported ())
- return 0;
-
- ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
+ {
+ return 0;
+ }
- os = this->ctx_->stream ();
+ ACE_OS::memset (namebuf,
+ '\0',
+ NAMEBUFSIZE);
- // generate the skeleton class name
+ // Generate the skeleton class name.
- os->indent (); // start with whatever indentation level we are at
+ os->indent ();
ACE_OS::sprintf (namebuf, "%s", node->flat_name ());
*os << "//Class " << be_global->impl_class_prefix ()
<< namebuf << be_global->impl_class_suffix () << be_nl;
- // now generate the class definition
+
+ // Now generate the class definition.
*os << "class " << be_global->stub_export_macro ()
<< " " << be_global->impl_class_prefix () << namebuf
<< be_global->impl_class_suffix () << " : ";
- //inherit from the base skeleton file
+
+ // Inherit from the base skeleton file.
*os <<"public virtual "<< node->full_skel_name ();
*os << be_nl
@@ -97,7 +97,7 @@ be_visitor_interface_ih::visit_interface (be_interface *node)
<< be_global->impl_class_suffix () << " (void);" << be_nl << be_uidt_nl;
- // generate code for elements in the scope (e.g., operations)
+ // Generate code for elements in the scope (e.g., operations).
if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -107,31 +107,15 @@ be_visitor_interface_ih::visit_interface (be_interface *node)
-1);
}
- /*
- if (node->n_inherits () > 0)
- {
- // this interface inherits from other interfaces
- be_interface *intf; // inherited interface
-
- for (i = 0; i < node->n_inherits (); i++)
- {
- intf = be_interface::narrow_from_decl (node->inherits ()[i]);
- // generate code for elements in the scope (e.g., operations)
- if (this->visit_scope (intf) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_ih::"
- "visit_interface - "
- "codegen for scope failed\n"),
- -1);
- }
- }
- }
- */
+ // Generate the code for the members of the derived classes.
+ int status =
+ node->traverse_inheritance_graph (
+ be_visitor_interface_ih::method_helper,
+ os
+ );
- //Generate the code for the members of the derived classes
- if (node->traverse_inheritance_graph (be_visitor_interface_ih::method_helper, os) == -1)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_interface_tie_sh_ss::"
@@ -146,11 +130,11 @@ be_visitor_interface_ih::visit_interface (be_interface *node)
}
-//Helper method to generate members within the scope of the base classes
+// Helper method to generate members within the scope of the base classes.
int
be_visitor_interface_ih::method_helper (be_interface *derived,
- be_interface *node,
- TAO_OutStream *os)
+ be_interface *node,
+ TAO_OutStream *os)
{
if (strcmp (derived->flat_name (), node->flat_name ()) != 0)
@@ -159,16 +143,16 @@ be_visitor_interface_ih::method_helper (be_interface *derived,
ctx.state (TAO_CodeGen::TAO_INTERFACE_IH);
ctx.interface (derived);
ctx.stream (os);
+ be_visitor_interface_ih visitor (&ctx);
- be_visitor* visitor = tao_cg->make_visitor (&ctx);
- if (visitor == 0 || visitor->visit_scope (node) == -1)
+ if (visitor.visit_scope (node) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_interface_is::"
- "method_helper\n"), -1);
+ "method_helper\n"),
+ -1);
}
- delete visitor;
}
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_is.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_is.cpp
index 243e6bb1e61..1dbd41d5731 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_is.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_is.cpp
@@ -16,18 +16,13 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface.h"
-
-
// ************************************************************
-// Interface visitor for implementation skeletons
+// Interface visitor for implementation skeletons.
// ************************************************************
-ACE_RCSID(be_visitor_interface, interface_is, "$Id$")
+ACE_RCSID (be_visitor_interface,
+ interface_is,
+ "$Id$")
be_visitor_interface_is::be_visitor_interface_is (be_visitor_context *ctx)
: be_visitor_interface (ctx)
@@ -44,22 +39,20 @@ be_visitor_interface_is::visit_interface (be_interface *node)
this->ctx_->interface (node);
- TAO_OutStream *os; // output stream
+ TAO_OutStream *os = this->ctx_->stream ();
if (node->impl_skel_gen () || node->imported ())
- return 0;
-
- os = this->ctx_->stream ();
-
-
- // generate the skeleton class name
+ {
+ return 0;
+ }
- os->indent (); // start with whatever indentation level we are at
+ // Generate the skeleton class name.
+ os->indent ();
- // constructor
*os << "// Implementation skeleton constructor" << be_nl;
- // find if we are at the top scope or inside some module
+
+ // Find if we are at the top scope or inside some module.
*os << be_global->impl_class_prefix () << node->flat_name ()
<< be_global->impl_class_suffix () <<"::"
<< be_global->impl_class_prefix () << node->flat_name ()
@@ -69,7 +62,6 @@ be_visitor_interface_is::visit_interface (be_interface *node)
*os << "{" << be_nl
<< "}" << be_nl << be_uidt_nl;
- // destructor
os->indent ();
*os << "// Implementation skeleton destructor" << be_nl;
@@ -82,7 +74,7 @@ be_visitor_interface_is::visit_interface (be_interface *node)
*os << "{" <<be_nl;
*os << "}" << be_nl <<be_uidt_nl;
- if (be_global->gen_copy_ctor () )
+ if (be_global->gen_copy_ctor ())
{
*os << "//Implementation Skeleton Copy Constructor" << be_nl;
@@ -93,11 +85,12 @@ be_visitor_interface_is::visit_interface (be_interface *node)
<< be_global->impl_class_prefix () << node->flat_name ()
<< be_global->impl_class_suffix () << "& t)"<< be_idt_nl;
- if(node->n_inherits () >0)
+ if (node->n_inherits () > 0)
{
- node->gen_copy_ctors(os);
+ node->gen_copy_ctors (os);
*os << ", TAO_ServantBase (t)" << be_nl;
}
+
*os << "{" << be_nl
<< "}" << be_nl << be_uidt_nl;
}
@@ -117,7 +110,7 @@ be_visitor_interface_is::visit_interface (be_interface *node)
<< "}" << be_nl << be_uidt_nl;
}
- // generate code for elements in the scope (e.g., operations)
+ // Generate code for elements in the scope (e.g., operations).
if (this->visit_scope (node) == -1)
{
@@ -127,63 +120,50 @@ be_visitor_interface_is::visit_interface (be_interface *node)
"codegen for scope failed\n"),
-1);
}
- /*
- if (node->n_inherits () > 0)
- {
- // this interface inherits from other interfaces
- be_interface *intf; // inherited interface
-
- for (int i = 0; i < node->n_inherits (); i++)
- {
- intf = be_interface::narrow_from_decl (node->inherits ()[i]);
- // generate code for elements in the scope (e.g., operations)
- if (this->visit_scope (intf) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_ih::"
- "visit_interface - "
- "codegen for scope failed\n"),
- -1);
- }
- }
- */
- if (node->traverse_inheritance_graph (be_visitor_interface_is::method_helper, os) == -1)
+
+ int status =
+ node->traverse_inheritance_graph (
+ be_visitor_interface_is::method_helper,
+ os
+ );
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_tie_sh_ss::"
+ "be_visitor_interface_is::"
"visit_interface - "
"traversal of inhertance graph failed\n"),
-1);
}
-
return 0;
}
-//Helper method to generate the members in the scope of the base classes
+// Helper method to generate the members in the scope of the base classes.
int
be_visitor_interface_is::method_helper (be_interface *derived,
- be_interface *node,
- TAO_OutStream *os)
+ be_interface *node,
+ TAO_OutStream *os)
{
-
- if (strcmp (derived->flat_name (), node->flat_name ()) != 0)
+ if (ACE_OS::strcmp (derived->flat_name (), node->flat_name ()) != 0)
{
be_visitor_context ctx;
ctx.state (TAO_CodeGen::TAO_INTERFACE_IS);
ctx.interface (derived);
ctx.stream (os);
+ be_visitor_interface_is visitor (&ctx);
+
+ if (visitor.visit_scope (node) == -1)
- be_visitor* visitor = tao_cg->make_visitor (&ctx);
- if (visitor == 0 || visitor->visit_scope (node) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_interface_is::"
- "method_helper\n"), -1);
+ "method_helper\n"),
+ -1);
}
- delete visitor;
+
}
+
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
index b8384ace7ba..cb14fe10d2b 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp
@@ -18,17 +18,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface.h"
-
-ACE_RCSID(be_visitor_interface, interface_sh, "$Id$")
-
+ACE_RCSID (be_visitor_interface,
+ interface_sh,
+ "$Id$")
// ************************************************************
-// Interface visitor for server header
+// Interface visitor for server header.
// ************************************************************
be_visitor_interface_sh::be_visitor_interface_sh (be_visitor_context *ctx)
@@ -43,29 +38,33 @@ be_visitor_interface_sh::~be_visitor_interface_sh (void)
int
be_visitor_interface_sh::visit_interface (be_interface *node)
{
- if (node->srv_hdr_gen () || node->imported ())
- return 0;
+ if (node->srv_hdr_gen () || node->imported () || node->is_abstract ())
+ {
+ return 0;
+ }
// If this node is a AMH-RH node, then generate code for it
if (node->is_local ())
{
if (this->is_amh_rh_node (node))
{
- // Create amh_rh_visitors
+ // Create amh_rh_visitors.
be_visitor_amh_rh_interface_sh amh_rh_intf (this->ctx_);
amh_rh_intf.visit_interface (node);
}
- return 0;
+
+ return 0;
}
if (this->generate_amh_classes (node) == -1)
- return -1;
-
- TAO_OutStream *os = this->ctx_->stream (); // output stream
+ {
+ return -1;
+ }
- ACE_CString class_name; // holds the class name
+ TAO_OutStream *os = this->ctx_->stream ();
os->indent ();
+ ACE_CString class_name;
// We shall have a POA_ prefix only if we are at the topmost level.
if (!node->is_nested ())
@@ -79,6 +78,9 @@ be_visitor_interface_sh::visit_interface (be_interface *node)
class_name += node->local_name ();
}
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Generate the skeleton class name.
*os << "class " << class_name.c_str () << ";" << be_nl;
@@ -113,21 +115,33 @@ be_visitor_interface_sh::visit_interface (be_interface *node)
<< " " << class_name.c_str () << be_idt_nl << ": " << be_idt;
long n_parents = node->n_inherits ();
+ AST_Interface *parent = 0;
+ int has_concrete_parent = 0;
if (n_parents > 0)
{
for (int i = 0; i < n_parents; ++i)
{
- *os << "public virtual " << "POA_"
- << node->inherits ()[i]->name ();
+ parent = node->inherits ()[i];
+
+ if (parent->is_abstract ())
+ {
+ continue;
+ }
- if (i < n_parents - 1)
+ if (has_concrete_parent == 1)
{
*os << "," << be_nl;
}
+
+ *os << "public virtual " << "POA_"
+ << parent->name ();
+
+ has_concrete_parent = 1;
}
}
- else
+
+ if (has_concrete_parent == 0)
{
// We don't inherit from another user defined object, hence our
// base class is the ServantBase class.
@@ -209,10 +223,18 @@ be_visitor_interface_sh::visit_interface (be_interface *node)
-1);
}
+ *os << "\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)
+ int status =
+ node->traverse_inheritance_graph (
+ be_interface::gen_skel_helper,
+ os
+ );
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_interface_sh::"
@@ -224,14 +246,12 @@ be_visitor_interface_sh::visit_interface (be_interface *node)
// Generate the embedded RequestInfo classes per operation.
// This is to be used by interceptors.
be_visitor_context ctx (*this->ctx_);
- be_visitor *visitor = 0;
// Interceptor related classes.
ctx.state (TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SH);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_interface_interceptors_sh ii_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&ii_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_interface_ch::"
"visit_interface - "
@@ -239,29 +259,27 @@ be_visitor_interface_sh::visit_interface (be_interface *node)
-1);
}
- delete visitor;
- visitor = 0;
-
*os << be_uidt_nl << "};\n\n";
- if (be_global->gen_thru_poa_collocation () ||
- be_global->gen_direct_collocation ())
+ if (be_global->gen_thru_poa_collocation ()
+ || be_global->gen_direct_collocation ())
{
ctx = *this->ctx_;
// Generate strategized proxy broker.
ctx.state (TAO_CodeGen::TAO_INTERFACE_STRATEGIZED_PROXY_BROKER_SH);
- visitor = tao_cg->make_visitor (&ctx);
- if (node->accept (visitor) == -1)
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_sh::"
- "visit_interface - "
- "codegen for thru_poa_collocated class failed\n"),
- -1);
- }
-
- delete visitor;
+ be_visitor_interface_strategized_proxy_broker_sh ispb_visitor (&ctx);
+
+ if (node->accept (&ispb_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "be_visitor_interface_sh::"
+ "visit_interface - "
+ "codegen for thru_poa_collocated class failed\n"
+ ),
+ -1
+ );
+ }
}
ctx = *this->ctx_;
@@ -269,51 +287,99 @@ be_visitor_interface_sh::visit_interface (be_interface *node)
// Generate the collocated class.
if (be_global->gen_thru_poa_collocation ())
{
- visitor = 0;
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SH);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_interface_thru_poa_proxy_impl_sh itppi_visitor (&ctx);
- if (visitor == 0 || node->accept (visitor) == -1)
+ if (node->accept (&itppi_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_interface_sh::"
"visit_interface - "
"codegen for thru_poa_collocated class failed\n"),
-1);
}
-
- delete visitor;
}
ctx = *this->ctx_;
if (be_global->gen_direct_collocation ())
{
- visitor = 0;
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_interface_direct_proxy_impl_sh idpi_visitor (&ctx);
- if (visitor == 0 || node->accept (visitor) == -1)
+ if (node->accept (&idpi_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "be_visitor_interface_sh::"
+ "visit_interface - "
+ "codegen for thru_poa_collocated class failed\n"
+ ),
+ -1
+ );
+ }
+ }
+
+ *os << "\n";
+ return 0;
+}
+
+int
+be_visitor_interface_sh::gen_abstract_ops_helper (
+ be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os
+ )
+{
+ if (node == base)
+ {
+ return 0;
+ }
+
+ AST_Decl *d = 0;
+ be_visitor_context ctx;
+ ctx.stream (os);
+
+ for (UTL_ScopeActiveIterator si (base, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ d = si.item ();
+
+ if (d == 0)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_sh::"
- "visit_interface - "
- "codegen for thru_poa_collocated class failed\n"),
+ "(%N:%l) be_visitor_interface_sh::"
+ "abstract_base_ops_helper - "
+ "bad node in this scope\n"),
-1);
}
- delete visitor;
+ if (d->node_type () == AST_Decl::NT_op)
+ {
+ UTL_ScopedName item_new_name (d->local_name (),
+ 0);
+
+ AST_Operation *op = AST_Operation::narrow_from_decl (d);
+ be_operation new_op (op->return_type (),
+ op->flags (),
+ &item_new_name,
+ op->is_local (),
+ op->is_abstract ());
+ new_op.set_defined_in (node);
+ be_visitor_interface::add_abstract_op_args (op,
+ new_op);
+ ctx.state (TAO_CodeGen::TAO_OPERATION_SH);
+ be_visitor_operation_sh op_visitor (&ctx);
+ op_visitor.visit_operation (&new_op);
+ }
}
- *os << "\n";
return 0;
}
-
void
be_visitor_interface_sh::this_method (be_interface *node)
{
@@ -333,5 +399,6 @@ be_visitor_interface_sh::generate_amh_classes (be_interface *node)
be_visitor_amh_interface_sh amh_intf (this->ctx_);
return amh_intf.visit_interface (node);
}
+
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
index 7ac5571926c..ecc0f5e998e 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp
@@ -18,13 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface.h"
-
-ACE_RCSID(be_visitor_interface, interface_si, "$Id$")
+ACE_RCSID (be_visitor_interface,
+ interface_si,
+ "$Id$")
// ************************************************************************
@@ -43,16 +39,22 @@ 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 ()
+ || node->is_local ()
+ || node->is_abstract ())
+ {
+ return 0;
+ }
- if (node->srv_inline_gen () || node->imported () || node->is_local ())
- return 0;
+ TAO_OutStream *os = this->ctx_->stream ();
- os = this->ctx_->stream ();
+ // Determine if we are in some form of a multiple inheritance.
+ int status =
+ node->traverse_inheritance_graph (be_interface::in_mult_inheritance_helper,
+ 0);
- // determine if we are in some form of a multiple inheritance
- if (node->traverse_inheritance_graph
- (be_interface::in_mult_inheritance_helper, 0) == -1)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_interface_si::visit_interface "
@@ -62,27 +64,28 @@ be_visitor_interface_si::visit_interface (be_interface *node)
// 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)
+ // call. Hence we generate these in the inline file.
+ status = node->traverse_inheritance_graph (be_interface::gen_skel_helper,
+ os);
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interface_si::"
"visit_interface - "
- "codegen for base class skeletons failed\n"), -1);
+ "codegen for base class skeletons failed\n"),
+ -1);
}
if (be_global->gen_tie_classes ())
{
- // generate the TIE class
+ // 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);
+ be_visitor_interface_tie_si visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_interface_sh::"
"visit_interface - "
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp
index f30ceb3ff6a..18261ecdc24 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp
@@ -18,18 +18,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface.h"
-#include "ace/SString.h"
-
-ACE_RCSID(be_visitor_interface, interface_ss, "$Id$")
-
+ACE_RCSID (be_visitor_interface,
+ interface_ss,
+ "$Id$")
// ************************************************************
-// Interface visitor for server skeletons
+// Interface visitor for server skeletons.
// ************************************************************
be_visitor_interface_ss::be_visitor_interface_ss (be_visitor_context *ctx)
@@ -44,7 +38,7 @@ be_visitor_interface_ss::~be_visitor_interface_ss (void)
int
be_visitor_interface_ss::visit_interface (be_interface *node)
{
- if (node->srv_skel_gen () || node->imported ())
+ if (node->srv_skel_gen () || node->imported () || node->is_abstract ())
{
return 0;
}
@@ -53,7 +47,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
{
if (this->is_amh_rh_node (node))
{
- // Create amh_rh_visitors
+ // Create amh_rh_visitors.
be_visitor_amh_rh_interface_ss amh_rh_ss_intf (this->ctx_);
amh_rh_ss_intf.visit_interface (node);
}
@@ -62,20 +56,24 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
}
if (this->generate_amh_classes (node) == -1)
- return -1;
+ {
+ return -1;
+ }
- // Generate the normal skeleton as usual
+ // Generate the normal skeleton as usual.
TAO_OutStream *os = this->ctx_->stream ();
- os->indent (); // start with whatever indentation level we are at
+ os->indent ();
ACE_CString full_skel_name_holder =
this->generate_full_skel_name (node);
+
const char *full_skel_name = full_skel_name_holder.c_str ();
ACE_CString flat_name_holder =
this->generate_flat_name (node);
+
const char *flat_name = flat_name_holder.c_str ();
if (node->gen_operation_table (flat_name, full_skel_name) == -1)
@@ -96,13 +94,14 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
-1);
}
- *os << "// TAO_IDL - Generated from " << be_nl
- << "// " << __FILE__ << ":" << __LINE__ << be_nl;
+ *os << be_nl << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
// Find if we are at the top scope or inside some module,
// pre-compute the prefix that must be added to the local name in
// each case.
const char *local_name_prefix = "";
+
if (!node->is_nested ())
{
local_name_prefix = "POA_";
@@ -110,6 +109,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
ACE_CString node_local_name_holder =
this->generate_local_name (node);
+
const char *node_local_name = node_local_name_holder.c_str ();
*os << full_skel_name << "::"
@@ -149,7 +149,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
*os << "{" << be_nl;
*os << "}\n\n";
- // generate code for elements in the scope (e.g., operations)
+ // Generate code for elements in the scope (e.g., operations).
if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -159,6 +159,9 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
-1);
}
+ *os << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Generate code for the _is_a skeleton.
os->indent ();
*os << "void " << full_skel_name
@@ -228,9 +231,14 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
<< be_idt_nl;
if (be_global->use_raw_throw ())
- *os << "throw CORBA::MARSHAL ();" << be_uidt << be_uidt_nl;
+ {
+ *os << "throw CORBA::MARSHAL ();" << be_uidt << be_uidt_nl;
+ }
else
- *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt << be_uidt_nl;
+ {
+ *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt << be_uidt_nl;
+ }
+
*os << "}\n\n";
// Generate code for the _interface skeleton.
@@ -310,14 +318,14 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
// Generate code for the _is_a override.
os->indent ();
+
*os << "CORBA::Boolean " << full_skel_name
<< "::_is_a (" << be_idt << be_idt_nl
<< "const char* value" << be_nl
<< "ACE_ENV_ARG_DECL_NOT_USED" << be_uidt_nl
<< ")" << be_uidt_nl
<< "{" << be_idt_nl
- << "const char *base_id = \"IDL:org.omg/CORBA/Object:1.0\";" << be_nl
- << "if (\n" << be_idt;
+ << "if (" << be_idt << be_idt_nl;
if (node->traverse_inheritance_graph (be_interface::is_a_helper, os) == -1)
{
@@ -328,11 +336,29 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
-1);
}
- os->indent ();
- *os << "(!ACE_OS::strcmp ((char *)value, base_id)))"
- << be_idt_nl << "return 1;" << be_uidt_nl
+ *os << "!ACE_OS::strcmp (" << be_idt << be_idt_nl
+ << "(char *)value," << be_nl
+ << "\"IDL:org.omg/CORBA/Object:1.0\"" << be_uidt_nl
+ << ")";
+
+ if (node->has_mixed_parentage ())
+ {
+ *os << " ||" << be_uidt_nl
+ << "!ACE_OS::strcmp (" << be_idt << be_idt_nl
+ << "(char *)value," << be_nl
+ << "\"IDL:org.omg/CORBA/AbstractBase:1.0\"" << be_uidt_nl
+ << ")";
+ }
+
+ *os << be_uidt << be_uidt_nl
+ << " )" << be_nl
+ << "{" << be_idt_nl
+ << "return 1;" << be_uidt_nl
+ << "}" << be_uidt_nl
<< "else" << be_idt_nl
- << "return 0;" << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
<< "}" << be_nl << be_nl;
// the downcast method.
@@ -351,10 +377,13 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
-1);
}
- *os << "if (ACE_OS::strcmp (logical_type_id, "
- << "\"IDL:omg.org/CORBA/Object:1.0\") == 0)" << be_idt_nl
+ *os << "if (ACE_OS::strcmp (logical_type_id," << be_nl
+ << " \"IDL:omg.org/CORBA/Object:1.0\") == 0)"
+ << be_idt_nl
+ << "{" << be_idt_nl
<< "return ACE_static_cast(PortableServer::Servant, this);"
- << be_uidt_nl;
+ << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
*os << "return 0;" << be_uidt_nl
<< "}" << be_nl << be_nl;
@@ -366,7 +395,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
*os << "return \"" << node->repoID () << "\";" << be_uidt_nl;
*os << "}" << be_nl << be_nl;
- // Print out dispatch method
+ // Print out dispatch method.
this->dispatch_method (node);
*os << be_nl;
@@ -378,40 +407,120 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
return 0;
}
+int
+be_visitor_interface_ss::gen_abstract_ops_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os)
+{
+ if (node == base)
+ {
+ return 0;
+ }
+
+ AST_Decl *d = 0;
+ be_visitor_context ctx;
+ ctx.stream (os);
+
+ for (UTL_ScopeActiveIterator si (base, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ d = si.item ();
+
+ if (d == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_ss::"
+ "abstract_base_ops_helper - "
+ "bad node in this scope\n"),
+ -1);
+ }
+
+ if (d->node_type () == AST_Decl::NT_op)
+ {
+ UTL_ScopedName *item_new_name = 0;
+ ACE_NEW_RETURN (item_new_name,
+ UTL_ScopedName (d->local_name ()->copy (),
+ 0),
+ -1);
+
+ UTL_ScopedName *base = (UTL_ScopedName *)node->name ()->copy ();
+ base->nconc (item_new_name);
+
+ AST_Operation *op = AST_Operation::narrow_from_decl (d);
+ be_operation new_op (op->return_type (),
+ op->flags (),
+ 0,
+ op->is_local (),
+ op->is_abstract ());
+ new_op.set_defined_in (node);
+ be_visitor_interface::add_abstract_op_args (op,
+ new_op);
+ new_op.set_name (base);
+ ctx.state (TAO_CodeGen::TAO_OPERATION_SS);
+ be_visitor_operation_ss op_visitor (&ctx);
+ op_visitor.visit_operation (&new_op);
+
+ base->destroy ();
+ delete base;
+ base = 0;
+ }
+ }
+
+ return 0;
+}
void
be_visitor_interface_ss::this_method (be_interface *node)
{
TAO_OutStream *os = this->ctx_->stream ();
- // the _this () operation
- *os << node->full_name () << "*" << be_nl
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // the _this () operation.
+ *os << node->full_name () << " *" << be_nl
<< node->full_skel_name ()
<< "::_this (ACE_ENV_SINGLE_ARG_DECL)" << be_nl
- << "{" << be_idt_nl // idt = 1
+ << "{" << be_idt_nl
<< "TAO_Stub *stub = this->_create_stub (ACE_ENV_SINGLE_ARG_PARAMETER);"
<< be_nl
<< "ACE_CHECK_RETURN (0);" << be_nl << be_nl
- << "TAO_Stub_Auto_Ptr safe_stub (stub);" << be_nl << be_nl;
+ << "TAO_Stub_Auto_Ptr safe_stub (stub);" << be_nl;
*os << "CORBA::Object_ptr tmp = CORBA::Object::_nil ();" << be_nl
<< be_nl
<< "if (stub->servant_orb_var ()->orb_core ()->"
- << "optimize_collocation_objects ())"
- << be_idt_nl // idt = 2
- << "ACE_NEW_RETURN (tmp, CORBA::Object (stub, 1, this), 0);"
- << be_uidt_nl // idt = 1
- << "else"
- << be_idt_nl // idt = 2
- << "ACE_NEW_RETURN (tmp, CORBA::Object (stub, 0, this), 0);"
- << be_uidt_nl << be_nl // idt = 1
- << "CORBA::Object_var obj = tmp;" << be_nl << be_nl;
-
- *os << "(void) safe_stub.release ();" << be_nl << be_nl;
-
- *os << "return " << "::" << node->full_name ()
+ << "optimize_collocation_objects ())" << be_idt_nl
+ << "{" << be_idt_nl
+ << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
+ << "tmp," << be_nl
+ << "CORBA::Object (" << be_idt << be_idt_nl
+ << "stub," << be_nl
+ << "1," << be_nl
+ << "this" << be_uidt_nl
+ << ")," << be_uidt_nl
+ << "0" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "else" << be_idt_nl
+ << "{" << be_idt_nl
+ << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
+ << "tmp," << be_nl
+ << "CORBA::Object (" << be_idt << be_idt_nl
+ << "stub," << be_nl
+ << "0," << be_nl
+ << "this" << be_uidt_nl
+ << ")," << be_uidt_nl
+ << "0" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+
+ *os << "CORBA::Object_var obj = tmp;" << be_nl
+ << "(void) safe_stub.release ();" << be_nl
+ << "return " << "::" << node->full_name ()
<< "::_unchecked_narrow (obj.in ());"
- << be_uidt_nl // idt = 0
+ << be_uidt_nl
<< "}" << be_nl;
}
@@ -420,7 +529,9 @@ be_visitor_interface_ss::dispatch_method (be_interface *node)
{
TAO_OutStream *os = this->ctx_->stream ();
- // now the dispatch method
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
*os << "void " << node->full_skel_name ()
<< "::_dispatch (" << be_idt << be_idt_nl
<< "TAO_ServerRequest &req," << be_nl
@@ -433,7 +544,7 @@ be_visitor_interface_ss::dispatch_method (be_interface *node)
<< " this" << be_nl
<< " ACE_ENV_ARG_PARAMETER);"
<< be_uidt_nl;
- *os << "}" << be_nl << be_nl;
+ *os << "}" << be_nl;
}
int
@@ -444,6 +555,7 @@ be_visitor_interface_ss::generate_amh_classes (be_interface *node)
be_visitor_amh_interface_ss amh_intf (this->ctx_);
return amh_intf.visit_interface (node);
}
+
return 0;
}
@@ -452,15 +564,14 @@ be_visitor_interface_ss::generate_proxy_classes (be_interface *node)
{
TAO_OutStream *os = this->ctx_->stream ();
- // Strategized Proxy Broker Implementation
+ // Strategized Proxy Broker Implementation.
be_visitor_context ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_interface_interceptors_ss ii_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&ii_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_interface_cs::"
"generate_proxy_classes - "
@@ -468,19 +579,15 @@ be_visitor_interface_ss::generate_proxy_classes (be_interface *node)
-1);
}
- delete visitor;
- visitor = 0;
-
if (be_global->gen_thru_poa_collocation ()
|| be_global->gen_direct_collocation ())
{
ctx = (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_INTERFACE_STRATEGIZED_PROXY_BROKER_SS);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_interface_strategized_proxy_broker_ss ispb_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&ispb_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_interface_cs::"
"generate_proxy_classes - "
@@ -488,7 +595,8 @@ be_visitor_interface_ss::generate_proxy_classes (be_interface *node)
-1);
}
- delete visitor;
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
// Proxy Broker Factory Function.
*os << be_nl
@@ -540,42 +648,34 @@ be_visitor_interface_ss::generate_proxy_classes (be_interface *node)
// Proxy Impl Implementations.
if (be_global->gen_thru_poa_collocation ())
{
- visitor = 0;
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SS);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_interface_thru_poa_proxy_impl_ss itppi_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&itppi_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_interface_cs::"
"generate_proxy_classes - "
"codegen for Base Proxy Broker class failed\n"),
-1);
}
-
- delete visitor;
}
if (be_global->gen_direct_collocation ())
{
- visitor = 0;
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_interface_direct_proxy_impl_ss idpi_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&idpi_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_interface_cs::"
"generate_proxy_classes - "
"codegen for Base Proxy Broker class failed\n"),
-1);
}
-
- delete visitor;
}
os->decr_indent (0);
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/proxy_brokers_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/proxy_brokers_ch.cpp
index 357e932f3af..538a39cf926 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/proxy_brokers_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/proxy_brokers_ch.cpp
@@ -1,19 +1,23 @@
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+//
+// $Id$
+//
-#include "be_visitor_interface.h"
+ACE_RCSID (be_visitor_interface,
+ proxy_brokers_ch,
+ "$Id$")
-ACE_RCSID (be_visitor_interface, proxy_brokers_ch, "$Id$")
-
- be_visitor_interface_proxy_brokers_ch::be_visitor_interface_proxy_brokers_ch (be_visitor_context *ctx)
- : be_visitor_interface (ctx)
+be_visitor_interface_proxy_brokers_ch::be_visitor_interface_proxy_brokers_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_interface (ctx)
{
// No-Op.
}
-be_visitor_interface_proxy_brokers_ch::~be_visitor_interface_proxy_brokers_ch (void)
+be_visitor_interface_proxy_brokers_ch::~be_visitor_interface_proxy_brokers_ch (
+ void
+ )
{
// No-Op.
}
@@ -35,11 +39,10 @@ be_visitor_interface_proxy_brokers_ch::visit_interface (be_interface *node)
be_visitor *visitor = 0;
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_BROKER_CH);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_interface_base_proxy_broker_ch bpb_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&bpb_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_interface_ch::"
"visit_interface - "
@@ -47,15 +50,12 @@ be_visitor_interface_proxy_brokers_ch::visit_interface (be_interface *node)
-1);
}
- delete visitor;
-
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_BROKER_CH);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_interface_remote_proxy_broker_ch rpb_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&rpb_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_interface_ch::"
"visit_interface - "
@@ -63,7 +63,5 @@ be_visitor_interface_proxy_brokers_ch::visit_interface (be_interface *node)
-1);
}
- delete visitor;
-
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/proxy_impls_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/proxy_impls_ch.cpp
index cca6a5e8a65..d5bc901855b 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/proxy_impls_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/proxy_impls_ch.cpp
@@ -1,19 +1,23 @@
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+//
+// $Id$
+//
-#include "be_visitor_interface.h"
+ACE_RCSID (be_visitor_interface,
+ base_proxy_broker_impl_ch,
+ "$Id$")
-ACE_RCSID (be_visitor_interface, base_proxy_broker_impl_ch, "$Id$")
-
-be_visitor_interface_proxy_impls_ch::be_visitor_interface_proxy_impls_ch (be_visitor_context *ctx)
+be_visitor_interface_proxy_impls_ch::be_visitor_interface_proxy_impls_ch (
+ be_visitor_context *ctx
+ )
: be_visitor_interface (ctx)
{
// No-Op.
}
-be_visitor_interface_proxy_impls_ch::~be_visitor_interface_proxy_impls_ch (void)
+be_visitor_interface_proxy_impls_ch::~be_visitor_interface_proxy_impls_ch (
+ void
+ )
{
// No-Op.
}
@@ -26,43 +30,37 @@ be_visitor_interface_proxy_impls_ch::visit_interface (be_interface *node)
// Generate Guards.
*os << "// The Proxy Implementations are used by each interface to"
<< be_nl
- << "// perform a call. Each different implementation encapsulate"
+ << "// perform a call. Each different implementation encapsulates"
<< be_nl
- << "// an invocation logics." << be_nl << be_nl;
+ << "// an invocation logic." << be_nl << be_nl;
// Code Generation for the proxy imlpementations base class.
be_visitor *visitor = 0;
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_IMPL_CH);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_interface_base_proxy_impl_ch bpi_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&bpi_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_ch::"
+ "be_visitor_interface_proxy_impls_ch::"
"visit_interface - "
"codegen for Base Proxy Impl. class failed\n"),
-1);
}
- delete visitor;
-
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_IMPL_CH);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_interface_remote_proxy_impl_ch rpi_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&rpi_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_ch::"
+ "be_visitor_interface_proxy_impls_ch::"
"visit_interface - "
"codegen for Remote Proxy Broker class failed\n"),
-1);
}
- delete visitor;
-
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_broker_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_broker_ch.cpp
index 273530debd1..e197ce1bc46 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_broker_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_broker_ch.cpp
@@ -1,27 +1,29 @@
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface.h"
+//
+// $Id$
+//
ACE_RCSID (be_visitor_interface,
be_visitor_interface_remote_proxy_broker_ch,
"$Id$")
-be_visitor_interface_remote_proxy_broker_ch::be_visitor_interface_remote_proxy_broker_ch (be_visitor_context *ctx)
+be_visitor_interface_remote_proxy_broker_ch::
+be_visitor_interface_remote_proxy_broker_ch (be_visitor_context *ctx)
: be_visitor_interface (ctx)
{
// No-Op.
}
-be_visitor_interface_remote_proxy_broker_ch::~be_visitor_interface_remote_proxy_broker_ch (void)
+be_visitor_interface_remote_proxy_broker_ch::
+~be_visitor_interface_remote_proxy_broker_ch (void)
{
// No-Op.
}
int
-be_visitor_interface_remote_proxy_broker_ch::visit_interface (be_interface *node)
+be_visitor_interface_remote_proxy_broker_ch::visit_interface (
+ be_interface *node
+ )
{
TAO_OutStream *os = this->ctx_->stream ();
@@ -29,10 +31,14 @@ be_visitor_interface_remote_proxy_broker_ch::visit_interface (be_interface *node
os->indent ();
*os << be_nl
- << "///////////////////////////////////////////////////////////////////////" << be_nl
+ << "///////////////////////////////////////////////////////////////////////"
+ << be_nl
<< "// Remote Proxy Broker Declaration " << be_nl
<< "//" << be_nl << be_nl;
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
*os << "class " << be_global->stub_export_macro () << " "
<< node->remote_proxy_broker_name () << be_idt_nl
<< ": public virtual "
@@ -48,7 +54,8 @@ be_visitor_interface_remote_proxy_broker_ch::visit_interface (be_interface *node
<< be_nl << be_nl;
// Accessor Method
- *os << "virtual " << node->base_proxy_impl_name () << " &" << "select_proxy ("
+ *os << "virtual " << node->base_proxy_impl_name () << " &"
+ << "select_proxy ("
<< be_idt << be_idt_nl;
*os << node->local_name () << " *object" << be_nl
@@ -62,8 +69,10 @@ be_visitor_interface_remote_proxy_broker_ch::visit_interface (be_interface *node
*os << "public:" << be_idt_nl;
// Factory Member Function declaration.
- *os << "// This member function is used to get an handle to the unique instance" << be_nl
- << "// of the Remote Proxy Broker that is available for a given" << be_nl
+ *os << "// This member function is used to get an handle to the "
+ << "unique instance" << be_nl
+ << "// of the Remote Proxy Broker that is available for a given"
+ << be_nl
<< "// interface." << be_nl
<< "static " << node->remote_proxy_broker_name ()
<< " *the" << node->remote_proxy_broker_name ()
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_broker_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_broker_cs.cpp
index 93fa5e34089..d2b53e17245 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_broker_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_broker_cs.cpp
@@ -1,33 +1,41 @@
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+//
+// $Id$
+//
-#include "be_visitor_interface.h"
+ACE_RCSID (be_visitor_interface,
+ remote_proxy_broker_cs,
+ "$Id$")
-ACE_RCSID (be_visitor_interface, base_proxy_broker_cs, "$Id$")
-
-be_visitor_interface_remote_proxy_broker_cs::be_visitor_interface_remote_proxy_broker_cs (be_visitor_context *ctx)
+be_visitor_interface_remote_proxy_broker_cs::
+be_visitor_interface_remote_proxy_broker_cs (be_visitor_context *ctx)
: be_visitor_interface (ctx)
{
// No-Op.
}
-be_visitor_interface_remote_proxy_broker_cs::~be_visitor_interface_remote_proxy_broker_cs (void)
+be_visitor_interface_remote_proxy_broker_cs::
+~be_visitor_interface_remote_proxy_broker_cs (void)
{
// No-Op.
}
int
-be_visitor_interface_remote_proxy_broker_cs::visit_interface (be_interface *node)
+be_visitor_interface_remote_proxy_broker_cs::visit_interface (
+ be_interface *node
+ )
{
TAO_OutStream *os = this->ctx_->stream ();
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
+
// Generate the class declaration.
os->indent ();
*os << be_nl
- << "///////////////////////////////////////////////////////////////////////" << be_nl
+ << "///////////////////////////////////////////////////////////////////////"
+ << be_nl
<< "// Remote & Base Proxy Broker Implementation" << be_nl
<< "//" << be_nl << be_nl;
@@ -82,11 +90,11 @@ be_visitor_interface_remote_proxy_broker_cs::visit_interface (be_interface *node
<< "return this->remote_proxy_impl_;"
<< be_uidt_nl << "}" << be_nl << be_nl;
-
*os << be_nl
<< "//" << be_nl
<< "// End Remote & Base Proxy Broker Implementation" << be_nl
<< "///////////////////////////////////////////////////////////////////////"
<< be_nl << be_nl;
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_impl_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_impl_ch.cpp
index ebdd838fd64..c43cf1a98a2 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_impl_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_impl_ch.cpp
@@ -1,25 +1,29 @@
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+//
+// $Id$
+//
-#include "be_visitor_interface.h"
+ACE_RCSID (be_visitor_interface,
+ remote_proxy_impl_ch,
+ "$Id$")
-ACE_RCSID (be_visitor_interface, remote_proxy_broker_impl_ch, "$Id$")
-
-be_visitor_interface_remote_proxy_impl_ch::be_visitor_interface_remote_proxy_impl_ch (be_visitor_context *ctx)
+be_visitor_interface_remote_proxy_impl_ch::
+be_visitor_interface_remote_proxy_impl_ch (be_visitor_context *ctx)
: be_visitor_interface (ctx)
{
// No-Op.
}
-be_visitor_interface_remote_proxy_impl_ch::~be_visitor_interface_remote_proxy_impl_ch (void)
+be_visitor_interface_remote_proxy_impl_ch::
+~be_visitor_interface_remote_proxy_impl_ch (void)
{
// No-Op.
}
int
-be_visitor_interface_remote_proxy_impl_ch::visit_interface (be_interface *node)
+be_visitor_interface_remote_proxy_impl_ch::visit_interface (
+ be_interface *node
+ )
{
TAO_OutStream *os = this->ctx_->stream ();
@@ -29,31 +33,33 @@ be_visitor_interface_remote_proxy_impl_ch::visit_interface (be_interface *node)
<< "// Remote Proxy Impl. Declaration" << be_nl
<< "//" << be_nl << be_nl;
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Generate Class Declaration.
*os << "class " << be_global->stub_export_macro ()
<< " " << node->remote_proxy_impl_name () << be_idt_nl;
*os << ": " << "public virtual " << node->base_proxy_impl_name ()
- << "," << be_idt_nl << "public virtual " << "TAO_Remote_Object_Proxy_Impl";
+ << "," << be_idt_nl << "public virtual "
+ << "TAO_Remote_Object_Proxy_Impl";
- if (node->n_inherits () > 0)
- {
- *os << "," << be_nl;
+ int nparents = node->n_inherits ();
- for (int i = 0; i < node->n_inherits (); i++)
+ if (nparents > 0)
+ {
+ for (int i = 0; i < nparents; ++i)
{
be_interface *inherited =
be_interface::narrow_from_decl (node->inherits ()[i]);
- *os << "public virtual ";
- *os << inherited->full_remote_proxy_impl_name ();
-
- if (i < node->n_inherits () - 1)
+ if (inherited->is_abstract ())
{
- // Node is the case of multiple
- // inheritance, so put a comma.
- *os << ", ";
- *os << be_nl;
+ continue;
}
+
+ *os << "," << be_nl;
+ *os << "public virtual ";
+ *os << inherited->full_remote_proxy_impl_name ();
}
}
@@ -86,3 +92,58 @@ be_visitor_interface_remote_proxy_impl_ch::visit_interface (be_interface *node)
return 0;
}
+
+int
+be_visitor_interface_remote_proxy_impl_ch::gen_abstract_ops_helper (
+ be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os
+ )
+{
+ if (node == base)
+ {
+ return 0;
+ }
+
+ AST_Decl *d = 0;
+ be_visitor_context ctx;
+ ctx.stream (os);
+
+ for (UTL_ScopeActiveIterator si (base, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ d = si.item ();
+
+ if (d == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_remote_proxy_"
+ "impl_ch::abstract_base_ops_helper - "
+ "bad node in this scope\n"),
+ -1);
+ }
+
+ if (d->node_type () == AST_Decl::NT_op)
+ {
+ UTL_ScopedName item_new_name (d->local_name (),
+ 0);
+
+ AST_Operation *op = AST_Operation::narrow_from_decl (d);
+ be_operation new_op (op->return_type (),
+ op->flags (),
+ &item_new_name,
+ op->is_local (),
+ op->is_abstract ());
+ new_op.set_defined_in (node);
+ be_visitor_interface::add_abstract_op_args (op,
+ new_op);
+ ctx.state (TAO_CodeGen::TAO_OPERATION_PROXY_IMPL_XH);
+ be_visitor_operation_proxy_impl_xh op_visitor (&ctx);
+ op_visitor.visit_operation (&new_op);
+ }
+ }
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_impl_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_impl_cs.cpp
index 3bca271e829..8d9f84ac942 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_impl_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_impl_cs.cpp
@@ -1,31 +1,38 @@
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+//
+// $Id$
+//
-#include "be_visitor_interface.h"
+ACE_RCSID (be_visitor_interface,
+ remote_proxy_impl_cs,
+ "$Id$")
-ACE_RCSID (be_visitor_interface, remote_proxy_broker_impl_cs, "$Id$")
-
-be_visitor_interface_remote_proxy_impl_cs::be_visitor_interface_remote_proxy_impl_cs (be_visitor_context *ctx)
+be_visitor_interface_remote_proxy_impl_cs::
+be_visitor_interface_remote_proxy_impl_cs (be_visitor_context *ctx)
: be_visitor_interface (ctx)
{
// No-Op.
}
-
-be_visitor_interface_remote_proxy_impl_cs::~be_visitor_interface_remote_proxy_impl_cs (void)
+be_visitor_interface_remote_proxy_impl_cs::
+~be_visitor_interface_remote_proxy_impl_cs (void)
{
// No-Op.
}
int
-be_visitor_interface_remote_proxy_impl_cs::visit_interface (be_interface *node)
+be_visitor_interface_remote_proxy_impl_cs::visit_interface (
+ be_interface *node
+ )
{
TAO_OutStream *os = this->ctx_->stream ();
os->decr_indent (0);
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
+
*os << be_nl
- << "///////////////////////////////////////////////////////////////////////" << be_nl
+ << "///////////////////////////////////////////////////////////////////////"
+ << be_nl
<< "// Base & Remote Proxy Implementation. " << be_nl
<< "//" << be_nl << be_nl;
// Create the destructor implementation for the base
@@ -35,12 +42,7 @@ be_visitor_interface_remote_proxy_impl_cs::visit_interface (be_interface *node)
*os << node->full_base_proxy_impl_name () << "::"
<< node->base_proxy_impl_name () << " (void)" << be_nl
<< "{}" << be_nl << be_nl;
- /*
- // Dtor Impl.
- *os << node->full_base_proxy_impl_name () << "::~"
- << node->base_proxy_impl_name () << " (void)" << be_nl
- << "{}" << be_nl << be_nl;
- */
+
// Create the destructor implementation for the remote
// proxy implementation.
@@ -49,13 +51,6 @@ be_visitor_interface_remote_proxy_impl_cs::visit_interface (be_interface *node)
<< node->remote_proxy_impl_name () << " (void)" << be_nl
<< "{}" << be_nl << be_nl;
- /*
- // Dtor Impl
- *os << node->full_remote_proxy_impl_name () << "::~"
- << node->remote_proxy_impl_name () << " (void)" << be_nl
- << "{}" << be_nl << be_nl;
- */
-
// Generate the code for the Remote Proxy Impl.
// operations
*os << "// Remote Implementation of the IDL interface methods"
@@ -75,6 +70,72 @@ be_visitor_interface_remote_proxy_impl_cs::visit_interface (be_interface *node)
<< "// End Base & Remote Proxy Implemeentation. " << be_nl
<< "///////////////////////////////////////////////////////////////////////"
<< be_nl << be_nl;
+
return 0;
+}
+
+int
+be_visitor_interface_remote_proxy_impl_cs::gen_abstract_ops_helper (
+ be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os
+ )
+{
+ if (node == base)
+ {
+ return 0;
+ }
+
+ AST_Decl *d = 0;
+ be_visitor_context ctx;
+ ctx.stream (os);
+
+ for (UTL_ScopeActiveIterator si (base, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ d = si.item ();
+
+ if (d == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_remote_proxy_"
+ "impl_cs::abstract_base_ops_helper - "
+ "bad node in this scope\n"),
+ -1);
+ }
+
+ if (d->node_type () == AST_Decl::NT_op)
+ {
+ UTL_ScopedName *item_new_name = 0;
+ ACE_NEW_RETURN (item_new_name,
+ UTL_ScopedName (d->local_name ()->copy (),
+ 0),
+ -1);
+ UTL_ScopedName *base = (UTL_ScopedName *)node->name ()->copy ();
+ base->nconc (item_new_name);
+
+ AST_Operation *op = AST_Operation::narrow_from_decl (d);
+ be_operation new_op (op->return_type (),
+ op->flags (),
+ 0,
+ op->is_local (),
+ op->is_abstract ());
+ new_op.set_defined_in (node);
+ be_visitor_interface::add_abstract_op_args (op,
+ new_op);
+ new_op.set_name (base);
+ ctx.state (TAO_CodeGen::TAO_OPERATION_REMOTE_PROXY_IMPL_CS);
+ be_visitor_operation_remote_proxy_impl_cs op_visitor (&ctx);
+ op_visitor.visit_operation (&new_op);
+
+ base->destroy ();
+ delete base;
+ base = 0;
+ }
+ }
+
+ return 0;
}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_ch.cpp
index fd4fd4987e8..7452a474649 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_ch.cpp
@@ -18,22 +18,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface.h"
-
-ACE_RCSID(be_visitor_interface, smart_proxy_ch, "$Id$")
+ACE_RCSID (be_visitor_interface,
+ smart_proxy_ch,
+ "$Id$")
// ************************************************************
// smart proxy class in header
// ************************************************************
-
-be_visitor_interface_smart_proxy_ch::be_visitor_interface_smart_proxy_ch
-(be_visitor_context *ctx)
+be_visitor_interface_smart_proxy_ch::be_visitor_interface_smart_proxy_ch (
+ be_visitor_context *ctx
+ )
: be_visitor_interface (ctx)
{
}
@@ -52,12 +48,17 @@ int be_visitor_interface_smart_proxy_ch::visit_interface (be_interface *node)
be_type *bt;
- // set the right type;
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
- // output the class defn
+ {
+ bt = node;
+ }
+
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
*os << "class " << be_global->stub_export_macro ()<< " "
<< "TAO_" << node->flat_name ()
@@ -122,6 +123,7 @@ int be_visitor_interface_smart_proxy_ch::visit_interface (be_interface *node)
<< "};\n\n";
os->indent ();
+
*os << "typedef TAO_Singleton<TAO_"<<node->flat_name ()
<< "_Proxy_Factory_Adapter, TAO_SYNCH_RECURSIVE_MUTEX> TAO_"
<< node->flat_name ()<< "_PROXY_FACTORY_ADAPTER;"<<be_nl << be_nl;
@@ -133,55 +135,61 @@ int be_visitor_interface_smart_proxy_ch::visit_interface (be_interface *node)
<< bt->nested_type_name (this->ctx_->scope ());
- if (node->n_inherits () > 0) // node interface inherits from other
- // interfaces
+ if (node->n_inherits () > 0)
{
long i;
+
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
+ // Inherited node is used in the scope of "node" node.
scope =
be_scope::narrow_from_scope (node->defined_in ())->decl ();
}
*os << "," << be_nl << " public virtual ";
- *os << inherited->nested_sp_type_name (scope,"_Smart_Proxy_Base"); // dump the scoped name
- } // end of for loop
+ *os << inherited->nested_sp_type_name (scope,
+ "_Smart_Proxy_Base");
+ }
}
else
{
*os << "," << be_nl << " public virtual TAO_Smart_Proxy_Base";
}
+
*os << be_uidt_nl;
*os << "{" << be_nl
<< "public:" << be_idt_nl
- << "TAO_"<< node->flat_name () << "_Smart_Proxy_Base (void);" << be_nl
- // Just to keep Old g++ complier (version: 2.7.2.3) happy its necessary
- // to declare and define the destructor explicitly.
- << "~TAO_"<< node->flat_name () << "_Smart_Proxy_Base (void);"<<be_nl
- // This method will delegate this method to the <base_proxy_>
- // member of the smart proxy and so the smart proxy's (nil)
- // stubobj will not be returned.
+ << "TAO_"<< node->flat_name () << "_Smart_Proxy_Base (void);"
+ << be_nl
+ // Just to keep Old g++ complier (version: 2.7.2.3) happy it's
+ // necesssary to declare and define the destructor explicitly.
+ << "~TAO_"<< node->flat_name () << "_Smart_Proxy_Base (void);"
+ << be_nl
+ // This method will delegate this method to the <base_proxy_>
+ // member of the smart proxy and so the smart proxy's (nil)
+ // stubobj will not be returned.
<< "virtual TAO_Stub *_stubobj (void) const;"
<< be_uidt_nl;
- // generate code for the interface definition by traversing thru the
+ // 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.
-
os->indent ();
+
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);
+ "codegen for scope failed\n"),
+ -1);
}
*os << "protected:" << be_idt_nl
@@ -197,5 +205,4 @@ int be_visitor_interface_smart_proxy_ch::visit_interface (be_interface *node)
}
return 0;
-
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_cs.cpp
index 48f57d01a47..7aae252e8a2 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_cs.cpp
@@ -17,26 +17,24 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface.h"
-
-ACE_RCSID(be_visitor_interface, smart_proxy_cs, "$Id$")
-
+ACE_RCSID (be_visitor_interface,
+ smart_proxy_cs,
+ "$Id$")
// ************************************************************
// be_visitor_interface_smart_proxy_cs
// ************************************************************
-be_visitor_interface_smart_proxy_cs::be_visitor_interface_smart_proxy_cs
-(be_visitor_context *ctx)
+be_visitor_interface_smart_proxy_cs::be_visitor_interface_smart_proxy_cs (
+ be_visitor_context *ctx
+ )
: be_visitor_interface (ctx)
{
}
-be_visitor_interface_smart_proxy_cs::~be_visitor_interface_smart_proxy_cs (void)
+be_visitor_interface_smart_proxy_cs::~be_visitor_interface_smart_proxy_cs (
+ void
+ )
{
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_sh.cpp
index 2b78387f443..152974f5126 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_sh.cpp
@@ -1,51 +1,59 @@
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+//
+// $Id$
+//
-#include "be_visitor_interface.h"
+ACE_RCSID (be_visitor_interface,
+ base_proxy_broker_sh,
+ "$Id$")
-ACE_RCSID (be_visitor_interface, base_proxy_broker_sh, "$Id$")
-
-be_visitor_interface_strategized_proxy_broker_sh::be_visitor_interface_strategized_proxy_broker_sh (be_visitor_context *ctx)
+be_visitor_interface_strategized_proxy_broker_sh::
+be_visitor_interface_strategized_proxy_broker_sh (be_visitor_context *ctx)
: be_visitor_interface (ctx)
{
// No-Op.
}
-
-be_visitor_interface_strategized_proxy_broker_sh::~be_visitor_interface_strategized_proxy_broker_sh (void)
+be_visitor_interface_strategized_proxy_broker_sh::
+~be_visitor_interface_strategized_proxy_broker_sh (void)
{
// No-Op.
}
int
-be_visitor_interface_strategized_proxy_broker_sh::visit_interface (be_interface *node)
+be_visitor_interface_strategized_proxy_broker_sh::visit_interface (
+ be_interface *node
+ )
{
- TAO_OutStream *os = this->ctx_->stream ();
-
- // os->gen_ifdef_macro (node->local_name (), "STRATEGIZED_PROXY_BROKER_");
+ TAO_OutStream *os = this->ctx_->stream ();
// Generate the class declaration.
os->indent ();
*os << be_nl
- << "///////////////////////////////////////////////////////////////////////" << be_nl
+ << "///////////////////////////////////////////////////////////////////////"
+ << be_nl
<< "// Strategized Proxy Broker Declaration " << be_nl
<< "//" << be_nl << be_nl;
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
*os << "class " << be_global->skel_export_macro () << " "
<< node->strategized_proxy_broker_name () << " : public virtual "
- << "::" << node->full_base_proxy_broker_name () << be_nl << "{" << be_nl
+ << "::" << node->full_base_proxy_broker_name () << be_nl << "{"
+ << be_nl
<< "public: " << be_idt_nl;
// Constructor
*os << node->strategized_proxy_broker_name () << " (void);" << be_nl << be_nl;
// Destructor
- *os << "virtual ~" << node->strategized_proxy_broker_name () << " (void);" << be_nl << be_nl;
+ *os << "virtual ~" << node->strategized_proxy_broker_name () << " (void);"
+ << be_nl << be_nl;
// Accessor Method
- *os << "virtual " << "::" << node->full_base_proxy_impl_name () << " &" << "select_proxy (" << be_idt_nl;
+ *os << "virtual " << "::" << node->full_base_proxy_impl_name () << " &"
+ << "select_proxy (" << be_idt_nl;
*os << "::" << node->full_name () << " *object" << be_nl
<< "ACE_ENV_ARG_DECL" << be_uidt_nl
@@ -59,8 +67,10 @@ be_visitor_interface_strategized_proxy_broker_sh::visit_interface (be_interface
<< be_nl << "ACE_ENV_ARG_DECL"
<< be_uidt_nl << ");"
<< be_nl << be_nl
- << "// Caches the proxy implementations. The proxy implementation" << be_nl
- << "// are totally stateless, and those can be shared by all the" << be_nl
+ << "// Caches the proxy implementations. The proxy implementation"
+ << be_nl
+ << "// are totally stateless, and those can be shared by all the"
+ << be_nl
<< "// instances of a given IDL interface type." << be_nl
<< "::" << node->full_base_proxy_impl_name () << be_nl
<< "*proxy_cache_[TAO_Collocation_Strategies::CS_LAST];"
@@ -68,8 +78,10 @@ be_visitor_interface_strategized_proxy_broker_sh::visit_interface (be_interface
<< "TAO_SYNCH_MUTEX mutex_;" << be_nl;
// Factory Function declaration.
- *os << "// This funxtion is used to get an handle to the unique instance" << be_nl
- << "// of the Strategized Proxy Broker that is available for a given" << be_nl
+ *os << "// This funxtion is used to get an handle to the unique instance"
+ << be_nl
+ << "// of the Strategized Proxy Broker that is available for a given"
+ << be_nl
<< "// interface."
<< be_uidt_nl << be_nl;
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp
index 644cff1056b..53669d2c205 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp
@@ -1,25 +1,29 @@
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+//
+// $Id$
+//
-#include "be_visitor_interface.h"
+ACE_RCSID (be_visitor_interface,
+ strategized_proxy_broker_ss,
+ "$Id$")
-ACE_RCSID (be_visitor_interface, base_proxy_broker_ss, "$Id$")
-
-be_visitor_interface_strategized_proxy_broker_ss::be_visitor_interface_strategized_proxy_broker_ss (be_visitor_context *ctx)
+be_visitor_interface_strategized_proxy_broker_ss::
+be_visitor_interface_strategized_proxy_broker_ss (be_visitor_context *ctx)
: be_visitor_interface (ctx)
{
// No-Op.
}
-be_visitor_interface_strategized_proxy_broker_ss::~be_visitor_interface_strategized_proxy_broker_ss (void)
+be_visitor_interface_strategized_proxy_broker_ss::
+~be_visitor_interface_strategized_proxy_broker_ss (void)
{
// No-Op.
}
int
-be_visitor_interface_strategized_proxy_broker_ss::visit_interface (be_interface *node)
+be_visitor_interface_strategized_proxy_broker_ss::visit_interface (
+ be_interface *node
+ )
{
TAO_OutStream *os = this->ctx_->stream ();
@@ -27,10 +31,14 @@ be_visitor_interface_strategized_proxy_broker_ss::visit_interface (be_interface
os->indent ();
*os << be_nl
- << "///////////////////////////////////////////////////////////////////////" << be_nl
+ << "///////////////////////////////////////////////////////////////////////"
+ << be_nl
<< "// Strategized Proxy Broker Implementation" << be_nl
<< "//" << be_nl << be_nl;
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
*os << "// Factory function Implementation." << be_nl
<< node->full_strategized_proxy_broker_name ()
<< " *" << node->full_strategized_proxy_broker_name () << "::the"
@@ -126,59 +134,58 @@ be_visitor_interface_strategized_proxy_broker_ss::visit_interface (be_interface
<< "switch (strategy)"
<< be_idt_nl // idt = 4
<< "{" << be_nl;
- if (be_global->gen_thru_poa_collocation ())
- {
- *os << "case TAO_Collocation_Strategies::CS_THRU_POA_STRATEGY:"
- << be_idt_nl // idt = 5
- << "ACE_NEW_THROW_EX ("
- << be_idt << be_idt_nl //idt = 7
- << "this->proxy_cache_[strategy]," << be_nl
- << node->full_thru_poa_proxy_impl_name () << "," << be_nl
- << "CORBA::NO_MEMORY ()"
- << be_uidt << be_uidt_nl // idt = 5
- << ");" << be_nl
- << "ACE_CHECK;" << be_nl
- << "break;"
- << be_nl << be_uidt_nl; // idt = 4
- }
-
- if (be_global->gen_direct_collocation ())
- {
- *os << "case TAO_Collocation_Strategies::CS_DIRECT_STRATEGY:"
- << be_idt_nl // idt = 5
- << "ACE_NEW_THROW_EX ("
- << be_idt << be_idt_nl //idt = 7
- << "this->proxy_cache_[strategy]," << be_nl
- << node->full_direct_proxy_impl_name () << "," << be_nl
- << "CORBA::NO_MEMORY ()"
- << be_uidt << be_uidt_nl // idt = 5
- << ");" << be_nl
- << "ACE_CHECK;" << be_nl
- << "break;"
- << be_nl << be_uidt_nl; // idt = 4
- }
-
- *os << "case TAO_Collocation_Strategies::CS_REMOTE_STRATEGY:" << be_nl
- << "default:"
+
+ if (be_global->gen_thru_poa_collocation ())
+ {
+ *os << "case TAO_Collocation_Strategies::CS_THRU_POA_STRATEGY:"
+ << be_idt_nl // idt = 5
+ << "ACE_NEW_THROW_EX ("
+ << be_idt << be_idt_nl //idt = 7
+ << "this->proxy_cache_[strategy]," << be_nl
+ << node->full_thru_poa_proxy_impl_name () << "," << be_nl
+ << "CORBA::NO_MEMORY ()"
+ << be_uidt << be_uidt_nl // idt = 5
+ << ");" << be_nl
+ << "ACE_CHECK;" << be_nl
+ << "break;"
+ << be_nl << be_uidt_nl; // idt = 4
+ }
+
+ if (be_global->gen_direct_collocation ())
+ {
+ *os << "case TAO_Collocation_Strategies::CS_DIRECT_STRATEGY:"
<< be_idt_nl // idt = 5
<< "ACE_NEW_THROW_EX ("
<< be_idt << be_idt_nl //idt = 7
<< "this->proxy_cache_[strategy]," << be_nl
- << "::" << node->full_remote_proxy_impl_name () << "," << be_nl
+ << node->full_direct_proxy_impl_name () << "," << be_nl
<< "CORBA::NO_MEMORY ()"
<< be_uidt << be_uidt_nl // idt = 5
<< ");" << be_nl
<< "ACE_CHECK;" << be_nl
<< "break;"
- << be_uidt_nl // idt = 4
- << be_uidt_nl // idt = 3
-
+ << be_nl << be_uidt_nl; // idt = 4
+ }
+
+ *os << "case TAO_Collocation_Strategies::CS_REMOTE_STRATEGY:" << be_nl
+ << "default:"
+ << be_idt_nl // idt = 5
+ << "ACE_NEW_THROW_EX ("
+ << be_idt << be_idt_nl //idt = 7
+ << "this->proxy_cache_[strategy]," << be_nl
+ << "::" << node->full_remote_proxy_impl_name () << "," << be_nl
+ << "CORBA::NO_MEMORY ()"
+ << be_uidt << be_uidt_nl // idt = 5
+ << ");" << be_nl
+ << "ACE_CHECK;" << be_nl
+ << "break;"
+ << be_uidt_nl // idt = 4
+ << be_uidt_nl // idt = 3
<< "}"
<< be_uidt_nl // idt = 2
<< be_uidt_nl // idt = 1
<< "}"
<< be_uidt_nl // idt = 0
-
<< "}" << be_nl << be_nl;
*os << be_nl
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_sh.cpp
index b638b69469a..3516857ae54 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_sh.cpp
@@ -1,73 +1,88 @@
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+//
+// $Id$
+//
-#include "be_visitor_interface.h"
+ACE_RCSID (be_visitor_interface,
+ thru_poa_proxy_impl_sh,
+ "$Id$")
-ACE_RCSID (be_visitor_interface, thru_poa_proxy_broker_impl_sh, "$Id$")
-
-be_visitor_interface_thru_poa_proxy_impl_sh::be_visitor_interface_thru_poa_proxy_impl_sh (be_visitor_context *ctx)
+be_visitor_interface_thru_poa_proxy_impl_sh::
+be_visitor_interface_thru_poa_proxy_impl_sh (be_visitor_context *ctx)
: be_visitor_interface (ctx)
{
// No-Op.
}
-be_visitor_interface_thru_poa_proxy_impl_sh::~be_visitor_interface_thru_poa_proxy_impl_sh (void)
+be_visitor_interface_thru_poa_proxy_impl_sh::
+~be_visitor_interface_thru_poa_proxy_impl_sh (void)
{
// No-Op.
}
int
-be_visitor_interface_thru_poa_proxy_impl_sh::visit_interface (be_interface *node)
+be_visitor_interface_thru_poa_proxy_impl_sh::visit_interface (
+ be_interface *node
+ )
{
TAO_OutStream *os = this->ctx_->stream ();
*os << be_nl
- << "///////////////////////////////////////////////////////////////////////" << be_nl
+ << "///////////////////////////////////////////////////////////////////////"
+ << be_nl
<< "// ThruPOA Impl. Declaration" << be_nl
<< "//" << be_nl << be_nl;
+
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Generate Class Declaration.
*os << "class " << be_global->skel_export_macro ()
<< " " << node->thru_poa_proxy_impl_name ();
- *os << " : " << be_idt_nl << "public virtual " << "::" << node->full_base_proxy_impl_name ()
+ *os << " : " << be_idt_nl << "public virtual "
+ << "::" << node->full_base_proxy_impl_name ()
<< "," << be_nl << "public virtual " << "TAO_ThruPOA_Object_Proxy_Impl";
if (node->n_inherits () > 0)
{
- *os << "," << be_nl;
+ AST_Interface *parent = 0;
+
for (int i = 0; i < node->n_inherits (); i++)
{
+ parent = node->inherits ()[i];
+
+ if (parent->is_abstract ())
+ {
+ continue;
+ }
+
+ *os << "," << be_nl;
+
be_interface *inherited =
- be_interface::narrow_from_decl (node->inherits ()[i]);
+ be_interface::narrow_from_decl (parent);
*os << "public virtual ";
*os << "::" << inherited->full_thru_poa_proxy_impl_name ();
- if (i < node->n_inherits () - 1) // node is the case of multiple
- // inheritance, so put a comma
- {
- *os << ", ";
- }
- *os << be_nl;
- } // end of for loop
+ }
}
*os << be_uidt_nl;
- *os << "{" << be_nl << "public:" << be_idt_nl;
+ *os << "{" << be_nl << "public:" << be_idt_nl;
- // Ctor
- *os << node->thru_poa_proxy_impl_name () << " (void);" << be_nl << be_nl;
+ // Ctor
+ *os << node->thru_poa_proxy_impl_name () << " (void);" << be_nl << be_nl;
- // Dtor
- *os << "virtual ~" << node->thru_poa_proxy_impl_name ()
- << " (void) { }" << be_nl << be_nl;
+ // Dtor
+ *os << "virtual ~" << node->thru_poa_proxy_impl_name ()
+ << " (void) { }" << be_nl << be_nl;
if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) thru_poa_proxy_impl_sh::"
"visit_interface - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
*os << be_uidt_nl << "};" << be_nl;
@@ -76,7 +91,62 @@ be_visitor_interface_thru_poa_proxy_impl_sh::visit_interface (be_interface *node
<< "// ThruPOA Proxy Impl. Declaration" << be_nl
<< "///////////////////////////////////////////////////////////////////////"
<< be_nl << be_nl;
- // os->gen_endif ();
+
return 0;
}
+
+int
+be_visitor_interface_thru_poa_proxy_impl_sh::gen_abstract_ops_helper (
+ be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os
+ )
+{
+ if (node == base)
+ {
+ return 0;
+ }
+
+ AST_Decl *d = 0;
+ be_visitor_context ctx;
+ ctx.stream (os);
+
+ for (UTL_ScopeActiveIterator si (base, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ d = si.item ();
+
+ if (d == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_thru_poa_proxy_"
+ "impl_sh::abstract_base_ops_helper - "
+ "bad node in this scope\n"),
+ -1);
+ }
+
+ if (d->node_type () == AST_Decl::NT_op)
+ {
+ UTL_ScopedName item_new_name (d->local_name (),
+ 0);
+
+ AST_Operation *op = AST_Operation::narrow_from_decl (d);
+ be_operation new_op (op->return_type (),
+ op->flags (),
+ &item_new_name,
+ op->is_local (),
+ op->is_abstract ());
+ new_op.set_defined_in (node);
+ be_visitor_interface::add_abstract_op_args (op,
+ new_op);
+ ctx.state (TAO_CodeGen::TAO_OPERATION_PROXY_IMPL_XH);
+ be_visitor_operation_proxy_impl_xh op_visitor (&ctx);
+ op_visitor.visit_operation (&new_op);
+ }
+ }
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_ss.cpp
index 8e7105a8c03..1a6264ba044 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_ss.cpp
@@ -1,43 +1,45 @@
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+//
+// $Id$
+//
-#include "be_visitor_interface.h"
+ACE_RCSID (be_visitor_interface,
+ thru_poa_proxy_impl_ss,
+ "$Id$")
-ACE_RCSID (be_visitor_interface, thru_poa_proxy_broker_impl_ss, "$Id$")
-
-be_visitor_interface_thru_poa_proxy_impl_ss::be_visitor_interface_thru_poa_proxy_impl_ss (be_visitor_context *ctx)
+be_visitor_interface_thru_poa_proxy_impl_ss::
+be_visitor_interface_thru_poa_proxy_impl_ss (be_visitor_context *ctx)
: be_visitor_interface (ctx)
{
// No-Op.
}
-be_visitor_interface_thru_poa_proxy_impl_ss::~be_visitor_interface_thru_poa_proxy_impl_ss (void)
+be_visitor_interface_thru_poa_proxy_impl_ss::
+~be_visitor_interface_thru_poa_proxy_impl_ss (void)
{
// No-Op.
}
int
-be_visitor_interface_thru_poa_proxy_impl_ss::visit_interface (be_interface *node)
+be_visitor_interface_thru_poa_proxy_impl_ss::visit_interface (
+ be_interface *node
+ )
{
TAO_OutStream *os = this->ctx_->stream ();
*os << be_nl
- << "///////////////////////////////////////////////////////////////////////\n"
+ << "///////////////////////////////////////////////////////////////////////"
+ << be_nl
<< "// ThruPOA Proxy Implementation\n"
<< "//\n\n";
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Ctor Implementation
*os << node->full_thru_poa_proxy_impl_name () << "::"
<< node->thru_poa_proxy_impl_name () << " (void)" << be_nl
<< "{}" << be_nl << be_nl;
- /*
- // Dtor Implementation
- *os << node->full_thru_poa_proxy_impl_name () << "::~"
- << node->thru_poa_proxy_impl_name () << " (void)" << be_nl
- << "{}" << be_nl << be_nl;
- */
// Generate the code for the ThruPOA Proxy Impl.
// operations
@@ -61,3 +63,69 @@ be_visitor_interface_thru_poa_proxy_impl_ss::visit_interface (be_interface *node
return 0;
}
+
+int
+be_visitor_interface_thru_poa_proxy_impl_ss::gen_abstract_ops_helper (
+ be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os
+ )
+{
+ if (node == base)
+ {
+ return 0;
+ }
+
+ AST_Decl *d = 0;
+ be_visitor_context ctx;
+ ctx.stream (os);
+
+ for (UTL_ScopeActiveIterator si (base, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ d = si.item ();
+
+ if (d == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_thru_poa_proxy"
+ "_impl_ss::abstract_base_ops_helper - "
+ "bad node in this scope\n"),
+ -1);
+ }
+
+ if (d->node_type () == AST_Decl::NT_op)
+ {
+ UTL_ScopedName *item_new_name = 0;
+ ACE_NEW_RETURN (item_new_name,
+ UTL_ScopedName (d->local_name ()->copy (),
+ 0),
+ -1);
+
+ UTL_ScopedName *base = (UTL_ScopedName *)node->name ()->copy ();
+ base->nconc (item_new_name);
+
+ AST_Operation *op = AST_Operation::narrow_from_decl (d);
+ be_operation new_op (op->return_type (),
+ op->flags (),
+ 0,
+ op->is_local (),
+ op->is_abstract ());
+ new_op.set_defined_in (node);
+ be_visitor_interface::add_abstract_op_args (op,
+ new_op);
+ new_op.set_name (base);
+ ctx.state (TAO_CodeGen::TAO_OPERATION_THRU_POA_PROXY_IMPL_SS);
+ be_visitor_operation_thru_poa_proxy_impl_ss op_visitor (&ctx);
+ op_visitor.visit_operation (&new_op);
+
+ base->destroy ();
+ delete base;
+ base = 0;
+ }
+ }
+
+ 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
index 5cf10eaa315..8421f97c59d 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/tie_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/tie_sh.cpp
@@ -19,20 +19,17 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface.h"
-
-ACE_RCSID(be_visitor_interface, tie_sh, "$Id$")
-
+ACE_RCSID (be_visitor_interface,
+ tie_sh,
+ "$Id$")
// ************************************************************
-// Interface visitor for server header
+// Interface visitor for server header.
// ************************************************************
-be_visitor_interface_tie_sh::be_visitor_interface_tie_sh (be_visitor_context *ctx)
+be_visitor_interface_tie_sh::be_visitor_interface_tie_sh (
+ be_visitor_context *ctx
+ )
: be_visitor_interface (ctx)
{
}
@@ -47,7 +44,7 @@ be_visitor_interface_tie_sh::visit_interface (be_interface *node)
static char namebuf [NAMEBUFSIZE];
static char tiename [NAMEBUFSIZE];
- if (node->imported ())
+ if (node->imported () || node->is_abstract ())
{
return 0;
}
@@ -88,6 +85,9 @@ be_visitor_interface_tie_sh::visit_interface (be_interface *node)
// Now generate the class definition.
os->indent ();
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
*os << "// TIE class: Refer to CORBA v2.2, Section 20.34.4" << be_nl;
*os << "template <class T>" << be_nl;
*os << "class " << " " << tiename << " : public " << namebuf << be_nl;
@@ -120,10 +120,13 @@ be_visitor_interface_tie_sh::visit_interface (be_interface *node)
<< "ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
<< ");" << be_uidt << "\n";
- if (node->traverse_inheritance_graph (
- be_visitor_interface_tie_sh::method_helper,
- os
- ) == -1)
+ int status =
+ node->traverse_inheritance_graph (
+ be_visitor_interface_tie_sh::method_helper,
+ os
+ );
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_interface_tie_sh_ss::"
@@ -133,6 +136,7 @@ be_visitor_interface_tie_sh::visit_interface (be_interface *node)
}
os->decr_indent (1);
+
*os << "private:" << be_idt_nl
<< "T *ptr_;" << be_nl
<< "PortableServer::POA_var poa_;" << be_nl
@@ -147,23 +151,30 @@ be_visitor_interface_tie_sh::visit_interface (be_interface *node)
int
be_visitor_interface_tie_sh::method_helper (be_interface *,
- be_interface *node,
- TAO_OutStream *os)
+ be_interface *node,
+ TAO_OutStream *os)
{
+ // Any methods from abstract parents have already been
+ // "added" to the derived interface scope by the overridden
+ // visit_scope() method in be_visitor_interface, so we can skip
+ // this base interface, if it is abstract.
+ if (node->is_abstract ())
+ {
+ return 0;
+ }
+
be_visitor_context ctx;
ctx.state (TAO_CodeGen::TAO_INTERFACE_TIE_SH);
-
ctx.stream (os);
- be_visitor* visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_interface_tie_sh visitor (&ctx);
- if (visitor == 0 || visitor->visit_scope (node) == -1)
+ if (visitor.visit_scope (node) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_interface_tie_sh::"
- "method_helper\n"), -1);
+ "method_helper\n"),
+ -1);
}
- delete visitor;
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
index 7a42da46f21..560b8213187 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/tie_si.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/tie_si.cpp
@@ -19,20 +19,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface.h"
-
-ACE_RCSID(be_visitor_interface, tie_si, "$Id$")
+ACE_RCSID (be_visitor_interface,
+ tie_si,
+ "$Id$")
// ************************************************************************
// Interface visitor for server inline
// ************************************************************************
-be_visitor_interface_tie_si::be_visitor_interface_tie_si (be_visitor_context *ctx)
+be_visitor_interface_tie_si::be_visitor_interface_tie_si (
+ be_visitor_context *ctx
+ )
: be_visitor_interface (ctx)
{
}
@@ -44,46 +42,67 @@ 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
- static char localskelname [NAMEBUFSIZE]; // holds the local skeleton name
-
- if (node->srv_inline_gen () || node->imported ())
- return 0;
+ if (node->srv_inline_gen () || node->imported () || node->is_abstract ())
+ {
+ return 0;
+ }
- ACE_OS::memset (fulltiename, '\0', NAMEBUFSIZE);
- ACE_OS::memset (localtiename, '\0', NAMEBUFSIZE);
- ACE_OS::memset (localskelname, '\0', NAMEBUFSIZE);
+ TAO_OutStream *os;
+ static char fulltiename [NAMEBUFSIZE];
+ static char localtiename [NAMEBUFSIZE];
+ static char localskelname [NAMEBUFSIZE];
+
+ ACE_OS::memset (fulltiename,
+ '\0',
+ NAMEBUFSIZE);
+ ACE_OS::memset (localtiename,
+ '\0',
+ NAMEBUFSIZE);
+ ACE_OS::memset (localskelname,
+ '\0',
+ NAMEBUFSIZE);
os = this->ctx_->stream ();
- // generate the skeleton class name which will be used to determine the TIE
- // class name
+ // 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 ());
- // we are outermost
- ACE_OS::sprintf (fulltiename, "%s_tie", node->full_skel_name ());
if (!node->is_nested ())
{
- ACE_OS::sprintf (localskelname, "POA_%s",
+ ACE_OS::sprintf (localskelname,
+ "POA_%s",
node->local_name ());
- ACE_OS::sprintf (localtiename, "POA_%s_tie",
+ ACE_OS::sprintf (localtiename,
+ "POA_%s_tie",
node->local_name ());
}
else
{
- ACE_OS::sprintf (localskelname, "%s",
+ ACE_OS::sprintf (localskelname,
+ "%s",
node->local_name ());
- ACE_OS::sprintf (localtiename, "%s_tie",
+ ACE_OS::sprintf (localtiename,
+ "%s_tie",
node->local_name ());
}
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
if (node->is_nested ())
{
*os << "#if defined (ACE_HAS_USING_KEYWORD)\n\n";
}
- os->indent (); // start with whatever indentation level we are at
+ os->indent ();
+
+ *os << "// TAO_IDL - Generated from "
+ << __FILE__ << ":" << __LINE__ << be_nl << be_nl << be_nl;
*os << "template <class T> ACE_INLINE" << be_nl
<< fulltiename << "<T>::" << localtiename << " (T &t)" << be_nl
@@ -170,7 +189,13 @@ be_visitor_interface_tie_si::visit_interface (be_interface *node)
<< "::_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER);" << be_uidt_nl
<< "}\n\n";
- if (node->traverse_inheritance_graph (be_visitor_interface_tie_si::method_helper, os) == -1)
+ int status =
+ node->traverse_inheritance_graph (
+ be_visitor_interface_tie_si::method_helper,
+ os
+ );
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_interface_tie_sh_ss::"
@@ -192,19 +217,29 @@ be_visitor_interface_tie_si::method_helper (be_interface *derived,
be_interface *node,
TAO_OutStream *os)
{
+ // Any methods from abstract parents have already been
+ // "added" to the derived interface scope by the overridden
+ // visit_scope() method in be_visitor_interface, so we can skip
+ // this base interface, if it is abstract.
+ if (node->is_abstract ())
+ {
+ return 0;
+ }
+
be_visitor_context ctx;
ctx.state (TAO_CodeGen::TAO_INTERFACE_TIE_SI);
ctx.interface (derived);
ctx.stream (os);
+ be_visitor_interface_tie_si visitor (&ctx);
+
+ if (visitor.visit_scope (node) == -1)
- be_visitor* visitor = tao_cg->make_visitor (&ctx);
- if (visitor == 0 || visitor->visit_scope (node) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_interface_tie_sh::"
- "method_helper\n"), -1);
+ "method_helper\n"),
+ -1);
}
- delete visitor;
+
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 0796b99e556..a042bdc1498 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface_fwd.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface_fwd.cpp
@@ -18,17 +18,20 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_interface_fwd.h"
+#include "be_interface.h"
#include "be_visitor_interface_fwd.h"
+#include "be_visitor_context.h"
+#include "be_helper.h"
+#include "be_extern.h"
-// include all the individual files
#include "be_visitor_interface_fwd/interface_fwd_ch.cpp"
#include "be_visitor_interface_fwd/interface_fwd_ci.cpp"
#include "be_visitor_interface_fwd/cdr_op_ch.cpp"
#include "be_visitor_interface_fwd/cdr_op_ci.cpp"
#include "be_visitor_interface_fwd/any_op_ch.cpp"
-ACE_RCSID(be, be_visitor_interface_fwd, "$Id$")
+ACE_RCSID (be,
+ be_visitor_interface_fwd,
+ "$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_interface_fwd/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface_fwd/any_op_ch.cpp
index 85a5f916b17..eafc335ad18 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface_fwd/any_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface_fwd/any_op_ch.cpp
@@ -19,13 +19,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_interface_fwd.h"
-
-ACE_RCSID(be_visitor_interface_fwd, any_op_ch, "$Id$")
-
+ACE_RCSID (be_visitor_interface_fwd,
+ any_op_ch,
+ "$Id$")
// ***************************************************************************
// Generates Any operator declarations in the client header
@@ -76,6 +72,5 @@ be_visitor_interface_fwd_any_op_ch::visit_interface_fwd (
<< node->name () << " *&);\n";
node->cli_hdr_any_op_gen (1);
-
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface_fwd/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface_fwd/cdr_op_ch.cpp
index 51806a8387b..be788d61101 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface_fwd/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface_fwd/cdr_op_ch.cpp
@@ -19,21 +19,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface_fwd.h"
-
-ACE_RCSID(be_visitor_interface_fwd, cdr_op_ch, "$Id$")
+ACE_RCSID (be_visitor_interface_fwd,
+ cdr_op_ch,
+ "$Id$")
// ***************************************************************************
// Forward declared interface visitor for generating CDR operator declarations
// in the client header. Called if this node is not later defined in the file.
// ***************************************************************************
-be_visitor_interface_fwd_cdr_op_ch::be_visitor_interface_fwd_cdr_op_ch
-(be_visitor_context *ctx)
+be_visitor_interface_fwd_cdr_op_ch::be_visitor_interface_fwd_cdr_op_ch (
+ be_visitor_context *ctx
+ )
: be_visitor_decl (ctx)
{
}
@@ -68,6 +65,7 @@ be_visitor_interface_fwd_cdr_op_ch::visit_interface_fwd (be_interface_fwd *node)
// Generate the CDR << and >> operator declarations.
os->indent ();
+
*os << be_global->stub_export_macro () << " CORBA::Boolean "
<< "operator<< (TAO_OutputCDR &, const " << node->full_name ()
<< "_ptr );" << be_nl;
@@ -76,6 +74,5 @@ be_visitor_interface_fwd_cdr_op_ch::visit_interface_fwd (be_interface_fwd *node)
<< node->full_name () << "_ptr &);\n";
node->cli_hdr_cdr_op_gen (1);
-
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface_fwd/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_interface_fwd/cdr_op_ci.cpp
index d6018d72cd6..34b287aa202 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface_fwd/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface_fwd/cdr_op_ci.cpp
@@ -19,13 +19,9 @@
//
// ================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface_fwd.h"
-
-ACE_RCSID(be_visitor_interface_fwd, cdr_op_ci, "$Id$")
+ACE_RCSID (be_visitor_interface_fwd,
+ cdr_op_ci,
+ "$Id$")
// ****************************************************************
// Interface visitor for generating CDR operator declarations in the
@@ -61,6 +57,7 @@ be_visitor_interface_fwd_cdr_op_ci::visit_interface_fwd (
// generate the CDR << and >> operator declarations
os->indent ();
+
*os << be_global->stub_export_macro () << " CORBA::Boolean operator<< ("
<< be_idt << be_idt_nl
<< "TAO_OutputCDR &," << be_nl
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
index feb767c831c..7984871f1ee 100644
--- 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
@@ -18,21 +18,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface_fwd.h"
-
-ACE_RCSID(be_visitor_interface_fwd, interface_fwd_ch, "$Id$")
-
+ACE_RCSID (be_visitor_interface_fwd,
+ interface_fwd_ch,
+ "$Id$")
// ********************************************************************
// 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_interface_fwd_ch::be_visitor_interface_fwd_ch (
+ be_visitor_context *ctx
+ )
: be_visitor_decl (ctx)
{
}
@@ -45,13 +42,13 @@ be_visitor_interface_fwd_ch::~be_visitor_interface_fwd_ch (void)
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 ())
{
return 0;
}
+ TAO_OutStream *os = this->ctx_->stream ();
+
// All we do in this is generate a forward declaration of the class.
*os << "class " << node->local_name () << ";" << be_nl;
@@ -106,6 +103,5 @@ be_visitor_interface_fwd_ch::visit_interface_fwd (be_interface_fwd *node)
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
index 70c08b598d5..8fa023edc4b 100644
--- 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
@@ -18,21 +18,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_interface_fwd.h"
-
-ACE_RCSID(be_visitor_interface_fwd, interface_fwd_ci, "$Id$")
-
+ACE_RCSID (be_visitor_interface_fwd,
+ interface_fwd_ci,
+ "$Id$")
// ********************************************************************
// 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_interface_fwd_ci::be_visitor_interface_fwd_ci (
+ be_visitor_context *ctx
+ )
: be_visitor_decl (ctx)
{
}
diff --git a/TAO/TAO_IDL/be/be_visitor_module.cpp b/TAO/TAO_IDL/be/be_visitor_module.cpp
index 1bd1b4ffe36..6028e016bb0 100644
--- a/TAO/TAO_IDL/be/be_visitor_module.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_module.cpp
@@ -18,13 +18,38 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_module.h"
+#include "be_constant.h"
+#include "be_enum.h"
+#include "be_exception.h"
+#include "be_interface.h"
+#include "be_interface_fwd.h"
+#include "be_structure.h"
+#include "be_structure_fwd.h"
+#include "be_typedef.h"
+#include "be_union.h"
+#include "be_union_fwd.h"
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
+#include "be_extern.h"
+#include "be_helper.h"
+#include "utl_err.h"
#include "be_visitor_module.h"
+#include "be_visitor_constant.h"
+#include "be_visitor_enum.h"
+#include "be_visitor_exception.h"
+#include "be_visitor_interface.h"
+#include "be_visitor_interface_fwd.h"
+#include "be_visitor_structure.h"
+#include "be_visitor_structure_fwd.h"
+#include "be_visitor_typedef.h"
+#include "be_visitor_union.h"
+#include "be_visitor_union_fwd.h"
+#include "be_visitor_valuetype.h"
+#include "be_visitor_valuetype_fwd.h"
+#include "be_visitor_context.h"
-// include all the individual files
#include "be_visitor_module/module.cpp"
#include "be_visitor_module/module_ch.cpp"
#include "be_visitor_module/module_sh.cpp"
@@ -32,5 +57,7 @@
#include "be_visitor_module/any_op.cpp"
#include "be_visitor_module/cdr_op.cpp"
-ACE_RCSID(be, be_visitor_module, "$Id$")
+ACE_RCSID (be,
+ be_visitor_module,
+ "$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_module/any_op.cpp b/TAO/TAO_IDL/be/be_visitor_module/any_op.cpp
index 2d50f3b54d0..5819d998f17 100644
--- a/TAO/TAO_IDL/be/be_visitor_module/any_op.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_module/any_op.cpp
@@ -19,14 +19,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_module.h"
-
-ACE_RCSID(be_visitor_module, any_op, "$Id$")
-
+ACE_RCSID (be_visitor_module,
+ any_op,
+ "$Id$")
// ***************************************************************************
// Module visitor for generating Any operator declarations in the client header
@@ -45,12 +40,13 @@ 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);
+ "codegen for scope failed\n"),
+ -1);
}
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_module/cdr_op.cpp b/TAO/TAO_IDL/be/be_visitor_module/cdr_op.cpp
index 9f3fd486ddf..540057da455 100644
--- a/TAO/TAO_IDL/be/be_visitor_module/cdr_op.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_module/cdr_op.cpp
@@ -19,14 +19,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_module.h"
-
-ACE_RCSID(be_visitor_module, cdr_op, "$Id")
-
+ACE_RCSID (be_visitor_module,
+ cdr_op,
+ "$Id: cdr_op.cpp,v 1.2 1999/05/28 02:16:43 coryan Exp ")
// ***************************************************************************
// Module visitor for generating CDR operator declarations in the client header
@@ -45,12 +40,13 @@ be_visitor_module_cdr_op::~be_visitor_module_cdr_op (void)
int
be_visitor_module_cdr_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_cdr_op::visit_module - "
- "codegen for scope failed\n"), -1);
+ "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
index d57c95b1ace..db31834b964 100644
--- a/TAO/TAO_IDL/be/be_visitor_module/module.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_module/module.cpp
@@ -18,13 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_module.h"
-
-ACE_RCSID(be_visitor_module, module, "$Id$")
+ACE_RCSID (be_visitor_module,
+ module,
+ "$Id$")
// ******************************************************
@@ -40,7 +36,6 @@ be_visitor_module::~be_visitor_module (void)
{
}
-// visit the Module node and its scope
int be_visitor_module::visit_module (be_module *node)
{
if (node->nmembers () == 0)
@@ -49,41 +44,44 @@ int be_visitor_module::visit_module (be_module *node)
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);
+ "codegen for scope failed\n"),
+ -1);
}
return 0;
}
-// =all common visit methods for module visitor
+// 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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_MODULE_CH:
- ctx.state (TAO_CodeGen::TAO_CONSTANT_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_CONSTANT_CH);
+ be_visitor_constant_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CS:
- ctx.state (TAO_CodeGen::TAO_CONSTANT_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_CONSTANT_CS);
+ be_visitor_constant_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
case TAO_CodeGen::TAO_MODULE_ANY_OP_CS:
case TAO_CodeGen::TAO_MODULE_CDR_OP_CH:
@@ -101,70 +99,77 @@ be_visitor_module::visit_constant (be_constant *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
"visit_constant - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
"visit_constant - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_MODULE_CH:
- ctx.state (TAO_CodeGen::TAO_ENUM_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_CH);
+ be_visitor_enum_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CS:
- ctx.state (TAO_CodeGen::TAO_ENUM_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_CS);
+ be_visitor_enum_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CH);
+ be_visitor_enum_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CS);
+ be_visitor_enum_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CH);
+ be_visitor_enum_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CI);
+ be_visitor_enum_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CS);
- break;
case TAO_CodeGen::TAO_MODULE_CI:
case TAO_CodeGen::TAO_MODULE_SH:
case TAO_CodeGen::TAO_MODULE_IH:
@@ -177,73 +182,90 @@ be_visitor_module::visit_enum (be_enum *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
"visit_enum - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
"visit_enum - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_MODULE_CH:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CH);
+ be_visitor_exception_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CI:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CI);
+ be_visitor_exception_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CS:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CS);
+ be_visitor_exception_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CH);
+ be_visitor_exception_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CS);
+ be_visitor_exception_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CH);
+ be_visitor_exception_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CI);
+ be_visitor_exception_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CS);
+ be_visitor_exception_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_SH:
case TAO_CodeGen::TAO_MODULE_IH:
case TAO_CodeGen::TAO_MODULE_SI:
@@ -260,115 +282,161 @@ be_visitor_module::visit_exception (be_exception *node)
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
"visit_exception - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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
+ ctx.node (node);
+ int status = 1;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_MODULE_CH:
+ // This is the only context state involved in strategies.
ctx.state (TAO_CodeGen::TAO_INTERFACE_CH);
break;
case TAO_CodeGen::TAO_MODULE_CI:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_CI);
+ be_visitor_interface_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CS:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_CS);
+ be_visitor_interface_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_SH:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_SH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_SH);
+ be_visitor_interface_sh visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_IH:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_IH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_IH);
+ be_visitor_interface_ih visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_SI:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_SI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_SI);
+ be_visitor_interface_si visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_SS:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_SS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_SS);
+ be_visitor_interface_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_IS:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_IS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_IS);
+ be_visitor_interface_is visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH);
+ be_visitor_interface_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS);
+ be_visitor_interface_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_CDR_OP_CH);
+ be_visitor_interface_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_CDR_OP_CI);
+ be_visitor_interface_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_CDR_OP_CS);
+ be_visitor_interface_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
"visit_interface - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
+ if (status == 0)
+ {
+ return 0;
+ }
+ else if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::"
+ "visit_interface - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
// Change the state depending on the kind of node strategy
ctx.state (node->next_state (ctx.state ()));
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);
+ "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);
+ "failed to accept visitor\n"),
+ -1);
}
+
delete visitor;
visitor = 0;
@@ -377,28 +445,29 @@ be_visitor_module::visit_interface (be_interface *node)
// the node.
if (node->has_extra_code_generation (ctx.state ()))
{
- // Change the state depending on the kind of node strategy
+ // Change the state depending on the kind of node strategy.
ctx.state (node->next_state (ctx.state (), 1));
visitor = tao_cg->make_visitor (&ctx);
+
if (!visitor)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
"visit_interface - "
- "NUL visitor\n"
- ), -1);
+ "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);
+ "failed to accept visitor\n"),
+ -1);
}
+
delete visitor;
visitor = 0;
}
@@ -406,39 +475,53 @@ be_visitor_module::visit_interface (be_interface *node)
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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_MODULE_CH:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CH);
+ be_visitor_interface_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CI:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CI);
+ be_visitor_interface_fwd_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CDR_OP_CI);
- break;
- case TAO_CodeGen::TAO_MODULE_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CDR_OP_CI);
+ be_visitor_interface_fwd_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_ANY_OP_CH);
+ be_visitor_interface_fwd_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CDR_OP_CH);
+ be_visitor_interface_fwd_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_MODULE_CDR_OP_CS:
case TAO_CodeGen::TAO_MODULE_ANY_OP_CS:
case TAO_CodeGen::TAO_MODULE_CS:
case TAO_CodeGen::TAO_MODULE_SH:
@@ -452,173 +535,175 @@ be_visitor_module::visit_interface_fwd (be_interface_fwd *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
"visit_interface_fwd - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
"visit_interface_fwd - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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 valuetype
int
be_visitor_module::visit_valuetype (be_valuetype *node)
{
- // instantiate a visitor context with a copy of our context. This info
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_MODULE_CH:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_CH);
+ be_visitor_valuetype_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CI:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_CI);
+ be_visitor_valuetype_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CS:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_CS);
+ be_visitor_valuetype_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CH);
+ be_visitor_valuetype_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CI);
+ be_visitor_valuetype_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CS);
+ be_visitor_valuetype_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CH);
+ be_visitor_valuetype_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CS);
+ be_visitor_valuetype_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_SH:
- case TAO_CodeGen::TAO_MODULE_IH:
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_SH);
+ be_visitor_valuetype_sh visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_SI:
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_SI);
+ be_visitor_valuetype_si visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_SS:
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_SS);
+ be_visitor_valuetype_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_MODULE_IH:
case TAO_CodeGen::TAO_MODULE_IS:
- return 0; // nothing to do, resp. not yet impl.
+ return 0; // nothing to do.
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
"visit_valuetype - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- // Change the state depending on the kind of node strategy
- ctx.state (node->next_state (ctx.state ()));
-
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
"visit_valuetype - "
- "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_valuetype - "
- "failed to accept visitor\n"
- ), -1);
- }
- delete visitor;
- visitor = 0;
-
- // Do addtional "extra" code generation if necessary
- if (node->has_extra_code_generation (ctx.state ()))
- {
- // Change the state depending on the kind of node strategy
- ctx.state (node->next_state (ctx.state (), 1));
-
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_module::"
- "visit_valuetype - "
- "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_valuetype - "
- "failed to accept visitor\n"
- ), -1);
- }
- delete visitor;
- visitor = 0;
+ "failed to accept visitor\n"),
+ -1);
}
return 0;
}
-// visit a valuetype_fwd
int
be_visitor_module::visit_valuetype_fwd (be_valuetype_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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_MODULE_CH:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CH);
+ be_visitor_valuetype_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CI:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CI);
+ be_visitor_valuetype_fwd_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CH);
+ be_visitor_valuetype_fwd_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CI);
+ be_visitor_valuetype_fwd_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CS:
case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
case TAO_CodeGen::TAO_MODULE_ANY_OP_CS:
@@ -634,73 +719,90 @@ be_visitor_module::visit_valuetype_fwd (be_valuetype_fwd *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
"visit_valuetype_fwd - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
"visit_valuetype_fwd - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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_valuetype_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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_MODULE_CH:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CH);
+ be_visitor_structure_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CI:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CI);
+ be_visitor_structure_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CS:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CS);
+ be_visitor_structure_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CH);
+ be_visitor_structure_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CS);
+ be_visitor_structure_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CH);
+ be_visitor_structure_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CI);
+ be_visitor_structure_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CS);
+ be_visitor_structure_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_SH:
case TAO_CodeGen::TAO_MODULE_IH:
case TAO_CodeGen::TAO_MODULE_SI:
@@ -712,73 +814,143 @@ be_visitor_module::visit_structure (be_structure *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
"visit_structure - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
"visit_structure - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept visitor\n"),
+ -1);
}
- // let the node accept this visitor
- if (node->accept (visitor) == -1)
+ return 0;
+}
+
+int
+be_visitor_module::visit_structure_fwd (be_structure_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);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_MODULE_CH:
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_FWD_CH);
+ be_visitor_structure_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_MODULE_CI:
+ case TAO_CodeGen::TAO_MODULE_CDR_OP_CI:
+ case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
+ case TAO_CodeGen::TAO_MODULE_CDR_OP_CH:
+ case TAO_CodeGen::TAO_MODULE_CDR_OP_CS:
+ 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:
+ case TAO_CodeGen::TAO_MODULE_IH:
+ case TAO_CodeGen::TAO_MODULE_IS:
+ return 0; // nothing to be done
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::"
+ "visit_structure_fwd - "
+ "Bad context state\n"),
+ -1);
+ }
+ }
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
- "visit_structure - "
- "failed to accept visitor\n"
- ), -1);
+ "visit_structure_fwd - "
+ "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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_MODULE_CH:
- ctx.state (TAO_CodeGen::TAO_UNION_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CH);
+ be_visitor_union_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CI:
- ctx.state (TAO_CodeGen::TAO_UNION_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CI);
+ be_visitor_union_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CS:
- ctx.state (TAO_CodeGen::TAO_UNION_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CS);
+ be_visitor_union_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CH);
+ be_visitor_union_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CS);
+ be_visitor_union_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CH);
+ be_visitor_union_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CI);
+ be_visitor_union_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CS);
+ be_visitor_union_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_SH:
case TAO_CodeGen::TAO_MODULE_IH:
case TAO_CodeGen::TAO_MODULE_SI:
@@ -790,73 +962,143 @@ be_visitor_module::visit_union (be_union *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
"visit_union - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
"visit_union - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept visitor\n"),
+ -1);
}
- // let the node accept this visitor
- if (node->accept (visitor) == -1)
+ return 0;
+}
+
+int
+be_visitor_module::visit_union_fwd (be_union_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);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_MODULE_CH:
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_FWD_CH);
+ be_visitor_union_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_MODULE_CI:
+ case TAO_CodeGen::TAO_MODULE_CDR_OP_CI:
+ case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
+ case TAO_CodeGen::TAO_MODULE_CDR_OP_CH:
+ case TAO_CodeGen::TAO_MODULE_CDR_OP_CS:
+ 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:
+ case TAO_CodeGen::TAO_MODULE_IH:
+ case TAO_CodeGen::TAO_MODULE_IS:
+ return 0; // nothing to be done
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::"
+ "visit_union_fwd - "
+ "Bad context state\n"),
+ -1);
+ }
+ }
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
- "visit_union - "
- "failed to accept visitor\n"
- ), -1);
+ "visit_union_fwd - "
+ "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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_MODULE_CH:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CH);
+ be_visitor_typedef_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CI:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CI);
+ be_visitor_typedef_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CS:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CS);
+ be_visitor_typedef_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH);
+ be_visitor_typedef_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS);
+ be_visitor_typedef_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CH);
+ be_visitor_typedef_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CI);
+ be_visitor_typedef_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CS);
+ be_visitor_typedef_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_SH:
case TAO_CodeGen::TAO_MODULE_SI:
case TAO_CodeGen::TAO_MODULE_SS:
@@ -868,30 +1110,19 @@ be_visitor_module::visit_typedef (be_typedef *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
"visit_typedef - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
"visit_typedef - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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
index 8f6ec45705d..85e5719acc8 100644
--- a/TAO/TAO_IDL/be/be_visitor_module/module_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_module/module_ch.cpp
@@ -17,14 +17,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_module.h"
-
-ACE_RCSID(be_visitor_module, module_ch, "$Id$")
-
+ACE_RCSID (be_visitor_module,
+ module_ch,
+ "$Id$")
// ******************************************************
// Module visitor for client header
@@ -42,13 +37,15 @@ 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 ();
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
os->indent ();
+
*os << "TAO_NAMESPACE "
<< " " << node->local_name () << be_nl
<< "{" << be_idt_nl;
@@ -61,10 +58,14 @@ be_visitor_module_ch::visit_module (be_module *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module_ch::"
"visit_module - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
- *os << be_uidt_nl
+ *os << be_uidt_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
+
+ *os << be_nl
<< "}\nTAO_NAMESPACE_CLOSE // module " << node->name () << "\n\n";
}
diff --git a/TAO/TAO_IDL/be/be_visitor_module/module_ih.cpp b/TAO/TAO_IDL/be/be_visitor_module/module_ih.cpp
index 4c715342240..92eacef28aa 100644
--- a/TAO/TAO_IDL/be/be_visitor_module/module_ih.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_module/module_ih.cpp
@@ -16,13 +16,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_module.h"
-
-ACE_RCSID(be_visitor_module, module_ih, "$Id$")
+ACE_RCSID (be_visitor_module,
+ module_ih,
+ "$Id$")
// ************************************************************
// Module visitor for server header
@@ -40,17 +36,17 @@ be_visitor_module_ih::~be_visitor_module_ih (void)
int
be_visitor_module_ih::visit_module (be_module *node)
{
- if (!node->impl_hdr_gen () && !node->imported ()) // not generated and not imported
+ if (!node->impl_hdr_gen () && !node->imported ())
{
-
if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_module_sh::"
+ "(%N:%l) be_visitor_module_ih::"
"visit_module - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
-
}
+
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
index f6173c11bf2..69277ece870 100644
--- a/TAO/TAO_IDL/be/be_visitor_module/module_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_module/module_sh.cpp
@@ -17,14 +17,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_module.h"
-
-ACE_RCSID(be_visitor_module, module_sh, "$Id$")
-
+ACE_RCSID (be_visitor_module,
+ module_sh,
+ "$Id$")
// ************************************************************
// Module visitor for server header
@@ -42,12 +37,13 @@ be_visitor_module_sh::~be_visitor_module_sh (void)
int
be_visitor_module_sh::visit_module (be_module *node)
{
- TAO_OutStream *os;
-
// Not generated and not imported.
if (!node->srv_hdr_gen () && !node->imported ())
{
- os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
// Generate the skeleton class name.
@@ -75,10 +71,15 @@ be_visitor_module_sh::visit_module (be_module *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module_sh::"
"visit_module - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
os->decr_indent ();
+
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
*os << "}" << be_nl << "TAO_NAMESPACE_CLOSE // module "
<< node->name () << "\n\n";
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation.cpp b/TAO/TAO_IDL/be/be_visitor_operation.cpp
index a8351b2acdb..d8096fb0927 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation.cpp
@@ -18,13 +18,33 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_argument.h"
+#include "be_array.h"
+#include "be_attribute.h"
+#include "be_enum.h"
+#include "be_exception.h"
+#include "be_interface_fwd.h"
+#include "be_native.h"
+#include "be_operation.h"
+#include "be_predefined_type.h"
+#include "be_sequence.h"
+#include "be_string.h"
+#include "be_structure.h"
+#include "be_type.h"
+#include "be_typedef.h"
+#include "be_union.h"
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
+#include "be_extern.h"
+#include "be_helper.h"
+#include "utl_identifier.h"
+#include "utl_exceptlist.h"
+#include "nr_extern.h"
#include "be_visitor_operation.h"
+#include "be_visitor_argument.h"
+#include "be_visitor_context.h"
-// include all the individual files
#include "be_visitor_operation/operation.cpp"
#include "be_visitor_operation/arglist.cpp"
#include "be_visitor_operation/argument.cpp"
@@ -50,13 +70,18 @@
#include "be_visitor_operation/tie_si.cpp"
#include "be_visitor_operation/rettype_pre_invoke_cs.cpp"
+// AMI
#include "be_visitor_operation/ami_ch.cpp"
#include "be_visitor_operation/ami_cs.cpp"
#include "be_visitor_operation/ami_handler_reply_stub_operation_ch.cpp"
#include "be_visitor_operation/ami_handler_reply_stub_operation_cs.cpp"
#include "be_visitor_operation/ami_exception_holder_operation_cs.cpp"
+
+// Smart proxy
#include "be_visitor_operation/smart_proxy_ch.cpp"
#include "be_visitor_operation/smart_proxy_cs.cpp"
+
+// Interceptors
#include "be_visitor_operation/interceptors_ch.cpp"
#include "be_visitor_operation/interceptors_cs.cpp"
#include "be_visitor_operation/interceptors_arglist.cpp"
@@ -65,9 +90,10 @@
#include "be_visitor_operation/interceptors_exceptlist.cpp"
#include "be_visitor_operation/interceptors_info_rettype.cpp"
#include "be_visitor_operation/interceptors_result.cpp"
+
+// Collocation
#include "be_visitor_operation/base_proxy_impl_ch.cpp"
#include "be_visitor_operation/proxy_impl_xh.cpp"
-#include "be_visitor_operation/inv_arglist.cpp"
#include "be_visitor_operation/remote_proxy_impl_cs.cpp"
#include "be_visitor_operation/thru_poa_proxy_impl_ss.cpp"
#include "be_visitor_operation/direct_proxy_impl_ss.cpp"
@@ -78,4 +104,6 @@
#include "be_visitor_operation/amh_rh_ss.cpp"
#include "be_visitor_operation/amh_rh_sh.cpp"
-ACE_RCSID(be, be_visitor_operation, "$Id$")
+ACE_RCSID (be,
+ be_visitor_operation,
+ "$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_sh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_sh.cpp
index 12cfa035143..2296a5d4c65 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_sh.cpp
@@ -19,21 +19,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "ast_decl.h"
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, operation_amh_rh_sh, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ operation_amh_rh_sh,
+ "$Id$")
// ******************************************************
// Visitor for generating AMH-RH skeleton for "operation"
// in skeleton header.
// ******************************************************
-be_visitor_amh_rh_operation_sh::be_visitor_amh_rh_operation_sh (be_visitor_context *ctx)
+be_visitor_amh_rh_operation_sh::be_visitor_amh_rh_operation_sh (
+ be_visitor_context *ctx
+ )
: be_visitor_operation (ctx)
{
}
@@ -92,20 +89,10 @@ be_visitor_amh_rh_operation_sh::visit_operation (be_operation *node)
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_OTHERS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
-
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_amh_rh_sh::"
- "visit_operation - "
- "Bad visitor to return type\n"),
- -1);
- }
+ be_visitor_operation_arglist visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_amh_rh_sh::"
"visit_operation - "
@@ -113,8 +100,6 @@ be_visitor_amh_rh_operation_sh::visit_operation (be_operation *node)
-1);
}
- delete visitor;
-
*os << ";" << be_nl;
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp
index 76669ed1dc8..43982f6d1d7 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp
@@ -10,11 +10,9 @@
*/
//=============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
+ACE_RCSID (be_visitor_operation,
+ amh_rh_ss,
+ "$Id$")
be_visitor_amh_rh_operation_ss::be_visitor_amh_rh_operation_ss (
be_visitor_context *ctx
@@ -212,7 +210,7 @@ be_visitor_amh_rh_operation_ss::marshal_params (be_operation *node)
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_INVOKE_CS);
ctx.sub_state (TAO_CodeGen::TAO_CDR_OUTPUT);
- be_compiled_visitor_operation_argument_invoke visitor (&ctx);
+ be_visitor_operation_argument_invoke visitor (&ctx);
if (node->accept (&visitor) == -1)
{
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp
index 4d5d252ab47..086e4a10e77 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp
@@ -19,16 +19,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "ast_decl.h"
-#include "be_visitor_operation.h"
-#include "be_visitor_argument.h"
-
-ACE_RCSID(be_visitor_operation, amh_sh, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ amh_sh,
+ "$Id$")
// ******************************************************
// Visitor for generating AMH skeleton for "operation" in skeleton header.
@@ -117,7 +110,7 @@ be_visitor_amh_operation_sh::visit_operation (be_operation *node)
*os << be_uidt_nl << "))" << be_uidt;
}
- *os << " = 0;\n" << be_nl;
+ *os << " = 0;" << be_nl << be_nl;
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp
index f0e40e41975..10e8da9bfac 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp
@@ -10,11 +10,9 @@
*/
//=============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
+ACE_RCSID (be_visitor_operation,
+ amh_ss,
+ "$Id$")
be_visitor_amh_operation_ss::be_visitor_amh_operation_ss (
be_visitor_context *ctx
@@ -111,7 +109,7 @@ be_visitor_amh_operation_ss::visit_operation (be_operation *node)
if (marshal_visitor.visit_argument (argument) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_ss::"
+ "(%N:%l) be_visitor_operation_ss::"
"visit_operation - "
"codegen for demarshal failed\n"),
-1);
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_ch.cpp
index aef71be2e41..a5966a04455 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/ami_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_ch.cpp
@@ -19,20 +19,17 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, operation_ami_ch, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ operation_ami_ch,
+ "$Id$")
// ******************************************************
// Visitor for generating AMI stub for "operation" in client header.
// ******************************************************
-be_visitor_operation_ami_ch::be_visitor_operation_ami_ch (be_visitor_context *ctx)
+be_visitor_operation_ami_ch::be_visitor_operation_ami_ch (
+ be_visitor_context *ctx
+ )
: be_visitor_operation (ctx)
{
}
@@ -86,30 +83,16 @@ be_visitor_operation_ami_ch::visit_operation (be_operation *node)
// parameter listing.
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_arglist visitor (&ctx);
- if (!visitor)
+ if (node->arguments ()->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_operation_ami_ch::"
- "visit_operation - "
- "Bad visitor to return type\n"),
- -1);
- }
-
- if (node->arguments ()->accept (visitor) == -1)
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_ami_ch::"
"visit_operation - "
"codegen for argument list failed\n"),
-1);
}
- delete visitor;
-
-// *os << be_nl;
-
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp
index a8577a4ac25..37e52f8374d 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp
@@ -20,20 +20,17 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, operation_ami_cs, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ operation_ami_cs,
+ "$Id$")
// ************************************************************
// Operation visitor for client stubs
// ************************************************************
-be_visitor_operation_ami_cs::be_visitor_operation_ami_cs (be_visitor_context *ctx)
+be_visitor_operation_ami_cs::be_visitor_operation_ami_cs (
+ be_visitor_context *ctx
+ )
: be_visitor_operation (ctx)
{
}
@@ -49,8 +46,12 @@ be_visitor_operation_ami_cs::post_process (be_decl *bd)
{
// all we do here is to insert a comma and a newline
TAO_OutStream *os = this->ctx_->stream ();
+
if (!this->last_node (bd))
- *os << ",\n";
+ {
+ *os << ",\n";
+ }
+
return 0;
}
@@ -59,16 +60,15 @@ be_visitor_operation_ami_cs::visit_operation (be_operation *node)
{
// No sendc method for oneway operations.
if (node->flags () == AST_Operation::OP_oneway)
- return 0;
-
- TAO_OutStream *os; // output stream
- be_visitor_context ctx; // visitor context
- be_visitor *visitor; // visitor
+ {
+ return 0;
+ }
- os = this->ctx_->stream ();
- this->ctx_->node (node); // save the node for future use
+ be_visitor_context ctx;
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
- os->indent (); // start with the current indentation level
+ os->indent ();
// Generate the return type mapping. Return type is simply void.
*os << "void" << be_nl;
@@ -78,25 +78,32 @@ be_visitor_operation_ami_cs::visit_operation (be_operation *node)
// Grab the scope name.
be_decl *parent =
be_scope::narrow_from_scope (node->defined_in ())->decl ();
+
if (parent == 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_ami_cs::"
- "visit_operation - "
- "scope name is nil\n"),
- -1);
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_ami_cs::"
+ "visit_operation - "
+ "scope name is nil\n"),
+ -1);
+ }
// Generate the scope::operation name.
*os << parent->full_name ()
<< "::sendc_";
- // check if we are an attribute node in disguise
+ // 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_";
+ // Now check if we are a "get" or "set" operation.
+ if (node->nmembers () == 1)
+ {
+ *os << "set_";
+ }
else
- *os << "get_";
+ {
+ *os << "get_";
+ }
}
*os << node->local_name ()->get_string ();
@@ -105,18 +112,16 @@ be_visitor_operation_ami_cs::visit_operation (be_operation *node)
// in the header file)
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_OTHERS);
- visitor = tao_cg->make_visitor (&ctx);
- if ((!visitor) || (node->arguments ()->accept (visitor) == -1))
+ be_visitor_operation_arglist oa_visitor (&ctx);
+
+ if (node->arguments ()->accept (&oa_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_ami_cs::"
"visit_operation - "
"codegen for argument list failed\n"),
-1);
}
- delete visitor;
- visitor = 0;
// Generate the actual code for the stub. However, if any of the argument
// types is "native", we flag a MARSHAL exception.
@@ -127,11 +132,11 @@ be_visitor_operation_ami_cs::visit_operation (be_operation *node)
be_type *bt = be_type::narrow_from_decl (node->arguments ()->return_type ());
- // generate any pre stub info if and only if none of our parameters is of the
- // native type
+ // Generate any pre stub info if and only if none of our parameters is of the
+ // native type.
if (!node->has_native ())
{
- // native type does not exist.
+ // Native type does not exist.
// Generate any "pre" stub information such as tables or declarations
// This is a template method and the actual work will be done by the
@@ -148,9 +153,11 @@ be_visitor_operation_ami_cs::visit_operation (be_operation *node)
if (node->has_native ()) // native exists => no stub
{
- if (this->gen_raise_exception (bt,
- "CORBA::MARSHAL",
- "") == -1)
+ int status = this->gen_raise_exception (bt,
+ "CORBA::MARSHAL",
+ "");
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_ami_cs::"
@@ -167,7 +174,7 @@ be_visitor_operation_ami_cs::visit_operation (be_operation *node)
<< "TAO_Stub *istub = this->_stubobj ();" << be_nl
<< "if (istub == 0)" << be_idt_nl;
- // if the stub object was bad, then we raise a system exception
+ // If the stub object was bad, then we raise a system exception.
if (this->gen_raise_exception (bt, "CORBA::INV_OBJREF",
"") == -1)
{
@@ -201,16 +208,16 @@ be_visitor_operation_ami_cs::visit_operation (be_operation *node)
return 0;
}
+// This method is used to generate the ParamData table entry.
int
be_visitor_operation_ami_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
+ // Retrieve the type for this argument.
bt = be_type::narrow_from_decl (node->field_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -222,6 +229,7 @@ be_visitor_operation_ami_cs::visit_argument (be_argument *node)
os->indent ();
*os << "{" << bt->tc_name () << ", ";
+
switch (node->direction ())
{
case AST_Argument::dir_IN:
@@ -234,64 +242,15 @@ be_visitor_operation_ami_cs::visit_argument (be_argument *node)
*os << "PARAM_OUT, ";
break;
}
- *os << "0}";
-
- return 0;
-}
-
-// ************************************************************
-// Operation visitor for interpretive client stubs
-// ************************************************************
-
-be_interpretive_visitor_operation_ami_cs::
-be_interpretive_visitor_operation_ami_cs (be_visitor_context *ctx)
- : be_visitor_operation_ami_cs (ctx)
-{
-}
-
-be_interpretive_visitor_operation_ami_cs::~be_interpretive_visitor_operation_ami_cs (void)
-{
-}
-// concrete implementation of the template methods
-
-int
-be_interpretive_visitor_operation_ami_cs::gen_pre_stub_info (be_operation *node,
- be_type *bt)
-{
- ACE_UNUSED_ARG (node);
- ACE_UNUSED_ARG (bt);
- return 0;
-}
+ *os << "0}";
-int
-be_interpretive_visitor_operation_ami_cs::gen_marshal_and_invoke (be_operation *node,
- be_type *bt)
-{
- ACE_UNUSED_ARG (node);
- ACE_UNUSED_ARG (bt);
return 0;
}
-// ************************************************************
-// Operation visitor for compiled client stubs
-// ************************************************************
-
-be_compiled_visitor_operation_ami_cs::
-be_compiled_visitor_operation_ami_cs (be_visitor_context *ctx)
- : be_visitor_operation_ami_cs (ctx)
-{
-}
-
-be_compiled_visitor_operation_ami_cs::~be_compiled_visitor_operation_ami_cs (void)
-{
-}
-
-// concrete implementation of the template methods
-
int
-be_compiled_visitor_operation_ami_cs::gen_pre_stub_info (be_operation *node,
- be_type *bt)
+be_visitor_operation_ami_cs::gen_pre_stub_info (be_operation *node,
+ be_type *bt)
{
// Nothing to be done here, we do not through any exceptions,
// besides system exceptions, so we do not need an user exception table.
@@ -302,11 +261,10 @@ be_compiled_visitor_operation_ami_cs::gen_pre_stub_info (be_operation *node,
}
int
-be_compiled_visitor_operation_ami_cs::gen_marshal_and_invoke (be_operation *node,
- be_type *bt)
+be_visitor_operation_ami_cs::gen_marshal_and_invoke (be_operation *node,
+ be_type *bt)
{
TAO_OutStream *os = this->ctx_->stream ();
- be_visitor *visitor;
be_visitor_context ctx;
os->indent ();
@@ -321,20 +279,24 @@ be_compiled_visitor_operation_ami_cs::gen_marshal_and_invoke (be_operation *node
default:
*os << "TAO_GIOP_Twoway_Asynch_Invocation _tao_call ";
}
+
*os << "(" << be_idt << be_idt_nl
<< "istub," << be_nl;
-
*os << "\"";
size_t ext = 0;
if (this->ctx_->attribute ())
{
- // now check if we are a "get" or "set" operation
- if (node->nmembers () == 1) // set
- *os << "_set_";
+ // Now check if we are a "get" or "set" operation.
+ if (node->nmembers () == 1)
+ {
+ *os << "_set_";
+ }
else
- *os << "_get_";
+ {
+ *os << "_get_";
+ }
ext += 5;
}
@@ -369,11 +331,15 @@ be_compiled_visitor_operation_ami_cs::gen_marshal_and_invoke (be_operation *node
if (this->ctx_->attribute ())
{
- // now check if we are a "get" or "set" operation
- if (node->nmembers () == 1) // set
- *os << "set_";
+ // Now check if we are a "get" or "set" operation
+ if (node->nmembers () == 1)
+ {
+ *os << "set_";
+ }
else
- *os << "get_";
+ {
+ *os << "get_";
+ }
}
*os << node->local_name () << "_reply_stub," << be_nl;
@@ -429,34 +395,43 @@ be_compiled_visitor_operation_ami_cs::gen_marshal_and_invoke (be_operation *node
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_INVOKE_CS);
ctx.sub_state (TAO_CodeGen::TAO_CDR_OUTPUT);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->marshaling ()->accept (visitor) == -1))
+ be_visitor_operation_argument_invoke visitor (&ctx);
+
+ if (node->marshaling ()->accept (&visitor) == -1)
{
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_ami_cs::"
- "gen_marshal_and_invoke - "
- "codegen for return var in do_static_call failed\n"),
- -1);
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) be_visitor_operation_ami_cs::"
+ "gen_marshal_and_invoke - "
+ "codegen for return var in do_static_call failed\n"
+ ),
+ -1
+ );
}
+
*os << be_uidt << be_uidt_nl
<< "))" << be_nl;
// If marshaling fails, raise exception.
- if (this->gen_raise_exception (bt, "CORBA::MARSHAL",
- "") == -1)
+ int status = this->gen_raise_exception (bt,
+ "CORBA::MARSHAL",
+ "");
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_ami_cs::"
+ "(%N:%l) be_visitor_operation_ami_cs::"
"gen_marshal_and invoke - "
"codegen for return var failed\n"),
-1);
}
+
*os << be_uidt;
}
*os << be_nl
- << "int _invoke_status = _tao_call.invoke (ACE_ENV_SINGLE_ARG_PARAMETER);";
+ << "int _invoke_status =" << be_idt_nl
+ << "_tao_call.invoke (ACE_ENV_SINGLE_ARG_PARAMETER);" << be_uidt;
*os << be_uidt_nl;
@@ -464,7 +439,7 @@ be_compiled_visitor_operation_ami_cs::gen_marshal_and_invoke (be_operation *node
if (this->gen_check_exception (bt) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_ami_cs::"
+ "(%N:%l) be_visitor_operation_ami_cs::"
"gen_marshal_and_invoke - "
"codegen for checking exception failed\n"),
-1);
@@ -479,12 +454,15 @@ be_compiled_visitor_operation_ami_cs::gen_marshal_and_invoke (be_operation *node
<< "if (_invoke_status != TAO_INVOKE_OK)" << be_nl
<< "{" << be_idt_nl;
- if (this->gen_raise_exception (bt,
- "CORBA::UNKNOWN",
- "TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_YES") == -1)
+ int status =
+ this->gen_raise_exception (bt,
+ "CORBA::UNKNOWN",
+ "TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_YES");
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_ami_cs::"
+ "(%N:%l) be_visitor_operation_ami_cs::"
"gen_marshal_and invoke - "
"codegen for return var failed\n"),
-1);
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_exception_holder_operation_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_exception_holder_operation_cs.cpp
index ed5ef268658..daba6c407e4 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/ami_exception_holder_operation_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_exception_holder_operation_cs.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, ami_exception_holder_operation_cs, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ ami_exception_holder_operation_cs,
+ "$Id$")
// ************************************************************
// Operation visitor for client stubs
@@ -127,7 +122,7 @@ be_visitor_operation_ami_exception_holder_operation_cs::visit_operation (
*os << "ACE_ENV_SINGLE_ARG_DECL";
}
- *os << ")" << be_uidt;
+ *os << ")";
// now generate the throw specs
if (this->gen_throw_spec (node) == -1)
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_ch.cpp
index 64ed89f8ce9..9b0eb3d35b6 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_ch.cpp
@@ -20,42 +20,37 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, ami_handler_reply_stub_operation_ch, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ ami_handler_reply_stub_operation_ch,
+ "$Id$")
// ************************************************************
// Operation visitor for server header
// ************************************************************
-be_visitor_operation_ami_handler_reply_stub_operation_ch::be_visitor_operation_ami_handler_reply_stub_operation_ch (be_visitor_context *ctx)
+be_visitor_operation_ami_handler_reply_stub_operation_ch::
+be_visitor_operation_ami_handler_reply_stub_operation_ch (be_visitor_context *ctx)
: be_visitor_operation (ctx)
{
}
-be_visitor_operation_ami_handler_reply_stub_operation_ch::~be_visitor_operation_ami_handler_reply_stub_operation_ch (void)
+be_visitor_operation_ami_handler_reply_stub_operation_ch::
+~be_visitor_operation_ami_handler_reply_stub_operation_ch (void)
{
}
int
-be_visitor_operation_ami_handler_reply_stub_operation_ch::visit_operation (be_operation *node)
+be_visitor_operation_ami_handler_reply_stub_operation_ch::visit_operation (
+ be_operation *node
+ )
{
- TAO_OutStream *os; // output stream
-
- os = this->ctx_->stream ();
- this->ctx_->node (node); // save the node
-
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
// Generate the corresponding static skeleton method for this
// operation only if there was no "native" type.
if (!node->has_native ())
{
-
// Next line.
*os << "static void ";
@@ -72,6 +67,7 @@ be_visitor_operation_ami_handler_reply_stub_operation_ch::visit_operation (be_op
*os << "_get_";
}
}
+
*os << node->local_name ()
<< "_reply_stub (" << be_idt << be_idt_nl;
@@ -83,5 +79,6 @@ be_visitor_operation_ami_handler_reply_stub_operation_ch::visit_operation (be_op
<< "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
<< ");" << be_uidt_nl << be_nl;
}
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_cs.cpp
index 1220c388552..f3f61b23101 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_cs.cpp
@@ -18,77 +18,90 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, ami_handler_reply_stub_operation_cs, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ ami_handler_reply_stub_operation_cs,
+ "$Id$")
// ************************************************************
-// Operation visitor for client stubs
+// Operation visitor for client stubs.
// ************************************************************
-be_visitor_operation_ami_handler_reply_stub_operation_cs::be_visitor_operation_ami_handler_reply_stub_operation_cs (be_visitor_context *ctx)
+be_visitor_operation_ami_handler_reply_stub_operation_cs::
+be_visitor_operation_ami_handler_reply_stub_operation_cs (
+ be_visitor_context *ctx
+ )
: be_visitor_operation (ctx)
{
}
-be_visitor_operation_ami_handler_reply_stub_operation_cs::~be_visitor_operation_ami_handler_reply_stub_operation_cs (void)
+be_visitor_operation_ami_handler_reply_stub_operation_cs::
+~be_visitor_operation_ami_handler_reply_stub_operation_cs (void)
{
}
-// processing to be done after every element in the scope is processed
+// Processing to be done after every element in the scope is processed
int
-be_visitor_operation_ami_handler_reply_stub_operation_cs::post_process (be_decl *bd)
+be_visitor_operation_ami_handler_reply_stub_operation_cs::post_process (
+ be_decl *bd
+ )
{
- // all we do here is to insert a comma and a newline
+ // All we do here is to insert a comma and a newline.
TAO_OutStream *os = this->ctx_->stream ();
+
if (!this->last_node (bd))
- *os << ",\n";
+ {
+ *os << ",\n";
+ }
+
return 0;
}
int
-be_visitor_operation_ami_handler_reply_stub_operation_cs::visit_operation (be_operation *node)
+be_visitor_operation_ami_handler_reply_stub_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 = 0; // visitor
+ be_type *bt;
+ be_visitor_context ctx;
- os = this->ctx_->stream ();
- this->ctx_->node (node); // save the node for future use
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
- // Init the return type variable.
+ // Initialize the return type variable.
bt = be_type::narrow_from_decl (node->return_type ());
+
if (!bt)
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_ami_handler_reply_stub_operation_cs::"
- "visit_operation - "
- "Bad return type\n"),
- -1);
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) be_visitor_ami_handler_reply_stub_operation_cs::"
+ "visit_operation - "
+ "Bad return type\n"
+ ),
+ -1
+ );
}
// Start with the current indentation level.
os->indent ();
-
// Generate the return type. Return type is simply void.
*os << be_nl << "void" << be_nl;
// Get the scope name.
- be_decl *parent = be_scope::narrow_from_scope (node->defined_in ())->decl ();
+ be_decl *parent =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
+
if (!parent)
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_ami_handler_reply_stub_operation_cs::"
- "visit_operation - "
- "node information not sufficient :-<\n"),
- -1);
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) be_visitor_operation_ami_handler_reply_stub_operation_cs::"
+ "visit_operation - "
+ "node information not sufficient :-<\n"
+ ),
+ -1
+ );
}
// Genereate scope name.
@@ -96,15 +109,21 @@ be_visitor_operation_ami_handler_reply_stub_operation_cs::visit_operation (be_op
// Generate the operation name.
*os << "::";
+
// 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_";
+ // Now check if we are a "get" or "set" operation
+ if (node->nmembers () == 1)
+ {
+ *os << "_set_";
+ }
else
- *os << "_get_";
+ {
+ *os << "_get_";
+ }
}
+
*os << node->local_name () << "_reply_stub (" << be_idt_nl;
// Generate the argument list.
@@ -160,18 +179,16 @@ be_visitor_operation_ami_handler_reply_stub_operation_cs::visit_operation (be_op
// 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))
+ be_visitor_operation_argument oad_visitor (&ctx);
+
+ if (node->accept (&oad_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) ami_handler_reply_stub_operation_cs::"
"visit_operation - "
"codegen for return var decl failed\n"),
-1);
}
- delete visitor;
- visitor = 0;
// Demarshal parameters
if (this->gen_marshal_and_invoke (node, bt) == -1)
@@ -272,23 +289,28 @@ be_visitor_operation_ami_handler_reply_stub_operation_cs::visit_operation (be_op
return 0;
}
+// This method is used to generate the ParamData table entry.
int
-be_visitor_operation_ami_handler_reply_stub_operation_cs::visit_argument (be_argument *node)
+be_visitor_operation_ami_handler_reply_stub_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
+ be_type *bt;
- // retrieve the type for this argument
+ // 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_ami_handler_reply_stub_operation_cs::"
- "visit_argument - "
- "Bad argument type\n"),
- -1);
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) be_visitor_operation_ami_handler_reply_stub_operation_cs::"
+ "visit_argument - "
+ "Bad argument type\n"
+ ),
+ -1
+ );
}
os->indent ();
@@ -310,27 +332,12 @@ be_visitor_operation_ami_handler_reply_stub_operation_cs::visit_argument (be_arg
return 0;
}
-// ************************************************************
-// Operation visitor for compiled client skeletons of the AMI reply handler
-// ************************************************************
-
-be_compiled_visitor_operation_ami_handler_reply_stub_operation_cs::
-be_compiled_visitor_operation_ami_handler_reply_stub_operation_cs (be_visitor_context *ctx)
- : be_visitor_operation_ami_handler_reply_stub_operation_cs (ctx)
-{
-}
-
-be_compiled_visitor_operation_ami_handler_reply_stub_operation_cs::~be_compiled_visitor_operation_ami_handler_reply_stub_operation_cs (void)
-{
-}
-
-// concrete implementation of the template methods
-
int
-be_compiled_visitor_operation_ami_handler_reply_stub_operation_cs::gen_pre_stub_info (be_operation *node,
- be_type *bt)
+be_visitor_operation_ami_handler_reply_stub_operation_cs::gen_pre_stub_info (
+ be_operation *node,
+ be_type *
+ )
{
- ACE_UNUSED_ARG (bt);
// Check if this operation raises any exceptions. In that case, we must
// generate a list of exception typecodes. This is not valid for
// attributes
@@ -338,37 +345,38 @@ be_compiled_visitor_operation_ami_handler_reply_stub_operation_cs::gen_pre_stub_
{
be_visitor_context ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_EXCEPTLIST_CS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ be_visitor_operation_exceptlist_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) "
- "be_compiled_visitor_operation_ami_handler_reply_stub_operation_cs::"
- "gen_pre_stub_info - "
- "Exceptionlist generation error\n"),
- -1);
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) "
+ "be_visitor_operation_ami_handler_reply_stub_operation_cs::"
+ "gen_pre_stub_info - "
+ "Exceptionlist generation error\n"
+ ),
+ -1
+ );
}
- delete visitor;
}
return 0;
}
int
-be_compiled_visitor_operation_ami_handler_reply_stub_operation_cs::
- gen_marshal_and_invoke (be_operation *node,
- be_type *bt)
+be_visitor_operation_ami_handler_reply_stub_operation_cs::gen_marshal_and_invoke (
+ be_operation *node,
+ be_type *
+ )
{
TAO_OutStream *os = this->ctx_->stream ();
- be_visitor *visitor = 0;
be_visitor_context ctx;
- ACE_UNUSED_ARG (bt);
-
os->indent ();
*os << "// Demarshall all the arguments." << be_nl;
+
if (this->has_param_type (node, AST_Argument::dir_IN))
{
*os << "if (!(\n" << be_idt << be_idt << be_idt;
@@ -377,24 +385,28 @@ be_compiled_visitor_operation_ami_handler_reply_stub_operation_cs::
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_DEMARSHAL_SS);
ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ be_visitor_operation_argument_marshal visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_ami_handler_reply_stub_operation_cs::"
+ "(%N:%l) be_visitor_operation_ami_handler_reply_stub_operation_cs::"
"gen_marshal_params - "
"codegen for args failed\n"),
-1);
}
- delete visitor;
*os << be_uidt << be_uidt_nl
<< " ))" << be_nl;
+
if (be_global->use_raw_throw ())
- *os << "throw CORBA::MARSHAL ();" << be_uidt_nl << be_nl;
+ {
+ *os << "throw CORBA::MARSHAL ();" << be_uidt_nl << be_nl;
+ }
else
- *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl << be_nl;
+ {
+ *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl << be_nl;
+ }
}
@@ -402,14 +414,18 @@ be_compiled_visitor_operation_ami_handler_reply_stub_operation_cs::
*os << "// Invoke the call back method." << be_nl
<< "_tao_reply_handler_object->";
- // check if we are an attribute node in disguise
+ // 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_";
+ // Now check if we are a "get" or "set" operation.
+ if (node->nmembers () == 1)
+ {
+ *os << "set_";
+ }
else
- *os << "get_";
+ {
+ *os << "get_";
+ }
}
*os << node->local_name () << " (" << be_idt << be_idt_nl;
@@ -417,24 +433,18 @@ be_compiled_visitor_operation_ami_handler_reply_stub_operation_cs::
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_SS);
- // generate the argument list containing the inout and inout arguments
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ be_visitor_operation_argument oau_visitor (&ctx);
+
+ if (node->accept (&oau_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) ami_handler_reply_stub_operation_cs::"
"visit_operation - "
"codegen for making upcall failed\n"),
-1);
}
- delete visitor;
- visitor = 0;
-
-// os->indent ();
*os << be_uidt_nl << ");" << be_uidt_nl;
-
*os << "ACE_CHECK;" << be_nl;
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp
index f112884f12e..6e6bee2d9b2 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_operation.h"
-#include "be_visitor_argument.h"
-
-ACE_RCSID(be_visitor_operation, arglist, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ arglist,
+ "$Id$")
// ************************************************************
// operation visitor to generate the argument list.
@@ -91,8 +86,8 @@ be_visitor_operation_arglist::visit_operation (be_operation *node)
-1);
}
- *os << be_uidt_nl // idt = 1
- << ")" << be_uidt; // idt = 0
+ *os << be_uidt_nl
+ << ")"; // idt = 0
// Now generate the throw specs.
if (this->gen_throw_spec (node) == -1)
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp b/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp
index 79fe13e262c..3a8ff384e61 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp
@@ -18,23 +18,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, argument, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ argument,
+ "$Id$")
// ************************************************************
-// generic operation visitor to handle the pre/post
-// do_static_call/upcall stuff with arguments
+// 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_operation_argument::be_visitor_operation_argument (
+ be_visitor_context *ctx
+ )
: be_visitor_operation (ctx)
{
}
@@ -48,8 +43,7 @@ be_visitor_operation_argument::post_process (be_decl *bd)
{
TAO_OutStream *os = this->ctx_->stream ();
-
- // if we are not the last parameter, we insert a comma. This is only
+ // If we are not the last parameter, we insert a comma. This is only
// applicable for the upcalls or the call to (de)marshal that we use in the
// interpreted marshaling.
switch (this->ctx_->state ())
@@ -62,10 +56,12 @@ be_visitor_operation_argument::post_process (be_decl *bd)
{
*os << "," << be_nl;
}
+
break;
default:
break;
}
+
return 0;
}
@@ -74,7 +70,7 @@ be_visitor_operation_argument::visit_operation (be_operation *node)
{
TAO_OutStream *os = this->ctx_->stream ();
- // all we do is hand over code generation to our scope
+ // All we do is hand over code generation to our scope.
if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -84,22 +80,27 @@ be_visitor_operation_argument::visit_operation (be_operation *node)
-1);
}
- // if we are supporting the alternate mapping, we must pass the
- // ACE_ENV_ARG_PARAMETER as the last parameter
+ // If we are supporting the alternate mapping, we must pass the
+ // ACE_ENV_ARG_PARAMETER as the last parameter.
if (!be_global->exception_support ())
{
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_SS:
case TAO_CodeGen::TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS:
- // applicable only to these cases where the actual upcall is made
+ // Applicable only to these cases where the actual upcall is made.
// Use ACE_ENV_SINGLE_ARG_DECL or ACE_ENV_ARG_DECL depending on
// whether the operation node has parameters.
if (node->argument_count () > 0)
- *os << " ACE_ENV_ARG_PARAMETER";
+ {
+ *os << " ACE_ENV_ARG_PARAMETER";
+ }
else
- *os << "ACE_ENV_SINGLE_ARG_PARAMETER";
+ {
+ *os << "ACE_ENV_SINGLE_ARG_PARAMETER";
+ }
+
break;
default:
break;
@@ -112,7 +113,7 @@ be_visitor_operation_argument::visit_operation (be_operation *node)
int
be_visitor_operation_argument::visit_argument (be_argument *node)
{
- // get the visitor that will dump the argument's mapping in the operation
+ // Get the visitor that will dump the argument's mapping in the operation
// signature.
be_visitor_context ctx (*this->ctx_);
@@ -121,6 +122,7 @@ be_visitor_operation_argument::visit_argument (be_argument *node)
// 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,
@@ -132,7 +134,7 @@ be_visitor_operation_argument::visit_argument (be_argument *node)
// 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
+ // information from the context.
be_interface *intf;
intf = this->ctx_->attribute ()
? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ())
@@ -146,34 +148,68 @@ be_visitor_operation_argument::visit_argument (be_argument *node)
"Bad interface\n"),
-1);
}
- ctx.scope (intf); // set new scope
+
+ ctx.scope (intf);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_OPERATION_ARG_PRE_INVOKE_CS:
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_PRE_INVOKE_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARGUMENT_PRE_INVOKE_CS);
+ be_visitor_args_pre_invoke_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_OPERATION_ARG_INVOKE_CS:
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_INVOKE_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARGUMENT_INVOKE_CS);
+ be_visitor_args_invoke_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_OPERATION_ARG_POST_INVOKE_CS:
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_POST_INVOKE_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARGUMENT_POST_INVOKE_CS);
+ be_visitor_args_post_invoke_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_OPERATION_ARG_DECL_SS:
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_VARDECL_SS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARGUMENT_VARDECL_SS);
+ be_visitor_args_vardecl_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_OPERATION_ARG_DEMARSHAL_SS:
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_DEMARSHAL_SS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARGUMENT_DEMARSHAL_SS);
+ be_visitor_args_marshal_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_OPERATION_ARG_MARSHAL_SS:
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_MARSHAL_SS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARGUMENT_MARSHAL_SS);
+ be_visitor_args_marshal_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS:
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS);
+ be_visitor_args_upcall_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_SS:
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_UPCALL_SS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARGUMENT_UPCALL_SS);
+ be_visitor_args_upcall_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -184,19 +220,8 @@ be_visitor_operation_argument::visit_argument (be_argument *node)
}
}
- // 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)
+ if (status == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_argument::"
@@ -204,6 +229,6 @@ be_visitor_operation_argument::visit_argument (be_argument *node)
"codegen for argument failed\n"),
-1);
}
- delete visitor;
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/argument_invoke.cpp b/TAO/TAO_IDL/be/be_visitor_operation/argument_invoke.cpp
index cb4d38bb115..d222235b04d 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/argument_invoke.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/argument_invoke.cpp
@@ -20,34 +20,31 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, argument_invoke, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ argument_invoke,
+ "$Id$")
// ************************************************************
// operation visitor to handle the passing of arguments to the CDR operators
// ************************************************************
-be_compiled_visitor_operation_argument_invoke::
-be_compiled_visitor_operation_argument_invoke (be_visitor_context
- *ctx)
+be_visitor_operation_argument_invoke::be_visitor_operation_argument_invoke (
+ be_visitor_context
+ *ctx
+ )
: be_visitor_operation_argument (ctx),
- last_arg_printed_ (be_compiled_visitor_operation_argument_invoke::TAO_ARG_NONE)
+ last_arg_printed_ (be_visitor_operation_argument_invoke::TAO_ARG_NONE)
{
}
-be_compiled_visitor_operation_argument_invoke::
-~be_compiled_visitor_operation_argument_invoke (void)
+be_visitor_operation_argument_invoke::~be_visitor_operation_argument_invoke (
+ void
+ )
{
}
int
-be_compiled_visitor_operation_argument_invoke::pre_process (be_decl *bd)
+be_visitor_operation_argument_invoke::pre_process (be_decl *bd)
{
TAO_OutStream *os = this->ctx_->stream ();
@@ -57,7 +54,7 @@ be_compiled_visitor_operation_argument_invoke::pre_process (be_decl *bd)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) "
- "be_compiled_visitor_operation_argument_invoke"
+ "be_visitor_operation_argument_invoke"
"::post_process - "
"Bad argument node\n"),
-1);
@@ -69,8 +66,8 @@ be_compiled_visitor_operation_argument_invoke::pre_process (be_decl *bd)
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
{
if (this->last_arg_printed_ !=
- be_compiled_visitor_operation_argument_invoke::TAO_ARG_NONE)
- *os << " &&\n";
+ be_visitor_operation_argument_invoke::TAO_ARG_NONE)
+ *os << " &&" << be_nl;
}
else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
{
@@ -81,14 +78,14 @@ be_compiled_visitor_operation_argument_invoke::pre_process (be_decl *bd)
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
{
if (this->last_arg_printed_ !=
- be_compiled_visitor_operation_argument_invoke::TAO_ARG_NONE)
- *os << " &&\n";
+ be_visitor_operation_argument_invoke::TAO_ARG_NONE)
+ *os << " &&" << be_nl;
}
else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
{
if (this->last_arg_printed_ !=
- be_compiled_visitor_operation_argument_invoke::TAO_ARG_NONE)
- *os << " &&\n";
+ be_visitor_operation_argument_invoke::TAO_ARG_NONE)
+ *os << " &&" << be_nl;
}
break;
case AST_Argument::dir_OUT:
@@ -99,8 +96,8 @@ be_compiled_visitor_operation_argument_invoke::pre_process (be_decl *bd)
else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
{
if (this->last_arg_printed_ !=
- be_compiled_visitor_operation_argument_invoke::TAO_ARG_NONE)
- *os << " &&\n";
+ be_visitor_operation_argument_invoke::TAO_ARG_NONE)
+ *os << " &&" << be_nl;
}
break;
}
@@ -109,7 +106,7 @@ be_compiled_visitor_operation_argument_invoke::pre_process (be_decl *bd)
}
int
-be_compiled_visitor_operation_argument_invoke::post_process (be_decl *bd)
+be_visitor_operation_argument_invoke::post_process (be_decl *bd)
{
be_argument *arg = be_argument::narrow_from_decl (bd);
@@ -117,7 +114,7 @@ be_compiled_visitor_operation_argument_invoke::post_process (be_decl *bd)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) "
- "be_compiled_visitor_operation_argument_invoke"
+ "be_visitor_operation_argument_invoke"
"::post_process - "
"Bad argument node\n"),
-1);
@@ -130,12 +127,12 @@ be_compiled_visitor_operation_argument_invoke::post_process (be_decl *bd)
case AST_Argument::dir_IN:
// only these arguments get printed
this->last_arg_printed_ =
- be_compiled_visitor_operation_argument_invoke::TAO_ARG_IN;
+ be_visitor_operation_argument_invoke::TAO_ARG_IN;
break;
case AST_Argument::dir_INOUT:
// only these arguments get printed
this->last_arg_printed_ =
- be_compiled_visitor_operation_argument_invoke::TAO_ARG_INOUT;
+ be_visitor_operation_argument_invoke::TAO_ARG_INOUT;
break;
case AST_Argument::dir_OUT:
// these arguments don't get printed for the << operator on the stub
@@ -151,19 +148,19 @@ be_compiled_visitor_operation_argument_invoke::post_process (be_decl *bd)
case AST_Argument::dir_INOUT:
// only these arguments get printed
this->last_arg_printed_ =
- be_compiled_visitor_operation_argument_invoke::TAO_ARG_INOUT;
+ be_visitor_operation_argument_invoke::TAO_ARG_INOUT;
break;
case AST_Argument::dir_OUT:
// only these arguments get printed
this->last_arg_printed_ =
- be_compiled_visitor_operation_argument_invoke::TAO_ARG_OUT;
+ be_visitor_operation_argument_invoke::TAO_ARG_OUT;
break;
}
break;
default:
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) "
- "be_compiled_visitor_operation_argument_invoke"
+ "be_visitor_operation_argument_invoke"
"::post_process - "
"Bad sub state\n"),
-1);
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/argument_marshal.cpp b/TAO/TAO_IDL/be/be_visitor_operation/argument_marshal.cpp
index 756964eacbd..ec59c0045c8 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/argument_marshal.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/argument_marshal.cpp
@@ -20,34 +20,31 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, argument_marshal, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ argument_marshal,
+ "$Id$")
// ************************************************************
// operation visitor to handle the passing of arguments to the CDR operators
// ************************************************************
-be_compiled_visitor_operation_argument_marshal::
-be_compiled_visitor_operation_argument_marshal (be_visitor_context
- *ctx)
+be_visitor_operation_argument_marshal::be_visitor_operation_argument_marshal (
+ be_visitor_context
+ *ctx
+ )
: be_visitor_operation_argument (ctx),
- last_arg_printed_ (be_compiled_visitor_operation_argument_marshal::TAO_ARG_NONE)
+ last_arg_printed_ (be_visitor_operation_argument_marshal::TAO_ARG_NONE)
{
}
-be_compiled_visitor_operation_argument_marshal::
-~be_compiled_visitor_operation_argument_marshal (void)
+be_visitor_operation_argument_marshal::~be_visitor_operation_argument_marshal (
+ void
+ )
{
}
int
-be_compiled_visitor_operation_argument_marshal::pre_process (be_decl *bd)
+be_visitor_operation_argument_marshal::pre_process (be_decl *bd)
{
TAO_OutStream *os = this->ctx_->stream ();
@@ -57,7 +54,7 @@ be_compiled_visitor_operation_argument_marshal::pre_process (be_decl *bd)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) "
- "be_compiled_visitor_operation_argument_marshal"
+ "be_visitor_operation_argument_marshal"
"::post_process - "
"Bad argument node\n"),
-1);
@@ -68,7 +65,7 @@ be_compiled_visitor_operation_argument_marshal::pre_process (be_decl *bd)
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
{
if (this->last_arg_printed_ !=
- be_compiled_visitor_operation_argument_marshal::TAO_ARG_NONE)
+ be_visitor_operation_argument_marshal::TAO_ARG_NONE)
*os << " &&\n";
}
else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
@@ -80,13 +77,13 @@ be_compiled_visitor_operation_argument_marshal::pre_process (be_decl *bd)
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
{
if (this->last_arg_printed_ !=
- be_compiled_visitor_operation_argument_marshal::TAO_ARG_NONE)
+ be_visitor_operation_argument_marshal::TAO_ARG_NONE)
*os << " &&\n";
}
else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
{
if (this->last_arg_printed_ !=
- be_compiled_visitor_operation_argument_marshal::TAO_ARG_NONE)
+ be_visitor_operation_argument_marshal::TAO_ARG_NONE)
*os << " &&\n";
}
break;
@@ -98,7 +95,7 @@ be_compiled_visitor_operation_argument_marshal::pre_process (be_decl *bd)
else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
{
if (this->last_arg_printed_ !=
- be_compiled_visitor_operation_argument_marshal::TAO_ARG_NONE)
+ be_visitor_operation_argument_marshal::TAO_ARG_NONE)
*os << " &&\n";
}
break;
@@ -108,7 +105,7 @@ be_compiled_visitor_operation_argument_marshal::pre_process (be_decl *bd)
}
int
-be_compiled_visitor_operation_argument_marshal::post_process (be_decl *bd)
+be_visitor_operation_argument_marshal::post_process (be_decl *bd)
{
be_argument *arg = be_argument::narrow_from_decl (bd);
@@ -116,7 +113,7 @@ be_compiled_visitor_operation_argument_marshal::post_process (be_decl *bd)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) "
- "be_compiled_visitor_operation_argument_marshal"
+ "be_visitor_operation_argument_marshal"
"::post_process - "
"Bad argument node\n"),
-1);
@@ -129,12 +126,12 @@ be_compiled_visitor_operation_argument_marshal::post_process (be_decl *bd)
case AST_Argument::dir_IN:
// only these arguments get printed
this->last_arg_printed_ =
- be_compiled_visitor_operation_argument_marshal::TAO_ARG_IN;
+ be_visitor_operation_argument_marshal::TAO_ARG_IN;
break;
case AST_Argument::dir_INOUT:
// only these arguments get printed
this->last_arg_printed_ =
- be_compiled_visitor_operation_argument_marshal::TAO_ARG_INOUT;
+ be_visitor_operation_argument_marshal::TAO_ARG_INOUT;
break;
case AST_Argument::dir_OUT:
// these arguments don't get printed for the << operator on the stub
@@ -150,19 +147,19 @@ be_compiled_visitor_operation_argument_marshal::post_process (be_decl *bd)
case AST_Argument::dir_INOUT:
// only these arguments get printed
this->last_arg_printed_ =
- be_compiled_visitor_operation_argument_marshal::TAO_ARG_INOUT;
+ be_visitor_operation_argument_marshal::TAO_ARG_INOUT;
break;
case AST_Argument::dir_OUT:
// only these arguments get printed
this->last_arg_printed_ =
- be_compiled_visitor_operation_argument_marshal::TAO_ARG_OUT;
+ be_visitor_operation_argument_marshal::TAO_ARG_OUT;
break;
}
break;
default:
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) "
- "be_compiled_visitor_operation_argument_marshal"
+ "be_visitor_operation_argument_marshal"
"::post_process - "
"Bad sub state\n"),
-1);
@@ -172,19 +169,19 @@ be_compiled_visitor_operation_argument_marshal::post_process (be_decl *bd)
// ****************************************************************
-be_visitor_compiled_args_decl::be_visitor_compiled_args_decl (be_visitor_context *ctx)
+be_visitor_args_decl::be_visitor_args_decl (be_visitor_context *ctx)
: be_visitor_scope (ctx)
{
}
int
-be_visitor_compiled_args_decl::visit_operation (be_operation *node)
+be_visitor_args_decl::visit_operation (be_operation *node)
{
return this->visit_scope (node);
}
int
-be_visitor_compiled_args_decl::visit_argument (be_argument *node)
+be_visitor_args_decl::visit_argument (be_argument *node)
{
this->ctx_->node (node); // save the argument node
@@ -196,7 +193,7 @@ be_visitor_compiled_args_decl::visit_argument (be_argument *node)
// visit array
int
-be_visitor_compiled_args_decl::visit_array (be_array *node)
+be_visitor_args_decl::visit_array (be_array *node)
{
TAO_OutStream *os = this->ctx_->stream ();
@@ -205,41 +202,52 @@ be_visitor_compiled_args_decl::visit_array (be_array *node)
if (f == 0)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_compiled_args_decl::"
+ "(%N:%l) be_visitor_args_decl::"
"visit_array - "
"cannot retrieve argument node\n"
- ), -1);
+ ),
+ -1);
}
// for anonymous arrays, the type name has a _ prepended. We compute
// the full_name with or without the underscore and use it later on.
char fname [NAMEBUFSIZE]; // to hold the full and
- ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
+
if (!this->ctx_->alias () // not a typedef
&& node->is_child (this->ctx_->scope ()))
{
- // for anonymous arrays ...
- // we have to generate a name for us that has an underscope
+ // For anonymous arrays ...
+ // We have to generate a name for us that has an underscope
// prepended to our local name. This needs to be inserted after
- // the parents's name
+ // the parents's name.
if (node->is_nested ())
{
be_decl *parent =
be_scope::narrow_from_scope (node->defined_in ())->decl ();
- ACE_OS::sprintf (fname, "%s::_%s", parent->full_name (),
+
+ ACE_OS::sprintf (fname,
+ "%s::_%s",
+ parent->full_name (),
node->local_name ()->get_string ());
}
else
{
- ACE_OS::sprintf (fname, "_%s", node->full_name ());
+ ACE_OS::sprintf (fname,
+ "_%s",
+ node->full_name ());
}
}
else
{
- // typedefed node
- ACE_OS::sprintf (fname, "%s", node->full_name ());
+ // Typedefed node.
+ ACE_OS::sprintf (fname,
+ "%s",
+ node->full_name ());
}
if (f->direction () != AST_Argument::dir_IN)
@@ -250,24 +258,27 @@ be_visitor_compiled_args_decl::visit_array (be_array *node)
<< f->local_name ()
<< be_uidt_nl << ");" << be_uidt_nl;
}
+
return 0;
}
// visit typedef type
int
-be_visitor_compiled_args_decl::visit_typedef (be_typedef *node)
+be_visitor_args_decl::visit_typedef (be_typedef *node)
{
this->ctx_->alias (node);
// 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_compiled_args_decl::"
+ "(%N:%l) be_visitor_args_decl::"
"visit_typedef - "
"Bad primitive type\n"
- ), -1);
+ ),
+ -1);
}
this->ctx_->alias (0);
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/base_proxy_impl_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/base_proxy_impl_ch.cpp
index 5cf6a728d1b..5d02b51fea8 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/base_proxy_impl_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/base_proxy_impl_ch.cpp
@@ -1,38 +1,29 @@
// $Id$
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+ACE_RCSID (be_visitor_operation,
+ x_proxy_impl_xh,
+ "$Id$")
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, x_proxy_impl_xh, "$Id$")
-
-
-be_visitor_operation_base_proxy_impl_ch::be_visitor_operation_base_proxy_impl_ch (be_visitor_context *ctx)
+be_visitor_operation_base_proxy_impl_ch::
+be_visitor_operation_base_proxy_impl_ch (be_visitor_context *ctx)
: be_visitor_scope (ctx)
{
}
-be_visitor_operation_base_proxy_impl_ch::~be_visitor_operation_base_proxy_impl_ch (void)
+be_visitor_operation_base_proxy_impl_ch::
+~be_visitor_operation_base_proxy_impl_ch (void)
{
}
int be_visitor_operation_base_proxy_impl_ch::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
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
- // 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 ());
+ // STEP I: generate the return type.
+ be_type *bt = be_type::narrow_from_decl (node->return_type ());
if (!bt)
{
@@ -43,32 +34,19 @@ int be_visitor_operation_base_proxy_impl_ch::visit_operation (be_operation *node
-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);
+ be_visitor_operation_rettype oro_visitor (&ctx);
- if (!visitor)
+ if (bt->accept (&oro_visitor) == -1)
{
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 ();
@@ -76,28 +54,16 @@ int be_visitor_operation_base_proxy_impl_ch::visit_operation (be_operation *node
// we grab a visitor that generates the parameter listing
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_BASE_PROXY_IMPL_CH);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_arglist oabpi_visitor (&ctx);
- if (!visitor)
+ if (node->accept (&oabpi_visitor) == -1)
{
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/direct_proxy_impl_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp
index 9b24f4fa611..3906b4e89eb 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp
@@ -1,34 +1,31 @@
// $Id$
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+ACE_RCSID (be_visitor_operation,
+ direct_proxy_impl_ss,
+ "$Id$")
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, direct_proxy_impl_ss, "$Id$")
-
-be_visitor_operation_direct_proxy_impl_ss::be_visitor_operation_direct_proxy_impl_ss
-(be_visitor_context *ctx)
- : be_visitor_scope (ctx)
+be_visitor_operation_direct_proxy_impl_ss::
+be_visitor_operation_direct_proxy_impl_ss (be_visitor_context *ctx)
+ : be_visitor_operation (ctx)
{
}
-be_visitor_operation_direct_proxy_impl_ss::~be_visitor_operation_direct_proxy_impl_ss (void)
+be_visitor_operation_direct_proxy_impl_ss::
+~be_visitor_operation_direct_proxy_impl_ss (void)
{
}
-
int
-be_visitor_operation_direct_proxy_impl_ss::visit_operation (be_operation *node)
+be_visitor_operation_direct_proxy_impl_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 ()
+ // information from the context.
+ be_interface *intf = this->ctx_->attribute ()
? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ())
: be_interface::narrow_from_scope (node->defined_in ());
@@ -41,8 +38,8 @@ be_visitor_operation_direct_proxy_impl_ss::visit_operation (be_operation *node)
-1);
}
- // retrieve the operation return type
be_type *bt = be_type::narrow_from_decl (node->return_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -51,31 +48,21 @@ be_visitor_operation_direct_proxy_impl_ss::visit_operation (be_operation *node)
"Bad return type\n"),
-1);
}
+
os->indent ();
// 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_direct_collocated_ss::"
- "visit_operation - "
- "Bad visitor for return type\n"),
- -1);
- }
+ be_visitor_operation_rettype oro_visitor (&ctx);
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&oro_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_direct_collocated_ss::"
"visit_operation - "
"codegen for return type failed\n"),
-1);
}
- delete visitor;
*os << " " << intf->full_direct_proxy_impl_name () << "::"
<< node->local_name () << " ";
@@ -84,26 +71,16 @@ be_visitor_operation_direct_proxy_impl_ss::visit_operation (be_operation *node)
// in the header file)
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XS);
- 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);
- }
+ be_visitor_operation_arglist oapi_visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&oapi_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";
@@ -122,8 +99,11 @@ be_visitor_operation_direct_proxy_impl_ss::visit_operation (be_operation *node)
<< "\"" << intf->repoID () << "\"" << ")"
<< be_uidt_nl // idt = 2
<< ")";
+
if (this->gen_invoke (ctx, node) == -1)
- return -1;
+ {
+ return -1;
+ }
*os << be_uidt_nl
<< "}" << be_nl << be_nl;
@@ -134,8 +114,10 @@ be_visitor_operation_direct_proxy_impl_ss::visit_operation (be_operation *node)
int
-be_visitor_operation_direct_proxy_impl_ss::gen_invoke (be_visitor_context &ctx,
- be_operation *node)
+be_visitor_operation_direct_proxy_impl_ss::gen_invoke (
+ be_visitor_context &ctx,
+ be_operation *node
+ )
{
TAO_OutStream *os = this->ctx_->stream ();
@@ -144,10 +126,10 @@ be_visitor_operation_direct_proxy_impl_ss::gen_invoke (be_visitor_context &ctx,
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ be_visitor_operation_argument visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_direct_collocated_ss::"
"gen_invoke - "
@@ -155,21 +137,9 @@ be_visitor_operation_direct_proxy_impl_ss::gen_invoke (be_visitor_context &ctx,
-1);
}
- // end the upcall
*os << be_uidt_nl
<< ");" << be_uidt << be_uidt << be_uidt_nl;
+
return 0;
}
-int
-be_visitor_operation_direct_proxy_impl_ss::void_return_type (be_type *bt)
-{
- // is the operation return type void?
-
- 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;
-}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp
index f957bcb3397..0a8a34ad455 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp
@@ -19,14 +19,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, exceptlist_cs, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ exceptlist_cs,
+ "$Id$")
// ****************************************************************************
// visitor to generate the exception list for operations
@@ -52,6 +47,7 @@ be_visitor_operation_exceptlist_cs::visit_operation (be_operation *node)
if (node->exceptions ())
{
os->indent ();
+
*os << "static TAO_Exception_Data " << "_tao_" << node->flat_name ()
<< "_exceptiondata [] = " << be_nl;
*os << "{" << be_idt_nl;
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_arglist.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_arglist.cpp
index 27499952058..b5eeb05802b 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_arglist.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_arglist.cpp
@@ -18,19 +18,14 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, interceptors_arglist, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ interceptors_arglist,
+ "$Id$")
// ************************************************************
-// operation visitor to generate the argument list.
+// 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
+// visitors to avoid code duplication and tight coupling.
// ************************************************************
be_visitor_operation_interceptors_arglist::
@@ -39,16 +34,18 @@ be_visitor_operation_interceptors_arglist (be_visitor_context *ctx)
{
}
-be_visitor_operation_interceptors_arglist::~be_visitor_operation_interceptors_arglist (void)
+be_visitor_operation_interceptors_arglist::
+~be_visitor_operation_interceptors_arglist (void)
{
}
int
-be_visitor_operation_interceptors_arglist::visit_operation (be_operation *node)
+be_visitor_operation_interceptors_arglist::visit_operation (
+ be_operation *node
+ )
{
TAO_OutStream *os = this->ctx_->stream ();
- // all we do is hand over code generation to our scope
if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -58,7 +55,6 @@ be_visitor_operation_interceptors_arglist::visit_operation (be_operation *node)
-1);
}
- // generate the ACE_ENV_ARG_PARAMETER for the alternative mapping
if (!be_global->exception_support ())
{
switch (this->ctx_->state ())
@@ -68,7 +64,6 @@ be_visitor_operation_interceptors_arglist::visit_operation (be_operation *node)
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARG_INFO_CS:
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_PARAMLIST:
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARG_INFO_SS:
- // case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_RESULT:
break;
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_CS:
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SS:
@@ -79,7 +74,7 @@ be_visitor_operation_interceptors_arglist::visit_operation (be_operation *node)
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_CS:
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SS:
{
- // last argument - is always CORBA::Environment
+ // Last argument - is always CORBA::Environment.
*os << " ACE_ENV_ARG_DECL_NOT_USED";
break;
}
@@ -88,7 +83,7 @@ be_visitor_operation_interceptors_arglist::visit_operation (be_operation *node)
{
// @@ Do it for all cases i.e arg count > = 0
- // last argument - is always CORBA::Environment
+ // Last argument - is always CORBA::Environment.
*os << " ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl;
break;
}
@@ -116,14 +111,16 @@ be_visitor_operation_interceptors_arglist::pre_process (be_decl *bd)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) "
- "be_compiled_visitor_operation_argument_invoke"
+ "be_visitor_operation_argument_invoke"
"::post_process - "
"Bad argument node\n"),
-1);
}
if (arg->direction () == AST_Argument::dir_OUT)
- return 0;
+ {
+ return 0;
+ }
switch (this->ctx_->state ())
{
@@ -191,8 +188,7 @@ be_visitor_operation_interceptors_arglist::visit_argument (be_argument *node)
// 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 *intf = this->ctx_->attribute ()
? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ())
: be_interface::narrow_from_scope (op->defined_in ());
@@ -205,43 +201,70 @@ be_visitor_operation_interceptors_arglist::visit_argument (be_argument *node)
-1);
}
- ctx.scope (intf); // set new scope
+ ctx.scope (intf);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_CH:
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_INFO_ARGLIST_CH);
- break;
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_CH:
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_ARGLIST_CH);
- break;
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_CS:
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_INFO_ARGLIST_CH);
- break;
+ case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SH:
+ case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SS:
+ {
+ ctx.state (TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_INFO_ARGLIST_CH);
+ be_visitor_args_request_info_arglist visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_CH:
+ {
+ ctx.state (TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_ARGLIST_CH);
+ be_visitor_args_request_info_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARG_INFO_CS:
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_ARGLIST_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_ARGLIST_CS);
+ be_visitor_args_request_info_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_CS:
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_INFO_ARGLIST_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_INFO_ARGLIST_CS);
+ be_visitor_args_request_info_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_PARAMLIST:
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_PARAMLIST);
- break;
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SH:
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_INFO_ARGLIST_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_PARAMLIST);
+ be_visitor_args_paramlist visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SH:
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_ARGLIST_SH);
- break;
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SS:
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_INFO_ARGLIST_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_ARGLIST_SH);
+ be_visitor_args_request_info_sh visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARG_INFO_SS:
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_ARGLIST_SS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_ARGLIST_SS);
+ be_visitor_args_request_info_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SS:
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_UPCALL_SS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARGUMENT_UPCALL_SS);
+ be_visitor_args_upcall_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -252,29 +275,15 @@ be_visitor_operation_interceptors_arglist::visit_argument (be_argument *node)
}
}
- // Grab a visitor.
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
-
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interceptors_arglist::"
"visit_argument - "
- "Bad visitor\n"),
- -1);
- }
-
- if (node->accept (visitor) == -1)
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_interceptors_arglist::"
- "visit_argument - "
"codegen for interceptors_arglist failed\n"),
-1);
}
- delete visitor;
return 0;
}
@@ -288,14 +297,16 @@ be_visitor_operation_interceptors_arglist::post_process (be_decl *bd)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) "
- "be_compiled_visitor_operation_argument_invoke"
+ "be_visitor_operation_argument_invoke"
"::post_process - "
"Bad argument node\n"),
-1);
}
if (arg->direction () != AST_Argument::dir_OUT)
- return 0;
+ {
+ return 0;
+ }
switch (this->ctx_->state ())
{
@@ -328,5 +339,6 @@ be_visitor_operation_interceptors_arglist::post_process (be_decl *bd)
}
}
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp
index aedee6e66f5..d0632d128ac 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp
@@ -18,18 +18,13 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+ACE_RCSID (be_visitor_operation,
+ operation_interceptors_ch,
+ "$Id$")
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, operation_interceptors_ch, "$Id$")
-
-
- // ******************************************************
- // primary visitor for "operation" in client header
- // ******************************************************
+// ******************************************************
+// primary visitor for "operation" in client header
+// ******************************************************
be_visitor_operation_interceptors_ch::be_visitor_operation_interceptors_ch (
be_visitor_context *ctx
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp
index 122e9f3784c..2c84d1e4fec 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp
@@ -18,18 +18,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_operation.h"
-
ACE_RCSID (be_visitor_operation,
operation_interceptors_cs,
"$Id$")
-
// ******************************************************
-// primary visitor for "operation" in client header
+// Primary visitor for "operation" in client header
// ******************************************************
be_visitor_operation_interceptors_cs::be_visitor_operation_interceptors_cs (
@@ -51,24 +45,28 @@ be_visitor_operation_interceptors_cs::visit_operation (be_operation *node)
TAO_OutStream *os = this->ctx_->stream ();
if (this->generate_class_declaration (os, node) == -1)
- return -1;
+ {
+ return -1;
+ }
if (this->generate_class_definition (os, node) == -1)
- return -1;
+ {
+ return -1;
+ }
return 0;
}
int
-be_visitor_operation_interceptors_cs::
- generate_class_declaration (TAO_OutStream *os,
- be_operation *node)
+be_visitor_operation_interceptors_cs::generate_class_declaration (
+ TAO_OutStream *os,
+ be_operation *node
+ )
{
be_type *bt = 0;
be_visitor_context ctx (*this->ctx_);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- // Save the node
+ // Save the node.
this->ctx_->node (node);
// Generate the ClientRequestInfo object per operation to
@@ -146,36 +144,32 @@ be_visitor_operation_interceptors_cs::
}
*os << " (" << be_idt << be_idt_nl
- << "TAO_GIOP_Invocation *_tao_invocation," << be_nl
- << "CORBA::Object_ptr _tao_target";
+ << "TAO_GIOP_Invocation *_tao_invocation," << be_nl;
+
+ if (node->defined_in ()->is_abstract ())
+ {
+ *os << "CORBA::AbstractBase_ptr _tao_target";
+ }
+ else
+ {
+ *os << "CORBA::Object_ptr _tao_target";
+ }
// 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_INTERCEPTORS_ARGLIST_CH);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_interceptors_arglist oia_visitor (&ctx);
- if (!visitor)
+ if (node->accept (&oia_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_operation_interceptors_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_interceptors_ch::"
"visit_operation - "
"codegen for argument list failed\n"),
-1);
}
- delete visitor;
-
if (be_global->exception_support ())
{
*os << be_uidt;
@@ -219,11 +213,10 @@ be_visitor_operation_interceptors_cs::
*os << be_nl << "void result (";
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_RETTYPE_CH);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_interceptors_info_rettype oiir_visitor (&ctx);
- if (!visitor || (bt->accept (visitor) == -1))
+ if (bt->accept (&oiir_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_cs::"
"visit_operation - "
@@ -235,7 +228,6 @@ be_visitor_operation_interceptors_cs::
}
*os << be_uidt_nl << "private:" << be_idt_nl;
-
*os << "TAO_ClientRequestInfo_" << node->flat_name ();
// We need the interface node in which this operation was defined. However,
@@ -341,29 +333,17 @@ be_visitor_operation_interceptors_cs::
// we grab a visitor that generates the parameter listing and
// modify it to generate reference members.
ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_CH);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_interceptors_arglist oiia_visitor (&ctx);
- if (!visitor)
+ if (node->accept (&oiia_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_operation_interceptors_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_interceptors_ch::"
"visit_operation - "
"codegen for argument list failed\n"),
-1);
}
- delete visitor;
-
// Generate the result data member.
// Generate the return type.
bt = be_type::narrow_from_decl (node->return_type ());
@@ -383,11 +363,10 @@ be_visitor_operation_interceptors_cs::
{
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_RETTYPE_CH);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_interceptors_info_rettype toiir_visitor (&ctx);
- if (!visitor || (bt->accept (visitor) == -1))
+ if (bt->accept (&toiir_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_cs::"
"visit_operation - "
@@ -408,16 +387,16 @@ be_visitor_operation_interceptors_cs::
}
int
-be_visitor_operation_interceptors_cs::
- generate_class_definition (TAO_OutStream *os,
- be_operation *node)
+be_visitor_operation_interceptors_cs::generate_class_definition (
+ TAO_OutStream *os,
+ be_operation *node
+ )
{
// Start with the current indentation level.
os->indent ();
be_type *bt = 0;
be_visitor_context ctx (*this->ctx_);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
// Save the node.
this->ctx_->node (node);
@@ -488,19 +467,26 @@ be_visitor_operation_interceptors_cs::
}
*os << " (" << be_idt << be_idt_nl
- << "TAO_GIOP_Invocation *_tao_invocation," << be_nl
- << "CORBA::Object_ptr _tao_target";
+ << "TAO_GIOP_Invocation *_tao_invocation," << be_nl;
+
+ if (node->defined_in ()->is_abstract ())
+ {
+ *os << "CORBA::AbstractBase_ptr _tao_target";
+ }
+ else
+ {
+ *os << "CORBA::Object_ptr _tao_target";
+ }
// 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_INTERCEPTORS_ARGLIST_CS);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_interceptors_arglist toiia_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&toiia_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_cs::"
"visit_operation - "
@@ -508,7 +494,6 @@ be_visitor_operation_interceptors_cs::
-1);
}
- delete visitor;
os->indent ();
*os << be_uidt_nl << ")" << be_uidt_nl;
@@ -519,11 +504,10 @@ be_visitor_operation_interceptors_cs::
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARG_INFO_CS);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_interceptors_arglist oiai_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&oiai_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_cs::"
"visit_operation - "
@@ -531,8 +515,6 @@ be_visitor_operation_interceptors_cs::
-1);
}
- delete visitor;
-
os->decr_indent ();
*os << be_nl << "{}\n\n";
@@ -582,20 +564,21 @@ be_visitor_operation_interceptors_cs::
{
*os << "// Generate the argument list on demand." << be_nl
<< "Dynamic::ParameterList *parameter_list =" << be_idt_nl
- << "TAO_RequestInfo_Util::make_parameter_list (ACE_ENV_SINGLE_ARG_PARAMETER);"
+ << "TAO_RequestInfo_Util::make_parameter_list "
+ << "(ACE_ENV_SINGLE_ARG_PARAMETER);"
<< be_uidt_nl
<< "ACE_CHECK_RETURN (0);" << be_nl
<< be_nl;
size_t parameter_count = this->count_non_out_parameters (node);
- if (node->argument_count () == 0 ||
- parameter_count == 0 ||
+ if (node->argument_count () == 0
+ || parameter_count == 0
// Now make sure that we have some in and inout
// parameters. Otherwise, there is nothing to be put into
// the Dyanmic::Paramlist.
- (!(this->has_param_type (node, AST_Argument::dir_IN)) &&
- !(this->has_param_type (node, AST_Argument::dir_INOUT))))
+ || (!(this->has_param_type (node, AST_Argument::dir_IN))
+ && !(this->has_param_type (node, AST_Argument::dir_INOUT))))
{
*os << "return parameter_list;" << be_uidt_nl;
}
@@ -621,11 +604,10 @@ be_visitor_operation_interceptors_cs::
// decide this.
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_PARAMLIST);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_interceptors_arglist oip_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&oip_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_cs::"
"visit_operation - "
@@ -633,8 +615,6 @@ be_visitor_operation_interceptors_cs::
-1);
}
- delete visitor;
-
*os << be_nl
<< "return safe_parameter_list._retn ();";
}
@@ -701,7 +681,8 @@ be_visitor_operation_interceptors_cs::
{
*os << "// Generate the exception list on demand." << be_nl
<< "Dynamic::ExceptionList *exception_list =" << be_idt_nl
- << "TAO_RequestInfo_Util::make_exception_list (ACE_ENV_SINGLE_ARG_PARAMETER);"
+ << "TAO_RequestInfo_Util::make_exception_list "
+ << "(ACE_ENV_SINGLE_ARG_PARAMETER);"
<< be_uidt_nl
<< "ACE_CHECK_RETURN (0);" << be_nl
<< be_nl;
@@ -718,11 +699,10 @@ be_visitor_operation_interceptors_cs::
// We change our scope to be able to generate the exceptionlist.
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_EXCEPTLIST);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_interceptors_exceptlist oie_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&oie_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_cs::"
"visit_operation - "
@@ -730,8 +710,6 @@ be_visitor_operation_interceptors_cs::
-1);
}
- delete visitor;
-
*os << be_nl
<< "return safe_exception_list._retn ();";
}
@@ -805,7 +783,8 @@ be_visitor_operation_interceptors_cs::
// Return an Any with tk_void TypeCode.
*os << "CORBA::Boolean tk_void_any = 1;" << be_nl
<< "CORBA::Any *result_any =" << be_idt_nl
- << "TAO_RequestInfo_Util::make_any (tk_void_any ACE_ENV_ARG_PARAMETER);"
+ << "TAO_RequestInfo_Util::make_any "
+ << "(tk_void_any ACE_ENV_ARG_PARAMETER);"
<< be_uidt_nl
<< "ACE_CHECK_RETURN (0);" << be_nl
<< be_nl
@@ -815,7 +794,8 @@ be_visitor_operation_interceptors_cs::
{
*os << "CORBA::Boolean tk_void_any = 0;" << be_nl
<< "CORBA::Any *result_any =" << be_idt_nl
- << "TAO_RequestInfo_Util::make_any (tk_void_any ACE_ENV_ARG_PARAMETER);"
+ << "TAO_RequestInfo_Util::make_any "
+ << "(tk_void_any ACE_ENV_ARG_PARAMETER);"
<< be_uidt_nl
<< "ACE_CHECK_RETURN (0);" << be_nl
<< be_nl
@@ -825,11 +805,10 @@ be_visitor_operation_interceptors_cs::
// Generate the insertion of result into Any.
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_RESULT);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_interceptors_result oir_visitor (&ctx);
- if (!visitor || (bt->accept (visitor) == -1))
+ if (bt->accept (&oir_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_cs::"
"visit_operation - "
@@ -837,8 +816,6 @@ be_visitor_operation_interceptors_cs::
-1);
}
- delete visitor;
-
*os << "return safe_result_any._retn ();";
}
}
@@ -867,7 +844,7 @@ be_visitor_operation_interceptors_cs::
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_interceptors_ch::"
+ "(%N:%l) be_visitor_interceptors_ch::"
"visit_operation - "
"Bad return type\n"),
-1);
@@ -882,11 +859,11 @@ be_visitor_operation_interceptors_cs::
*os << "TAO_ClientRequestInfo_"<< node->flat_name ();
- // 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 and add a "_get"/"_set" to the flat
- // name to get around the problem of overloaded methods which are
- // generated for attributes.
+ // 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 and add a "_get"/"_set"
+ // to the flat name to get around the problem of overloaded methods
+ // which are generated for attributes.
if (this->ctx_->attribute ())
{
bt = be_type::narrow_from_decl (node->return_type ());
@@ -917,11 +894,10 @@ be_visitor_operation_interceptors_cs::
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_CH);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_rettype or_visitor (&ctx);
- if (!visitor || (bt->accept (visitor) == -1))
+ if (bt->accept (&or_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_cs::"
"visit_operation - "
@@ -930,6 +906,7 @@ be_visitor_operation_interceptors_cs::
}
os->indent ();
+
*os << " result)" << be_uidt << be_uidt << be_uidt_nl
<< "{" << be_idt_nl
<< "// update the result " << be_nl
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp
index 483f72c2553..f60dd96d77d 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, interceptors_exceptlist, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ interceptors_exceptlist,
+ "$Id$")
// ************************************************************
// Operation visitor for exception list
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_info_rettype.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_info_rettype.cpp
index a119d621f85..5a244b36f95 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_info_rettype.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_info_rettype.cpp
@@ -19,40 +19,40 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, interceptors_info_rettype, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ interceptors_info_rettype,
+ "$Id$")
// ****************************************************************************
// Operation visitor for return types. This generates the mapping for a return
// type in an operation signature
// ****************************************************************************
-be_visitor_operation_interceptors_info_rettype::be_visitor_operation_interceptors_info_rettype (be_visitor_context
- *ctx)
+be_visitor_operation_interceptors_info_rettype::
+be_visitor_operation_interceptors_info_rettype (be_visitor_context *ctx)
: be_visitor_decl (ctx)
{
}
-be_visitor_operation_interceptors_info_rettype::~be_visitor_operation_interceptors_info_rettype (void)
+be_visitor_operation_interceptors_info_rettype::
+~be_visitor_operation_interceptors_info_rettype (void)
{
}
int
be_visitor_operation_interceptors_info_rettype::visit_array (be_array *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
- be_type *bt; // return type
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- if (this->ctx_->alias ()) // a typedefed return type
- bt = this->ctx_->alias ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
*os << bt->name () << "_slice *";
@@ -62,14 +62,17 @@ be_visitor_operation_interceptors_info_rettype::visit_array (be_array *node)
int
be_visitor_operation_interceptors_info_rettype::visit_enum (be_enum *node)
{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- 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 ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
*os << bt->name ();
@@ -79,14 +82,17 @@ be_visitor_operation_interceptors_info_rettype::visit_enum (be_enum *node)
int
be_visitor_operation_interceptors_info_rettype::visit_interface (be_interface *node)
{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- 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 ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
*os << bt->name () << "_ptr";
@@ -96,14 +102,17 @@ be_visitor_operation_interceptors_info_rettype::visit_interface (be_interface *n
int
be_visitor_operation_interceptors_info_rettype::visit_interface_fwd (be_interface_fwd *node)
{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- 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 ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
*os << bt->name () << "_ptr";
@@ -113,14 +122,17 @@ be_visitor_operation_interceptors_info_rettype::visit_interface_fwd (be_interfac
int
be_visitor_operation_interceptors_info_rettype::visit_native (be_native *node)
{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- 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 ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
*os << bt->name ();
@@ -130,18 +142,22 @@ be_visitor_operation_interceptors_info_rettype::visit_native (be_native *node)
int
be_visitor_operation_interceptors_info_rettype::visit_predefined_type (be_predefined_type *node)
{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- 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 ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
switch (node->pt ())
{
case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
*os << bt->name () << "_ptr";
break;
case AST_PredefinedType::PT_any:
@@ -164,16 +180,19 @@ be_visitor_operation_interceptors_info_rettype::visit_predefined_type (be_predef
int
be_visitor_operation_interceptors_info_rettype::visit_sequence (be_sequence *node)
{
-
- // we should never directly be here because anonymous sequence return types
+ // 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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- if (this->ctx_->alias ()) // a typedefed return type
- bt = this->ctx_->alias ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
*os << bt->name () << " *";
@@ -183,8 +202,7 @@ be_visitor_operation_interceptors_info_rettype::visit_sequence (be_sequence *nod
int
be_visitor_operation_interceptors_info_rettype::visit_string (be_string *node)
{
-
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ TAO_OutStream *os = this->ctx_->stream ();
if (node->width () == (long) sizeof (char))
{
@@ -201,20 +219,23 @@ be_visitor_operation_interceptors_info_rettype::visit_string (be_string *node)
int
be_visitor_operation_interceptors_info_rettype::visit_structure (be_structure *node)
{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- 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 ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
*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)
+ if (node->size_type () == AST_Type::VARIABLE)
{
*os << " *";
}
@@ -244,20 +265,23 @@ be_visitor_operation_interceptors_info_rettype::visit_typedef (be_typedef *node)
int
be_visitor_operation_interceptors_info_rettype::visit_union (be_union *node)
{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- 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 ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
*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)
+ if (node->size_type () == AST_Type::VARIABLE)
{
*os << " *";
}
@@ -268,14 +292,17 @@ be_visitor_operation_interceptors_info_rettype::visit_union (be_union *node)
int
be_visitor_operation_interceptors_info_rettype::visit_valuetype (be_valuetype *node)
{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- 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 ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
*os << bt->name () << " *";
@@ -285,14 +312,17 @@ be_visitor_operation_interceptors_info_rettype::visit_valuetype (be_valuetype *n
int
be_visitor_operation_interceptors_info_rettype::visit_valuetype_fwd (be_valuetype_fwd *node)
{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- 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 ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
*os << bt->name () << " *";
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_result.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_result.cpp
index f7f400d7de3..817be665329 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_result.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_result.cpp
@@ -18,33 +18,30 @@
//
// ============================================================================
-#include "idl.h"
-#include "be.h"
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_argument, interceptors_result, "$Id$")
-
+ACE_RCSID (be_visitor_argument,
+ interceptors_result,
+ "$Id$")
// ************************************************************
// be_visitor_operation_interceptors_result for generating the result as
// stored in the request info for interceptors
// ************************************************************
-be_visitor_operation_interceptors_result::be_visitor_operation_interceptors_result (be_visitor_context *ctx)
+be_visitor_operation_interceptors_result::
+be_visitor_operation_interceptors_result (be_visitor_context *ctx)
: be_visitor_decl (ctx)
{
}
-be_visitor_operation_interceptors_result::~be_visitor_operation_interceptors_result (void)
+be_visitor_operation_interceptors_result::
+~be_visitor_operation_interceptors_result (void)
{
}
int
be_visitor_operation_interceptors_result::visit_array (be_array *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
-
- // if the current type is an alias, use that
+ TAO_OutStream *os = this->ctx_->stream ();
be_type *bt;
if (this->ctx_->alias ())
@@ -66,7 +63,7 @@ be_visitor_operation_interceptors_result::visit_array (be_array *node)
int
be_visitor_operation_interceptors_result::visit_enum (be_enum *)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
*os << "(*result_any) <<= this->_result;" << be_nl;
@@ -76,7 +73,7 @@ be_visitor_operation_interceptors_result::visit_enum (be_enum *)
int
be_visitor_operation_interceptors_result::visit_interface (be_interface *)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
*os << "(*result_any) <<= this->_result;" << be_nl;
@@ -86,7 +83,7 @@ be_visitor_operation_interceptors_result::visit_interface (be_interface *)
int
be_visitor_operation_interceptors_result::visit_interface_fwd (be_interface_fwd *)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
*os << "(*result_any) <<= this->_result;" << be_nl;
@@ -121,7 +118,7 @@ be_visitor_operation_interceptors_result::visit_valuetype_fwd (be_valuetype_fwd
int
be_visitor_operation_interceptors_result::visit_predefined_type (be_predefined_type *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
*os << "(*result_any) <<= ";
@@ -140,6 +137,7 @@ be_visitor_operation_interceptors_result::visit_predefined_type (be_predefined_t
*os << "CORBA::Any::from_octet (this->_result);" << be_nl;
break;
case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
case AST_PredefinedType::PT_any:
case AST_PredefinedType::PT_long:
case AST_PredefinedType::PT_ulong:
@@ -167,7 +165,7 @@ be_visitor_operation_interceptors_result::visit_predefined_type (be_predefined_t
int
be_visitor_operation_interceptors_result::visit_sequence (be_sequence *)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
*os << "(*result_any) <<= this->_result;" << be_nl;
@@ -177,14 +175,14 @@ be_visitor_operation_interceptors_result::visit_sequence (be_sequence *)
int
be_visitor_operation_interceptors_result::visit_string (be_string *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
*os << "(*result_any) <<= ";
- // we need to make a distinction between bounded and unbounded strings
+ // We need to make a distinction between bounded and unbounded strings.
if (node->max_size ()->ev ()->u.ulval != 0)
{
- // bounded strings
+ // Bounded strings.
if (node->width () == (long) sizeof (char))
{
*os << "CORBA::Any::from_string ((char *)";
@@ -209,7 +207,7 @@ return 0;
int
be_visitor_operation_interceptors_result::visit_structure (be_structure *)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
*os << "(*result_any) <<= this->_result;" << be_nl;
@@ -220,7 +218,7 @@ be_visitor_operation_interceptors_result::visit_structure (be_structure *)
int
be_visitor_operation_interceptors_result::visit_union (be_union *)
{
- TAO_OutStream *os = this->ctx_->stream (); // get output stream
+ TAO_OutStream *os = this->ctx_->stream ();
*os << "(*result_any) <<= this->_result;" << be_nl;
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp
index 0df38e65f67..d82171570fc 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp
@@ -18,25 +18,24 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, operation_interceptors_sh, "$Id$")
-
-
- // ******************************************************
- // primary visitor for "operation" in server header
- // ******************************************************
-
- be_visitor_operation_interceptors_sh::be_visitor_operation_interceptors_sh (be_visitor_context *ctx)
- : be_visitor_operation (ctx)
+ACE_RCSID (be_visitor_operation,
+ operation_interceptors_sh,
+ "$Id$")
+
+// ******************************************************
+// primary visitor for "operation" in server header
+// ******************************************************
+
+be_visitor_operation_interceptors_sh::be_visitor_operation_interceptors_sh (
+ be_visitor_context *ctx
+ )
+ : be_visitor_operation (ctx)
{
}
-be_visitor_operation_interceptors_sh::~be_visitor_operation_interceptors_sh (void)
+be_visitor_operation_interceptors_sh::~be_visitor_operation_interceptors_sh (
+ void
+ )
{
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ss.cpp
index d651e62e77f..ce6431704a0 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ss.cpp
@@ -19,18 +19,13 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+ACE_RCSID (be_visitor_operation,
+ operation_interceptors_ss,
+ "$Id$")
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, operation_interceptors_ss, "$Id$")
-
-
- // ******************************************************
- // primary visitor for "operation" in server header
- // ******************************************************
+// ******************************************************
+// primary visitor for "operation" in server header
+// ******************************************************
be_visitor_operation_interceptors_ss::be_visitor_operation_interceptors_ss (
be_visitor_context *ctx
@@ -51,22 +46,26 @@ be_visitor_operation_interceptors_ss::visit_operation (be_operation *node)
TAO_OutStream *os = this->ctx_->stream ();
if (this->generate_class_declaration (os, node) == -1)
- return -1;
+ {
+ return -1;
+ }
if (this->generate_class_definition (os, node) == -1)
- return -1;
+ {
+ return -1;
+ }
return 0;
}
int
-be_visitor_operation_interceptors_ss::
- generate_class_declaration (TAO_OutStream *os,
- be_operation *node)
+be_visitor_operation_interceptors_ss::generate_class_declaration (
+ TAO_OutStream *os,
+ be_operation *node
+ )
{
be_type *bt = 0;
be_visitor_context ctx (*this->ctx_);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
// save the node.
this->ctx_->node (node);
@@ -129,7 +128,7 @@ be_visitor_operation_interceptors_ss::
-1);
}
- // grab the right visitor to generate the return type if its not
+ // Grab the right visitor to generate the return type if its not
// void it means it is not the accessor.
if (!this->void_return_type (bt))
{
@@ -141,8 +140,7 @@ be_visitor_operation_interceptors_ss::
}
}
-
- *os << " (" << be_idt_nl
+ *os << " (" << be_idt << be_idt_nl
<< "TAO_ServerRequest &_tao_server_request," << be_nl;
be_interface *intf;
@@ -160,43 +158,30 @@ be_visitor_operation_interceptors_ss::
}
// Pass in the pointer to the Servant_Upcall.
- *os << "TAO_Object_Adapter::Servant_Upcall *tao_servant_upcall,";
+ *os << "TAO_Object_Adapter::Servant_Upcall *tao_servant_upcall," << be_nl;
// Get the right object implementation.
- *os << intf->full_skel_name () << " *tao_impl" << be_nl;
+ *os << intf->full_skel_name () << " *tao_impl";
// 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_INTERCEPTORS_ARGLIST_SH);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_interceptors_arglist oia_visitor (&ctx);
- if (!visitor)
+ if (node->accept (&oia_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_operation_interceptors_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_interceptors_sh::"
"visit_operation - "
"codegen for argument list failed\n"),
-1);
}
- delete visitor;
-
- *os << ");\n\n";
+ *os << be_uidt_nl << ");" << be_uidt_nl << be_nl;
- os->indent ();
- // Here I still need to generate the other methods + private args
+ // Here I still need to generate the other methods + private args.
*os << "virtual Dynamic::ParameterList * arguments ("
<< be_idt << be_idt_nl
<< "ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
@@ -220,16 +205,16 @@ be_visitor_operation_interceptors_ss::
*os << "virtual char * target_most_derived_interface ("
<< be_idt << be_idt_nl
- << "ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)"
- << be_uidt_nl
+ << "ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
+ << ")" << be_nl
<< "ACE_THROW_SPEC ((CORBA::SystemException));"
<< be_uidt_nl << be_nl;
*os << "virtual CORBA::Boolean target_is_a (" << be_idt << be_idt_nl
<< "const char * id" << be_nl
- << "ACE_ENV_ARG_DECL_WITH_DEFAULTS)"
- << be_uidt_nl
- << "ACE_THROW_SPEC ((CORBA::SystemException));\n"
+ << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
+ << ")" << be_nl
+ << "ACE_THROW_SPEC ((CORBA::SystemException));"
<< be_uidt_nl;
// Store the result for later use.
@@ -249,14 +234,14 @@ be_visitor_operation_interceptors_ss::
// void since we cant have a private member to be of void type.
if (!this->void_return_type (bt))
{
- *os << "void result (";
+ *os << be_nl << "void result (";
+
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_CH);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_rettype or_visitor (&ctx);
- if (!visitor || (bt->accept (visitor) == -1))
+ if (bt->accept (&or_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_cs::"
"visit_operation - "
@@ -268,7 +253,6 @@ be_visitor_operation_interceptors_ss::
}
*os << be_uidt_nl << "private:" << be_idt_nl;
-
*os << "TAO_ServerRequestInfo_" << node->flat_name ();
// We need the interface node in which this operation was defined. However,
@@ -301,7 +285,8 @@ be_visitor_operation_interceptors_ss::
}
}
- *os << " (const "<< "TAO_ServerRequestInfo_"<< node->flat_name ();
+ *os << " (" << be_idt << be_idt_nl
+ << "const "<< "TAO_ServerRequestInfo_"<< node->flat_name ();
// 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
@@ -334,8 +319,10 @@ be_visitor_operation_interceptors_ss::
}
- *os << " &);" << be_nl
- << "void operator= (const "
+ *os << " &" << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl
+ << "void operator= (" << be_idt << be_idt_nl
+ << "const "
<< "TAO_ServerRequestInfo_"<< node->flat_name ();
// We need the interface node in which this operation was defined. However,
@@ -369,33 +356,23 @@ be_visitor_operation_interceptors_ss::
}
- *os << " &);" << be_nl;
+ *os << " &" << be_uidt_nl
+ << ");" << be_uidt_nl;
*os << be_uidt_nl << "private:" << be_idt_nl;
// Get the right object implementation.
*os << intf->full_skel_name () << " *_tao_impl;" << be_nl;
- // Need to generate the args as reference memebers...
+ // Need to generate the args as reference memebers.
// generate the member list with the appropriate mapping. For these
// we grab a visitor that generates the parameter listing and
// modify it to generate reference members.
-
ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SH);
- visitor = tao_cg->make_visitor (&ctx);
-
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_operation_interceptors_sh::"
- "visit_operation - "
- "Bad visitor to return type\n"),
- -1);
- }
+ be_visitor_operation_interceptors_arglist oiia_visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&oiia_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_interceptors_sh::"
"visit_operation - "
@@ -403,11 +380,8 @@ be_visitor_operation_interceptors_ss::
-1);
}
- delete visitor;
-
// Generate the result data member.
// Generate the return type.
-
bt = be_type::narrow_from_decl (node->return_type ());
if (!bt)
@@ -425,11 +399,10 @@ be_visitor_operation_interceptors_ss::
{
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_SH);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_rettype tor_visitor (&ctx);
- if (!visitor || (bt->accept (visitor) == -1))
+ if (bt->accept (&tor_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_cs::"
"visit_operation - "
@@ -446,13 +419,13 @@ be_visitor_operation_interceptors_ss::
}
int
-be_visitor_operation_interceptors_ss::
- generate_class_definition (TAO_OutStream *os,
- be_operation *node)
+be_visitor_operation_interceptors_ss::generate_class_definition (
+ TAO_OutStream *os,
+ be_operation *node
+ )
{
be_type *bt = 0;
be_visitor_context ctx (*this->ctx_);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
// Save the node.
this->ctx_->node (node);
@@ -557,11 +530,10 @@ be_visitor_operation_interceptors_ss::
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SS);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_interceptors_arglist oia_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&oia_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_ss::"
"visit_operation - "
@@ -569,8 +541,6 @@ be_visitor_operation_interceptors_ss::
-1);
}
- delete visitor;
-
*os << be_uidt_nl << ")" << be_nl;
// Generate the member list and set each member but before that,
@@ -581,11 +551,10 @@ be_visitor_operation_interceptors_ss::
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARG_INFO_SS);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_interceptors_arglist oiai_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&oiai_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_args_info_ss::"
"visit_argument- "
@@ -593,8 +562,6 @@ be_visitor_operation_interceptors_ss::
-1);
}
- delete visitor;
-
os->decr_indent ();
*os << be_nl << "{}\n\n";
@@ -635,24 +602,28 @@ be_visitor_operation_interceptors_ss::
}
}
- *os << "::arguments (ACE_ENV_SINGLE_ARG_DECL)" << be_idt_nl
+ *os << "::arguments (" << be_idt << be_idt_nl
+ << "ACE_ENV_SINGLE_ARG_DECL" << be_uidt_nl
+ << ")" << be_nl
<< "ACE_THROW_SPEC ((CORBA::SystemException))" << be_uidt_nl
<< "{" << be_idt_nl
<< "// Generate the argument list on demand." << be_nl
<< "Dynamic::ParameterList *parameter_list =" << be_idt_nl
- << "TAO_RequestInfo_Util::make_parameter_list (ACE_ENV_SINGLE_ARG_PARAMETER);"
+ << "TAO_RequestInfo_Util::make_parameter_list "
+ << "(ACE_ENV_SINGLE_ARG_PARAMETER);"
<< be_uidt_nl
<< "ACE_CHECK_RETURN (0);" << be_nl
<< be_nl;
size_t parameter_count = this->count_non_out_parameters (node);
- if (node->argument_count () == 0 ||
- parameter_count == 0 ||
+
+ if (node->argument_count () == 0
+ || parameter_count == 0
// Now make sure that we have some in and inout
// parameters. Otherwise, there is nothing to be put into
// the Dynamic::Parameterlist.
- (!(this->has_param_type (node, AST_Argument::dir_IN)) &&
- !(this->has_param_type (node, AST_Argument::dir_INOUT))))
+ || (!(this->has_param_type (node, AST_Argument::dir_IN))
+ &&!(this->has_param_type (node, AST_Argument::dir_INOUT))))
{
*os << "return parameter_list;" << be_uidt_nl;
}
@@ -678,11 +649,10 @@ be_visitor_operation_interceptors_ss::
// decide this.
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_PARAMLIST);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_interceptors_arglist oip_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&oip_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_cs::"
"visit_operation - "
@@ -690,8 +660,6 @@ be_visitor_operation_interceptors_ss::
-1);
}
- delete visitor;
-
*os << be_nl
<< "return safe_parameter_list._retn ();" << be_uidt_nl;
}
@@ -737,7 +705,9 @@ be_visitor_operation_interceptors_ss::
}
}
- *os << "::exceptions (ACE_ENV_SINGLE_ARG_DECL)"<< be_idt_nl
+ *os << "::exceptions (" << be_idt << be_idt_nl
+ << "ACE_ENV_SINGLE_ARG_DECL" << be_uidt_nl
+ << ")"<< be_nl
<< "ACE_THROW_SPEC ((CORBA::SystemException))" << be_uidt_nl
<< "{" << be_idt_nl;
@@ -745,7 +715,8 @@ be_visitor_operation_interceptors_ss::
{
*os << "// Generate the exception list on demand." << be_nl
<< "Dynamic::ExceptionList *exception_list =" << be_idt_nl
- << "TAO_RequestInfo_Util::make_exception_list (ACE_ENV_SINGLE_ARG_PARAMETER);"
+ << "TAO_RequestInfo_Util::make_exception_list "
+ << "(ACE_ENV_SINGLE_ARG_PARAMETER);"
<< be_uidt_nl
<< "ACE_CHECK_RETURN (0);" << be_nl
<< be_nl;
@@ -762,11 +733,10 @@ be_visitor_operation_interceptors_ss::
// We change our scope to be able to generate the exceptionlist.
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_EXCEPTLIST);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_interceptors_exceptlist oie_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&oie_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_cs::"
"visit_operation - "
@@ -774,8 +744,6 @@ be_visitor_operation_interceptors_ss::
-1);
}
- delete visitor;
-
*os << be_nl
<< "return safe_exception_list._retn ();";
}
@@ -834,7 +802,9 @@ be_visitor_operation_interceptors_ss::
}
}
- *os << "::result (ACE_ENV_SINGLE_ARG_DECL)"<< be_idt_nl
+ *os << "::result (" << be_idt << be_idt_nl
+ << "ACE_ENV_SINGLE_ARG_DECL" << be_uidt_nl
+ << ")"<< be_nl
<< "ACE_THROW_SPEC ((CORBA::SystemException))" << be_uidt_nl
<< "{" << be_idt_nl;
@@ -849,7 +819,8 @@ be_visitor_operation_interceptors_ss::
// Return an Any with tk_void TypeCode.
*os << "CORBA::Boolean tk_void_any = 1;" << be_nl
<< "CORBA::Any *result_any =" << be_idt_nl
- << "TAO_RequestInfo_Util::make_any (tk_void_any ACE_ENV_ARG_PARAMETER);"
+ << "TAO_RequestInfo_Util::make_any "
+ << "(tk_void_any ACE_ENV_ARG_PARAMETER);"
<< be_uidt_nl
<< "ACE_CHECK_RETURN (0);" << be_nl
<< be_nl
@@ -859,7 +830,8 @@ be_visitor_operation_interceptors_ss::
{
*os << "CORBA::Boolean tk_void_any = 0;" << be_nl
<< "CORBA::Any *result_any =" << be_idt_nl
- << "TAO_RequestInfo_Util::make_any (tk_void_any ACE_ENV_ARG_PARAMETER);"
+ << "TAO_RequestInfo_Util::make_any "
+ << "(tk_void_any ACE_ENV_ARG_PARAMETER);"
<< be_uidt_nl
<< "ACE_CHECK_RETURN (0);" << be_nl
<< be_nl
@@ -869,11 +841,10 @@ be_visitor_operation_interceptors_ss::
// Generate the insertion of result into Any.
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_RESULT);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_interceptors_result oir_visitor (&ctx);
- if (!visitor || (bt->accept (visitor) == -1))
+ if (bt->accept (&oir_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_cs::"
"visit_operation - "
@@ -881,8 +852,6 @@ be_visitor_operation_interceptors_ss::
-1);
}
- delete visitor;
-
*os << be_nl
<< "return safe_result_any._retn ();";
}
@@ -941,7 +910,8 @@ be_visitor_operation_interceptors_ss::
*os << "::target_most_derived_interface ("
<< be_idt << be_idt_nl
- << "ACE_ENV_SINGLE_ARG_DECL_NOT_USED)" << be_uidt_nl
+ << "ACE_ENV_SINGLE_ARG_DECL_NOT_USED" << be_uidt_nl
+ << ")" << be_nl
<< "ACE_THROW_SPEC ((CORBA::SystemException))" << be_uidt_nl
<< "{" << be_idt_nl
<< "return" << be_idt_nl
@@ -987,7 +957,8 @@ be_visitor_operation_interceptors_ss::
*os << "::target_is_a (" << be_idt << be_idt_nl
<< "const char * id" << be_nl
- << "ACE_ENV_ARG_DECL)" << be_uidt_nl
+ << "ACE_ENV_ARG_DECL" << be_uidt_nl
+ << ")" << be_nl
<< "ACE_THROW_SPEC ((CORBA::SystemException))" << be_uidt_nl
<< "{" << be_idt_nl
<< "return this->_tao_impl->_is_a (id ACE_ENV_ARG_PARAMETER);"
@@ -1029,7 +1000,7 @@ be_visitor_operation_interceptors_ss::
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_interceptors_ch::"
+ "(%N:%l) be_visitor_interceptors_ch::"
"visit_operation - "
"Bad return type\n"),
-1);
@@ -1052,11 +1023,10 @@ be_visitor_operation_interceptors_ss::
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_CH);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_rettype or_visitor (&ctx);
- if (!visitor || (bt->accept (visitor) == -1))
+ if (bt->accept (&or_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_cs::"
"visit_operation - "
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/inv_arglist.cpp b/TAO/TAO_IDL/be/be_visitor_operation/inv_arglist.cpp
deleted file mode 100644
index 0e7b149472d..00000000000
--- a/TAO/TAO_IDL/be/be_visitor_operation/inv_arglist.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-// $Id$
-
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, inv_arglist, "$Id$")
-
-
-be_visitor_operation_inv_arglist::
-be_visitor_operation_inv_arglist (be_visitor_context *ctx)
- : be_visitor_operation (ctx)
-{
-}
-
-be_visitor_operation_inv_arglist::~be_visitor_operation_inv_arglist (void)
-{
-}
-
-int
-be_visitor_operation_inv_arglist::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_inv_arglist::"
- "visit_operation - "
- "codegen for scope failed\n"),
- -1);
- }
-
- return 0;
-}
-
-int
-be_visitor_operation_inv_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_inv_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_inv_arglist::"
- "visit_argument - "
- "Bad interface\n"),
- -1);
- }
- ctx.scope (intf); // set new scope
-
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_INVOKE_ARG_LIST);
-
- // grab a visitor
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
-
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_inv_arglist::"
- "visit_argument - "
- "Bad visitor\n"),
- -1);
- }
- if (node->accept (visitor) == -1)
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_inv_arglist::"
- "visit_argument - "
- "codegen for inv_arglist failed\n"),
- -1);
- }
- delete visitor;
- return 0;
-}
-
-
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp
index 5e65540aa00..a560547a29e 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp
@@ -18,28 +18,25 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, operation, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ operation,
+ "$Id$")
// ************************************************************
// Generic Operation visitor
// ************************************************************
be_visitor_operation::be_visitor_operation (be_visitor_context *ctx)
- : be_visitor_scope (ctx)
+ : be_visitor_scope (ctx),
+ operation_name_ (0)
{
}
be_visitor_operation::~be_visitor_operation (void)
{
+ delete [] operation_name_;
}
-
// Is the operation return type void?
int
be_visitor_operation::void_return_type (be_type *bt)
@@ -141,7 +138,7 @@ be_visitor_operation::gen_throw_spec (be_operation *node)
}
UTL_Scope *scope = node->defined_in ();
- be_interface *iface = be_interface::narrow_from_scope ( scope );
+ be_interface *iface = be_interface::narrow_from_scope (scope);
/***************************************************************************/
// 2.6
@@ -151,9 +148,11 @@ be_visitor_operation::gen_throw_spec (be_operation *node)
if (iface != 0)
{
int is_amh_exception_holder = this->is_amh_exception_holder (iface);
- if(!iface->is_valuetype () || is_amh_exception_holder)
+ AST_Decl::NodeType nt = iface->node_type ();
+
+ if (nt != AST_Decl::NT_valuetype || is_amh_exception_holder)
{
- *os << be_idt_nl << throw_spec_open;
+ *os << be_nl << throw_spec_open;
*os << be_idt_nl << "CORBA::SystemException";
if (node->exceptions ())
@@ -180,6 +179,7 @@ be_visitor_operation::gen_throw_spec (be_operation *node)
*os << excp->name ();
}
}
+
*os << be_uidt_nl << throw_spec_close << be_uidt;
}
}
@@ -244,7 +244,7 @@ be_visitor_operation::gen_environment_decl (int argument_emitted,
// Method that returns the appropriate CORBA::Environment variable.
const char *
-be_visitor_operation::gen_environment_var ()
+be_visitor_operation::gen_environment_var (void)
{
static const char *ace_try_env_decl = "ACE_DECLARE_NEW_CORBA_ENV;";
static const char *null_env_decl = "";
@@ -320,11 +320,10 @@ int
be_visitor_operation::gen_check_exception (be_type *return_type)
{
TAO_OutStream *os = this->ctx_->stream ();
- os->indent ();
if (return_type == 0 || this->void_return_type (return_type))
{
- *os << "ACE_CHECK;\n";
+ *os << "ACE_CHECK;" << be_nl;
return 0;
}
@@ -344,7 +343,7 @@ be_visitor_operation::gen_check_exception (be_type *return_type)
-1);
}
- *os << ");\n";
+ *os << ");" << be_nl;
return 0;
}
@@ -352,7 +351,6 @@ int
be_visitor_operation::gen_check_interceptor_exception (be_type *return_type)
{
TAO_OutStream *os = this->ctx_->stream ();
- os->indent ();
if (return_type == 0 || this->void_return_type (return_type))
{
@@ -379,3 +377,935 @@ be_visitor_operation::gen_check_interceptor_exception (be_type *return_type)
*os << ");\n";
return 0;
}
+
+int
+be_visitor_operation::gen_stub_operation_body (
+ be_operation *node,
+ be_type *return_type
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_visitor_context ctx;
+ const char *target = "_collocated_tao_target_";
+
+ if (node->defined_in ()->is_abstract ())
+ {
+ target = "this";
+ }
+
+ // 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 ACE_ENV_ARG_PARAMETER
+ *os << "{" << be_idt_nl;
+ *os << this->gen_environment_var () << "\n";
+
+ // Generate any pre stub info if and only if none of our parameters is of
+ // the native type.
+ if (!node->has_native ())
+ {
+ // native type does not exist.
+
+ // Generate any "pre" stub information such as tables or declarations
+ // This is a template method and the actual work will be done by the
+ // derived class
+ if (this->gen_pre_stub_info (node) == -1)
+ {
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
+ "visit_operation - "
+ "gen_pre_stub_info failed\n"
+ ),
+ -1
+ );
+ }
+ }
+
+ // Declare return type.
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_DECL_CS);
+ be_visitor_operation_rettype_vardecl_cs rd_visitor (&ctx);
+
+ if (return_type->accept (&rd_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
+ "visit_operation - "
+ "codegen for return var decl failed\n"),
+ -1);
+ }
+
+ if (node->has_native ()) // native exists => no stub
+ {
+ if (this->gen_raise_exception (return_type,
+ "CORBA::MARSHAL",
+ "") == -1)
+ {
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
+ "visit_operation - "
+ "codegen for return var failed\n"
+ ),
+ -1
+ );
+ }
+ }
+ else
+ {
+ // Generate code that retrieves the underlying stub object and then
+ // invokes do_static_call on it.
+ *os << "TAO_Stub *istub = " << target << "->_stubobj ();"
+ << be_nl << be_nl
+ << "if (istub == 0)" << be_idt_nl
+ << "{" << be_idt_nl;
+
+ // If the stub object was bad, then we raise a system exception.
+ if (this->gen_raise_exception (return_type, "CORBA::INTERNAL", "") == -1)
+ {
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
+ "visit_operation - "
+ "codegen for checking exception failed\n"
+ ),
+ -1
+ );
+ }
+
+ *os << be_uidt;
+
+ os->indent ();
+
+ *os << "}" << be_uidt_nl << be_nl;
+
+ // Do any pre marshal and invoke processing with return type. This
+ // includes allocating memory, initialization.
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_PRE_INVOKE_CS);
+ be_visitor_operation_rettype_pre_invoke_cs rpi_visitor (&ctx);
+
+ if (return_type->accept (&rpi_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
+ "visit_operation - "
+ "codegen for retval pre invoke failed\n"
+ ),
+ -1
+ );
+ }
+
+ // Do any pre marshal and invoke stuff with arguments.
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_PRE_INVOKE_CS);
+ be_visitor_operation_argument api_visitor (&ctx);
+
+ if (node->accept (&api_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
+ "visit_operation - "
+ "codegen for argument pre invoke failed\n"
+ ),
+ -1
+ );
+ }
+
+ // Generate the code for marshaling in the parameters and transmitting
+ // them.
+ if (this->gen_marshal_and_invoke (node, return_type) == -1)
+ {
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
+ "visit_operation - "
+ "codegen for marshal and invoke failed\n"
+ ),
+ -1
+ );
+
+ }
+
+ if (!this->void_return_type (return_type))
+ {
+ // Now generate the normal successful return statement.
+ if (return_type->size_type () == AST_Type::VARIABLE
+ || return_type->base_node_type () == AST_Decl::NT_array)
+ {
+ *os << "return _tao_retval._retn ();";
+ }
+ else
+ {
+ *os << "return _tao_retval;";
+ }
+ }
+ } // end of if (!native)
+
+ *os << be_uidt_nl << "}\n\n";
+
+ return 0;
+}
+
+int
+be_visitor_operation::gen_pre_stub_info (
+ be_operation *node
+ )
+{
+ // 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 ())
+ {
+ be_visitor_context ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OPERATION_EXCEPTLIST_CS);
+ be_visitor_operation_exceptlist_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) "
+ "be_visitor_operation_cs::"
+ "gen_pre_stub_info - "
+ "Exceptionlist generation error\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_operation::gen_marshal_and_invoke (
+ be_operation *node,
+ be_type *bt
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_visitor_context ctx;
+ const char *target = "_collocated_tao_target_";
+
+ if (node->defined_in ()->is_abstract ())
+ {
+ target = "this";
+ }
+
+
+ os->indent ();
+
+ *os << be_nl;
+
+ // Create the GIOP_Invocation and grab the outgoing CDR stream.
+ switch (node->flags ())
+ {
+ case AST_Operation::OP_oneway:
+ *os << "TAO_GIOP_Oneway_Invocation _tao_call ";
+ break;
+ default:
+ *os << "TAO_GIOP_Twoway_Invocation _tao_call ";
+ }
+
+ // Do we have "_set_" or "_get_" prepended?
+ size_t ext = this->ctx_->attribute () ? 5 : 0;
+
+ // Do we have any arguments in the operation that needs marshalling
+ int flag =
+ node->count_arguments_with_direction (AST_Argument::dir_IN
+ | AST_Argument::dir_INOUT);
+
+ *os << "(" << be_idt << be_idt_nl
+ << "istub," << be_nl
+ << this->compute_operation_name (node)
+ << "," << be_nl
+ << ACE_OS::strlen (node->original_local_name ()->get_string ()) + ext
+ << "," << be_nl
+ << flag
+ << "," <<be_nl
+ << "istub->orb_core ()" << be_uidt_nl
+ << ");" << be_uidt_nl;
+
+ *os << be_nl
+ << "int _invoke_status;" << be_nl;
+
+ // Generate code to obtain the client request interceptors from the
+ // ORB.
+ *os << "\n#if (TAO_HAS_INTERCEPTORS == 1)" << be_nl;
+ *os << "TAO_ClientRequestInterceptor_Adapter _tao_vfr ("
+ << be_idt << be_idt_nl
+ << "istub->orb_core ()->client_request_interceptors ()," << be_nl
+ << "&_tao_call," << be_nl
+ << "_invoke_status"
+ << be_uidt_nl
+ << ");" << be_uidt_nl;
+
+ *os << "\n#endif /* TAO_HAS_INTERCEPTORS */" << be_nl;
+
+ // The connection retry loop.
+ *os << be_nl
+ << "for (;;)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_invoke_status = TAO_INVOKE_EXCEPTION;" << be_nl;
+
+
+ *os << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl;
+
+ *os << "TAO_ClientRequestInfo_" << node->flat_name ();
+
+ // 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 and add a "_get"/"_set" to the flat
+ // name to get around the problem of overloaded methods which are
+ // generated for attributes.
+ if (this->ctx_->attribute ())
+ {
+ bt = be_type::narrow_from_decl (node->return_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interceptors_ch::"
+ "visit_operation - "
+ "Bad return type\n"),
+ -1);
+ }
+
+ // Grab the right visitor to generate the return type if its not
+ // void it means it is not the accessor.
+ if (!this->void_return_type (bt))
+ {
+ *os << "_get";
+ }
+ else
+ {
+ *os << "_set";
+ }
+ }
+
+ *os << " _tao_ri (" << be_idt << be_idt_nl
+ << "&_tao_call," << be_nl
+ << target;
+
+ // Generate the formal argument fields which are passed
+ // to the RequestInfo object.
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_CS);
+ be_visitor_operation_interceptors_arglist iia_visitor (&ctx);
+
+ if (node->accept (&iia_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
+ "visit_operation - "
+ "codegen for arglist failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl << ");" << be_uidt_nl;
+
+ if (this->gen_check_exception (bt) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
+ "gen_marshal_and_invoke - "
+ "codegen for checking exception failed\n"),
+ -1);
+ }
+
+ *os << "\n#endif /* TAO_HAS_INTERCEPTORS */" << be_nl;
+
+ // Prepare the request header.
+ *os << be_nl << "CORBA::Short _tao_response_flag = ";
+
+ switch (node->flags ())
+ {
+ case AST_Operation::OP_oneway:
+ *os << "_tao_call.sync_scope ();" << be_nl
+ << "TAO_INTERCEPTOR (_tao_ri.response_expected (0));" << be_nl;
+ break;
+ default:
+ *os << "TAO_TWOWAY_RESPONSE_FLAG;" << be_nl
+ << "TAO_INTERCEPTOR (_tao_ri.response_expected (1));" << be_nl;
+ }
+
+ *os << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl;
+
+ *os << be_nl << "ACE_TRY" << be_idt_nl
+ << "{" << be_idt_nl;
+
+ // Invoke send_request() interception point.
+ // This is done before the Invocation::start() call so that a
+ // connection can be avoided if send_request() throws an exception,
+ // i.e. this is an optimization.
+ *os << "_tao_vfr.send_request (" << be_idt << be_idt_nl
+ << "&_tao_ri" << be_nl
+ << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << "ACE_TRY_CHECK;" << be_nl;
+
+ // _invoke_status is potentially set (via a reference) in
+ // TAO_ClientRequestInterceptor_Adapter::send_request() so check its
+ // value. If a location forward or transport retry occured, then we
+ // need to restart the loop so that the ClientRequestInfo object is
+ // setup for the re-issued request.
+ //
+ // Note that since we're invoking the send_request() interception
+ // point before the Invocation::start() call, i.e. before a
+ // connection is ever made, we're actually able to forward requests
+ // for oneways via the PortableInterceptor::ForwardRequest exception
+ // too!
+ *os << be_nl
+ << "if (_invoke_status == TAO_INVOKE_RESTART)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_call.restart_flag (1);" << be_nl
+ << "continue;" << be_uidt_nl
+ << "}" << be_uidt_nl;
+
+ *os << "\n#endif /* TAO_HAS_INTERCEPTORS */" << be_nl;
+
+
+ *os << be_nl
+ << "_tao_call.start (ACE_ENV_SINGLE_ARG_PARAMETER);" << be_nl;
+
+ // Check if there is an exception.
+ if (this->gen_check_interceptor_exception (bt) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
+ "gen_marshal_and_invoke - "
+ "codegen for checking exception failed\n"),
+ -1);
+ }
+
+ *os << be_nl
+ << "_tao_call.prepare_header (" << be_idt << be_idt_nl
+ << "ACE_static_cast (CORBA::Octet, _tao_response_flag)" << be_nl
+ << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
+ << ");" << be_uidt_nl;
+
+ // Check if there is an exception.
+ if (this->gen_check_interceptor_exception (bt) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
+ "gen_marshal_and_invoke - "
+ "codegen for checking exception failed\n"),
+ -1);
+ }
+
+ // Now make sure that we have some in and inout parameters. Otherwise, there
+ // is nothing to be marshaled in.
+ if (this->has_param_type (node, AST_Argument::dir_IN) ||
+ this->has_param_type (node, AST_Argument::dir_INOUT))
+ {
+ *os << be_nl
+ << "TAO_OutputCDR &_tao_out = _tao_call.out_stream ();"
+ << be_nl << be_nl
+ << "if (!(" << be_idt << be_idt_nl;
+
+ // Marshal each in and inout argument.
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_INVOKE_CS);
+ ctx.sub_state (TAO_CodeGen::TAO_CDR_OUTPUT);
+ be_visitor_operation_argument_invoke oai_visitor (&ctx);
+
+ if (node->accept (&oai_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_cs::"
+ "gen_marshal_and_invoke - "
+ "codegen for return var in "
+ "do_static_call failed\n"),
+ -1);
+ }
+
+ *os << be_nl
+ << "))" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ // If marshaling fails, raise exception.
+ if (this->gen_raise_interceptor_exception (bt, "CORBA::MARSHAL", "")
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_cs::"
+ "gen_marshal_and invoke - "
+ "codegen for return var failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl << be_nl;
+ *os << "}" << be_uidt_nl << be_nl;
+ }
+ else
+ {
+ *os << be_nl << be_nl;
+ }
+
+ *os << "_invoke_status =" << be_idt_nl;
+
+ if (node->flags () == AST_Operation::OP_oneway)
+ {
+ // Oneway operation.
+ *os << "_tao_call.invoke (ACE_ENV_SINGLE_ARG_PARAMETER);";
+ }
+ else
+ {
+ if (node->exceptions ())
+ {
+ *os << "_tao_call.invoke (_tao_" << node->flat_name ()
+ << "_exceptiondata, "
+ << node->exceptions ()->length ()
+ << " ACE_ENV_ARG_PARAMETER);";
+ }
+ else
+ {
+ *os << "_tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);";
+ }
+ }
+
+ *os << be_uidt_nl;
+
+ // Check if there is an exception.
+ if (this->gen_check_interceptor_exception (bt) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_cs::"
+ "gen_marshal_and_invoke - "
+ "codegen for checking exception failed\n"),
+ -1);
+ }
+
+ *os << be_nl
+ << "if (_invoke_status == TAO_INVOKE_EXCEPTION)" << be_idt_nl
+ << "{" << be_idt_nl;
+
+ // Unlisted user exception received by client.
+ int status = this->gen_raise_interceptor_exception (
+ bt,
+ "CORBA::UNKNOWN",
+ "TAO_OMG_VMCID | 1, CORBA::COMPLETED_YES"
+ );
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_cs::"
+ "gen_marshal_and invoke - "
+ "codegen for return var failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl << "}" << be_uidt_nl;
+
+ // Note that we no longer turn this code generation off if it's a
+ // one way operation since the sync scope policy may actually allow
+ // things such as LOCATION_FORWARD replies to be propagated back to
+ // the client (e.g. SYNC_WITH_TARGET).
+ *os << "else if (_invoke_status == TAO_INVOKE_RESTART)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "TAO_INTERCEPTOR (" << be_idt << be_idt_nl
+ << "_tao_ri.reply_status (_invoke_status);" << be_nl
+ << "_tao_vfr.receive_other (" << be_idt << be_idt_nl
+ << "&_tao_ri" << be_nl
+ << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << "ACE_TRY_CHECK;" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << be_nl
+ << "continue;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << be_nl;
+
+ // If we reach here, we are ready to proceed.
+ // the code below this is for twoway operations only.
+
+ if (!this->void_return_type (bt)
+ || this->has_param_type (node, AST_Argument::dir_INOUT)
+ || this->has_param_type (node, AST_Argument::dir_OUT))
+
+ {
+ // Do any post_invoke stuff that might be necessary.
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_POST_INVOKE_CS);
+ ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT);
+ be_visitor_operation_argument oapi_visitor (&ctx);
+
+ if (node->accept (&oapi_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_cs::"
+ "gen_marshal_and_invoke - "
+ "codegen for args in post do_static_call\n"),
+ -1);
+ }
+
+ // Generate any temporary variables to demarshal the arguments.
+ be_visitor_args_decl vis1 (&ctx);
+
+ if (node->accept (&vis1) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_cs::"
+ "gen_pre_stub_info - "
+ "codegen for pre args failed\n"),
+ -1);
+ }
+
+ if (!this->void_return_type (bt))
+ {
+ // Generate any temporary variables to demarshal the return value.
+ be_visitor_operation_rettype_post_invoke_cs vis2 (&ctx);
+
+ if (bt->accept (&vis2) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_cs::"
+ "gen_pre_stub_info - "
+ "codegen rettype [post invoke] failed\n"),
+ -1);
+ }
+ }
+
+ // Check if there was a user exception, else demarshal the
+ // return val (if any) and parameters (if any) that came with
+ // the response message.
+ *os << be_nl
+ << "TAO_InputCDR &_tao_in = _tao_call.inp_stream ();"
+ << be_nl << be_nl
+ << "if (!(" << be_idt << be_idt_nl;
+
+ if (!this->void_return_type (bt))
+ {
+ // Demarshal the return value.
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_INVOKE_CS);
+ ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT);
+ be_visitor_operation_rettype_marshal_ss ori_visitor (&ctx);
+
+ if (node->accept (&ori_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_cs::"
+ "gen_marshal_and_invoke - "
+ "codegen for return var failed\n"),
+ -1);
+ }
+ }
+
+ if (this->has_param_type (node, AST_Argument::dir_INOUT)
+ || this->has_param_type (node, AST_Argument::dir_OUT))
+ {
+ if (!this->void_return_type (bt))
+ {
+ *os << " &&" << be_nl;
+ }
+
+ // Demarshal each out and inout argument.
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_INVOKE_CS);
+ ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT);
+ be_visitor_operation_argument_invoke oai_visitor (&ctx);
+
+ if (node->accept (&oai_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_cs::"
+ "gen_marshal_and_invoke - "
+ "codegen for return var failed\n"),
+ -1);
+ }
+ }
+
+ *os << be_nl
+ << "))" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ // If marshaling fails, raise exception.
+ int status = this->gen_raise_interceptor_exception (
+ bt,
+ "CORBA::MARSHAL",
+ "TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_YES"
+ );
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_cs::"
+ "gen_marshal_and invoke - "
+ "codegen for return var failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl << "}" << be_uidt_nl;
+ }
+
+ *os << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl;
+
+ // Populate the ClientRequestInfo object with result, if any, of the
+ // invocation.
+ if (!this->void_return_type (bt))
+ {
+ // Here's what we are going to do to have a uniform way of getting the
+ // return value updated for the Request Info:
+ // declare a operation_retval type object and assign the
+ // _tao_retval._retn () to it.
+ // We pass this to the result updation method (note: it hasnt
+ // got destroyed)
+ // We then put it back into the original _tao_retval
+ // object.
+ // And finally the _retn () is returned from the operation w.o
+ // causing any problems.
+
+ // Generate the return type mapping (same as in the header file)
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_OTHERS);
+ be_visitor_operation_rettype oro_visitor (&ctx);
+
+ if (bt->accept (&oro_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
+ "visit_operation - "
+ "codegen for return type failed\n"
+ ),
+ -1
+ );
+ }
+
+ if (bt->size_type () == AST_Type::VARIABLE
+ || bt->base_node_type () == AST_Decl::NT_array)
+ {
+ *os << " _tao_retval_info =" << be_idt_nl
+ << "_tao_retval._retn ();" << be_uidt_nl
+ << "_tao_ri.result (_tao_retval_info);" << be_nl
+ << "_tao_retval = _tao_retval_info;" << be_nl;
+ }
+ else
+ {
+ *os << " _tao_retval_info =" << be_idt_nl
+ << "_tao_retval;" << be_uidt_nl
+ << "_tao_ri.result (_tao_retval_info);" << be_nl;
+ }
+ }
+
+ // Oneway operations don't have receive_reply() interception since
+ // once the request goes over the wire, its the end of the story!
+ // However, we still need to call an ending interception point
+ // (receive_other()) to satisfy the General Flow Rules.
+ if (node->flags () != AST_Operation::OP_oneway)
+ {
+ // If we get this far (in the generated code) then we
+ // successfully completed the request, i.e. no connection retry
+ // will occur, nor will a LOCATION_FORWARD.
+ // Invoke receive_reply() interception point.
+ *os << be_nl
+ << "_tao_ri.reply_status (_invoke_status);" << be_nl
+ << "_tao_vfr.receive_reply (" << be_idt << be_idt_nl
+ << "&_tao_ri" << be_nl
+ << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
+ << ");" << be_uidt_nl;
+ }
+ else if (node->flags () == AST_Operation::OP_oneway)
+ {
+ // Invoke receive_other() interception point.
+ *os << be_nl
+ << "_tao_ri.reply_status (_invoke_status);" << be_nl
+ << "_tao_vfr.receive_other (" << be_idt_nl
+ << "&_tao_ri" << be_nl
+ << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
+ << ");" << be_nl;
+ }
+
+ *os << "ACE_TRY_CHECK;"
+ << be_uidt_nl
+ << "}" << be_uidt_nl;
+
+ // Note that we do NOT catch the PortableInterceptor::ForwardRequest
+ // exception here. It is caught in the
+ // TAO_ClientRequestInterceptor_Adapter class. This is necessary to
+ // prevent applications from being able to throw the exception in an
+ // effort to get an easy (but illegal) way to forward a request.
+
+ *os << "ACE_CATCHANY" << be_idt_nl
+ << "{" << be_idt_nl;
+
+ // Update the exception field of the ClientRequestInfo.
+ *os << "_tao_ri.exception (&ACE_ANY_EXCEPTION);"<< be_nl;
+
+ *os << "_tao_vfr.receive_exception (" << be_idt << be_idt_nl
+ << "&_tao_ri" << be_nl
+ << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << "ACE_TRY_CHECK;" << be_nl;
+
+ // The receive_exception() interception point may have thrown a
+ // PortableInterceptor::ForwardRequest exception. In that event,
+ // the connection retry loop must be restarted so do not rethrow the
+ // caught exception.
+ *os << be_nl
+ << "PortableInterceptor::ReplyStatus _tao_status =" << be_idt_nl
+ << "_tao_ri.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER);" << be_uidt_nl
+ << "ACE_TRY_CHECK;" << be_nl;
+
+ *os << be_nl
+ << "if (_tao_status == PortableInterceptor::SYSTEM_EXCEPTION" << be_nl
+ << " || _tao_status == PortableInterceptor::USER_EXCEPTION)"
+ << be_idt_nl
+ << "{" << be_idt_nl;
+
+ if (be_global->use_raw_throw ())
+ {
+ *os << "throw;";
+ }
+ else
+ {
+ *os << "ACE_RE_THROW;";
+ }
+
+ *os << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl;
+
+ *os << "}" << be_uidt_nl
+ << "ACE_ENDTRY;" << be_nl;
+
+ if (this->gen_check_exception (bt) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_cs::"
+ "gen_marshal_and_invoke - "
+ "codegen for checking exception failed\n"),
+ -1);
+ }
+
+ // The receive_exception() or receive_other() interception point may
+ // have thrown a PortableInterceptor::ForwardRequest exception. In
+ // that event, the connection retry loop must be restarted. Note
+ // that the _invoke_status variable is not set by the interceptor
+ // support code, so we must explicitly check the status in the
+ // ClientRequestInfo object.
+ *os << be_nl
+ << "PortableInterceptor::ReplyStatus _tao_status =" << be_idt_nl
+ << "_tao_ri.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER);" << be_uidt_nl;
+
+ if (this->gen_check_exception (bt) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_cs::"
+ "gen_marshal_and_invoke - "
+ "codegen for checking exception failed\n"),
+ -1);
+ }
+
+ *os << be_nl
+ << "if (_tao_status == PortableInterceptor::LOCATION_FORWARD" << be_nl
+ << " || _tao_status == PortableInterceptor::TRANSPORT_RETRY)"
+ << be_idt_nl
+ << "{" << be_idt_nl
+ << "continue;" << be_uidt_nl
+ << "}" << be_uidt_nl;
+
+ *os << "\n#endif /* TAO_HAS_INTERCEPTORS */" << be_nl;
+
+ *os << be_nl << "break;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_operation::gen_raise_interceptor_exception (
+ be_type *bt,
+ const char *excep,
+ const char *completion_status
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (this->void_return_type (bt))
+ {
+ if (be_global->use_raw_throw ())
+ {
+ *os << "throw " << excep << "(" << completion_status << ");";
+ }
+ else
+ {
+ *os << "TAO_INTERCEPTOR_THROW (" << be_idt << be_idt_nl
+ << excep << " (" << be_idt << be_idt_nl
+ << completion_status << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << ");" << be_uidt;
+ }
+ }
+ else
+ {
+ if (bt->size_type () == AST_Type::VARIABLE
+ || bt->base_node_type () == AST_Decl::NT_array)
+ {
+ *os << "TAO_INTERCEPTOR_THROW_RETURN (" << be_idt << be_idt_nl
+ << excep << " (" << be_idt << be_idt_nl
+ << completion_status << be_uidt_nl
+ << ")," << be_uidt_nl
+ << "0" << be_uidt_nl
+ << ");" << be_uidt;
+ }
+ else
+ {
+ *os << "TAO_INTERCEPTOR_THROW_RETURN (" << be_idt << be_idt_nl
+ << excep << " (" << be_idt << be_idt_nl
+ << completion_status << be_uidt_nl
+ << ")," << be_uidt_nl
+ << "_tao_retval" << be_uidt_nl
+ << ");" << be_uidt;
+ }
+ }
+
+ return 0;
+}
+
+const char*
+be_visitor_operation::compute_operation_name (
+ be_operation *node
+ )
+{
+ if (this->operation_name_ == 0)
+ {
+ // Length for two double quotes and the null termination char.
+ size_t len = 3;
+
+ if (this->ctx_->attribute ())
+ {
+ // "Added length for "_set_" or "_get_".
+ len += 5;
+ }
+
+ len += ACE_OS::strlen (node->original_local_name ()->get_string ());
+
+ ACE_NEW_RETURN (this->operation_name_,
+ char [len],
+ 0);
+
+ ACE_OS::strcpy (this->operation_name_, "\"");
+
+ if (this->ctx_->attribute ())
+ {
+ // Now check if we are a "get" or "set" operation.
+ if (node->nmembers () == 1)
+ {
+ ACE_OS::strcat (this->operation_name_, "_set_");
+ }
+ else
+ {
+ ACE_OS::strcat (this->operation_name_, "_get_");
+ }
+ }
+
+ ACE_OS::strcat (this->operation_name_,
+ node->original_local_name ()->get_string ());
+ ACE_OS::strcat (this->operation_name_, "\"");
+ }
+
+ return this->operation_name_;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp
index 08ef81d3e6a..af66778bbf7 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp
@@ -18,17 +18,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, operation_ch, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ operation_ch,
+ "$Id$")
// ******************************************************
-// primary visitor for "operation" in client header
+// Primary visitor for "operation" in client header.
// ******************************************************
be_visitor_operation_ch::be_visitor_operation_ch (be_visitor_context *ctx)
@@ -44,15 +39,17 @@ int
be_visitor_operation_ch::visit_operation (be_operation *node)
{
TAO_OutStream *os = this->ctx_->stream ();
- be_type *bt;
this->ctx_->node (node);
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// 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 ());
+ be_type *bt = be_type::narrow_from_decl (node->return_type ());
if (!bt)
{
@@ -66,20 +63,10 @@ be_visitor_operation_ch::visit_operation (be_operation *node)
// 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);
- }
+ be_visitor_operation_rettype or_visitor (&ctx);
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&or_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_ch::"
"visit_operation - "
@@ -87,8 +74,6 @@ be_visitor_operation_ch::visit_operation (be_operation *node)
-1);
}
- delete visitor;
-
// STEP 2: generate the operation name.
*os << " " << node->local_name ();
@@ -96,28 +81,16 @@ be_visitor_operation_ch::visit_operation (be_operation *node)
// 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);
+ be_visitor_operation_arglist oa_visitor (&ctx);
- if (!visitor)
+ if (node->accept (&oa_visitor) == -1)
{
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
index a02cdaa5c9b..4cea8a38b26 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, operation_cs, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ operation_cs,
+ "$Id$")
// ************************************************************
// Operation visitor for client stubs
@@ -127,131 +122,140 @@ be_visitor_operation_cs::visit_operation (be_operation *node)
-1);
}
- *os << "{" << be_idt_nl;
- *os << this->gen_environment_var ();
-
- if (be_global->exception_support ())
+ // @@@ (JP) No collocation for abstract interface operations yet. We
+ // are generating the code as if there were no proxies, and using
+ // the (concrete interface's) stub info that we got over the wire.
+ if (intf->is_abstract ())
{
- *os << be_nl << be_nl;
+ return this->gen_stub_operation_body (node,
+ bt);
}
-
- // For what follows, the return type node nust be unaliased.
- if (bt->node_type () == AST_Decl::NT_typedef)
- {
- be_typedef *btd = be_typedef::narrow_from_decl (bt);
- bt = btd->primitive_base_type ();
- }
-
- AST_Decl::NodeType bnt = bt->base_node_type ();
- be_predefined_type *bpt = 0;
- AST_PredefinedType::PredefinedType pdt = AST_PredefinedType::PT_void;
-
- if (bnt == AST_Decl::NT_pre_defined)
+ else
{
- bpt = be_predefined_type::narrow_from_decl (bt);
- pdt = bpt->pt ();
+ *os << "{" << be_idt_nl;
+ *os << this->gen_environment_var ();
- if (pdt == AST_PredefinedType::PT_longlong)
+ if (be_global->exception_support ())
{
- *os << "CORBA::LongLong _tao_check_retval = "
- << "ACE_CDR_LONGLONG_INITIALIZER;" << be_nl << be_nl;
+ *os << be_nl << be_nl;
}
- else if (pdt == AST_PredefinedType::PT_longdouble)
+
+ // For what follows, the return type node nust be unaliased.
+ if (bt->node_type () == AST_Decl::NT_typedef)
{
- *os << "CORBA::LongDouble _tao_check_retval = "
- << "ACE_CDR_LONG_DOUBLE_INITIALIZER;" << be_nl << be_nl;
+ be_typedef *btd = be_typedef::narrow_from_decl (bt);
+ bt = btd->primitive_base_type ();
}
- }
-
- // Generate code that retrieves the proper proxy implementation
- // using the proxy broker available, and perform the call
- // using the proxy implementation provided by the broker.
-
- *os << intf->base_proxy_impl_name () << " &proxy = " << be_idt_nl
- << "this->the" << intf->base_proxy_broker_name ()
- << "_->select_proxy (this ACE_ENV_ARG_PARAMETER);" << be_uidt_nl;
- if (!this->void_return_type (bt))
- {
- *os << "ACE_CHECK_RETURN (";
+ AST_Decl::NodeType bnt = bt->base_node_type ();
+ be_predefined_type *bpt = 0;
+ AST_PredefinedType::PredefinedType pdt = AST_PredefinedType::PT_void;
- if (bnt == AST_Decl::NT_enum)
- {
- // The enum is a unique type, so we must cast.
- *os << "(" << bt->name () << ")0);";
- }
- else if (bnt == AST_Decl::NT_struct || bnt == AST_Decl::NT_union)
+ if (bnt == AST_Decl::NT_pre_defined)
{
- be_decl *bd = be_decl::narrow_from_decl (bt);
+ bpt = be_predefined_type::narrow_from_decl (bt);
+ pdt = bpt->pt ();
- if (bd->size_type () == be_decl::FIXED)
+ if (pdt == AST_PredefinedType::PT_longlong)
{
- // For a fixed size struct or union the return value
- // is not a pointer, so we call the default constructor
- // and return the result.
- *os << bt->name () << " ());";
+ *os << "CORBA::LongLong _tao_check_retval = "
+ << "ACE_CDR_LONGLONG_INITIALIZER;" << be_nl << be_nl;
}
- else
+ else if (pdt == AST_PredefinedType::PT_longdouble)
{
- *os << "0);";
+ *os << "CORBA::LongDouble _tao_check_retval = "
+ << "ACE_CDR_LONG_DOUBLE_INITIALIZER;" << be_nl << be_nl;
}
}
- else if (bnt == AST_Decl::NT_pre_defined)
+
+ // Generate code that retrieves the proper proxy implementation
+ // using the proxy broker available, and perform the call
+ // using the proxy implementation provided by the broker.
+
+ *os << intf->base_proxy_impl_name () << " &proxy = " << be_idt_nl
+ << "this->the" << intf->base_proxy_broker_name ()
+ << "_->select_proxy (this ACE_ENV_ARG_PARAMETER);" << be_uidt_nl;
+
+ if (!this->void_return_type (bt))
{
- if (pdt == AST_PredefinedType::PT_longlong
- || pdt == AST_PredefinedType::PT_longdouble)
+ *os << "ACE_CHECK_RETURN (";
+
+ if (bnt == AST_Decl::NT_enum)
+ {
+ // The enum is a unique type, so we must cast.
+ *os << "(" << bt->name () << ")0);";
+ }
+ else if (bnt == AST_Decl::NT_struct || bnt == AST_Decl::NT_union)
{
- *os << "_tao_check_retval);" << be_nl
- << "ACE_UNUSED_ARG (_tao_check_retval);";
+ if (bt->size_type () == AST_Type::FIXED)
+ {
+ // For a fixed size struct or union the return value
+ // is not a pointer, so we call the default constructor
+ // and return the result.
+ *os << bt->name () << " ());";
+ }
+ else
+ {
+ *os << "0);";
+ }
+ }
+ else if (bnt == AST_Decl::NT_pre_defined)
+ {
+ if (pdt == AST_PredefinedType::PT_longlong
+ || pdt == AST_PredefinedType::PT_longdouble)
+ {
+ *os << "_tao_check_retval);" << be_nl
+ << "ACE_UNUSED_ARG (_tao_check_retval);";
+ }
+ else
+ {
+ *os << "0);";
+ }
}
else
{
*os << "0);";
}
+
+ *os << be_nl << be_nl
+ << "return ";
}
else
{
- *os << "0);";
+ *os << "ACE_CHECK;" << be_nl << be_nl;
}
- *os << be_nl << be_nl
- << "return ";
- }
- else
- {
- *os << "ACE_CHECK;" << be_nl << be_nl;
- }
+ *os << "proxy." << node->local_name ()
+ << " (" << be_idt << be_idt_nl << "this";
+
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ AST_Decl *d = si.item ();
- *os << "proxy." << node->local_name ()
- << " (" << be_idt << be_idt_nl << "this";
+ if (d == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_scope::visit_scope - "
+ "bad node in this scope\n"),
+ -1);
+ }
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
+ be_decl *decl = be_decl::narrow_from_decl (d);
- if (d == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_scope::visit_scope - "
- "bad node in this scope\n"),
- -1);
+ *os << "," << be_nl
+ << decl->local_name();
}
- be_decl *decl = be_decl::narrow_from_decl (d);
-
- *os << "," << be_nl
- << decl->local_name();
- }
+ if (!be_global->exception_support ())
+ {
+ *os << " ACE_ENV_ARG_PARAMETER";
+ }
- if (!be_global->exception_support ())
- {
- *os << " ACE_ENV_ARG_PARAMETER";
+ *os << be_uidt_nl << ");" << be_uidt << be_uidt_nl << "}\n\n";
}
- *os << be_uidt_nl << ");" << be_uidt << be_uidt_nl << "}\n\n";
-
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_ih.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_ih.cpp
index 716787d0da4..be08e30a904 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation_ih.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_ih.cpp
@@ -16,16 +16,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, operation_ih, "$Id$")
+ACE_RCSID (be_visitor_operation,
+ operation_ih,
+ "$Id$")
// ************************************************************
-// Operation visitor for implementation header
+// Operation visitor for implementation header.
// ************************************************************
be_visitor_operation_ih::be_visitor_operation_ih (be_visitor_context *ctx)
@@ -40,17 +36,14 @@ be_visitor_operation_ih::~be_visitor_operation_ih (void)
int
be_visitor_operation_ih::visit_operation (be_operation *node)
{
- TAO_OutStream *os; // output stream
- be_type *bt; // type node representing the return type
-
- os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream ();
this->ctx_->node (node); // save the node
// 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 ());
+ be_type *bt = be_type::narrow_from_decl (node->return_type ());
if (!bt)
{
@@ -64,20 +57,10 @@ be_visitor_operation_ih::visit_operation (be_operation *node)
// 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_ih::"
- "visit_operation - "
- "Bad visitor to return type\n"),
- -1);
- }
+ be_visitor_operation_rettype oro_visitor (&ctx);
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&oro_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_ih::"
"visit_operation - "
@@ -85,8 +68,6 @@ be_visitor_operation_ih::visit_operation (be_operation *node)
-1);
}
- delete visitor;
-
// STEP 2: generate the operation name
*os << " " << node->local_name ();
@@ -94,20 +75,10 @@ be_visitor_operation_ih::visit_operation (be_operation *node)
// we grab a visitor that generates the parameter listing
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_IH);
- visitor = tao_cg->make_visitor (&ctx);
-
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_operation_ih::"
- "visit_operation - "
- "Bad visitor to return type\n"),
- -1);
- }
+ be_visitor_operation_arglist oa_visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&oa_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_ih::"
"visit_operation - "
@@ -115,8 +86,6 @@ be_visitor_operation_ih::visit_operation (be_operation *node)
-1);
}
- delete visitor;
-
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_is.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_is.cpp
index fab89122083..928cddddcc5 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation_is.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_is.cpp
@@ -16,14 +16,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "ace/SString.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, operation_is, "$Id$")
+ACE_RCSID (be_visitor_operation,
+ operation_is,
+ "$Id$")
// ************************************************************
// Operation visitor for implementation skeleton
@@ -41,25 +36,16 @@ be_visitor_operation_is::~be_visitor_operation_is (void)
int
be_visitor_operation_is::visit_operation (be_operation *node)
{
- TAO_OutStream *os; // output stream
- be_type *bt; // type node representing the return type
-
- //cout<<"Within visit_operation "<<endl;
- os = this->ctx_->stream ();
- be_interface *intf =
- this->ctx_->interface ();
-
-
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_interface *intf = this->ctx_->interface ();
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 ());
+ be_type *bt = be_type::narrow_from_decl (node->return_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -69,50 +55,29 @@ be_visitor_operation_is::visit_operation (be_operation *node)
-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);
+ be_visitor_operation_rettype oro_visitor (&ctx);
- if (!visitor)
+ if (bt->accept (&oro_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_operation_is::"
- "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_is::"
"visit_operation - "
"codegen for return type failed\n"),
-1);
}
- delete visitor;
const char *classname = 0;
if (intf)
{
- //If derived class
+ // If derived class/
classname = intf->flat_name ();
-
}
-
else
{
- ACE_CString str(node->flat_name ());
-
- int lnmlength = ACE_OS::strlen (node->local_name ()->get_string ());
-
- int fnmlength = ACE_OS::strlen (node->flat_name ());
- fnmlength--;
-
- classname = str.substr (0,(fnmlength-lnmlength) ).rep ();
+ classname = ScopeAsDecl (node->defined_in ())->flat_name ();
}
// STEP 2: generate the operation name
@@ -123,69 +88,21 @@ be_visitor_operation_is::visit_operation (be_operation *node)
// we grab a visitor that generates the parameter listing
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_IS);
- visitor = tao_cg->make_visitor (&ctx);
-
+ be_visitor_operation_arglist oa_visitor (&ctx);
- if (!visitor)
+ if (node->accept (&oa_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_operation_is::"
- "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_is::"
"visit_operation - "
"codegen for argument list failed\n"),
-1);
}
- delete visitor;
-
- //generate the excetions thrown by the operation
- // this->gen_throw_spec (node);
-
- *os <<be_idt_nl << "{"<<be_idt_nl;
- *os << "//Add your implementation here"<<be_uidt_nl;
-
- //Code to generate teh return statement in the operations.....
- //Can be uncommented when required
-
- /*
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_IS);
- visitor = tao_cg->make_visitor (&ctx);
-
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_operation_is::"
- "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_is::"
- "visit_operation - "
- "codegen for return type failed\n"),
- -1);
- }
- delete visitor;
- */
+ *os << be_idt_nl << "{" << be_idt_nl;
+ *os << "// Add your implementation here" << be_uidt_nl;
*os << "}" << be_nl << be_uidt_nl;
-
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
index 41ebae411c1..d6261d65ab4 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_sh.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, operation_sh, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ operation_sh,
+ "$Id$")
// ************************************************************
// Operation visitor for server header
@@ -43,19 +38,19 @@ 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
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
- os = this->ctx_->stream ();
- this->ctx_->node (node); // save the node
+ os->indent ();
- os->indent (); // start with the current indentation level
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
- // 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 ());
+ // STEP I: generate the return type.
+ be_type *bt = be_type::narrow_from_decl (node->return_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -65,30 +60,18 @@ be_visitor_operation_sh::visit_operation (be_operation *node)
-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);
+ be_visitor_operation_rettype oro_visitor (&ctx);
- if (!visitor)
+ if (bt->accept (&oro_visitor) == -1)
{
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 ();
@@ -97,49 +80,44 @@ be_visitor_operation_sh::visit_operation (be_operation *node)
// 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);
- }
+ be_visitor_operation_arglist oa_visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&oa_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
+ // 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
+
+ // 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_";
+ // Now check if we are a "get" or "set" operation
+ if (node->nmembers () == 1)
+ {
+ *os << "_set_";
+ }
else
- *os << "_get_";
+ {
+ *os << "_get_";
+ }
}
- *os << node->local_name () <<
- "_skel (" << be_idt << be_idt_nl
+
+ *os << node->local_name ()
+ << "_skel (" << be_idt << be_idt_nl
<< "TAO_ServerRequest &_tao_req," << be_nl
<< "void *_tao_servant," << be_nl
<< "void *_tao_servant_upcall" << be_nl
<< "ACE_ENV_ARG_DECL" << be_uidt_nl
- << ");" << be_uidt << "\n\n";
+ << ");" << be_uidt << "\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
index d5420b63ba6..e79e48011bb 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp
@@ -18,18 +18,10 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-#include "be_visitor_argument.h"
-
ACE_RCSID (be_visitor_operation,
operation_ss,
"$Id$")
-
// ************************************************************
// Operation visitor for server skeletons
// ************************************************************
@@ -42,7 +34,7 @@ be_visitor_operation_ss::be_visitor_operation_ss (be_visitor_context *ctx)
be_visitor_operation_ss::~be_visitor_operation_ss (void)
{
- delete[] this->operation_name_;
+ delete [] this->operation_name_;
}
// Processing to be done after every element in the scope is processed.
@@ -91,8 +83,7 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
// 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 *intf = this->ctx_->attribute ()
? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ())
: be_interface::narrow_from_scope (node->defined_in ());
@@ -107,6 +98,10 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
// Generate the signature of the static skeleton.
os->indent ();
+
+ *os << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
*os << "void " << intf->full_skel_name () << "::";
// Check if we are an attribute node in disguise.
@@ -130,8 +125,8 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
<< "ACE_ENV_ARG_DECL" << be_uidt_nl
<< ")" << be_uidt_nl;
- // Generate the actual code for the skeleton. However, if any of the argument
- // types is "native", we do not generate any skeleton
+ // 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 << "{\n" << be_idt;
@@ -157,9 +152,9 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
// 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);
+ be_visitor_operation_rettype_vardecl_ss ord_visitor (&ctx);
- // Do we have any arguments in the operation that needs marshalling.
+ // Do we have any arguments in the operation that needs marshalling?
int flag =
node->count_arguments_with_direction (AST_Argument::dir_INOUT |
AST_Argument::dir_OUT);
@@ -172,9 +167,8 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
*os << "_tao_server_request.argument_flag (0);" << be_nl;
}
- if (!visitor || (bt->accept (visitor) == -1))
+ if (bt->accept (&ord_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_ss::"
"visit_operation - "
@@ -185,11 +179,10 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
// Declare variables for arguments.
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_DECL_SS);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_argument oad_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&oad_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_ss::"
"visit_operation - "
@@ -263,11 +256,10 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
// RequestInfo object.
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SS);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_interceptors_arglist oiia_visitor (&ctx);
- if ((!visitor) || (node->accept (visitor) == -1))
+ if (node->accept (&oiia_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_cs::"
"visit_operation - "
@@ -275,7 +267,6 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
-1);
}
- delete visitor;
*os << be_uidt_nl << ");" << be_uidt_nl << be_nl;
*os << "ACE_TRY" << be_idt_nl
@@ -309,11 +300,10 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
// 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);
+ be_visitor_operation_rettype_assign_ss ora_visitor (&ctx);
- if (!visitor || (bt->accept (visitor) == -1))
+ if (bt->accept (&ora_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_ss::"
"visit_operation - "
@@ -326,11 +316,10 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
<< "_tao_impl->" << node->local_name () << " (" << be_idt << be_idt_nl;
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_SS);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_argument oau_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&oau_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_ss::"
"visit_operation - "
@@ -364,7 +353,7 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
// Close scope for "if (!_tao_vfr.location_forwarded ()"
*os << be_uidt_nl
- << "}" << be_uidt_nl;
+ << "}" << be_uidt;
// Close the TAO_PICurrent_Guard scope
*os << be_uidt_nl
@@ -393,11 +382,10 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
// 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);
+ be_visitor_operation_rettype oro_visitor (&ctx);
- if ((!visitor) || (bt->accept (visitor) == -1))
+ if (bt->accept (&oro_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_cs::"
"visit_operation - "
@@ -405,9 +393,7 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
-1);
}
- delete visitor;
-
- if (bt->size_type () == be_decl::VARIABLE
+ if (bt->size_type () == AST_Type::VARIABLE
|| bt->base_node_type () == AST_Decl::NT_array)
{
*os << " _tao_retval_info = _tao_retval._retn ();" << be_nl
@@ -451,14 +437,21 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
*os << be_nl
<< "if (_tao_status == PortableInterceptor::SYSTEM_EXCEPTION" << be_nl
<< " || _tao_status == PortableInterceptor::USER_EXCEPTION)"
- << be_idt_nl;
+ << be_idt_nl
+ << "{" << be_idt_nl;
if (be_global->use_raw_throw ())
- *os << "throw;" << be_uidt << be_uidt_nl;
+ {
+ *os << "throw;";
+ }
else
- *os << "ACE_RE_THROW;" << be_uidt << be_uidt_nl;
+ {
+ *os << "ACE_RE_THROW;";
+ }
- *os << "}" << be_uidt_nl
+ *os << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}" << be_uidt_nl
<< "ACE_ENDTRY;" << be_nl;
*os << "ACE_CHECK;\n"
<< "#endif /* TAO_HAS_INTERCEPTORS */" << be_nl << be_nl;
@@ -487,9 +480,9 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
*os << "// In case _tao_servant_upcall is not used in this function"
<< be_nl
- << "ACE_UNUSED_ARG (_tao_servant_upcall);" << be_nl;
+ << "ACE_UNUSED_ARG (_tao_servant_upcall);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
- *os << be_uidt_nl << "}\n\n";
return 0;
}
@@ -499,10 +492,9 @@ 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 ());
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
if (!bt)
{
@@ -555,7 +547,6 @@ be_visitor_operation_ss::gen_demarshal_params (be_operation *node,
be_type *)
{
TAO_OutStream *os = this->ctx_->stream ();
- be_visitor *visitor;
be_visitor_context ctx;
// Now make sure that we have some in and inout parameters. Otherwise, there
@@ -572,13 +563,12 @@ be_visitor_operation_ss::gen_demarshal_params (be_operation *node,
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_DEMARSHAL_SS);
ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_argument_marshal oad_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&oad_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_ss::"
+ "(%N:%l) be_visitor_operation_ss::"
"gen_demarshal_params - "
"codegen for demarshal failed\n"),
-1);
@@ -587,12 +577,14 @@ be_visitor_operation_ss::gen_demarshal_params (be_operation *node,
*os << be_uidt_nl << "))\n" << be_idt;
// If marshaling fails, raise exception.
- if (this->gen_raise_exception (0,
- "CORBA::MARSHAL",
- "") == -1)
+ int status = this->gen_raise_exception (0,
+ "CORBA::MARSHAL",
+ "");
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_ss::"
+ "(%N:%l) be_visitor_operation_ss::"
"gen_marshal_and invoke - "
"codegen for return var failed\n"),
-1);
@@ -610,7 +602,6 @@ be_visitor_operation_ss::gen_marshal_params (be_operation *node,
be_type *bt)
{
TAO_OutStream *os = this->ctx_->stream ();
- be_visitor *visitor;
be_visitor_context ctx;
// Setup parameters for marshaling and marshal them into the
@@ -623,9 +614,9 @@ be_visitor_operation_ss::gen_marshal_params (be_operation *node,
// We still need the following check because we maybe 2way and yet have no
// parameters and a void return type.
- if (this->void_return_type (bt) &&
- !this->has_param_type (node, AST_Argument::dir_INOUT) &&
- !this->has_param_type (node, AST_Argument::dir_OUT))
+ if (this->void_return_type (bt)
+ && !this->has_param_type (node, AST_Argument::dir_INOUT)
+ && !this->has_param_type (node, AST_Argument::dir_OUT))
{
return 0;
}
@@ -635,17 +626,12 @@ be_visitor_operation_ss::gen_marshal_params (be_operation *node,
{
ctx = *this->ctx_;
- be_visitor_context *new_ctx = 0;
- ACE_NEW_RETURN (new_ctx,
- be_visitor_context (ctx),
- 0);
-
- be_visitor_operation_rettype_post_upcall_ss visitor (new_ctx);
+ be_visitor_operation_rettype_post_upcall_ss visitor (&ctx);
if (bt->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_ss::"
+ "(%N:%l) be_visitor_operation_ss::"
"gen_marshal_params - "
"codegen for return var [post upcall] failed\n"),
-1);
@@ -654,12 +640,12 @@ be_visitor_operation_ss::gen_marshal_params (be_operation *node,
// Generate any temporary variables to demarshal the arguments.
ctx = *this->ctx_;
- be_visitor_args_post_upcall_ss vis1 (new be_visitor_context (ctx));
+ be_visitor_args_post_upcall_ss vis1 (&ctx);
if (node->accept (&vis1) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_cs::"
+ "(%N:%l) be_visitor_operation_cs::"
"gen_pre_stub_info - "
"codegen for pre args failed\n"),
-1);
@@ -675,21 +661,20 @@ be_visitor_operation_ss::gen_marshal_params (be_operation *node,
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_MARSHAL_SS);
ctx.sub_state (TAO_CodeGen::TAO_CDR_OUTPUT);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_rettype_marshal_ss orm_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&orm_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_ss::"
+ "(%N:%l) be_visitor_operation_ss::"
"gen_marshal_params - "
"codegen for return var failed\n"),
-1);
}
}
- if (this->has_param_type (node, AST_Argument::dir_INOUT) ||
- this->has_param_type (node, AST_Argument::dir_OUT))
+ if (this->has_param_type (node, AST_Argument::dir_INOUT)
+ || this->has_param_type (node, AST_Argument::dir_OUT))
{
if (!this->void_return_type (bt))
@@ -702,13 +687,12 @@ be_visitor_operation_ss::gen_marshal_params (be_operation *node,
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_MARSHAL_SS);
ctx.sub_state (TAO_CodeGen::TAO_CDR_OUTPUT);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_argument_marshal oam_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&oam_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_ss::"
+ "(%N:%l) be_visitor_operation_ss::"
"gen_marshal_params - "
"codegen for args failed\n"),
-1);
@@ -716,13 +700,16 @@ be_visitor_operation_ss::gen_marshal_params (be_operation *node,
}
*os << be_uidt_nl << "))\n";
- // if marshaling fails, raise exception
- if (this->gen_raise_exception (0,
- "CORBA::MARSHAL",
- "") == -1)
+
+ // If marshaling fails, raise exception.
+ int status = this->gen_raise_exception (0,
+ "CORBA::MARSHAL",
+ "");
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_ss::"
+ "(%N:%l) be_visitor_operation_ss::"
"gen_marshal_params - "
"codegen for raising exception failed\n"),
-1);
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp
index d7e00029d36..6d2e814446b 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp
@@ -1,15 +1,12 @@
// $Id$
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+ACE_RCSID (be_visitor_operation,
+ proxy_impl_xh,
+ "$Id$")
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, proxy_impl_xh, "$Id$")
-
-
-be_visitor_operation_proxy_impl_xh::be_visitor_operation_proxy_impl_xh (be_visitor_context *ctx)
+be_visitor_operation_proxy_impl_xh::be_visitor_operation_proxy_impl_xh (
+ be_visitor_context *ctx
+ )
: be_visitor_scope (ctx)
{
}
@@ -20,17 +17,14 @@ be_visitor_operation_proxy_impl_xh::~be_visitor_operation_proxy_impl_xh (void)
int be_visitor_operation_proxy_impl_xh::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
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
- // 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 ());
+ // STEP I: generate the return type.
+ be_type *bt = be_type::narrow_from_decl (node->return_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -40,30 +34,18 @@ int be_visitor_operation_proxy_impl_xh::visit_operation (be_operation *node)
-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);
- }
+ be_visitor_operation_rettype oro_visitor (&ctx);
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&oro_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 ();
@@ -72,26 +54,16 @@ int be_visitor_operation_proxy_impl_xh::visit_operation (be_operation *node)
// we grab a visitor that generates the parameter listing
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XH);
- 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);
- }
+ be_visitor_operation_arglist oapi_visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&oapi_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/remote_proxy_impl_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp
index 9e0cefca478..b7a7780c60e 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp
@@ -1,60 +1,60 @@
// $Id$
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
ACE_RCSID (be_visitor_operation,
be_visitor_operation_remote_proxy_impl_cs,
"$Id$")
-
// ************************************************************
// Operation visitor for client stubs
// ************************************************************
-be_visitor_operation_remote_proxy_impl_cs::be_visitor_operation_remote_proxy_impl_cs (be_visitor_context *ctx)
- : be_visitor_operation (ctx),
- operation_name_ (0)
+be_visitor_operation_remote_proxy_impl_cs::
+be_visitor_operation_remote_proxy_impl_cs (be_visitor_context *ctx)
+ : be_visitor_operation (ctx)
{
}
-be_visitor_operation_remote_proxy_impl_cs::~be_visitor_operation_remote_proxy_impl_cs (void)
+be_visitor_operation_remote_proxy_impl_cs::
+~be_visitor_operation_remote_proxy_impl_cs (void)
{
- delete[] operation_name_;
}
-// processing to be done after every element in the scope is processed
+// Processing to be done after every element in the scope is processed.
int
be_visitor_operation_remote_proxy_impl_cs::post_process (be_decl *bd)
{
- // all we do here is to insert a comma and a newline
+ // All we do here is to insert a comma and a newline.
TAO_OutStream *os = this->ctx_->stream ();
+
if (!this->last_node (bd))
- *os << ",\n";
+ {
+ *os << ",\n";
+ }
+
return 0;
}
int
-be_visitor_operation_remote_proxy_impl_cs::visit_operation (be_operation *node)
+be_visitor_operation_remote_proxy_impl_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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+ be_visitor_context ctx;
- os = this->ctx_->stream ();
- this->ctx_->node (node); // save the node for future use
+ this->ctx_->node (node);
if (node->is_local ())
- return 0;
+ {
+ return 0;
+ }
- os->indent (); // start with the current indentation level
+ os->indent ();
- // retrieve the operation return type
+ // Retrieve the operation return type.
bt = be_type::narrow_from_decl (node->return_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -67,197 +67,55 @@ be_visitor_operation_remote_proxy_impl_cs::visit_operation (be_operation *node)
// 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);
+ be_visitor_operation_rettype ort_visitor (&ctx);
- if ((!visitor) || (bt->accept (visitor) == -1))
+ if (bt->accept (&ort_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
"visit_operation - "
"codegen for return type failed\n"),
-1);
}
- delete visitor;
// Generate the operation name
be_decl* scope = be_scope::narrow_from_scope (node->defined_in ())->decl ();
be_interface *interface = be_interface::narrow_from_decl (scope);
- *os <<" " << interface->full_remote_proxy_impl_name () << "::" << node->local_name ();
+
+ *os <<" " << interface->full_remote_proxy_impl_name ()
+ << "::" << node->local_name ();
// Generate the argument list with the appropriate mapping (same as
- // in the header file)
+ // in the header file).
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XS);
- visitor = tao_cg->make_visitor (&ctx);
- if ((!visitor) || (node->accept (visitor) == -1))
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "visit_operation - "
- "codegen for argument list failed\n"),
- -1);
- }
- delete visitor;
+ be_visitor_operation_arglist arglist_visitor (&ctx);
- // 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 ACE_ENV_ARG_PARAMETER
- *os << "{" << be_idt_nl;
-
-/* This shall go away as soon as we drop the include_env switch
- (2001-10-29 oliver.kellogg@t-online.de) =======*/
- // Deal with differences between IDL mapping for true C++ exceptions and
- // alternate mapping. Since our code uses the ACE_TRY_ENV variable in a
- // number of places, for the true exception case, we will have to explicitly
- // declare the ACE_TRY_ENV variable.
- *os << this->gen_environment_var () << "\n";
-//============================================================================
-
- // Generate any pre stub info if and only if none of our parameters is of the
- // native type.
- if (!node->has_native ())
- {
- // native type does not exist.
-
- // Generate any "pre" stub information such as tables or declarations
- // This is a template method and the actual work will be done by the
- // derived class
- if (this->gen_pre_stub_info (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "visit_operation - "
- "gen_pre_stub_info failed\n"),
- -1);
- }
- }
-
- // Declare 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))
+ if (node->accept (&arglist_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
"visit_operation - "
- "codegen for return var decl failed\n"),
+ "codegen for argument list failed\n"),
-1);
}
- if (node->has_native ()) // native exists => no stub
- {
- if (this->gen_raise_exception (bt,
- "CORBA::MARSHAL",
- "") == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "visit_operation - "
- "codegen for return var failed\n"),
- -1);
- }
- }
- else
- {
- // Generate code that retrieves the underlying stub object and then
- // invokes do_static_call on it.
- *os << be_nl
- << "TAO_Stub *istub = _collocated_tao_target_->_stubobj ();" << be_nl
- << "if (istub == 0)" << be_idt_nl;
-
- // if the stub object was bad, then we raise a system exception
- if (this->gen_raise_exception (bt,
- "CORBA::INTERNAL",
- "") == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "visit_operation - "
- "codegen for checking exception failed\n"),
- -1);
-
- }
- *os << be_uidt_nl << "\n";
-
- // do any pre marshal and invoke processing with return type. This
- // includes allocating memory, initialization.
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_PRE_INVOKE_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_remote_proxy_impl_cs::"
- "visit_operation - "
- "codegen for retval pre invoke failed\n"),
- -1);
- }
-
- // do any pre marshal and invoke stuff with arguments
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_PRE_INVOKE_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_remote_proxy_impl_cs::"
- "visit_operation - "
- "codegen for argument pre invoke failed\n"),
- -1);
- }
-
- // generate the code for marshaling in the parameters and transmitting
- // them
- if (this->gen_marshal_and_invoke (node, bt) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "visit_operation - "
- "codegen for marshal and invoke failed\n"),
- -1);
-
- }
-
- if (!this->void_return_type (bt))
- {
- // now generate the normal successful return statement
- // os->indent ();
- if (bt->size_type () == be_decl::VARIABLE
- || bt->base_node_type () == AST_Decl::NT_array)
- {
- *os << "return _tao_retval._retn ();";
- }
- else
- {
- *os << "return _tao_retval;";
- }
- }
- } // end of if (!native)
-
- *os << be_uidt_nl << "}\n\n";
-
- return 0;
+ // Generate the code for the operation body.
+ return this->gen_stub_operation_body (node,
+ bt);
}
-
-
-
int
be_visitor_operation_remote_proxy_impl_cs::visit_argument (be_argument *node)
{
- // this method is used to generate the ParamData table entry
+ // This method is used to generate the ParamData table entry.
TAO_OutStream *os = this->ctx_->stream ();
- be_type *bt; // argument type
+ be_type *bt;
- // retrieve the type for this argument
+ // Retrieve the type for this argument.
bt = be_type::narrow_from_decl (node->field_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -269,6 +127,7 @@ be_visitor_operation_remote_proxy_impl_cs::visit_argument (be_argument *node)
os->indent ();
*os << "{" << bt->tc_name () << ", ";
+
switch (node->direction ())
{
case AST_Argument::dir_IN:
@@ -286,703 +145,3 @@ be_visitor_operation_remote_proxy_impl_cs::visit_argument (be_argument *node)
return 0;
}
-int
-be_visitor_operation_remote_proxy_impl_cs::gen_pre_stub_info (be_operation *node)
-{
-
- // 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 ())
- {
- be_visitor_context ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_EXCEPTLIST_CS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) "
- "be_compiled_visitor_operation_cs::"
- "gen_pre_stub_info - "
- "Exceptionlist generation error\n"),
- -1);
- }
- }
-
- return 0;
-}
-
-int
-be_visitor_operation_remote_proxy_impl_cs::gen_marshal_and_invoke (
- be_operation *node,
- be_type *bt)
-{
- TAO_OutStream *os = this->ctx_->stream ();
- be_visitor *visitor;
- be_visitor_context ctx;
-
- os->indent ();
-
- // create the GIOP_Invocation and grab the outgoing CDR stream
- switch (node->flags ())
- {
- case AST_Operation::OP_oneway:
- *os << "TAO_GIOP_Oneway_Invocation _tao_call ";
- break;
- default:
- *os << "TAO_GIOP_Twoway_Invocation _tao_call ";
- }
-
- // Do we have "_set_" or "_get_" prepended?
- size_t ext = this->ctx_->attribute () ? 5 : 0;
-
- // Do we have any arguments in the operation that needs marshalling
- int flag =
- node->count_arguments_with_direction (AST_Argument::dir_IN
- | AST_Argument::dir_INOUT);
-
- *os << "(" << be_idt << be_idt_nl
- << "istub," << be_nl
- << this->compute_operation_name (node)
- << "," << be_nl
- << ACE_OS::strlen (node->original_local_name ()->get_string ()) + ext
- << "," << be_nl
- << flag
- << "," <<be_nl
- << "istub->orb_core ()" << be_uidt_nl
- << ");" << be_uidt_nl;
-
- *os << be_nl
- << "int _invoke_status;" << be_nl;
-
- // Generate code to obtain the client request interceptors from the
- // ORB.
- *os << "\n#if (TAO_HAS_INTERCEPTORS == 1)" << be_nl;
- *os << "TAO_ClientRequestInterceptor_Adapter _tao_vfr ("
- << be_idt << be_idt_nl
- << "istub->orb_core ()->client_request_interceptors ()," << be_nl
- << "&_tao_call," << be_nl
- << "_invoke_status"
- << be_uidt_nl
- << ");" << be_uidt_nl;
-
- *os << "\n#endif /* TAO_HAS_INTERCEPTORS */" << be_nl;
-
- // The connection retry loop.
- *os << be_nl
- << "for (;;)" << be_idt_nl
- << "{" << be_idt_nl
- << "_invoke_status = TAO_INVOKE_EXCEPTION;" << be_nl;
-
-
- *os << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl;
-
- *os << "TAO_ClientRequestInfo_" << node->flat_name ();
-
- // 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 and add a "_get"/"_set" to the flat
- // name to get around the problem of overloaded methods which are
- // generated for attributes.
- if (this->ctx_->attribute ())
- {
- bt = be_type::narrow_from_decl (node->return_type ());
-
- if (!bt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_interceptors_ch::"
- "visit_operation - "
- "Bad return type\n"),
- -1);
- }
-
- // Grab the right visitor to generate the return type if its not
- // void it means it is not the accessor.
- if (!this->void_return_type (bt))
- *os << "_get";
- else
- *os << "_set";
- }
-
- *os << " _tao_ri (" << be_idt_nl
- << "&_tao_call," << be_nl
- << "_collocated_tao_target_";
-
- // Generate the formal argument fields which are passed
- // to the RequestInfo object.
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_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_remote_proxy_impl_cs::"
- "visit_operation - "
- "codegen for arglist failed\n"),
- -1);
- }
-
- delete visitor;
-
- *os << be_uidt_nl << ");" << be_nl;
-
- if (this->gen_check_exception (bt) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "gen_marshal_and_invoke - "
- "codegen for checking exception failed\n"),
- -1);
- }
-
- *os << "\n#endif /* TAO_HAS_INTERCEPTORS */" << be_nl;
-
- *os << be_nl;
-
- // Prepare the request header.
- *os << be_nl << "CORBA::Short _tao_response_flag = ";
-
- switch (node->flags ())
- {
- case AST_Operation::OP_oneway:
- *os << "_tao_call.sync_scope ();" << be_nl
- << "TAO_INTERCEPTOR (_tao_ri.response_expected (0));" << be_nl;
- break;
- default:
- *os << "TAO_TWOWAY_RESPONSE_FLAG;" << be_nl
- << "TAO_INTERCEPTOR (_tao_ri.response_expected (1));" << be_nl;
- }
-
- *os << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl;
-
- *os << be_nl << "ACE_TRY" << be_idt_nl
- << "{" << be_idt_nl;
-
- // Invoke send_request() interception point.
- // This is done before the Invocation::start() call so that a
- // connection can be avoided if send_request() throws an exception,
- // i.e. this is an optimization.
- *os << "_tao_vfr.send_request (" << be_idt_nl
- << "&_tao_ri" << be_nl
- << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
- << ");" << be_nl
- << "ACE_TRY_CHECK;" << be_nl;
-
- // _invoke_status is potentially set (via a reference) in
- // TAO_ClientRequestInterceptor_Adapter::send_request() so check its
- // value. If a location forward or transport retry occured, then we
- // need to restart the loop so that the ClientRequestInfo object is
- // setup for the re-issued request.
- //
- // Note that since we're invoking the send_request() interception
- // point before the Invocation::start() call, i.e. before a
- // connection is ever made, we're actually able to forward requests
- // for oneways via the PortableInterceptor::ForwardRequest exception
- // too!
- *os << be_nl
- << "if (_invoke_status == TAO_INVOKE_RESTART)" << be_idt_nl
- << "{" << be_idt_nl
- << "_tao_call.restart_flag (1);" << be_nl
- << "continue;" << be_uidt_nl
- << "}" << be_uidt_nl;
-
- *os << "\n#endif /* TAO_HAS_INTERCEPTORS */" << be_nl;
-
-
- *os << be_nl
- << "_tao_call.start (ACE_ENV_SINGLE_ARG_PARAMETER);" << be_nl;
- // check if there is an exception
- if (this->gen_check_interceptor_exception (bt) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "gen_marshal_and_invoke - "
- "codegen for checking exception failed\n"),
- -1);
- }
-
- *os << be_nl
- << "_tao_call.prepare_header (" << be_idt << be_idt_nl
- << "ACE_static_cast (CORBA::Octet, _tao_response_flag)" << be_nl
- << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
- << ");" << be_uidt_nl;
- // check if there is an exception
-
- if (this->gen_check_interceptor_exception (bt) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "gen_marshal_and_invoke - "
- "codegen for checking exception failed\n"),
- -1);
- }
-
- // Now make sure that we have some in and inout parameters. Otherwise, there
- // is nothing to be marshaled in.
- if (this->has_param_type (node, AST_Argument::dir_IN) ||
- this->has_param_type (node, AST_Argument::dir_INOUT))
- {
- *os << be_nl
- << "TAO_OutputCDR &_tao_out = _tao_call.out_stream ();"
- << be_nl
- << "if (!(" << be_idt << be_idt_nl;
-
- // Marshal each in and inout argument.
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_INVOKE_CS);
- ctx.sub_state (TAO_CodeGen::TAO_CDR_OUTPUT);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_cs::"
- "gen_marshal_and_invoke - "
- "codegen for return var in do_static_call failed\n"),
- -1);
- }
- *os << be_uidt_nl
- << "))" << be_nl;
-
- // If marshaling fails, raise exception.
- if (this->gen_raise_interceptor_exception (bt,
- "CORBA::MARSHAL",
- "")
- == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_cs::"
- "gen_marshal_and invoke - "
- "codegen for return var failed\n"),
- -1);
- }
-
- *os << be_uidt_nl;
- }
- else
- *os << be_nl;
-
- *os << "_invoke_status =" << be_idt_nl;
- if (node->flags () == AST_Operation::OP_oneway)
- {
- // Oneway operation.
- *os << "_tao_call.invoke (ACE_ENV_SINGLE_ARG_PARAMETER);";
- }
- else
- {
- if (node->exceptions ())
- {
- *os << "_tao_call.invoke (_tao_" << node->flat_name ()
- << "_exceptiondata, "
- << node->exceptions ()->length ()
- << " ACE_ENV_ARG_PARAMETER);";
- }
- else
- {
- *os << "_tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);";
- }
- }
-
- *os << be_uidt_nl;
- // Check if there is an exception.
- if (this->gen_check_interceptor_exception (bt) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_cs::"
- "gen_marshal_and_invoke - "
- "codegen for checking exception failed\n"),
- -1);
- }
-
- *os << be_nl
- << "if (_invoke_status == TAO_INVOKE_EXCEPTION)" << be_idt_nl
- << "{" << be_idt_nl;
-
- // Unlisted user exception received by client.
- if (this->gen_raise_interceptor_exception (
- bt,
- "CORBA::UNKNOWN",
- "TAO_OMG_VMCID | 1, CORBA::COMPLETED_YES") == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_cs::"
- "gen_marshal_and invoke - "
- "codegen for return var failed\n"),
- -1);
- }
-
- *os << be_uidt_nl << "}" << be_uidt_nl;
-
- // Note that we no longer turn this code generation off if it's a
- // one way operation since the sync scope policy may actually allow
- // things such as LOCATION_FORWARD replies to be propagated back to
- // the client (e.g. SYNC_WITH_TARGET).
- *os << "else if (_invoke_status == TAO_INVOKE_RESTART)" << be_idt_nl
- << "{" << be_idt_nl
- << "TAO_INTERCEPTOR (" << be_idt_nl
- << "_tao_ri.reply_status (_invoke_status);" << be_nl
- << "_tao_vfr.receive_other (" << be_idt_nl
- << "&_tao_ri" << be_nl
- << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
- << ");" << be_nl
- << "ACE_TRY_CHECK;" << be_uidt_nl
- << ")" << be_nl
- << be_nl
- << "continue;" << be_uidt_nl
- << "}" << be_uidt_nl
- << be_nl;
-
- // If we reach here, we are ready to proceed.
- // the code below this is for twoway operations only.
-
- if (!this->void_return_type (bt) ||
- this->has_param_type (node, AST_Argument::dir_INOUT) ||
- this->has_param_type (node, AST_Argument::dir_OUT))
-
- {
- // Do any post_invoke stuff that might be necessary.
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_POST_INVOKE_CS);
- ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_cs::"
- "gen_marshal_and_invoke - "
- "codegen for args in post do_static_call\n"),
- -1);
- }
-
- // Generate any temporary variables to demarshal the arguments
- ctx = *this->ctx_;
- be_visitor_compiled_args_decl vis1 (new be_visitor_context (ctx));
- if (node->accept (&vis1) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_cs::"
- "gen_pre_stub_info - "
- "codegen for pre args failed\n"),
- -1);
- }
-
- if (!this->void_return_type (bt))
- {
- // Generate any temporary variables to demarshal the return value
- ctx = *this->ctx_;
- be_visitor_context *new_ctx =
- new be_visitor_context (ctx);
- be_visitor_operation_rettype_post_invoke_cs vis2 (new_ctx);
- if (bt->accept (&vis2) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_cs::"
- "gen_pre_stub_info - "
- "codegen rettype [post invoke] failed\n"),
- -1);
- }
- }
-
- // check if there was a user exception, else demarshal the
- // return val (if any) and parameters (if any) that came with
- // the response message
- *os << "TAO_InputCDR &_tao_in = _tao_call.inp_stream ();" << be_nl
- << "if (!(" << be_idt << be_idt_nl;
-
- if (!this->void_return_type (bt))
- {
- // demarshal the return val
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_INVOKE_CS);
- ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_cs::"
- "gen_marshal_and_invoke - "
- "codegen for return var failed\n"),
- -1);
- }
- }
-
- if (this->has_param_type (node, AST_Argument::dir_INOUT) ||
- this->has_param_type (node, AST_Argument::dir_OUT))
- {
- if (!this->void_return_type (bt))
- *os << " &&" << be_nl;
-
- // demarshal each out and inout argument
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_INVOKE_CS);
- ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_cs::"
- "gen_marshal_and_invoke - "
- "codegen for return var failed\n"),
- -1);
- }
- }
-
- *os << be_nl
- << "))" << be_uidt_nl
- << "{" << be_idt_nl;
- // if marshaling fails, raise exception
- if (this->gen_raise_interceptor_exception
- (bt, "CORBA::MARSHAL",
- "TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_YES") == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_cs::"
- "gen_marshal_and invoke - "
- "codegen for return var failed\n"),
- -1);
- }
-
- *os << be_uidt_nl << "}" << be_uidt_nl;
- }
-
- *os << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl;
-
- // Populate the ClientRequestInfo object with result, if any, of the
- // invocation.
- if (!this->void_return_type (bt))
- {
- // Here's what we are going to do to have a uniform way of getting the
- // return value updated for the Request Info:
- // declare a operation_retval type object and assign the
- // _tao_retval._retn () to it.
- // We pass this to the result updation method (note: it hasnt
- // got destroyed)
- // We then put it back into the original _tao_retval
- // object.
- // And finally the _retn () is returned from the operation w.o
- // causing any problems.
-
- // 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) || (bt->accept (visitor) == -1))
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "visit_operation - "
- "codegen for return type failed\n"),
- -1);
- }
- delete visitor;
-
- if (bt->size_type () == be_decl::VARIABLE
- || bt->base_node_type () == AST_Decl::NT_array)
- {
- *os << " _tao_retval_info = _tao_retval._retn ();" << be_nl
- << "_tao_ri.result (_tao_retval_info);" << be_nl
- << "_tao_retval = _tao_retval_info;" << be_nl;
- }
- else
- {
- *os << " _tao_retval_info = _tao_retval;" << be_nl
- << "_tao_ri.result (_tao_retval_info);" << be_nl;
- }
- }
-
- // Oneway operations don't have receive_reply() interception since
- // once the request goes over the wire, its the end of the story!
- // However, we still need to call an ending interception point
- // (receive_other()) to satisfy the General Flow Rules.
- if (node->flags () != AST_Operation::OP_oneway)
- {
- // If we get this far (in the generated code) then we
- // successfully completed the request, i.e. no connection retry
- // will occur, nor will a LOCATION_FORWARD.
- // Invoke receive_reply() interception point.
- *os << be_nl
- << "_tao_ri.reply_status (_invoke_status);" << be_nl
- << "_tao_vfr.receive_reply (" << be_idt_nl
- << "&_tao_ri" << be_nl
- << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
- << ");" << be_nl;
- }
- else if (node->flags () == AST_Operation::OP_oneway)
- {
- // Invoke receive_other() interception point.
- *os << be_nl
- << "_tao_ri.reply_status (_invoke_status);" << be_nl
- << "_tao_vfr.receive_other (" << be_idt_nl
- << "&_tao_ri" << be_nl
- << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
- << ");" << be_nl;
- }
-
- *os << "ACE_TRY_CHECK;" << be_uidt_nl;
-
- *os << be_uidt_nl
- << "}" << be_uidt_nl;
-
- // Note that we do NOT catch the PortableInterceptor::ForwardRequest
- // exception here. It is caught in the
- // TAO_ClientRequestInterceptor_Adapter class. This is necessary to
- // prevent applications from being able to throw the exception in an
- // effort to get an easy (but illegal) way to forward a request.
-
- *os << "ACE_CATCHANY" << be_idt_nl
- << "{" << be_idt_nl;
-
- // Update the exception field of the ClientRequestInfo.
- *os << "_tao_ri.exception (&ACE_ANY_EXCEPTION);"<< be_nl;
-
- *os << "_tao_vfr.receive_exception (" << be_idt_nl
- << "&_tao_ri" << be_nl
- << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
- << ");" << be_nl
- << "ACE_TRY_CHECK;" << be_nl;
-
- // The receive_exception() interception point may have thrown a
- // PortableInterceptor::ForwardRequest exception. In that event,
- // the connection retry loop must be restarted so do not rethrow the
- // caught exception.
- *os << be_nl
- << "PortableInterceptor::ReplyStatus _tao_status =" << be_idt_nl
- << "_tao_ri.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER);" << be_uidt_nl
- << "ACE_TRY_CHECK;" << be_nl;
-
- *os << be_nl
- << "if (_tao_status == PortableInterceptor::SYSTEM_EXCEPTION" << be_nl
- << " || _tao_status == PortableInterceptor::USER_EXCEPTION)"
- << be_idt_nl;
-
- if (be_global->use_raw_throw ())
- *os << "throw;" << be_uidt << be_uidt_nl;
- else
- *os << "ACE_RE_THROW;" << be_uidt << be_uidt_nl;
-
- *os << "}" << be_uidt_nl
- << "ACE_ENDTRY;" << be_nl;
-
- if (this->gen_check_exception (bt) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_cs::"
- "gen_marshal_and_invoke - "
- "codegen for checking exception failed\n"),
- -1);
- }
-
- // The receive_exception() or receive_other() interception point may
- // have thrown a PortableInterceptor::ForwardRequest exception. In
- // that event, the connection retry loop must be restarted. Note
- // that the _invoke_status variable is not set by the interceptor
- // support code, so we must explicitly check the status in the
- // ClientRequestInfo object.
- *os << be_nl
- << "PortableInterceptor::ReplyStatus _tao_status =" << be_idt_nl
- << "_tao_ri.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER);" << be_uidt_nl;
-
- if (this->gen_check_exception (bt) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_cs::"
- "gen_marshal_and_invoke - "
- "codegen for checking exception failed\n"),
- -1);
- }
-
- *os << be_nl
- << "if (_tao_status == PortableInterceptor::LOCATION_FORWARD" << be_nl
- << " || _tao_status == PortableInterceptor::TRANSPORT_RETRY)"
- << be_idt_nl
- << "continue;" << be_uidt_nl;
-
- *os << "\n#endif /* TAO_HAS_INTERCEPTORS */" << be_nl;
-
- *os << be_nl << "break;" << be_uidt_nl
- << "}" << be_uidt_nl;
-
- return 0;
-}
-
-int
-be_visitor_operation_remote_proxy_impl_cs::gen_raise_interceptor_exception (be_type *bt,
- const char *excep,
- const char *completion_status)
-{
- TAO_OutStream *os = this->ctx_->stream ();
-
- if (this->void_return_type (bt))
- {
- if (be_global->use_raw_throw ())
- {
- *os << "throw " << excep << "(" << completion_status << ");";
- }
- else
- {
- *os << "TAO_INTERCEPTOR_THROW (" << be_idt_nl
- << excep << " (" << completion_status
- << ")" << be_uidt_nl
- << ");" << be_nl;
- }
- }
- else
- {
- if (bt->size_type () == be_decl::VARIABLE
- || bt->base_node_type () == AST_Decl::NT_array)
- {
- *os << "TAO_INTERCEPTOR_THROW_RETURN (" << be_idt_nl
- << excep << " (" << completion_status << ")," << be_nl
- << "0" << be_uidt_nl
- << ");" << be_nl;
- }
- else
- {
- *os << "TAO_INTERCEPTOR_THROW_RETURN (" << be_idt_nl
- << excep << " (" << completion_status << ")," << be_nl
- << "_tao_retval" << be_uidt_nl
- << ");" << be_nl;
- }
- }
-
- return 0;
-}
-
-const char*
-be_visitor_operation_remote_proxy_impl_cs::compute_operation_name (be_operation *node)
-{
- if (this->operation_name_ == 0)
- {
- size_t len = 3; // length for two double quotes
- // and the null termination char.
- if (this->ctx_->attribute ())
- len += 5; // "Added length for "_set_" or "_get_".
-
- len += ACE_OS::strlen (node->original_local_name ()->get_string ());
-
- ACE_NEW_RETURN (this->operation_name_,
- char [len],
- 0);
-
- ACE_OS::strcpy (this->operation_name_, "\"");
- if (this->ctx_->attribute ())
- {
- // now check if we are a "get" or "set" operation
- if (node->nmembers () == 1) // set
- ACE_OS::strcat (this->operation_name_, "_set_");
- else
- ACE_OS::strcat (this->operation_name_, "_get_");
- }
- ACE_OS::strcat (this->operation_name_,
- node->original_local_name ()->get_string ());
- ACE_OS::strcat (this->operation_name_, "\"");
- }
- return this->operation_name_;
-}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp
index 973012c93b6..ff0c96d5d75 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp
@@ -18,13 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, rettype, "$Id$")
+ACE_RCSID (be_visitor_operation,
+ rettype,
+ "$Id$")
// ****************************************************************************
@@ -166,9 +162,10 @@ be_visitor_operation_rettype::visit_predefined_type (be_predefined_type *node)
switch (node->pt ())
{
case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
*os << bt->name ();
- // If it's not TCKind, it's either TypeCode or ValueBase.
+ // If it's not TCKind, it's either Object, TypeCode or ValueBase.
if (ACE_OS::strcmp (bt->local_name ()->get_string (), "TCKind") != 0)
{
*os << "_ptr";
@@ -252,7 +249,7 @@ be_visitor_operation_rettype::visit_structure (be_structure *node)
// Based on whether we are variable or not, we return a pointer or the
// aggregate type.
- if (node->size_type () == be_decl::VARIABLE)
+ if (node->size_type () == AST_Type::VARIABLE)
{
*os << " *";
}
@@ -299,7 +296,7 @@ be_visitor_operation_rettype::visit_union (be_union *node)
// Based on whether we are variable or not, we return a pointer or the
// aggregate type.
- if (node->size_type () == be_decl::VARIABLE)
+ if (node->size_type () == AST_Type::VARIABLE)
{
*os << " *";
}
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
index 65f263d1a45..073f6dd5d97 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/rettype_assign_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_assign_ss.cpp
@@ -19,14 +19,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, rettype_assign_ss, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ rettype_assign_ss,
+ "$Id$")
// ****************************************************************************
// visitor for assignment to a return value variable from the upcall
@@ -122,6 +117,7 @@ visit_predefined_type (be_predefined_type *node)
case AST_PredefinedType::PT_void:
break;
case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
case AST_PredefinedType::PT_any:
default:
*os << "_tao_retval = ";
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_is.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_is.cpp
index 9578bd33269..8ce8cf18421 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/rettype_is.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_is.cpp
@@ -16,22 +16,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, rettype_is, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ rettype_is,
+ "$Id$")
// ****************************************************************************
// Operation visitor for return types. This generates the mapping for a return
// type in an operation signature
// ****************************************************************************
-be_visitor_operation_rettype_is::be_visitor_operation_rettype_is (be_visitor_context
- *ctx)
+be_visitor_operation_rettype_is::be_visitor_operation_rettype_is (
+ be_visitor_context *ctx
+ )
: be_visitor_decl (ctx)
{
}
@@ -43,64 +39,65 @@ be_visitor_operation_rettype_is::~be_visitor_operation_rettype_is (void)
int
be_visitor_operation_rettype_is::visit_array (be_array *)
{
-
-
TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
- *os << "return 0;" <<be_nl;
+ *os << "return 0;" << be_nl;
return 0;
}
int
be_visitor_operation_rettype_is::visit_enum (be_enum *)
{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "return 0;" << be_nl;
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
- *os << "return 0;" <<be_nl;
return 0;
}
int
be_visitor_operation_rettype_is::visit_interface (be_interface *)
{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "return 0;" << be_nl;
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
- *os << "return 0;" <<be_nl;
return 0;
}
int
be_visitor_operation_rettype_is::visit_interface_fwd (be_interface_fwd *)
{
+ TAO_OutStream *os = this->ctx_->stream ();
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ *os << "return 0;" << be_nl;
- *os << "return 0;" <<be_nl;
return 0;
}
int
be_visitor_operation_rettype_is::visit_native (be_native *)
{
+ TAO_OutStream *os = this->ctx_->stream ();
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ *os << "return 0;" << be_nl;
- *os << "return 0;" <<be_nl;
return 0;
}
int
be_visitor_operation_rettype_is::visit_predefined_type (be_predefined_type *node)
{
-
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (node->pt ())
{
case AST_PredefinedType::PT_void:
- *os << "return;" <<be_nl;
- break;
+ *os << "return;" << be_nl;
+
+ break;
default:
- *os << "return 0;" <<be_nl;
+ *os << "return 0;" << be_nl;
+
break;
}
@@ -110,42 +107,40 @@ be_visitor_operation_rettype_is::visit_predefined_type (be_predefined_type *node
int
be_visitor_operation_rettype_is::visit_sequence (be_sequence *)
{
+ // We should never directly be here because anonymous sequence return types
+ // are not allowed.
+ TAO_OutStream *os = this->ctx_->stream ();
+ *os << "return 0;" << be_nl;
- // we should never directly be here because anonymous sequence return types
- // are not allowed
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
-
- *os << "return 0;" <<be_nl;
return 0;
}
int
be_visitor_operation_rettype_is::visit_string (be_string *)
{
+ TAO_OutStream *os = this->ctx_->stream ();
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
-
+ *os << "return 0;" << be_nl;
- *os << "return 0;" <<be_nl;
return 0;
}
int
be_visitor_operation_rettype_is::visit_structure (be_structure *)
{
-
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ TAO_OutStream *os = this->ctx_->stream ();
*os << "return 0;" <<be_nl;
+
return 0;
}
int
be_visitor_operation_rettype_is::visit_typedef (be_typedef *node)
{
+ this->ctx_->alias (node);
- this->ctx_->alias (node); // set the alias node
if (node->primitive_base_type ()->accept (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -154,6 +149,7 @@ be_visitor_operation_rettype_is::visit_typedef (be_typedef *node)
"accept on primitive type failed\n"),
-1);
}
+
this->ctx_->alias (0);
return 0;
}
@@ -161,10 +157,9 @@ be_visitor_operation_rettype_is::visit_typedef (be_typedef *node)
int
be_visitor_operation_rettype_is::visit_union (be_union *)
{
+ TAO_OutStream *os = this->ctx_->stream ();
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
-
- *os << "return 0;" <<be_nl;
+ *os << "return 0;" << be_nl;
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
index 6abd8fdaf79..ee688d485cb 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/rettype_marshal_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_marshal_ss.cpp
@@ -23,12 +23,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "be.h"
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, rettype_marshal_ss, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ rettype_marshal_ss,
+ "$Id$")
// ****************************************************************************
// visitor for arguments passing to the CDR operators.
@@ -45,13 +42,14 @@ be_visitor_operation_rettype_marshal_ss::
{
}
-int be_visitor_operation_rettype_marshal_ss::
-visit_operation (be_operation *node)
+int be_visitor_operation_rettype_marshal_ss::visit_operation (
+ be_operation *node
+ )
{
- this->ctx_->node (node); // save the argument node
+ this->ctx_->node (node);
- // retrieve the type of the argument
be_type *bt = be_type::narrow_from_decl (node->return_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -68,12 +66,10 @@ visit_operation (be_operation *node)
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
{
- os->indent ();
*os << "(_tao_out << ";
}
else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
{
- os->indent ();
*os << "(_tao_in >> ";
}
else
@@ -261,6 +257,7 @@ int be_visitor_operation_rettype_marshal_ss::visit_predefined_type (be_predefine
switch (node->pt ())
{
case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
*os << "_tao_retval.in ()";
break;
case AST_PredefinedType::PT_any:
@@ -302,6 +299,7 @@ int be_visitor_operation_rettype_marshal_ss::visit_predefined_type (be_predefine
switch (node->pt ())
{
case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
*os << "_tao_retval.inout ()";
break;
case AST_PredefinedType::PT_any:
@@ -436,14 +434,14 @@ int be_visitor_operation_rettype_marshal_ss::visit_structure (be_structure *node
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
{
- if (node->size_type () == be_decl::VARIABLE)
+ if (node->size_type () == AST_Type::VARIABLE)
*os << "_tao_retval.in ()";
else
*os << "_tao_retval";
}
else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
{
- if (node->size_type () == be_decl::VARIABLE)
+ if (node->size_type () == AST_Type::VARIABLE)
*os << "_tao_retval.inout ()";
else
*os << "_tao_retval";
@@ -465,14 +463,14 @@ int be_visitor_operation_rettype_marshal_ss::visit_union (be_union *node)
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT)
{
- if (node->size_type () == be_decl::VARIABLE)
+ if (node->size_type () == AST_Type::VARIABLE)
*os << "_tao_retval.in ()";
else
*os << "_tao_retval";
}
else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT)
{
- if (node->size_type () == be_decl::VARIABLE)
+ if (node->size_type () == AST_Type::VARIABLE)
*os << "_tao_retval.inout ()";
else
*os << "_tao_retval";
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_post_invoke_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_post_invoke_cs.cpp
index 07274f66d0f..f6dfc8e7e3f 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/rettype_post_invoke_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_post_invoke_cs.cpp
@@ -19,45 +19,44 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, rettype_post_invoke_cs, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ rettype_post_invoke_cs,
+ "$Id$")
// *******************************************************************************
// be_visitor_operation_rettype_post_invoke_cs
// ********************************************************************************
be_visitor_operation_rettype_post_invoke_cs::
- be_visitor_operation_rettype_post_invoke_cs (be_visitor_context *ctx)
- : be_visitor_decl (ctx)
+be_visitor_operation_rettype_post_invoke_cs (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
{
}
int
be_visitor_operation_rettype_post_invoke_cs::visit_array (be_array *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ TAO_OutStream *os = this->ctx_->stream ();
be_type *bt = node;
- if (this->ctx_->alias ()) // a typedefed return type
- bt = this->ctx_->alias ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
*os << bt->name () << "_forany _tao_retval_forany ("
<< be_idt << be_idt_nl
<< "_tao_retval.inout ()" << be_uidt_nl
- << ");\n" << be_uidt;
+ << ");" << be_uidt_nl;
+
return 0;
}
int
be_visitor_operation_rettype_post_invoke_cs::visit_typedef (be_typedef *node)
{
- this->ctx_->alias (node); // set the alias node
+ this->ctx_->alias (node);
+
if (node->primitive_base_type ()->accept (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -66,6 +65,7 @@ be_visitor_operation_rettype_post_invoke_cs::visit_typedef (be_typedef *node)
"accept on primitive type failed\n"),
-1);
}
+
this->ctx_->alias (0);
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
index 8e547ffee36..90b7d6af6fb 100644
--- 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
@@ -19,38 +19,36 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, rettype_post_upcall_ss, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ rettype_post_upcall_ss,
+ "$Id$")
// ****************************************************************************
// 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_context *ctx)
+ : be_visitor_decl (ctx)
{
}
int
be_visitor_operation_rettype_post_upcall_ss::visit_array (be_array *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ TAO_OutStream *os = this->ctx_->stream ();
be_type *bt = node;
- if (this->ctx_->alias ()) // a typedefed return type
- bt = this->ctx_->alias ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
*os << bt->name () << "_forany _tao_retval_forany ("
<< be_idt << be_idt_nl
<< "_tao_retval.inout ()" << be_uidt_nl
<< ");\n" << be_uidt;
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_pre_invoke_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_pre_invoke_cs.cpp
index d3eb147723f..ca2f69c51e4 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/rettype_pre_invoke_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_pre_invoke_cs.cpp
@@ -19,14 +19,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, rettype_pre_invoke_cs, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ rettype_pre_invoke_cs,
+ "$Id$")
// *****************************************************************************
// be_visitor_operation_rettype_pre_invoke_cs
@@ -46,28 +41,32 @@ be_visitor_operation_rettype_pre_invoke_cs::
int
be_visitor_operation_rettype_pre_invoke_cs::visit_array (be_array *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
- be_type *bt; // return type
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- if (this->ctx_->alias ()) // a typedefed return type
- bt = this->ctx_->alias ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
- os->indent ();
*os << "{" << be_idt_nl
<< bt->name () << "_slice *tmp;" << be_nl
<< "ACE_ALLOCATOR_RETURN (tmp, "
<< bt->name () << "_alloc (), _tao_retval._retn ());" << be_nl
<< "_tao_retval = tmp;" << be_uidt_nl
<< "}\n";
+
return 0;
}
int
be_visitor_operation_rettype_pre_invoke_cs::visit_interface (be_interface *)
{
- // don't do anything. This is the overriding action
+ // Don't do anything. This is the overriding action.
return 0;
}
@@ -81,57 +80,68 @@ int
be_visitor_operation_rettype_pre_invoke_cs::
visit_predefined_type (be_predefined_type *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (node->pt ())
{
case AST_PredefinedType::PT_any:
- os->indent ();
+
*os << "{" << be_idt_nl
<< "CORBA::Any *tmp;" << be_nl
<< "ACE_NEW_RETURN (tmp, CORBA::Any, _tao_retval._retn ());" << be_nl
<< "_tao_retval = tmp;" << be_uidt_nl
<< "}\n";
+
break;
default:
break;
}
+
return 0;
}
int
be_visitor_operation_rettype_pre_invoke_cs::visit_sequence (be_sequence *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
- be_type *bt; // return type
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- if (this->ctx_->alias ()) // a typedefed return type
- bt = this->ctx_->alias ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
os->indent ();
+
*os << "{" << be_idt_nl
<< bt->name () << " *tmp;" << be_nl
<< "ACE_NEW_RETURN (tmp, "
<< bt->name () << ", _tao_retval._retn ());" << be_nl
<< "_tao_retval = tmp;" << be_uidt_nl
<< "}\n";
+
return 0;
}
int
be_visitor_operation_rettype_pre_invoke_cs::visit_structure (be_structure *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
- be_type *bt; // return type
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- if (this->ctx_->alias ()) // a typedefed return type
- bt = this->ctx_->alias ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
- // check if the union is variable
if (node->size_type () == be_type::VARIABLE)
{
os->indent ();
@@ -142,13 +152,15 @@ be_visitor_operation_rettype_pre_invoke_cs::visit_structure (be_structure *node)
<< "_tao_retval = tmp;" << be_uidt_nl
<< "}\n";
}
+
return 0;
}
int
be_visitor_operation_rettype_pre_invoke_cs::visit_typedef (be_typedef *node)
{
- this->ctx_->alias (node); // set the alias node
+ this->ctx_->alias (node);
+
if (node->primitive_base_type ()->accept (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -157,6 +169,7 @@ be_visitor_operation_rettype_pre_invoke_cs::visit_typedef (be_typedef *node)
"accept on primitive type failed\n"),
-1);
}
+
this->ctx_->alias (0);
return 0;
}
@@ -164,18 +177,22 @@ be_visitor_operation_rettype_pre_invoke_cs::visit_typedef (be_typedef *node)
int
be_visitor_operation_rettype_pre_invoke_cs::visit_union (be_union *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
- be_type *bt; // return type
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- if (this->ctx_->alias ()) // a typedefed return type
- bt = this->ctx_->alias ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
- // check if the union is variable
if (node->size_type () == be_type::VARIABLE)
{
os->indent ();
+
*os << "{" << be_idt_nl
<< bt->name () << " *tmp;" << be_nl
<< "ACE_NEW_RETURN (tmp, "
@@ -183,6 +200,7 @@ be_visitor_operation_rettype_pre_invoke_cs::visit_union (be_union *node)
<< "_tao_retval = tmp;" << be_uidt_nl
<< "}\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
index 300c34bb256..84e0d9b0de3 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/rettype_return_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_return_cs.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, rettype_return_cs, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ rettype_return_cs,
+ "$Id$")
// ************************************************************
// be_visitor_operation_rettype_return_cs
@@ -33,120 +28,132 @@ ACE_RCSID(be_visitor_operation, rettype_return_cs, "$Id$")
// 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_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)
+be_visitor_operation_rettype_return_cs::
+~be_visitor_operation_rettype_return_cs (void)
{
}
int
be_visitor_operation_rettype_return_cs::visit_array (be_array *)
{
- // Grab the out stream
TAO_OutStream *os = this->ctx_->stream ();
*os << "_tao_retval._retn ()";
+
return 0;
}
int
be_visitor_operation_rettype_return_cs::visit_enum (be_enum *)
{
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ TAO_OutStream *os = this->ctx_->stream ();
*os << "_tao_retval";
+
return 0;
}
int
be_visitor_operation_rettype_return_cs::visit_interface (be_interface *)
{
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ TAO_OutStream *os = this->ctx_->stream ();
*os << "_tao_retval._retn ()";
+
return 0;
}
int
be_visitor_operation_rettype_return_cs::visit_interface_fwd (be_interface_fwd *)
{
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ TAO_OutStream *os = this->ctx_->stream ();
*os << "_tao_retval";
+
return 0;
}
int
be_visitor_operation_rettype_return_cs::visit_valuetype (be_valuetype *)
{
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ TAO_OutStream *os = this->ctx_->stream ();
*os << "_tao_retval._retn ()";
+
return 0;
}
int
be_visitor_operation_rettype_return_cs::visit_valuetype_fwd (be_valuetype_fwd *)
{
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ TAO_OutStream *os = this->ctx_->stream ();
*os << "_tao_retval._retn ()";
+
return 0;
}
int
-be_visitor_operation_rettype_return_cs::visit_predefined_type (be_predefined_type *node)
+be_visitor_operation_rettype_return_cs::visit_predefined_type (
+ be_predefined_type *node
+ )
{
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ TAO_OutStream *os = this->ctx_->stream ();
switch (node->pt ())
{
case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
*os << "_tao_retval._retn ()";
- break;
+ break;
case AST_PredefinedType::PT_any:
*os << "_tao_retval._retn ()";
- break;
+ break;
case AST_PredefinedType::PT_void:
break;
-
default:
*os << "_tao_retval";
+
break;
}
+
return 0;
}
int
be_visitor_operation_rettype_return_cs::visit_sequence (be_sequence *)
{
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ TAO_OutStream *os = this->ctx_->stream ();
*os << "_tao_retval._retn ()";
+
return 0;
}
int
be_visitor_operation_rettype_return_cs::visit_string (be_string *)
{
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ TAO_OutStream *os = this->ctx_->stream ();
*os << "_tao_retval._retn ()";
+
return 0;
}
int
be_visitor_operation_rettype_return_cs::visit_structure (be_structure *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ TAO_OutStream *os = this->ctx_->stream ();
- if (node->size_type () == be_decl::VARIABLE)
+ if (node->size_type () == AST_Type::VARIABLE)
{
*os << "_tao_retval._retn ()";
}
@@ -154,13 +161,15 @@ be_visitor_operation_rettype_return_cs::visit_structure (be_structure *node)
{
*os << "_tao_retval";
}
+
return 0;
}
int
be_visitor_operation_rettype_return_cs::visit_typedef (be_typedef *node)
{
- this->ctx_->alias (node); // set the alias node
+ this->ctx_->alias (node);
+
if (node->primitive_base_type ()->accept (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -169,6 +178,7 @@ be_visitor_operation_rettype_return_cs::visit_typedef (be_typedef *node)
"accept on primitive type failed\n"),
-1);
}
+
this->ctx_->alias (0);
return 0;
}
@@ -176,9 +186,9 @@ be_visitor_operation_rettype_return_cs::visit_typedef (be_typedef *node)
int
be_visitor_operation_rettype_return_cs::visit_union (be_union *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ TAO_OutStream *os = this->ctx_->stream ();
- if (node->size_type () == be_decl::VARIABLE)
+ if (node->size_type () == AST_Type::VARIABLE)
{
*os << "_tao_retval._retn ()";
}
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
index 79602578ad9..ddfae38a161 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_cs.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, rettype_vardecl_cs, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ rettype_vardecl_cs,
+ "$Id$")
// ************************************************************
// be_visitor_operation_rettype_vardecl_cs
@@ -47,18 +42,21 @@ be_visitor_operation_rettype_vardecl_cs::
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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- if (this->ctx_->alias ()) // a typedefed return type
- bt = this->ctx_->alias ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
os->indent ();
*os << bt->name () << "_var _tao_retval;";
-
*os << be_nl;
return 0;
@@ -67,13 +65,17 @@ be_visitor_operation_rettype_vardecl_cs::visit_array (be_array *node)
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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- if (this->ctx_->alias ()) // a typedefed return type
- bt = this->ctx_->alias ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
os->indent ();
@@ -87,13 +89,17 @@ be_visitor_operation_rettype_vardecl_cs::visit_enum (be_enum *node)
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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- if (this->ctx_->alias ()) // a typedefed return type
- bt = this->ctx_->alias ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
os->indent ();
@@ -118,13 +124,17 @@ 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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- if (this->ctx_->alias ()) // a typedefed return type
- bt = this->ctx_->alias ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
os->indent ();
@@ -147,13 +157,17 @@ be_visitor_operation_rettype_vardecl_cs::visit_interface_fwd (
int
be_visitor_operation_rettype_vardecl_cs::visit_valuetype (be_valuetype *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
- be_type *bt; // return type
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- if (this->ctx_->alias ()) // a typedefed return type
- bt = this->ctx_->alias ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
os->indent ();
@@ -166,13 +180,17 @@ be_visitor_operation_rettype_vardecl_cs::visit_valuetype (be_valuetype *node)
int
be_visitor_operation_rettype_vardecl_cs::visit_valuetype_fwd (be_valuetype_fwd *node)
{
- TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
- be_type *bt; // return type
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- if (this->ctx_->alias ()) // a typedefed return type
- bt = this->ctx_->alias ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
os->indent ();
*os << "::" << bt->name () << "_var _tao_retval;\n\n"
@@ -182,7 +200,9 @@ be_visitor_operation_rettype_vardecl_cs::visit_valuetype_fwd (be_valuetype_fwd *
}
int
-be_visitor_operation_rettype_vardecl_cs::visit_predefined_type (be_predefined_type *node)
+be_visitor_operation_rettype_vardecl_cs::visit_predefined_type (
+ be_predefined_type *node
+ )
{
TAO_OutStream *os = this->ctx_->stream ();
be_type *bt;
@@ -201,28 +221,34 @@ be_visitor_operation_rettype_vardecl_cs::visit_predefined_type (be_predefined_ty
switch (node->pt ())
{
case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
*os << bt->name () << "_var _tao_retval ("
<< bt->name () << "::_nil ());";
+
break;
case AST_PredefinedType::PT_any:
*os << bt->name () << "_var _tao_retval;";
+
break;
case AST_PredefinedType::PT_void:
break;
case AST_PredefinedType::PT_longdouble:
*os << bt->name ()
<< " _tao_retval = ACE_CDR_LONG_DOUBLE_INITIALIZER;";
+
break;
case AST_PredefinedType::PT_longlong:
*os << bt->name ()
<< " _tao_retval = ACE_CDR_LONGLONG_INITIALIZER;";
+
break;
default:
*os << bt->name () << " _tao_retval = 0;";
+
break;
}
- *os << be_nl << be_nl;
+ *os << be_nl;
return 0;
}
@@ -230,17 +256,22 @@ be_visitor_operation_rettype_vardecl_cs::visit_predefined_type (be_predefined_ty
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
+ // We should never directly be here because anonymous sequence return types
+ // are not allowed.
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- if (this->ctx_->alias ()) // a typedefed return type
- bt = this->ctx_->alias ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
os->indent ();
+
*os << bt->name () << "_var _tao_retval;\n" << be_nl;
return 0;
@@ -253,8 +284,6 @@ be_visitor_operation_rettype_vardecl_cs::visit_string (be_string *node)
os->indent ();
- // @@ Jeff, this sort of code looks weird to me, on *all* platforms
- // sizeof(char) is 1, by definition...
if (node->width () == (long) sizeof (char))
{
*os << "CORBA::String_var _tao_retval;";
@@ -271,19 +300,23 @@ be_visitor_operation_rettype_vardecl_cs::visit_string (be_string *node)
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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- if (this->ctx_->alias ()) // a typedefed return type
- bt = this->ctx_->alias ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ 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)
+ // Based on whether we are variable or not, we return a pointer or the
+ // aggregate type.
+ if (node->size_type () == AST_Type::VARIABLE)
{
*os << bt->name () << "_var _tao_retval;" << be_nl;
}
@@ -301,7 +334,8 @@ be_visitor_operation_rettype_vardecl_cs::visit_structure (be_structure *node)
int
be_visitor_operation_rettype_vardecl_cs::visit_typedef (be_typedef *node)
{
- this->ctx_->alias (node); // set the alias node
+ this->ctx_->alias (node);
+
if (node->primitive_base_type ()->accept (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -310,6 +344,7 @@ be_visitor_operation_rettype_vardecl_cs::visit_typedef (be_typedef *node)
"accept on primitive type failed\n"),
-1);
}
+
this->ctx_->alias (0);
return 0;
}
@@ -317,19 +352,23 @@ be_visitor_operation_rettype_vardecl_cs::visit_typedef (be_typedef *node)
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
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
- if (this->ctx_->alias ()) // a typedefed return type
- bt = this->ctx_->alias ();
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ 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)
+ // Based on whether we are variable or not, we return a pointer or the
+ // aggregate type.
+ if (node->size_type () == AST_Type::VARIABLE)
{
*os << bt->name () << "_var _tao_retval;";
}
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
index 74034b7c6ab..5f1ae49f1a6 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_ss.cpp
@@ -19,14 +19,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, rettype_vardecl_ss, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ rettype_vardecl_ss,
+ "$Id$")
// ************************************************************************
// be_visitor_operation_rettype_vardecl_ss
@@ -34,8 +29,8 @@ ACE_RCSID(be_visitor_operation, rettype_vardecl_ss, "$Id$")
// of the return type.
// ************************************************************************
-be_visitor_operation_rettype_vardecl_ss::be_visitor_operation_rettype_vardecl_ss
-(be_visitor_context *ctx)
+be_visitor_operation_rettype_vardecl_ss::
+be_visitor_operation_rettype_vardecl_ss (be_visitor_context *ctx)
: be_visitor_decl (ctx)
{
}
@@ -104,7 +99,7 @@ visit_interface_fwd (be_interface_fwd *node)
return 0;
}
-// like be_compiled_visitor_operation_rettype_vardecl_ss
+// Like be_visitor_operation_rettype_vardecl_ss.
int
be_visitor_operation_rettype_vardecl_ss::visit_valuetype (be_valuetype *node)
{
@@ -143,6 +138,7 @@ visit_predefined_type (be_predefined_type *node)
switch (node->pt ())
{
case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
*os << bt->name () << "_var _tao_retval;\n";
break;
case AST_PredefinedType::PT_any:
@@ -222,7 +218,7 @@ be_visitor_operation_rettype_vardecl_ss::visit_structure (be_structure *node)
// Based on whether we are variable or not, we return a pointer or the
// aggregate type.
- if (node->size_type () == be_decl::VARIABLE)
+ if (node->size_type () == AST_Type::VARIABLE)
{
*os << "::" << bt->name () << "_var _tao_retval;\n";
}
@@ -270,7 +266,7 @@ be_visitor_operation_rettype_vardecl_ss::visit_union (be_union *node)
// Based on whether we are variable or not, we return a pointer or the
// aggregate type.
- if (node->size_type () == be_decl::VARIABLE)
+ if (node->size_type () == AST_Type::VARIABLE)
{
*os << "::" << bt->name () << "_var _tao_retval;\n";
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_ch.cpp
index 67166a5d8fc..2dbf281187a 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_ch.cpp
@@ -18,25 +18,24 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, operation_smart_proxy_ch, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ smart_proxy_ch,
+ "$Id$")
// ******************************************************
-// primary visitor for "operation" in client header
+// Primary visitor for "operation" in client header.
// ******************************************************
-be_visitor_operation_smart_proxy_ch::be_visitor_operation_smart_proxy_ch (be_visitor_context *ctx)
+be_visitor_operation_smart_proxy_ch::be_visitor_operation_smart_proxy_ch (
+ be_visitor_context *ctx
+ )
: be_visitor_scope (ctx)
{
}
-be_visitor_operation_smart_proxy_ch::~be_visitor_operation_smart_proxy_ch (void)
+be_visitor_operation_smart_proxy_ch::~be_visitor_operation_smart_proxy_ch (
+ void
+ )
{
}
@@ -46,19 +45,15 @@ be_visitor_operation_smart_proxy_ch::visit_operation (be_operation *node)
if (be_global->gen_smart_proxies ())
{
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
+ os->indent ();
- 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 ());
+ // STEP I: generate the return type.
+ be_type *bt = be_type::narrow_from_decl (node->return_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -68,58 +63,36 @@ be_visitor_operation_smart_proxy_ch::visit_operation (be_operation *node)
-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_smart_proxy_ch::"
- "visit_operation - "
- "Bad visitor to return type\n"),
- -1);
- }
+ be_visitor_operation_rettype or_visitor (&ctx);
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&or_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_smart_proxy_ch::"
"visit_operation - "
"codegen for return type failed\n"),
-1);
}
- delete visitor;
- // STEP 2: generate the operation name
+ // 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_smart_proxy_ch::"
- "visit_operation - "
- "Bad visitor to return type\n"),
- -1);
- }
+ be_visitor_operation_arglist oa_visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&oa_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_smart_proxy_ch::"
"visit_operation - "
"codegen for argument list failed\n"),
-1);
}
- delete visitor;
}
else
{
@@ -127,5 +100,4 @@ be_visitor_operation_smart_proxy_ch::visit_operation (be_operation *node)
}
return 0;
-
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_cs.cpp
index 715d774c75b..e0740edbd2a 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_cs.cpp
@@ -18,26 +18,24 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, operation_smart_proxy_cs, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ operation_smart_proxy_cs,
+ "$Id$")
// ************************************************************
// Operation visitor for client stubs
// ************************************************************
-be_visitor_operation_smart_proxy_cs::be_visitor_operation_smart_proxy_cs
-(be_visitor_context *ctx)
- : be_visitor_scope (ctx)
+be_visitor_operation_smart_proxy_cs::be_visitor_operation_smart_proxy_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_operation (ctx)
{
}
-be_visitor_operation_smart_proxy_cs::~be_visitor_operation_smart_proxy_cs (void)
+be_visitor_operation_smart_proxy_cs::~be_visitor_operation_smart_proxy_cs (
+ void
+ )
{
}
@@ -49,9 +47,8 @@ int be_visitor_operation_smart_proxy_cs::visit_operation (be_operation *node)
// 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 ()
+ // information from the context.
+ be_interface *intf = this->ctx_->attribute ()
? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ())
: be_interface::narrow_from_scope (node->defined_in ());
@@ -64,8 +61,8 @@ int be_visitor_operation_smart_proxy_cs::visit_operation (be_operation *node)
-1);
}
- // retrieve the operation return type
be_type *bt = be_type::narrow_from_decl (node->return_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -75,30 +72,19 @@ int be_visitor_operation_smart_proxy_cs::visit_operation (be_operation *node)
-1);
}
- // STEP 2: generate the return type mapping (same as in the header file)
+ // 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);
+ be_visitor_operation_rettype oro_visitor (&ctx);
- if (!visitor)
+ if (bt->accept (&oro_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_operation_smart_proxy_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_smart_proxy_cs::"
"visit_operation - "
"codegen for return type failed\n"),
-1);
}
- delete visitor;
// Its necessary to take care of the nested case. The smart proxy classes
// are in the same scope as the proxy (i.e. interface) but here the
@@ -121,26 +107,16 @@ int be_visitor_operation_smart_proxy_cs::visit_operation (be_operation *node)
// 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_ss::"
- "visit_operation - "
- "Bad visitor to return type\n"),
- -1);
- }
+ be_visitor_operation_arglist oao_visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&oao_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_ss::"
"visit_operation - "
"codegen for argument list failed\n"),
-1);
}
- delete visitor;
*os << "{" << be_idt << "\n";
@@ -167,11 +143,10 @@ int be_visitor_operation_smart_proxy_cs::visit_operation (be_operation *node)
}
return 0;
-
}
int be_visitor_operation_smart_proxy_cs::gen_invoke (be_visitor_context &ctx,
- be_operation *node)
+ be_operation *node)
{
TAO_OutStream *os = this->ctx_->stream ();
@@ -180,10 +155,10 @@ int be_visitor_operation_smart_proxy_cs::gen_invoke (be_visitor_context &ctx,
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ be_visitor_operation_argument visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_smart_proxy_cs::"
"gen_invoke - "
@@ -191,21 +166,9 @@ int be_visitor_operation_smart_proxy_cs::gen_invoke (be_visitor_context &ctx,
-1);
}
- // end the upcall
*os << be_uidt_nl
<< ");\n" << be_uidt;
+
return 0;
}
-int
-be_visitor_operation_smart_proxy_cs::void_return_type (be_type *bt)
-{
- // is the operation return type void?
-
- 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;
-}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/thru_poa_proxy_impl_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/thru_poa_proxy_impl_ss.cpp
index fe21b95ff28..db4d71260a6 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/thru_poa_proxy_impl_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/thru_poa_proxy_impl_ss.cpp
@@ -1,31 +1,30 @@
// $Id$
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, be_visitor_operation_thru_poa_proxy_impl_ss, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ be_visitor_operation_thru_poa_proxy_impl_ss,
+ "$Id$")
// ************************************************************
// Operation visitor for client stubs
// ************************************************************
-be_visitor_operation_thru_poa_proxy_impl_ss::be_visitor_operation_thru_poa_proxy_impl_ss (be_visitor_context *ctx)
+be_visitor_operation_thru_poa_proxy_impl_ss::
+be_visitor_operation_thru_poa_proxy_impl_ss (be_visitor_context *ctx)
: be_visitor_operation (ctx)
{
}
-be_visitor_operation_thru_poa_proxy_impl_ss::~be_visitor_operation_thru_poa_proxy_impl_ss (void)
+be_visitor_operation_thru_poa_proxy_impl_ss::
+~be_visitor_operation_thru_poa_proxy_impl_ss (void)
{
//No-Op.
}
int
-be_visitor_operation_thru_poa_proxy_impl_ss::visit_operation (be_operation *node)
+be_visitor_operation_thru_poa_proxy_impl_ss::visit_operation (
+ be_operation *node
+ )
{
TAO_OutStream *os = this->ctx_->stream ();
@@ -39,49 +38,48 @@ be_visitor_operation_thru_poa_proxy_impl_ss::visit_operation (be_operation *node
if (!intf)
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::"
- "visit_operation - "
- "bad interface scope\n"),
- -1);
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) be_visitor_operation_thru_poa_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_thru_poa_collocated_ss::"
- "visit_operation - "
- "Bad return type\n"),
- -1);
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) be_visitor_operation_thru_poa_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);
+ be_visitor_operation_rettype oro_visitor (&ctx);
- if (!visitor)
+ if (bt->accept (&oro_visitor) == -1)
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_operation_thru_poa_collocated_ss::"
- "visit_operation - "
- "Bad visitor for return type\n"),
- -1);
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::"
+ "visit_operation - "
+ "codegen for return type failed\n"
+ ),
+ -1
+ );
}
- if (bt->accept (visitor) == -1)
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::"
- "visit_operation - "
- "codegen for return type failed\n"),
- -1);
- }
- delete visitor;
-
*os << " " << intf->full_thru_poa_proxy_impl_name () << "::";
*os << node->local_name ();
@@ -89,26 +87,16 @@ be_visitor_operation_thru_poa_proxy_impl_ss::visit_operation (be_operation *node
// in the header file)
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XS);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_operation_ss::"
- "visit_operation - "
- "Bad visitor to return type\n"),
- -1);
- }
+ be_visitor_operation_arglist oapi_visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&oapi_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_ss::"
"visit_operation - "
"codegen for argument list failed\n"),
-1);
}
- delete visitor;
*os << "{" << be_idt << be_nl;
@@ -117,15 +105,18 @@ be_visitor_operation_thru_poa_proxy_impl_ss::visit_operation (be_operation *node
// Declare a return type
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_DECL_SS);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (bt->accept (visitor) == -1))
+ be_visitor_operation_rettype_vardecl_ss ord_visitor (&ctx);
+
+ if (bt->accept (&ord_visitor) == -1)
{
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::"
- "visit_operation - "
- "codegen for return var decl failed\n"),
- -1);
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::"
+ "visit_operation - "
+ "codegen for return var decl failed\n"
+ ),
+ -1
+ );
}
if (!this->void_return_type (bt))
@@ -139,7 +130,8 @@ be_visitor_operation_thru_poa_proxy_impl_ss::visit_operation (be_operation *node
*os <<"TAO_Object_Adapter::Servant_Upcall servant_upcall ("
<< be_idt << be_idt_nl
- << "_collocated_tao_target_->_stubobj ()->servant_orb_var ()->orb_core ()"
+ << "_collocated_tao_target_->_stubobj ()"
+ << "->servant_orb_var ()->orb_core ()"
<< be_uidt_nl
<< ");" << be_uidt_nl
<< "CORBA::Object_var forward_to;" << be_nl
@@ -147,46 +139,32 @@ be_visitor_operation_thru_poa_proxy_impl_ss::visit_operation (be_operation *node
<< "_collocated_tao_target_->_object_key ()," << be_nl
<< "\"" << node->original_local_name () << "\"," << be_nl
<< "forward_to.out ()";
- if (!be_global->exception_support ())
- *os << be_nl
- << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
- << ");" << be_uidt_nl;
- else
- *os << be_uidt_nl << ");" << be_uidt_nl;
- // check if there is an exception
if (!be_global->exception_support ())
- if (this->gen_check_exception (bt) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::"
- "visit_operation - "
- "codegen for checking exception failed\n"),
- -1);
- }
-
- if (!be_global->exception_support ())
- os->indent ();
-
- *os << "servant_upcall.pre_invoke_collocated_request (";
- if (!be_global->exception_support ())
- *os << "ACE_ENV_SINGLE_ARG_PARAMETER";
- *os << ");" << be_nl;
+ {
+ *os << be_nl
+ << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
+ << ");" << be_uidt_nl;
+ }
+ else
+ {
+ *os << be_uidt_nl << ");" << be_uidt_nl;
+ }
- // check if there is an exception
+ // Check if there is an exception.
if (!be_global->exception_support ())
if (this->gen_check_exception (bt) == -1)
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::"
- "visit_operation - "
- "codegen for checking exception failed\n"),
- -1);
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::"
+ "visit_operation - "
+ "codegen for checking exception failed\n"
+ ),
+ -1
+ );
}
- if (!be_global->exception_support ())
- os->indent ();
-
if (!this->void_return_type (bt))
{
*os << "return ";
@@ -200,17 +178,12 @@ be_visitor_operation_thru_poa_proxy_impl_ss::visit_operation (be_operation *node
<< ")" << be_uidt;
if (this->gen_invoke (ctx, node) == -1)
- return -1;
-
- if (this->void_return_type (bt))
{
- *os << "return;\n";
+ return -1;
}
*os << "}\n\n";
- os->decr_indent (0);
-
return 0;
}
@@ -228,46 +201,29 @@ be_visitor_operation_thru_poa_proxy_impl_ss::gen_invoke (
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_argument visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&visitor) == -1)
{
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::"
- "gen_invoke - "
- "codegen for making upcall failed\n"),
- -1);
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::"
+ "gen_invoke - "
+ "codegen for making upcall failed\n"
+ ),
+ -1
+ );
}
// End the upcall
*os << be_uidt_nl
<< ");";
- // retrieve the operation return type
+ // Retrieve the operation return type.
be_type *bt = be_type::narrow_from_decl (node->return_type ());
- if (this->void_return_type (bt))
- {
- *os << be_uidt << be_uidt_nl;
- }
- else
- {
- *os << be_uidt << be_uidt << be_uidt_nl;
- }
+ *os << be_uidt << be_uidt << be_uidt_nl;
return 0;
}
-int
-be_visitor_operation_thru_poa_proxy_impl_ss::void_return_type (be_type *bt)
-{
- // is the operation return type void?
-
- 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;
-}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/tie_sh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/tie_sh.cpp
index 08c28a0d6ee..ea3cc13e472 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/tie_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/tie_sh.cpp
@@ -19,20 +19,17 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, tie_sh, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ tie_sh,
+ "$Id$")
// ************************************************************
-// Operation visitor for server header for TIE class operations
+// 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_operation_tie_sh::be_visitor_operation_tie_sh (
+ be_visitor_context *ctx
+ )
: be_visitor_scope (ctx)
{
}
@@ -44,16 +41,14 @@ 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
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
- os = this->ctx_->stream ();
- this->ctx_->node (node); // save the node
+ os->indent ();
- os->indent (); // start with the current indentation level
+ // STEP I: generate the return type.
+ be_type *bt = be_type::narrow_from_decl (node->return_type ());
- // STEP I: generate the return type
- bt = be_type::narrow_from_decl (node->return_type ());
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -63,32 +58,20 @@ be_visitor_operation_tie_sh::visit_operation (be_operation *node)
-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);
+ be_visitor_operation_rettype oro_visitor (&ctx);
- if (!visitor)
+ if (bt->accept (&oro_visitor) == -1)
{
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
+ // STEP 2: generate the operation name.
*os << " " << node->local_name ();
// STEP 3: generate the argument list with the appropriate mapping. For these
@@ -97,25 +80,16 @@ be_visitor_operation_tie_sh::visit_operation (be_operation *node)
// 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);
- }
+ be_visitor_operation_arglist oa_visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&oa_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
index 2a53fe4a408..131fe85fbde 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/tie_si.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/tie_si.cpp
@@ -18,21 +18,17 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_operation, tie_si, "$Id$")
-
+ACE_RCSID (be_visitor_operation,
+ tie_si,
+ "$Id$")
// ************************************************************
-// Operation visitor for server inline for TIE class operations
+// 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_operation_tie_si::be_visitor_operation_tie_si (
+ be_visitor_context *ctx
+ )
: be_visitor_scope (ctx)
{
}
@@ -45,8 +41,7 @@ int be_visitor_operation_tie_si::visit_operation (be_operation *node)
{
TAO_OutStream *os = this->ctx_->stream ();
- be_interface *intf =
- this->ctx_->interface ();
+ be_interface *intf = this->ctx_->interface ();
if (!intf)
{
@@ -57,8 +52,9 @@ int be_visitor_operation_tie_si::visit_operation (be_operation *node)
-1);
}
- // retrieve the operation return type
+ // Retrieve the operation return type.
be_type *bt = be_type::narrow_from_decl (node->return_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -71,30 +67,19 @@ int be_visitor_operation_tie_si::visit_operation (be_operation *node)
os->indent ();
*os << "template <class T> ACE_INLINE\n";
- // generate the return type mapping (same as in the header file)
+ // 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);
- }
+ be_visitor_operation_rettype oro_visitor (&ctx);
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&oro_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 () << " ";
@@ -103,31 +88,22 @@ int be_visitor_operation_tie_si::visit_operation (be_operation *node)
// 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);
- }
+ be_visitor_operation_arglist oao_visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&oao_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_nl;
- if (bt->node_type () != AST_Decl::NT_pre_defined
- || be_predefined_type::narrow_from_decl (bt)->pt () != AST_PredefinedType::PT_void)
+ be_predefined_type *pdt = be_predefined_type::narrow_from_decl (bt);
+
+ if (pdt == 0 || pdt->pt () != AST_PredefinedType::PT_void)
{
*os << "return ";
}
@@ -136,17 +112,17 @@ int be_visitor_operation_tie_si::visit_operation (be_operation *node)
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))
+ be_visitor_operation_argument ocau_visitor (&ctx);
+
+ if (node->accept (&ocau_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_ss::"
"visit_operation - "
"codegen for making upcall failed\n"),
-1);
}
- // end the upcall
+
*os << be_uidt_nl;
*os << ");" << be_uidt_nl;
*os << "}\n\n";
diff --git a/TAO/TAO_IDL/be/be_visitor_root.cpp b/TAO/TAO_IDL/be/be_visitor_root.cpp
index 6521d5d8535..f50ee1cb45e 100644
--- a/TAO/TAO_IDL/be/be_visitor_root.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root.cpp
@@ -16,12 +16,39 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_constant.h"
+#include "be_enum.h"
+#include "be_exception.h"
+#include "be_interface.h"
+#include "be_interface_fwd.h"
+#include "be_module.h"
+#include "be_root.h"
+#include "be_structure.h"
+#include "be_structure_fwd.h"
+#include "be_typedef.h"
+#include "be_union.h"
+#include "be_union_fwd.h"
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
+#include "be_helper.h"
+#include "be_extern.h"
+
#include "be_visitor_root.h"
+#include "be_visitor_constant.h"
+#include "be_visitor_enum.h"
+#include "be_visitor_exception.h"
+#include "be_visitor_interface.h"
+#include "be_visitor_interface_fwd.h"
+#include "be_visitor_module.h"
+#include "be_visitor_structure.h"
+#include "be_visitor_structure_fwd.h"
+#include "be_visitor_typedef.h"
+#include "be_visitor_union.h"
+#include "be_visitor_union_fwd.h"
+#include "be_visitor_valuetype.h"
+#include "be_visitor_valuetype_fwd.h"
+#include "be_visitor_context.h"
-// include all the individual files
#include "be_visitor_root/root.cpp"
#include "be_visitor_root/root_ch.cpp"
#include "be_visitor_root/root_ci.cpp"
@@ -35,4 +62,6 @@
#include "be_visitor_root/any_op.cpp"
#include "be_visitor_root/cdr_op.cpp"
-ACE_RCSID(be, be_visitor_root, "$Id$")
+ACE_RCSID (be,
+ be_visitor_root,
+ "$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_root/any_op.cpp b/TAO/TAO_IDL/be/be_visitor_root/any_op.cpp
index 9d31730b5c7..427dbbb8125 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/any_op.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/any_op.cpp
@@ -19,14 +19,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_root.h"
-
-ACE_RCSID(be_visitor_root, any_op, "$Id$")
-
+ACE_RCSID (be_visitor_root,
+ any_op,
+ "$Id$")
// ***************************************************************************
// Root visitor for generating Any operator declarations in the client header
@@ -45,12 +40,13 @@ 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);
+ "codegen for scope failed\n"),
+ -1);
}
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_root/cdr_op.cpp b/TAO/TAO_IDL/be/be_visitor_root/cdr_op.cpp
index 36f9214da42..ce1b5ad5c47 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/cdr_op.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/cdr_op.cpp
@@ -19,14 +19,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_root.h"
-
-ACE_RCSID(be_visitor_root, cdr_op, "$Id$")
-
+ACE_RCSID (be_visitor_root,
+ cdr_op,
+ "$Id$")
// ***************************************************************************
// Root visitor for generating CDR operator declarations in the client header
@@ -49,16 +44,15 @@ be_visitor_root_cdr_op::visit_root (be_root *node)
if (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_CDR_OP_CH)
{
- *os << be_nl
- << "#ifndef __ACE_INLINE__\n\n";
+ *os << "#ifndef __ACE_INLINE__" << be_nl << be_nl;
}
- // 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_cdr_op::visit_root - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
if (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_CDR_OP_CH)
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root.cpp b/TAO/TAO_IDL/be/be_visitor_root/root.cpp
index 2bea93a0734..68ee260a2ec 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_root.h"
-
-ACE_RCSID(be_visitor_root, root, "$Id$")
-
+ACE_RCSID (be_visitor_root,
+ root,
+ "$Id$")
// Generic Root visitor
be_visitor_root::be_visitor_root (be_visitor_context *ctx)
@@ -37,31 +32,31 @@ be_visitor_root::~be_visitor_root (void)
{
}
-// this method must be overridden by the derived root visitors
+// 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
+ // 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);
+ "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);
+ "codegen for scope failed\n"),
+ -1);
}
// If we are generating the client header file, this is the place to
@@ -70,16 +65,18 @@ int be_visitor_root::visit_root (be_root *node)
if (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_CH)
{
TAO_OutStream *os = this->ctx_->stream ();
-
- size_t size = be_global->non_local_interfaces.size ();
be_interface *i = 0;
be_interface_fwd *ifwd = 0;
size_t index = 0;
+ size_t size = be_global->non_local_interfaces.size ();
+
if (size > 0)
{
*os << "// Proxy Broker Factory function pointer declarations."
- << be_nl << be_nl;
+ << be_nl;
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
}
for (index = 0; index < size; ++index)
@@ -98,112 +95,191 @@ int be_visitor_root::visit_root (be_root *node)
size = be_global->non_defined_interfaces.size ();
+ if (size > 0)
+ {
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ }
+
for (index = 0; index < size; ++index)
{
be_global->non_defined_interfaces.dequeue_head (ifwd);
- *os << "// External declarations for undefined interface" << be_nl
- << "// " << ifwd->full_name () << be_nl;
+ if (ifwd->is_valuetype ())
+ {
+ *os << "// External declarations for undefined valuetype"
+ << be_nl
+ << "// " << ifwd->full_name () << be_nl;
+
+ *os << be_global->stub_export_macro () << be_nl
+ << "void" << be_nl
+ << "tao_" << ifwd->flat_name ()
+ << "_add_ref ("
+ << be_idt << be_idt_nl
+ << ifwd->full_name () << " *" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << be_global->stub_export_macro () << be_nl
+ << "void" << be_nl
+ << "tao_" << ifwd->flat_name ()
+ << "_remove_ref (" << be_idt << be_idt_nl
+ << ifwd->full_name () << " *" << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+ }
+ else
+ {
+ *os << "// External declarations for undefined interface"
+ << be_nl
+ << "// " << ifwd->full_name () << be_nl;
+
+ *os << be_global->stub_export_macro () << be_nl
+ << ifwd->full_name () << "_ptr" << be_nl
+ << "tao_" << ifwd->flat_name ()
+ << "_duplicate ("
+ << be_idt << be_idt_nl
+ << ifwd->full_name () << "_ptr" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << be_global->stub_export_macro () << be_nl
+ << "void" << be_nl
+ << "tao_" << ifwd->flat_name ()
+ << "_release (" << be_idt << be_idt_nl
+ << ifwd->full_name () << "_ptr" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << be_global->stub_export_macro () << be_nl
+ << ifwd->full_name () << "_ptr" << be_nl
+ << "tao_" << ifwd->flat_name ()
+ << "_nil (" << be_idt << be_idt_nl
+ << "void" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << be_global->stub_export_macro () << be_nl
+ << ifwd->full_name () << "_ptr" << be_nl
+ << "tao_" << ifwd->flat_name ()
+ << "_narrow (" << be_idt << be_idt_nl
+ << "CORBA::Object *" << be_nl
+ << "ACE_ENV_ARG_DECL_NOT_USED" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << be_global->stub_export_macro () << be_nl
+ << "CORBA::Object *" << be_nl
+ << "tao_" << ifwd->flat_name ()
+ << "_upcast (" << be_idt << be_idt_nl
+ << "void *" << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+ }
+ }
- *os << be_global->stub_export_macro () << be_nl
- << ifwd->full_name () << "_ptr" << be_nl
- << "tao_" << ifwd->flat_name ()
- << "_duplicate ("
- << be_idt << be_idt_nl
- << ifwd->full_name () << "_ptr" << be_uidt_nl
- << ");" << be_uidt_nl
- << be_global->stub_export_macro () << be_nl
- << "void" << be_nl
- << "tao_" << ifwd->flat_name ()
- << "_release (" << be_idt << be_idt_nl
- << ifwd->full_name () << "_ptr" << be_uidt_nl
- << ");" << be_uidt_nl
- << be_global->stub_export_macro () << be_nl
- << ifwd->full_name () << "_ptr" << be_nl
- << "tao_" << ifwd->flat_name ()
- << "_nil (" << be_idt << be_idt_nl
- << "void" << be_uidt_nl
- << ");" << be_uidt_nl
- << be_global->stub_export_macro () << be_nl
- << ifwd->full_name () << "_ptr" << be_nl
- << "tao_" << ifwd->flat_name ()
- << "_narrow (" << be_idt << be_idt_nl
- << "CORBA::Object *" << be_nl
- << "ACE_ENV_ARG_DECL_NOT_USED" << be_uidt_nl
- << ");" << be_uidt_nl
- << be_global->stub_export_macro () << be_nl
- << "CORBA::Object *" << be_nl
- << "tao_" << ifwd->flat_name ()
- << "_upcast (" << be_idt << be_idt_nl
- << "void *" << be_uidt_nl
- << ");" << be_uidt_nl << be_nl;
+ size = be_global->mixed_parentage_interfaces.size ();
+
+ if (size > 0)
+ {
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "// Overrides of CORBA::release and CORBA::is_nil for"
+ << be_nl
+ << "// interfaces that inherit from both CORBA::Object" << be_nl
+ << "// and CORBA::AbstractBase." << be_nl << be_nl
+ << "TAO_NAMESPACE CORBA" << be_nl
+ << "{" << be_idt;
+ }
+
+ for (index = 0; index < size; ++index)
+ {
+ be_global->mixed_parentage_interfaces.dequeue_head (i);
+
+ *os << be_nl
+ << "TAO_NAMESPACE_STORAGE_CLASS void release ("
+ << i->name () << "_ptr);" << be_nl
+ << "TAO_NAMESPACE_STORAGE_CLASS CORBA::Boolean is_nil ("
+ << i->name () << "_ptr);";
+ }
+
+ if (size > 0)
+ {
+ *os << be_uidt_nl
+ << "}" << be_nl
+ << "TAO_NAMESPACE_CLOSE" << be_nl << be_nl;
}
}
- be_visitor *visitor;
be_visitor_context ctx (*this->ctx_);
- // make one more pass over the entire tree and generate the OBV_ namespaces
- // and OBV_ classes
+ // Make one more pass over the entire tree and generate the OBV_ namespaces
+ // and OBV_ classes.
idl_bool obv = 0;
+ int status = 0;
+
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_ROOT_CH:
- obv = 1;
- ctx.state (TAO_CodeGen::TAO_MODULE_OBV_CH);
- break;
+ {
+ obv = 1;
+ ctx.state (TAO_CodeGen::TAO_MODULE_OBV_CH);
+ be_visitor_obv_module visitor (&ctx);
+ status = visitor.visit_scope (node);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CI:
- obv = 1;
- ctx.state (TAO_CodeGen::TAO_MODULE_OBV_CI);
- break;
+ {
+ obv = 1;
+ ctx.state (TAO_CodeGen::TAO_MODULE_OBV_CI);
+ be_visitor_obv_module visitor (&ctx);
+ status = visitor.visit_scope (node);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CS:
- obv = 1;
- ctx.state (TAO_CodeGen::TAO_MODULE_OBV_CS);
- break;
+ {
+ obv = 1;
+ ctx.state (TAO_CodeGen::TAO_MODULE_OBV_CS);
+ be_visitor_obv_module visitor (&ctx);
+ status = visitor.visit_scope (node);
+ break;
+ }
default:
- break;
+ break;
}
- if (obv)
- {
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_root::"
- "visit_root - "
- "NUL visitor\n"
- ), -1);
- }
- if (visitor->visit_scope (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_root::"
- "visit_root - "
- "failed to generate OBV_ things\n"
- ), -1);
- }
- delete visitor;
+ if (obv == 1 && status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_root - "
+ "failed to generate OBV_ things\n"),
+ -1);
}
// The next 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.
ctx = *this->ctx_;
+ status = 0;
+
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_ROOT_CH:
- ctx.state (TAO_CodeGen::TAO_ROOT_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ROOT_ANY_OP_CH);
+
+ if (be_global->any_support ())
+ {
+ be_visitor_root_any_op visitor (&ctx);
+ status = node->accept (&visitor);
+ }
+
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CS:
- ctx.state (TAO_CodeGen::TAO_ROOT_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ROOT_ANY_OP_CS);
+
+ if (be_global->any_support ())
+ {
+ be_visitor_root_any_op visitor (&ctx);
+ status = node->accept (&visitor);
+ }
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_IH:
(void) tao_cg->end_implementation_header (
be_global->be_get_implementation_hdr_fname (0)
@@ -213,7 +289,6 @@ int be_visitor_root::visit_root (be_root *node)
(void) tao_cg->end_server_header ();
return 0;
case TAO_CodeGen::TAO_ROOT_CI:
- break;
case TAO_CodeGen::TAO_ROOT_IS:
break;
case TAO_CodeGen::TAO_ROOT_SI:
@@ -243,56 +318,48 @@ int be_visitor_root::visit_root (be_root *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_constant - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- // *ASG* - this is a tempoaray hack soln so that our CDR operators get
- // generated in the *.i file rather than the *.cpp file
- if (this->ctx_->state () != TAO_CodeGen::TAO_ROOT_CI
- && this->ctx_->state () != TAO_CodeGen::TAO_ROOT_IH
- && this->ctx_->state () != TAO_CodeGen::TAO_ROOT_IS)
+ if (status == -1)
{
- 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;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_root - "
+ "failed to generate Any operators\n"),
+ -1);
}
- // make one more pass over the entire tree and generate the CDR << and >>
- // operators for compiled marshaling. Again, this code can be conditionally
- // generated if compiled marshaling is desired.
+
+ // Make one more pass over the entire tree and generate the CDR operators.
ctx = *this->ctx_;
+ status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_ROOT_CH:
- ctx.state (TAO_CodeGen::TAO_ROOT_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ROOT_CDR_OP_CH);
+ be_visitor_root_cdr_op visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CI:
- ctx.state (TAO_CodeGen::TAO_ROOT_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ROOT_CDR_OP_CI);
+ be_visitor_root_cdr_op visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CS:
- ctx.state (TAO_CodeGen::TAO_ROOT_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ROOT_CDR_OP_CS);
+ be_visitor_root_cdr_op visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_SH:
case TAO_CodeGen::TAO_ROOT_IH:
case TAO_CodeGen::TAO_ROOT_SI:
@@ -305,32 +372,21 @@ int be_visitor_root::visit_root (be_root *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_constant - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
- } 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)
+ }
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_root - "
- "failed to generate CDR operators\n"
- ), -1);
+ "failed to generate CDR operators\n"),
+ -1);
}
- delete visitor;
- // generate any final code such as #endifs
+ // Generate any final code such as #endifs.
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_ROOT_CH:
@@ -342,29 +398,33 @@ int be_visitor_root::visit_root (be_root *node)
return 0;
}
-// =all common visit methods for root visitor
+// 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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_ROOT_CH:
- ctx.state (TAO_CodeGen::TAO_CONSTANT_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_CONSTANT_CH);
+ be_visitor_constant_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CS:
- ctx.state (TAO_CodeGen::TAO_CONSTANT_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_CONSTANT_CS);
+ be_visitor_constant_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
@@ -382,149 +442,173 @@ be_visitor_root::visit_constant (be_constant *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_constant - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_constant - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_ROOT_CH:
- ctx.state (TAO_CodeGen::TAO_ENUM_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_CH);
+ be_visitor_enum_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CS:
- ctx.state (TAO_CodeGen::TAO_ENUM_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_CS);
+ be_visitor_enum_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CH);
+ be_visitor_enum_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CS);
+ be_visitor_enum_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CH);
+ be_visitor_enum_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CI);
+ be_visitor_enum_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_ENUM_CDR_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:
- case TAO_CodeGen::TAO_ROOT_IS:
- case TAO_CodeGen::TAO_ROOT_IH:
+ case TAO_CodeGen::TAO_ROOT_IS:
+ case TAO_CodeGen::TAO_ROOT_IH:
return 0; // nothing to be done
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_enum - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_enum - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_ROOT_CH:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CH);
+ be_visitor_exception_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CI:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CI);
+ be_visitor_exception_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CS:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CS);
+ be_visitor_exception_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CH);
+ be_visitor_exception_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CS);
+ be_visitor_exception_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CH);
+ be_visitor_exception_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CI);
+ be_visitor_exception_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CS);
+ be_visitor_exception_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_SH:
case TAO_CodeGen::TAO_ROOT_SI:
case TAO_CodeGen::TAO_ROOT_SS:
@@ -536,31 +620,20 @@ be_visitor_root::visit_exception (be_exception *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_exception - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_exception - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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;
}
@@ -568,14 +641,11 @@ be_visitor_root::visit_exception (be_exception *node)
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
+ // 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
+ ctx.node (node);
+ int status = 1;
switch (this->ctx_->state ())
{
@@ -583,73 +653,135 @@ be_visitor_root::visit_interface (be_interface *node)
ctx.state (TAO_CodeGen::TAO_INTERFACE_CH);
break;
case TAO_CodeGen::TAO_ROOT_CI:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_CI);
+ be_visitor_interface_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CS:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_CS);
+ be_visitor_interface_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_SH:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_SH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_SH);
+ be_visitor_interface_sh visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_IH:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_IH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_IH);
+ be_visitor_interface_ih visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_SI:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_SI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_SI);
+ be_visitor_interface_si visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_SS:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_SS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_SS);
+ be_visitor_interface_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_IS:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_IS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_IS);
+ be_visitor_interface_is visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH);
+ be_visitor_interface_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS);
+ be_visitor_interface_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_CDR_OP_CH);
+ be_visitor_interface_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_CDR_OP_CI);
+ be_visitor_interface_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_CDR_OP_CS);
+ be_visitor_interface_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_interface - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
+ if (status == 0)
+ {
+ return 0;
+ }
+ else if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_interface - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
// Change the state depending on the kind of node strategy
ctx.state (node->next_state (ctx.state ()));
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);
+ "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);
+ "failed to accept visitor\n"),
+ -1);
}
+
delete visitor;
visitor = 0;
@@ -662,24 +794,25 @@ be_visitor_root::visit_interface (be_interface *node)
ctx.state (node->next_state (ctx.state (), 1));
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);
+ "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);
+ "failed to accept visitor\n"),
+ -1);
}
+
delete visitor;
visitor = 0;
}
@@ -687,39 +820,53 @@ be_visitor_root::visit_interface (be_interface *node)
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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_ROOT_CH:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CH);
+ be_visitor_interface_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CI:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CI);
+ be_visitor_interface_fwd_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CDR_OP_CI);
- break;
- case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CDR_OP_CS);
- break;
- case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CDR_OP_CI);
+ be_visitor_interface_fwd_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_ANY_OP_CH);
+ be_visitor_interface_fwd_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ {
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CDR_OP_CH);
+ be_visitor_interface_fwd_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
case TAO_CodeGen::TAO_ROOT_CS:
case TAO_CodeGen::TAO_ROOT_SH:
@@ -733,173 +880,176 @@ be_visitor_root::visit_interface_fwd (be_interface_fwd *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_interface_fwd - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_interface_fwd - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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 a valuetype
int
be_visitor_root::visit_valuetype (be_valuetype *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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_ROOT_CH:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_CH);
+ be_visitor_valuetype_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CI:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_CI);
+ be_visitor_valuetype_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CS:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_CS);
+ be_visitor_valuetype_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CH);
+ be_visitor_valuetype_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CI);
+ be_visitor_valuetype_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CS);
+ be_visitor_valuetype_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CH);
+ be_visitor_valuetype_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CS);
+ be_visitor_valuetype_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_SH:
- case TAO_CodeGen::TAO_ROOT_IH:
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_SH);
+ be_visitor_valuetype_sh visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_SI:
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_SI);
+ be_visitor_valuetype_si visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_SS:
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_SS);
+ be_visitor_valuetype_ss visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_IH:
case TAO_CodeGen::TAO_ROOT_IS:
case TAO_CodeGen::TAO_ROOT_TIE_SH:
- return 0; // nothing to do, resp. not yet impl.
+ return 0; // nothing to do.
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_valuetype - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- // Change the state depending on the kind of node strategy
- ctx.state (node->next_state (ctx.state ()));
-
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_root::"
- "visit_valuetype - "
- "NUL visitor\n"
- ), -1);
- }
-
- // let the node accept this visitor
- if (node->accept (visitor) == -1)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_valuetype - "
- "failed to accept visitor\n"
- ), -1);
+ "failed to accept visitor\n"),
+ -1);
}
- delete visitor;
- visitor = 0;
-
- // Do addtional "extra" code generation if necessary
- if (node->has_extra_code_generation (ctx.state ()))
- {
- // Change the state depending on the kind of node strategy
- ctx.state (node->next_state (ctx.state (), 1));
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_root::"
- "visit_valuetype - "
- "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_valuetype - "
- "failed to accept visitor\n"
- ), -1);
- }
- delete visitor;
- visitor = 0;
- }
return 0;
}
-// visit an valuetype_fwd
int
be_visitor_root::visit_valuetype_fwd (be_valuetype_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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_ROOT_CH:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CH);
+ be_visitor_valuetype_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CI:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CI);
+ be_visitor_valuetype_fwd_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CH);
+ be_visitor_valuetype_fwd_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CI);
+ be_visitor_valuetype_fwd_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
@@ -909,357 +1059,540 @@ be_visitor_root::visit_valuetype_fwd (be_valuetype_fwd *node)
case TAO_CodeGen::TAO_ROOT_SS:
case TAO_CodeGen::TAO_ROOT_IS:
case TAO_CodeGen::TAO_ROOT_IH:
- return 0; // nothing to be done
+ return 0; // nothing to be done
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_valuetype_fwd - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_valuetype_fwd - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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_valuetype_fwd - "
- "failed to accept visitor\n"
- ), -1);
- }
- delete visitor;
return 0;
}
-// visit a 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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_ROOT_CH:
- ctx.state (TAO_CodeGen::TAO_MODULE_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_MODULE_CH);
+ be_visitor_module_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CI:
- ctx.state (TAO_CodeGen::TAO_MODULE_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_MODULE_CI);
+ be_visitor_module visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CS:
- ctx.state (TAO_CodeGen::TAO_MODULE_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_MODULE_CS);
+ be_visitor_module visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_SH:
- ctx.state (TAO_CodeGen::TAO_MODULE_SH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_MODULE_SH);
+ be_visitor_module_sh visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_SI:
- ctx.state (TAO_CodeGen::TAO_MODULE_SI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_MODULE_SI);
+ be_visitor_module visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_SS:
- ctx.state (TAO_CodeGen::TAO_MODULE_SS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_MODULE_SS);
+ be_visitor_module visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_IS:
- ctx.state (TAO_CodeGen::TAO_MODULE_IS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_MODULE_IS);
+ be_visitor_module visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_IH:
- ctx.state (TAO_CodeGen::TAO_MODULE_IH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_MODULE_IH);
+ be_visitor_module_ih visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_MODULE_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_MODULE_ANY_OP_CH);
+ be_visitor_module_any_op visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_MODULE_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_MODULE_ANY_OP_CS);
+ be_visitor_module_any_op visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_MODULE_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_MODULE_CDR_OP_CH);
+ be_visitor_module_cdr_op visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_MODULE_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_MODULE_CDR_OP_CI);
+ be_visitor_module_cdr_op visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_MODULE_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_MODULE_CDR_OP_CS);
+ be_visitor_module_cdr_op visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_module - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_module - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_ROOT_CH:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CH);
+ be_visitor_structure_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CI:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CI);
+ be_visitor_structure_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CS:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CS);
+ be_visitor_structure_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CH);
+ be_visitor_structure_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CS);
+ be_visitor_structure_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CH);
+ be_visitor_structure_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CI);
+ be_visitor_structure_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CS);
+ be_visitor_structure_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_SH:
case TAO_CodeGen::TAO_ROOT_SI:
case TAO_CodeGen::TAO_ROOT_SS:
- case TAO_CodeGen::TAO_ROOT_IS:
- case TAO_CodeGen::TAO_ROOT_IH:
+ case TAO_CodeGen::TAO_ROOT_IS:
+ case TAO_CodeGen::TAO_ROOT_IH:
return 0; // nothing to be done
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_structure - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_structure - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept visitor\n"),
+ -1);
}
- // let the node accept this visitor
- if (node->accept (visitor) == -1)
+ return 0;
+}
+
+int
+be_visitor_root::visit_structure_fwd (be_structure_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);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_FWD_CH);
+ be_visitor_structure_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CI:
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ 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:
+ case TAO_CodeGen::TAO_ROOT_IH:
+ case TAO_CodeGen::TAO_ROOT_IS:
+ return 0; // nothing to be done
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_structure_fwd - "
+ "Bad context state\n"),
+ -1);
+ }
+ }
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
- "visit_structure - "
- "failed to accept visitor\n"
- ), -1);
+ "visit_structure_fwd - "
+ "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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_ROOT_CH:
- ctx.state (TAO_CodeGen::TAO_UNION_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CH);
+ be_visitor_union_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CI:
- ctx.state (TAO_CodeGen::TAO_UNION_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CI);
+ be_visitor_union_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CS:
- ctx.state (TAO_CodeGen::TAO_UNION_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CS);
+ be_visitor_union_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CH);
+ be_visitor_union_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CS);
+ be_visitor_union_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CH);
+ be_visitor_union_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CI);
+ be_visitor_union_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CS);
+ be_visitor_union_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_SH:
case TAO_CodeGen::TAO_ROOT_SI:
case TAO_CodeGen::TAO_ROOT_SS:
- case TAO_CodeGen::TAO_ROOT_IS:
- case TAO_CodeGen::TAO_ROOT_IH:
+ case TAO_CodeGen::TAO_ROOT_IS:
+ case TAO_CodeGen::TAO_ROOT_IH:
return 0; // nothing to be done
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_union - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_union - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept visitor\n"),
+ -1);
}
- // let the node accept this visitor
- if (node->accept (visitor) == -1)
+ return 0;
+}
+
+int
+be_visitor_root::visit_union_fwd (be_union_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);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_FWD_CH);
+ be_visitor_union_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CI:
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ 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:
+ case TAO_CodeGen::TAO_ROOT_IH:
+ case TAO_CodeGen::TAO_ROOT_IS:
+ return 0; // nothing to be done
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_union_fwd - "
+ "Bad context state\n"),
+ -1);
+ }
+ }
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
- "visit_union - "
- "failed to accept visitor\n"
- ), -1);
+ "visit_interface_fwd - "
+ "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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_ROOT_CH:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CH);
+ be_visitor_typedef_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CI:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CI);
+ be_visitor_typedef_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CS:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CS);
+ be_visitor_typedef_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH);
+ be_visitor_typedef_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS);
+ be_visitor_typedef_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CH);
+ be_visitor_typedef_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CI);
+ be_visitor_typedef_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CS);
+ be_visitor_typedef_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_ROOT_SH:
case TAO_CodeGen::TAO_ROOT_SI:
case TAO_CodeGen::TAO_ROOT_SS:
- case TAO_CodeGen::TAO_ROOT_IS:
- case TAO_CodeGen::TAO_ROOT_IH:
+ case TAO_CodeGen::TAO_ROOT_IS:
+ case TAO_CodeGen::TAO_ROOT_IH:
return 0; // nothing to be done
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_typedef - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::"
"visit_typedef - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept visitor"),
+ -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
index fd9bb00d90e..ff7dba28e3a 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_root.h"
-
-ACE_RCSID(be_visitor_root, root_ch, "$Id$")
-
+ACE_RCSID (be_visitor_root,
+ root_ch,
+ "$Id$")
// ********************************
// Root visitor for client header
@@ -47,10 +42,10 @@ be_visitor_root_ch::init (void)
if (tao_cg->start_client_header (be_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;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root_ch::init - "
+ "Error opening client header file\n"),
+ -1);
}
// Initialize the stream.
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ci.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ci.cpp
index a7c9d9e60db..4a6001866d6 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_ci.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_root.h"
-
-ACE_RCSID(be_visitor_root, root_ci, "$Id$")
-
+ACE_RCSID (be_visitor_root,
+ root_ci,
+ "$Id$")
// *********************************
// Root visitor for client inline
@@ -47,10 +42,10 @@ be_visitor_root_ci::init (void)
if (tao_cg->start_client_inline (be_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;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root_ci - "
+ "Error opening client inline file\n"),
+ -1);
}
this->ctx_->stream (tao_cg->client_inline ());
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_cs.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_cs.cpp
index aea6f39d996..2fcc8acd791 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_cs.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_root.h"
-
-ACE_RCSID(be_visitor_root, root_cs, "$Id$")
-
+ACE_RCSID (be_visitor_root,
+ root_cs,
+ "$Id$")
// ***********************************
// Root visitor for client stubs
@@ -49,7 +44,8 @@ be_visitor_root_cs::init (void)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root_cs - "
- "Error opening client stub file\n"), -1);
+ "Error opening client stub file\n"),
+ -1);
}
// init stream
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ih.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ih.cpp
index e913ee653b6..5ff8eea3403 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root_ih.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_ih.cpp
@@ -16,14 +16,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_root.h"
-
-ACE_RCSID(be_visitor_root, root_ih, "$Id$")
-
+ACE_RCSID (be_visitor_root,
+ root_ih,
+ "$Id$")
// ***********************************
// Root visitor for implementation header
@@ -41,7 +36,6 @@ be_visitor_root_ih::~be_visitor_root_ih (void)
int
be_visitor_root_ih::init (void)
{
- // open the file
if (tao_cg->start_implementation_header (
be_global->be_get_implementation_hdr_fname ()
)
@@ -56,7 +50,6 @@ be_visitor_root_ih::init (void)
}
- // set the stream and the next state
this->ctx_->stream (tao_cg->implementation_header ());
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_is.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_is.cpp
index c6b1aeab137..82f3fe275c2 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root_is.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_is.cpp
@@ -1,3 +1,6 @@
+//
+// $Id$
+//
// ============================================================================
//
// = LIBRARY
@@ -14,14 +17,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_root.h"
-
-//ACE_RCSID(be_visitor_root, root_ss, "$Id$")
-
+ACE_RCSID (be_visitor_root,
+ root_is,
+ "$Id$")
// ******************************************************
// Root visitor for implementation skeletons
@@ -39,7 +37,7 @@ be_visitor_root_is::~be_visitor_root_is (void)
int
be_visitor_root_is::init (void)
{
- // first open the file for writing
+ // First open the file for writing.
if (tao_cg->start_implementation_skeleton (
be_global->be_get_implementation_skel_fname ()
)
@@ -47,10 +45,10 @@ be_visitor_root_is::init (void)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root_is::init - "
- "Error opening implementation skeletons file\n"), -1);
+ "Error opening implementation skeletons file\n"),
+ -1);
}
- // set stream
this->ctx_->stream (tao_cg->implementation_skeleton ());
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
index 3443aa6fac7..affeb35db6c 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_sh.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_root.h"
-
-ACE_RCSID(be_visitor_root, root_sh, "$Id$")
-
+ACE_RCSID (be_visitor_root,
+ root_sh,
+ "$Id$")
// ***********************************
// Root visitor for server header
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_si.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_si.cpp
index dedd3512e93..77cd9ceb807 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root_si.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_si.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_root.h"
-
-ACE_RCSID(be_visitor_root, root_si, "$Id$")
-
+ACE_RCSID (be_visitor_root,
+ root_si,
+ "$Id$")
// ***********************************************
// Root visitor for server inline
@@ -49,7 +44,8 @@ be_visitor_root_si::init (void)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root_si::init - "
- "server inline open failed\n"), -1);
+ "server inline open failed\n"),
+ -1);
}
if (be_global->gen_tie_classes ())
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ss.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ss.cpp
index c661b0ffea1..fcaf4307fac 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_ss.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_root.h"
-
-ACE_RCSID(be_visitor_root, root_ss, "$Id$")
-
+ACE_RCSID (be_visitor_root,
+ root_ss,
+ "$Id$")
// ******************************************************
// Root visitor for server skeletons
@@ -51,7 +46,8 @@ be_visitor_root_ss::init (void)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root_ss::init - "
- "Error opening server skeletons file\n"), -1);
+ "Error opening server skeletons file\n"),
+ -1);
}
if (be_global->gen_tie_classes ())
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_sth.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_sth.cpp
index a15e855d3c9..979e52c743b 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root_sth.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_sth.cpp
@@ -18,15 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_root.h"
-#include "be_visitor_interface.h"
-
-ACE_RCSID(be_visitor_root, root_sth, "$Id$")
-
+ACE_RCSID (be_visitor_root,
+ root_sth,
+ "$Id$")
// ****************************************
// Root visitor for server template header
@@ -168,7 +162,7 @@ be_visitor_root_sth::visit_module (be_module *node)
if (!node->is_nested ())
{
- *os << "#endif /* ACE_HAS_USING_KEYWORD */\n";
+ *os << "#endif /* ACE_HAS_USING_KEYWORD */\n\n";
}
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_scope.cpp b/TAO/TAO_IDL/be/be_visitor_scope.cpp
index e2cc13b8793..1b473fa8395 100644
--- a/TAO/TAO_IDL/be/be_visitor_scope.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_scope.cpp
@@ -19,13 +19,14 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_argument.h"
+#include "be_scope.h"
#include "be_visitor_scope.h"
+#include "be_visitor_context.h"
-ACE_RCSID(be, be_visitor_scope, "$Id$")
-
+ACE_RCSID (be,
+ be_visitor_scope,
+ "$Id$")
// ******************************************************
// Generic visitor for a scope.
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence.cpp b/TAO/TAO_IDL/be/be_visitor_sequence.cpp
index 8bb155d0cd5..c13e473c54a 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence.cpp
@@ -16,12 +16,30 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_array.h"
+#include "be_enum.h"
+#include "be_exception.h"
+#include "be_interface.h"
+#include "be_interface_fwd.h"
+#include "be_predefined_type.h"
+#include "be_sequence.h"
+#include "be_string.h"
+#include "be_structure.h"
+#include "be_structure_fwd.h"
+#include "be_union.h"
+#include "be_union_fwd.h"
+#include "be_type.h"
+#include "be_typedef.h"
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
+#include "be_helper.h"
+#include "be_extern.h"
+#include "utl_identifier.h"
+#include "nr_extern.h"
+
#include "be_visitor_sequence.h"
+#include "be_visitor_context.h"
-// 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/cdr_op_ch.cpp"
@@ -52,4 +70,6 @@
#include "be_visitor_sequence/gen_bounded_str_sequence_cs.cpp"
#include "be_visitor_sequence/gen_bounded_wstr_sequence_cs.cpp"
-ACE_RCSID(be, be_visitor_sequence, "$Id$")
+ACE_RCSID (be,
+ be_visitor_sequence,
+ "$Id$")
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
index 438370d76c5..20dfd17d723 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/any_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/any_op_ch.cpp
@@ -18,13 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, any_op_ch, "$Id$")
-
+ACE_RCSID (be_visitor_sequence,
+ any_op_ch,
+ "$Id$")
// ***************************************************************************
// Sequence visitor for generating Any operator declarations in the client header
@@ -52,7 +48,7 @@ be_visitor_sequence_any_op_ch::visit_sequence (be_sequence *node)
TAO_OutStream *os = this->ctx_->stream ();
- // generate the Any <<= and >>= operators
+ // Generate the Any <<= and >>= operators.
os->indent ();
*os << be_global->stub_export_macro ();
*os << " void"
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
index 4aa81ac77de..36a77410f5a 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp
@@ -18,13 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, any_op_cs, "$Id$")
-
+ACE_RCSID (be_visitor_sequence,
+ any_op_cs,
+ "$Id$")
// ***************************************************************************
// Sequence visitor for generating Any operator declarations in the client
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp
index ae3536245da..03c5ebe2613 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp
@@ -18,21 +18,17 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, buffer_type, "$Id$")
-
+ACE_RCSID (be_visitor_sequence,
+ buffer_type,
+ "$Id$")
// ****************************************************************
// 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_sequence_buffer_type::be_visitor_sequence_buffer_type (
+ be_visitor_context *ctx
+ )
: be_visitor_decl (ctx)
{
}
@@ -49,14 +45,23 @@ be_visitor_sequence_buffer_type::visit_node (be_type *node)
be_type *bt;
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (this->ctx_->state () == TAO_CodeGen::TAO_SEQUENCE_BUFFER_TYPE_CH)
- *os << bt->nested_type_name (this->ctx_->scope ());
+ {
+ *os << bt->nested_type_name (this->ctx_->scope ());
+ }
else
- *os << bt->name ();
+ {
+ *os << bt->name ();
+ }
+
return 0;
}
@@ -64,10 +69,18 @@ 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";
+ AST_PredefinedType::PredefinedType pt = node->pt ();
+
+ if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ *os << node->name () << "_ptr";
+ }
else
- *os << node->name ();
+ {
+ *os << node->name ();
+ }
+
return 0;
}
@@ -81,10 +94,16 @@ 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");
+ {
+ *os << node->nested_type_name (this->ctx_->scope (), "_ptr");
+ }
else
- *os << node->name () << "_ptr";
+ {
+ *os << node->name () << "_ptr";
+ }
+
return 0;
}
@@ -92,10 +111,16 @@ 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");
+ {
+ *os << node->nested_type_name (this->ctx_->scope (), "_ptr");
+ }
else
- *os << node->name () << "_ptr";
+ {
+ *os << node->name () << "_ptr";
+ }
+
return 0;
}
@@ -135,12 +160,24 @@ be_visitor_sequence_buffer_type::visit_structure (be_structure *node)
}
int
+be_visitor_sequence_buffer_type::visit_structure_fwd (be_structure_fwd *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_union_fwd (be_union_fwd *node)
+{
+ return this->visit_node (node);
+}
+
+int
be_visitor_sequence_buffer_type::visit_enum (be_enum *node)
{
return this->visit_node (node);
@@ -161,7 +198,8 @@ be_visitor_sequence_buffer_type::visit_array (be_array *node)
int
be_visitor_sequence_buffer_type::visit_typedef (be_typedef *node)
{
- this->ctx_->alias (node); // set the alias node
+ this->ctx_->alias (node);
+
if (node->primitive_base_type ()->accept (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -170,6 +208,7 @@ be_visitor_sequence_buffer_type::visit_typedef (be_typedef *node)
"accept on primitive type failed\n"),
-1);
}
+
this->ctx_->alias (0);
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp
index 32c29cc8b76..4c860142bf7 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp
@@ -19,20 +19,17 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, cdr_op_ch, "$Id$")
+ACE_RCSID (be_visitor_sequence,
+ cdr_op_ch,
+ "$Id$")
// ***************************************************************************
// Sequence visitor for generating CDR operator declarations in the client header
// ***************************************************************************
-be_visitor_sequence_cdr_op_ch::be_visitor_sequence_cdr_op_ch
-(be_visitor_context *ctx)
+be_visitor_sequence_cdr_op_ch::be_visitor_sequence_cdr_op_ch (
+ be_visitor_context *ctx
+ )
: be_visitor_decl (ctx)
{
}
@@ -44,15 +41,15 @@ be_visitor_sequence_cdr_op_ch::~be_visitor_sequence_cdr_op_ch (void)
int
be_visitor_sequence_cdr_op_ch::visit_sequence (be_sequence *node)
{
- if (node->cli_hdr_cdr_op_gen () ||
- node->imported () ||
- node->is_local ())
- return 0;
+ if (node->cli_hdr_cdr_op_gen ()
+ || node->imported ()
+ || node->is_local ())
+ {
+ return 0;
+ }
TAO_OutStream *os = this->ctx_->stream ();
- // generate the CDR << and >> operator declarations
-
be_type *bt = be_type::narrow_from_decl (node);
be_typedef *tdef = be_typedef::narrow_from_decl (bt);
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ci.cpp
index cff75285ad5..bc92dc2684a 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ci.cpp
@@ -19,22 +19,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, cdr_op_ci, "$Id$")
-
+ACE_RCSID (be_visitor_sequence,
+ cdr_op_ci,
+ "$Id$")
// ***************************************************************************
// Sequence visitor for generating CDR operator declarations in the client
// stubs file
// ***************************************************************************
-be_visitor_sequence_cdr_op_ci::be_visitor_sequence_cdr_op_ci
-(be_visitor_context *ctx)
+be_visitor_sequence_cdr_op_ci::be_visitor_sequence_cdr_op_ci (
+ be_visitor_context *ctx
+ )
: be_visitor_decl (ctx)
{
}
@@ -46,10 +42,12 @@ be_visitor_sequence_cdr_op_ci::~be_visitor_sequence_cdr_op_ci (void)
int
be_visitor_sequence_cdr_op_ci::visit_sequence (be_sequence *node)
{
- if (node->cli_inline_cdr_op_gen () ||
- node->imported () ||
- node->is_local ())
- return 0;
+ if (node->cli_inline_cdr_op_gen ()
+ || node->imported ()
+ || node->is_local ())
+ {
+ return 0;
+ }
TAO_OutStream *os = this->ctx_->stream ();
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp
index 22cb2f8d323..0b25d0c741c 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp
@@ -19,21 +19,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, cdr_op_cs, "$Id$")
+ACE_RCSID (be_visitor_sequence,
+ cdr_op_cs,
+ "$Id$")
// ***************************************************************************
// Sequence visitor for generating CDR operator declarations in the client
-// stubs file
+// stubs file.
// ***************************************************************************
-be_visitor_sequence_cdr_op_cs::be_visitor_sequence_cdr_op_cs
-(be_visitor_context *ctx)
+be_visitor_sequence_cdr_op_cs::be_visitor_sequence_cdr_op_cs (
+ be_visitor_context *ctx
+ )
: be_visitor_decl (ctx)
{
}
@@ -47,7 +44,7 @@ be_visitor_sequence_cdr_op_cs::visit_sequence (be_sequence *node)
{
if (this->ctx_->alias ())
{
- // we are here because the base type of the sequence node is
+ // We are here because the base type of the sequence node is
// itself a sequence i.e., this is a case of sequence of
// typedef'd sequence. For the case of sequence of
// anonymous sequence, see comment below.
@@ -55,15 +52,18 @@ be_visitor_sequence_cdr_op_cs::visit_sequence (be_sequence *node)
}
else
{
- if (node->cli_stub_cdr_op_gen () ||
- node->imported () ||
- node->is_local ())
- return 0;
+ if (node->cli_stub_cdr_op_gen ()
+ || node->imported ()
+ || node->is_local ())
+ {
+ return 0;
+ }
TAO_OutStream *os = this->ctx_->stream ();
be_type *bt =
be_type::narrow_from_decl (node->base_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -78,9 +78,13 @@ be_visitor_sequence_cdr_op_cs::visit_sequence (be_sequence *node)
if (bt->node_type () == AST_Decl::NT_sequence)
{
- if (this->gen_anonymous_base_type (bt,
- TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CS)
- == -1)
+ int status =
+ this->gen_anonymous_base_type (
+ bt,
+ TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CS
+ );
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_array_cdr_op_cs::"
@@ -90,21 +94,25 @@ be_visitor_sequence_cdr_op_cs::visit_sequence (be_sequence *node)
}
}
- // generate the CDR << and >> operator defns
+ // Generate the CDR << and >> operator defns.
- // save the sequence node for further use
+ // Save the sequence node for further use.
this->ctx_->node (node);
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// If we're an anonymous sequence, we must protect against
// being declared more than once.
if (!this->ctx_->tdef ())
{
- *os << "\n#if !defined _TAO_CDR_OP_"
+ *os << "#if !defined _TAO_CDR_OP_"
<< node->flat_name () << "_CPP_" << be_nl
- << "#define _TAO_CDR_OP_" << node->flat_name () << "_CPP_\n\n";
+ << "#define _TAO_CDR_OP_" << node->flat_name () << "_CPP_"
+ << be_nl << be_nl;
}
- // set the sub state as generating code for the output operator
+ // Set the sub state as generating code for the output operator.
this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_OUTPUT);
*os << "CORBA::Boolean operator<< (" << be_idt << be_idt_nl
<< "TAO_OutputCDR &strm," << be_nl
@@ -113,11 +121,13 @@ be_visitor_sequence_cdr_op_cs::visit_sequence (be_sequence *node)
<< ")" << be_uidt_nl
<< "{" << be_idt_nl;
- // first encode the sequence length
- *os << "if (strm << _tao_sequence.length ())" << be_nl
+ // First encode the sequence length.
+ *os << "CORBA::ULong _tao_seq_len = _tao_sequence.length ();"
+ << be_nl << be_nl;
+ *os << "if (strm << _tao_seq_len)" << be_idt_nl
<< "{" << be_idt_nl;
- // now encode the sequence elements
- *os << "// encode all elements" << be_nl;
+ // Now encode the sequence elements.
+ *os << "// Encode all elements." << be_nl;
if (bt->node_type () == AST_Decl::NT_sequence)
{
@@ -135,35 +145,28 @@ be_visitor_sequence_cdr_op_cs::visit_sequence (be_sequence *node)
}
}
- *os << "}" << be_nl
- << "return 0; // error" << be_uidt_nl
- << "}\n\n";
+ *os << "}" << be_uidt_nl << be_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
- // set the sub state as generating code for the input operator
+ // Set the sub state as generating code for the input operator.
os->indent ();
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_INPUT);
+
*os << "CORBA::Boolean operator>> (" << be_idt << be_idt_nl
<< "TAO_InputCDR &strm," << be_nl
<< node->name () << " &_tao_sequence" << be_uidt_nl
<< ")" << be_uidt_nl
<< "{" << be_idt_nl;
- // first retrieve the length and adjust the sequence length accordingly
- *os << "CORBA::ULong _tao_seq_len;" << be_nl;
- *os << "if (strm >> _tao_seq_len)" << be_nl
+ // First retrieve the length and adjust the sequence length accordingly.
+ *os << "CORBA::ULong _tao_seq_len;" << be_nl << be_nl;
+ *os << "if (strm >> _tao_seq_len)" << be_idt_nl
<< "{" << be_idt_nl;
-
- // Add a sanity check for the length of a sequence.
- *os << "// Add a check to the length of the sequence" << be_nl;
- *os << "// to make sure it does not exceed the length" << be_nl;
- *os << "// of the stream. (See bug 1159.)" << be_nl;
- *os << "if (_tao_seq_len > strm.length())" << be_idt_nl;
- *os << "return 0;" << be_uidt_nl;
-
- // now check if the length does not exceed the maximum. We do this only
+ // Now check if the length does not exceed the maximum. We do this only
// for bounded sequences
AST_Expression *expr = node->max_size ();
- // dimension value
- if ((expr == NULL) || ((expr != NULL) && (expr->ev () == NULL)))
+
+ if (expr == 0 || (expr != 0 && expr->ev () == 0))
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_cdr_op_cs::"
@@ -176,8 +179,8 @@ be_visitor_sequence_cdr_op_cs::visit_sequence (be_sequence *node)
{
if (expr->ev ()->u.ulval > 0)
{
- // we are dealing with a bounded sequence. Check if we are within
- // bounds
+ // We are dealing with a bounded sequence. Check if we are within
+ // bounds.
*os << "if (_tao_seq_len <= _tao_sequence.maximum ())" << be_nl
<< "{" << be_idt_nl;
}
@@ -191,17 +194,26 @@ be_visitor_sequence_cdr_op_cs::visit_sequence (be_sequence *node)
-1);
}
- *os << "// set the length of the sequence" << be_nl
- << "_tao_sequence.length (_tao_seq_len);" << be_nl;
+ *os << "// Set the length of the sequence." << be_nl
+ << "_tao_sequence.length (_tao_seq_len);" << be_nl << be_nl;
// Now we do a check for the sequence length to be non zero.
- // If length is 0 we return true.
+ // If length is 0 we return true.
*os << "// If length is 0 we return true." << be_nl;
- *os << "if (0 >= _tao_seq_len) " << be_idt_nl;
- *os << "return 1;" << be_uidt_nl;
-
+ *os << "if (0 >= _tao_seq_len) " << be_idt_nl
+ << "{" << be_idt_nl;
+ *os << "return 1;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+ // Add a sanity check for the length of a sequence.
+ *os << "// Add a check to the length of the sequence" << be_nl;
+ *os << "// to make sure it does not exceed the length" << be_nl;
+ *os << "// of the stream. (See bug 58.)" << be_nl;
+ *os << "if (_tao_seq_len > strm.length ())" << be_idt_nl
+ << "{" << be_idt_nl;
+ *os << "return 0;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
- *os << "// retrieve all the elements" << be_nl;
+ *os << "// Retrieve all the elements." << be_nl;
if (bt->node_type () == AST_Decl::NT_sequence)
@@ -222,12 +234,13 @@ be_visitor_sequence_cdr_op_cs::visit_sequence (be_sequence *node)
if (expr->ev ()->u.ulval > 0)
{
- // we are dealing with a bounded sequence.
- *os << "}" << be_uidt_nl;
+ // We are dealing with a bounded sequence.
+ *os << "}" << be_uidt << be_uidt_nl;
}
- *os << "}" << be_nl
- << "return 0; // error" << be_uidt_nl
- << "}\n\n";
+
+ *os << "}" << be_uidt_nl << be_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
if (!this->ctx_->tdef ())
{
@@ -238,11 +251,10 @@ be_visitor_sequence_cdr_op_cs::visit_sequence (be_sequence *node)
node->cli_stub_cdr_op_gen (1);
}
+
return 0;
}
-// handle all the base types
-
int
be_visitor_sequence_cdr_op_cs::visit_array (be_array *node)
{
@@ -280,35 +292,34 @@ be_visitor_sequence_cdr_op_cs::visit_valuetype_fwd (be_valuetype_fwd *node)
}
int
-be_visitor_sequence_cdr_op_cs::visit_predefined_type (be_predefined_type *node)
+be_visitor_sequence_cdr_op_cs::visit_predefined_type (
+ be_predefined_type *node
+ )
{
TAO_OutStream *os = this->ctx_->stream ();
switch (node->pt ())
{
+ case AST_PredefinedType::PT_object:
case AST_PredefinedType::PT_pseudo:
case AST_PredefinedType::PT_any:
- // let the helper handle this
return this->visit_node (node);
case AST_PredefinedType::PT_void:
- // error
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_cdr_op_cs::"
"visit_predefined_type - "
- "Bad primitive type\n"
- ), -1);
+ "Bad primitive type\n"),
+ -1);
default:
- // all other primitive types. Handle them as shown below
break;
};
- // we get here if the "type" of individual elements of the sequence is a
+ // We get here if the "type" of individual elements of the sequence is a
// primitive type. In this case, we treat the sequence as a single
// dimensional sequence (even of it was multi-dimensional), and pass
// the total length of the sequence as a cross product of the
- // dimensions
+ // dimensions.
- // grab the sequence node
be_sequence *sequence = this->ctx_->be_node_as_sequence ();
if (!sequence)
@@ -320,12 +331,13 @@ be_visitor_sequence_cdr_op_cs::visit_predefined_type (be_predefined_type *node)
-1);
}
- // handle octet sequences using the optimizations provided by the TAO ORB
- // Core. If these optimizations are not available, then use the normal form
+ // Handle octet sequences using the optimizations provided by the TAO ORB
+ // Core. If these optimizations are not available, then use the normal form.
if (node->pt () == AST_PredefinedType::PT_octet && sequence->unbounded ())
{
*os << "\n#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)" << be_nl;
+
switch (this->ctx_->sub_state ())
{
case TAO_CodeGen::TAO_CDR_INPUT:
@@ -376,12 +388,14 @@ be_visitor_sequence_cdr_op_cs::visit_predefined_type (be_predefined_type *node)
"bad sub state\n"),
-1);
}
+
*os << "\n#else /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */" << be_nl;
}
*os << "return strm.";
- // based on our substate, we may be reading from a stream or writing into a
- // stream
+
+ // Based on our substate, we may be reading from a stream or writing into a
+ // stream/
switch (this->ctx_->sub_state ())
{
case TAO_CodeGen::TAO_CDR_INPUT:
@@ -398,7 +412,7 @@ be_visitor_sequence_cdr_op_cs::visit_predefined_type (be_predefined_type *node)
-1);
}
- // determine what kind of sequence are we reading/writing
+ // Determine what kind of sequence are we reading/writing.
switch (node->pt ())
{
case AST_PredefinedType::PT_long:
@@ -449,7 +463,7 @@ be_visitor_sequence_cdr_op_cs::visit_predefined_type (be_predefined_type *node)
-1);
}
- // handle special case to avoid compiler errors
+ // Handle special case to avoid compiler errors.
switch (node->pt ())
{
case AST_PredefinedType::PT_char:
@@ -478,7 +492,10 @@ be_visitor_sequence_cdr_op_cs::visit_predefined_type (be_predefined_type *node)
*os << "_tao_sequence.length ());" << be_uidt_nl;
if (node->pt () == AST_PredefinedType::PT_octet && sequence->unbounded ())
- *os << "\n#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */" << be_nl;
+ {
+ *os << "\n#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */" << be_nl;
+ }
+
return 0;
}
@@ -503,35 +520,28 @@ be_visitor_sequence_cdr_op_cs::visit_union (be_union *node)
int
be_visitor_sequence_cdr_op_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
+ this->ctx_->alias (node);
be_type *bt = node->primitive_base_type ();
+
if (!bt || (bt->accept (this) == -1))
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_cdr_op_cs::"
"visit_typedef - "
- "Bad primitive type\n"
- ), -1);
+ "Bad primitive type\n"),
+ -1);
}
this->ctx_->alias (0);
return 0;
}
-// helper
int
be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt)
{
TAO_OutStream *os = this->ctx_->stream ();
be_sequence *node = this->ctx_->be_node_as_sequence ();
- be_visitor_context ctx (*this->ctx_);
- ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
-
if (!node)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -541,16 +551,20 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt)
-1);
}
- // initialize a boolean variable
- *os << "CORBA::Boolean _tao_marshal_flag = 1;" << be_nl;
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CS);
+ be_visitor_sequence_base visitor (&ctx);
- // we get here if the "type" of individual elements of the sequence is not a
- // primitive type. In this case, we are left with no other alternative but to
- // encode/decode element by element
+ // Initialize a boolean variable.
+ *os << "CORBA::Boolean _tao_marshal_flag = 1;" << be_nl << be_nl;
+
+ // We get here if the "type" of individual elements of the sequence is not a
+ // primitive type. In this case, we are left with no other alternative but
+ // to encode/decode element by element.
AST_Expression *expr = node->max_size ();
- // dimension value
- if ((expr == NULL) || ((expr != NULL) && (expr->ev () == NULL)))
+
+ if (expr == 0 || (expr != 0 && expr->ev () == 0))
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_cdr_op_cs::"
@@ -558,11 +572,12 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt)
"bad sequence dimension\n"),
-1);
}
+
if (expr->ev ()->et == AST_Expression::EV_ulong)
{
- *os << "for (CORBA::ULong i = 0; i < _tao_sequence.length ()"
+ *os << "for (CORBA::ULong i = 0; i < _tao_seq_len"
<< " && _tao_marshal_flag; "
- << "i++)" << be_nl
+ << "++i)" << be_idt_nl
<< "{" << be_idt_nl;
}
else
@@ -574,9 +589,9 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt)
-1);
}
- // if the type was a string, an obj ref, or a pseudo-obj, we are dealing with
- // a manager type and hence we must use the appropriate in () and out ()
- // methods.
+ // If the type was a string, an obj ref, or a pseudo-obj, we are dealing
+ // with a manager type and hence we must use the appropriate in() and
+ // out() methods.
//
switch (this->ctx_->sub_state ())
@@ -585,7 +600,7 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt)
switch (bt->node_type ())
{
case AST_Decl::NT_array:
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_cdr_op_cs::"
@@ -596,7 +611,7 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt)
*os << "_forany tmp (";
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_cdr_op_cs::"
@@ -608,7 +623,7 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt)
*os << "_alloc ());" << be_nl;
*os << "_tao_marshal_flag = (strm >> tmp);" << be_nl;
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_cdr_op_cs::"
@@ -619,7 +634,7 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt)
*os << "_copy (_tao_sequence[i], tmp.in ());" << be_nl;
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_cdr_op_cs::"
@@ -629,6 +644,7 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt)
}
*os << "_free (tmp.inout ());" << be_uidt_nl;
+
break;
case AST_Decl::NT_string:
case AST_Decl::NT_wstring:
@@ -643,9 +659,10 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt)
"bad string node\n"),
-1);
}
+
if (str->max_size ()->ev ()->u.ulval == 0)
{
- // unbounded
+ // Unbounded.
*os << "_tao_marshal_flag = (strm >> _tao_sequence[i].out ());"
<< be_uidt_nl;
}
@@ -661,19 +678,27 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt)
*os << "_tao_marshal_flag = (strm >> "
<< "CORBA::Any::to_wstring (_tao_sequence[i].out (), ";
}
- *os << str->max_size ()->ev ()->u.ulval << "));" << be_uidt_nl;
+
+ *os << str->max_size ()->ev ()->u.ulval << "));"
+ << be_uidt_nl;
}
}
break;
case AST_Decl::NT_interface:
case AST_Decl::NT_interface_fwd:
- *os << "_tao_marshal_flag = (strm >> _tao_sequence[i].out ());" << be_uidt_nl;
+ case AST_Decl::NT_valuetype:
+ case AST_Decl::NT_valuetype_fwd:
+ *os << "_tao_marshal_flag = (strm >> _tao_sequence[i].out ());"
+ << be_uidt_nl;
+
break;
case AST_Decl::NT_pre_defined:
{
- // we need to separately handle this case of pseudo objects because
- // they have a _var type
- be_predefined_type *pt = be_predefined_type::narrow_from_decl (bt);
+ // We need to separately handle this case of pseudo objects
+ // because they have a _var type.
+ be_predefined_type *pt =
+ be_predefined_type::narrow_from_decl (bt);
+
if (!pt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -683,28 +708,37 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt)
-1);
}
- if (pt->pt () == AST_PredefinedType::PT_pseudo)
+ AST_PredefinedType::PredefinedType pdt = pt->pt ();
+
+ if (pdt == AST_PredefinedType::PT_pseudo
+ || pdt == AST_PredefinedType::PT_object)
{
*os << "_tao_marshal_flag = (strm >> _tao_sequence[i].out ());"
<< be_uidt_nl;
}
else
{
- *os << "_tao_marshal_flag = (strm >> _tao_sequence[i]);" << be_uidt_nl;
+ *os << "_tao_marshal_flag = (strm >> _tao_sequence[i]);"
+ << be_uidt_nl;
}
}
+
break;
default:
- *os << "_tao_marshal_flag = (strm >> _tao_sequence[i]);" << be_uidt_nl;
+ *os << "_tao_marshal_flag = (strm >> _tao_sequence[i]);"
+ << be_uidt_nl;
+
break;
}
+
*os << "}";
+
break;
case TAO_CodeGen::TAO_CDR_OUTPUT:
switch (bt->node_type ())
{
case AST_Decl::NT_array:
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_cdr_op_cs::"
@@ -715,7 +749,7 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt)
*os << "_var tmp_var (" << be_idt << be_idt_nl;
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_cdr_op_cs::"
@@ -730,21 +764,27 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt)
// function signature, MSVC++ 5.0 needs the const cast,
// and many other compilers just won't do it.
*os << "#if defined (_MSC_VER) && (_MSC_VER <= 1100)";
+
os->indent ();
+
*os << be_idt << be_idt_nl;
*os << "ACE_const_cast (const " << this->ctx_->node ()->name ()
<< ", _tao_sequence)[i]\n";
*os << "#else";
+
os->indent ();
+
*os << be_nl;
*os << "_tao_sequence[i]\n";
*os << "#endif /* defined (_MSC_VER) && (_MSC_VER <= 1100) */";
+
os->indent ();
+
*os << be_uidt_nl;
*os << ")" << be_uidt << be_uidt_nl;
*os << ");" << be_uidt_nl;
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_cdr_op_cs::"
@@ -755,16 +795,22 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt)
*os << "_forany tmp (tmp_var.inout ());" << be_nl;
*os << "_tao_marshal_flag = (strm << tmp";
+
break;
case AST_Decl::NT_string:
case AST_Decl::NT_wstring:
case AST_Decl::NT_interface:
case AST_Decl::NT_interface_fwd:
+ case AST_Decl::NT_valuetype:
+ case AST_Decl::NT_valuetype_fwd:
*os << "_tao_marshal_flag = (strm << _tao_sequence[i].in ()";
+
break;
case AST_Decl::NT_pre_defined:
{
- be_predefined_type *pt = be_predefined_type::narrow_from_decl (bt);
+ be_predefined_type *pt =
+ be_predefined_type::narrow_from_decl (bt);
+
if (!pt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -774,7 +820,10 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt)
-1);
}
- if (pt->pt () == AST_PredefinedType::PT_pseudo)
+ AST_PredefinedType::PredefinedType pdt = pt->pt ();
+
+ if (pdt == AST_PredefinedType::PT_pseudo
+ || pdt == AST_PredefinedType::PT_object)
{
*os << "_tao_marshal_flag = (strm << _tao_sequence[i].in ()";
}
@@ -783,13 +832,17 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt)
*os << "_tao_marshal_flag = (strm << _tao_sequence[i]";
}
}
+
break;
default:
*os << "_tao_marshal_flag = (strm << _tao_sequence[i]";
+
break;
}
+
*os << ");" << be_uidt_nl
<< "}";
+
break;
default:
ACE_ERROR_RETURN ((LM_ERROR,
@@ -799,9 +852,8 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt)
-1);
}
- *os << be_nl;
+ *os << be_uidt_nl<< be_nl;
*os << "return _tao_marshal_flag;" << be_uidt_nl;
- delete visitor;
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp
index 1232a499956..6ef79bbb44e 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp
@@ -18,22 +18,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, elemtype, "$Id$")
-
+ACE_RCSID (be_visitor_sequence,
+ elemtype,
+ "$Id$")
// ***********************************************************
// sequence element type visitor for return types of [] methods
// ***********************************************************
-be_visitor_sequence_elemtype::
-be_visitor_sequence_elemtype (be_visitor_context *ctx)
+be_visitor_sequence_elemtype::be_visitor_sequence_elemtype (
+ be_visitor_context *ctx
+ )
: be_visitor_decl (ctx)
{
}
@@ -50,14 +46,23 @@ be_visitor_sequence_elemtype::visit_node (be_type *node)
be_type *bt;
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (this->ctx_->state () == TAO_CodeGen::TAO_SEQELEM_RETTYPE_CH)
- *os << bt->nested_type_name (this->ctx_->scope ()) << " &";
+ {
+ *os << bt->nested_type_name (this->ctx_->scope ()) << " &";
+ }
else
- *os << bt->name () << " &";
+ {
+ *os << bt->name () << " &";
+ }
+
return 0;
}
@@ -68,25 +73,36 @@ be_visitor_sequence_elemtype::visit_predefined_type (be_predefined_type *node)
be_type *bt;
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
switch (node->pt ())
{
case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
{
int is_pseudo_object =
ACE_OS::strcmp (node->local_name ()->get_string (),
"Object") != 0;
+
if (is_pseudo_object)
{
*os << "TAO_Pseudo_Object_Manager<";
}
+ else if (node->is_abstract ())
+ {
+ *os << "TAO_Abstract_Manager<";
+ }
else
{
*os << "TAO_Object_Manager<";
}
+
if (this->ctx_->state () == TAO_CodeGen::TAO_SEQELEM_RETTYPE_CH)
{
*os << bt->nested_type_name (this->ctx_->scope ()) << ",";
@@ -101,10 +117,15 @@ be_visitor_sequence_elemtype::visit_predefined_type (be_predefined_type *node)
break;
default:
if (this->ctx_->state () == TAO_CodeGen::TAO_SEQELEM_RETTYPE_CH)
- *os << bt->nested_type_name (this->ctx_->scope ()) << " &";
+ {
+ *os << bt->nested_type_name (this->ctx_->scope ()) << " &";
+ }
else
- *os << bt->name () << " &";
+ {
+ *os << bt->name () << " &";
+ }
}
+
return 0;
}
@@ -121,19 +142,39 @@ be_visitor_sequence_elemtype::visit_interface (be_interface *node)
be_type *bt;
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (this->ctx_->state () == TAO_CodeGen::TAO_SEQELEM_RETTYPE_CH)
{
- *os << "TAO_Object_Manager<";
+ if (node->is_abstract ())
+ {
+ *os << "TAO_Abstract_Manager<";
+ }
+ else
+ {
+ *os << "TAO_Object_Manager<";
+ }
+
*os << bt->nested_type_name (this->ctx_->scope ()) << ", ";
*os << bt->nested_type_name (this->ctx_->scope (), "_var") << ">";
}
else
{
- *os << "TAO_Object_Manager<";
+ if (node->is_abstract ())
+ {
+ *os << "TAO_Abstract_Manager<";
+ }
+ else
+ {
+ *os << "TAO_Object_Manager<";
+ }
+
*os << bt->name () << ", ";
*os << bt->name () << "_var>";
}
@@ -148,9 +189,13 @@ be_visitor_sequence_elemtype::visit_valuetype (be_valuetype *node)
be_type *bt;
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (this->ctx_->state () == TAO_CodeGen::TAO_SEQELEM_RETTYPE_CH)
{
@@ -175,9 +220,13 @@ be_visitor_sequence_elemtype::visit_interface_fwd (be_interface_fwd *node)
be_type *bt;
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (this->ctx_->state () == TAO_CodeGen::TAO_SEQELEM_RETTYPE_CH)
{
@@ -202,9 +251,13 @@ be_visitor_sequence_elemtype::visit_valuetype_fwd (be_valuetype_fwd *node)
be_type *bt;
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (this->ctx_->state () == TAO_CodeGen::TAO_SEQELEM_RETTYPE_CH)
{
@@ -246,12 +299,24 @@ be_visitor_sequence_elemtype::visit_structure (be_structure *node)
}
int
+be_visitor_sequence_elemtype::visit_structure_fwd (be_structure_fwd *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_union_fwd (be_union_fwd *node)
+{
+ return this->visit_node (node);
+}
+
+int
be_visitor_sequence_elemtype::visit_enum (be_enum *node)
{
return this->visit_node (node);
@@ -273,6 +338,7 @@ 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,
@@ -281,6 +347,7 @@ be_visitor_sequence_elemtype::visit_typedef (be_typedef *node)
"accept on primitive type failed\n"),
-1);
}
+
this->ctx_->alias (0);
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ch.cpp
index 460cb93d1bc..625703b4056 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ch.cpp
@@ -20,22 +20,15 @@
//
// ============================================================================
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, gen_bounded_obj_sequence_ch, "$Id$")
-
+ACE_RCSID (be_visitor_sequence,
+ gen_bounded_obj_sequence_ch,
+ "$Id$")
int
be_visitor_sequence_ch::gen_bounded_obj_sequence (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 ());
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
if (!bt)
{
@@ -63,7 +56,7 @@ be_visitor_sequence_ch::gen_bounded_obj_sequence (be_sequence *node)
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_sequence_base visitor (&ctx);
// !! Branching in either compile time template instantiation
// or manual template instantiation.
@@ -78,20 +71,20 @@ be_visitor_sequence_ch::gen_bounded_obj_sequence (be_sequence *node)
<< "// = Initialization and termination methods." << be_nl
<< be_nl;
- // default constructor
+ // Default constructor.
*os << class_name << " (void);" << be_nl;
- // constructor
+ // Constructor.
*os << class_name << " (" << be_idt << be_idt_nl
<< "CORBA::ULong length," << be_nl;
- bt->accept (visitor);
+ bt->accept (&visitor);
*os <<"* *value," << be_nl
<< "CORBA::Boolean release = 0" << be_uidt_nl
<< ");" << be_uidt_nl;
- // constructor
+ // Constructor.
*os << class_name << " (" << be_idt << be_idt_nl
<< "const " << class_name << " &rhs" << be_uidt_nl
<< ");" << be_uidt_nl;
@@ -101,41 +94,39 @@ be_visitor_sequence_ch::gen_bounded_obj_sequence (be_sequence *node)
<< "const " << class_name << " &rhs" << be_uidt_nl
<< ");" << be_uidt_nl;
- // destructor
+ // Destructor.
*os << "virtual ~" << class_name << " (void);" << be_nl << be_nl;
- // Accessors
+ // Accessors.
*os << "// = Accessors." << be_nl;
be_predefined_type *prim = be_predefined_type::narrow_from_decl (pt);
+ AST_Decl::NodeType nt = pt->node_type ();
+
int is_pseudo_object =
- pt->node_type () == AST_Decl::NT_pre_defined
- && prim && prim->pt () == AST_PredefinedType::PT_pseudo
- && ACE_OS::strcmp (prim->local_name ()->get_string (),
- "Object") != 0;
- int is_valuetype = 0;
+ nt == AST_Decl::NT_pre_defined
+ && prim
+ && prim->pt () == AST_PredefinedType::PT_object;
// operator[]
if (is_pseudo_object)
{
*os << "TAO_Pseudo_Object_Manager<";
}
- else
+ else if (nt == AST_Decl::NT_valuetype)
{
- be_interface *bf = be_interface::narrow_from_decl (pt);
- if (bf != 0)
- is_valuetype = bf->is_valuetype ();
- else
+ *os << "TAO_Valuetype_Manager<";
+ }
+ else if (nt == AST_Decl::NT_interface)
+ {
+ if (node->base_type ()->is_abstract ())
{
- be_interface_fwd *bff = be_interface_fwd::narrow_from_decl (pt);
- if (bff != 0)
- is_valuetype = bff->is_valuetype ();
+ *os << "TAO_Abstract_Manager<";
}
-
- if (is_valuetype)
- *os << "TAO_Valuetype_Manager<";
else
- *os << "TAO_Object_Manager<";
+ {
+ *os << "TAO_Object_Manager<";
+ }
}
*os << bt->name () << ","
@@ -148,14 +139,14 @@ be_visitor_sequence_ch::gen_bounded_obj_sequence (be_sequence *node)
// allocbuf
*os << "static ";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " **allocbuf (CORBA::ULong length);" << be_nl;
// freebuf
*os << "static void freebuf (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " **buffer);" << be_nl << be_nl;
@@ -169,13 +160,14 @@ be_visitor_sequence_ch::gen_bounded_obj_sequence (be_sequence *node)
*os << "virtual void _deallocate_buffer (void);" << be_nl;
// get_buffer
- bt->accept(visitor);
+ bt->accept (&visitor);
+
*os << "* *get_buffer (CORBA::Boolean orphan = 0);" << be_nl;
// get_buffer
*os << "const ";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "* *get_buffer (void) const;" << be_nl;
@@ -185,24 +177,23 @@ be_visitor_sequence_ch::gen_bounded_obj_sequence (be_sequence *node)
<< "CORBA::ULong ol" << be_uidt_nl
<< ");" << be_uidt_nl << be_nl;
- if (! (is_pseudo_object || is_valuetype))
+ if (! (is_pseudo_object || nt == AST_Decl::NT_valuetype))
{
// Pseudo objects do not require these methods.
*os << "virtual void _downcast (" << be_idt << be_idt_nl
- << "void* target," << be_nl
- << "CORBA_Object *src" << be_nl
- << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
- << ");" << be_uidt_nl;
-
+ << "void* target," << be_nl
+ << "CORBA_Object *src" << be_nl
+ << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
+ << ");" << be_uidt_nl;
*os << "virtual CORBA_Object* _upcast (void *src) const;";
}
+
*os << be_uidt_nl << "};" << be_nl;
os->gen_endif ();
- // generate #endif for AHETI
+ // Generate #endif for AHETI.
os->gen_endif_AHETI ();
- delete visitor;
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ci.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ci.cpp
index 23c63bc255d..662f31fea20 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ci.cpp
@@ -19,21 +19,15 @@
// Modifications by Aniruddha Gokhale
// ============================================================================
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, gen_bounded_obj_sequence_ci, "$Id$")
+ACE_RCSID (be_visitor_sequence,
+ gen_bounded_obj_sequence_ci,
+ "$Id$")
int
be_visitor_sequence_ci::gen_bounded_obj_sequence (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 ());
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
if (!bt)
{
@@ -45,7 +39,7 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
}
// Generate the class name.
- be_type *pt;
+ be_type *pt;
if (bt->node_type () == AST_Decl::NT_typedef)
{
@@ -105,14 +99,15 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CI);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_sequence_base visitor (&ctx);
+
+ *os << be_nl << "// TAO_IDL - Generated from "
+ << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
// Branching in either compile time template instantiation
// or manual template instatiation.
os->gen_ifdef_AHETI();
-
os->gen_ifdef_macro (class_name);
-
os->indent ();
// First generate the static methods since they are used by others. Since
@@ -120,7 +115,7 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
// some compilers give lots of warnings.
// allocbuf
- *os << "ACE_INLINE "; bt->accept (visitor);
+ *os << "ACE_INLINE "; bt->accept (&visitor);
*os << " **" << be_nl;
*os << full_class_name << "::allocbuf (CORBA::ULong /* length */) "
<< "// Allocate storage for a sequence.." << be_nl
@@ -129,7 +124,7 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
// The accept is here the first time used and if an
// error occurs, it will occur here. Later no check
// for errors will be done.
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ci::"
@@ -142,7 +137,7 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
<< be_nl
<< "ACE_NEW_RETURN (buf, ";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "*[" << node->max_size () << "], 0);" << be_nl
<< be_nl
@@ -151,26 +146,13 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
<< "{" << be_idt_nl
<< "buf[i] = ";
- int is_valuetype = 0;
- {
- be_interface *bf = be_interface::narrow_from_decl (pt);
- if (bf != 0)
- is_valuetype = bf->is_valuetype ();
- else
- {
- be_interface_fwd *bff = be_interface_fwd::narrow_from_decl (pt);
- if (bff != 0)
- is_valuetype = bff->is_valuetype ();
- }
- }
-
- if (is_valuetype)
+ if (pt->node_type () == AST_Decl::NT_valuetype)
{
*os << "0;";
}
else if (bt_is_defined)
{
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "::_nil ();";
}
@@ -188,7 +170,7 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
*os << "ACE_INLINE void" << be_nl
<< full_class_name << "::freebuf (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " **buffer)" << be_nl
<< "{" << be_idt_nl
@@ -197,7 +179,7 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
<< "{" << be_idt_nl
<< "if (buffer[i] != ";
- if (is_valuetype)
+ if (pt->node_type () == AST_Decl::NT_valuetype)
{
*os << "0)" << be_idt_nl
<< "{" << be_idt_nl
@@ -206,14 +188,14 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
}
else if (bt_is_defined)
{
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "::_nil ())" << be_idt_nl
<< "{" << be_idt_nl
<< "CORBA::release (buffer[i]);" << be_nl
<< "buffer[i] = ";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "::_nil ();" << be_uidt_nl;
}
@@ -247,7 +229,7 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
<< full_class_name << "::" << class_name
<< " (CORBA::ULong length," << be_idt_nl;
- bt->accept (visitor);
+ bt->accept (&visitor);
*os <<"* *value," << be_nl
<< "CORBA::Boolean release)" << be_uidt_nl
@@ -268,21 +250,21 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
<< "if (rhs.buffer_ != 0)" << be_nl
<< "{" << be_idt_nl;
- bt->accept(visitor);
+ bt->accept (&visitor);
*os <<" **tmp1 = allocbuf (" << node->max_size () << ");" << be_nl;
- bt->accept(visitor);
+ bt->accept(&visitor);
*os <<" ** const tmp2 = ACE_reinterpret_cast (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "** ACE_CAST_CONST, rhs.buffer_);" << be_nl
<< "for (CORBA::ULong i = 0; i < rhs.length_; i++)" << be_idt_nl
<< "{" << be_idt_nl;
- if (is_valuetype)
+ if (pt->node_type () == AST_Decl::NT_valuetype)
{
*os << "if (tmp2[i] != 0)" << be_idt_nl
<< "tmp2[i]->_add_ref ();" << be_uidt_nl
@@ -291,16 +273,17 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
else
{
*os << "tmp1[i] = ";
- if (bt_is_defined)
- {
- bt->accept (visitor);
- *os << "::_duplicate (tmp2[i]);";
- }
- else
- {
- *os << "tao_" << pt->flat_name () << "_duplicate (tmp2[i]);";
- }
+ if (bt_is_defined)
+ {
+ bt->accept (&visitor);
+
+ *os << "::_duplicate (tmp2[i]);";
+ }
+ else
+ {
+ *os << "tao_" << pt->flat_name () << "_duplicate (tmp2[i]);";
+ }
}
*os << be_uidt_nl
@@ -326,18 +309,18 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
<< "if (this->release_ && this->buffer_ != 0)" << be_nl
<< "{" << be_idt_nl;
- bt->accept (visitor);
+ bt->accept (&visitor);
*os <<" **tmp = ACE_reinterpret_cast (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " **, this->buffer_);" << be_nl
<< be_nl
<< "for (CORBA::ULong i = 0; i < this->length_; ++i)" << be_idt_nl
<< "{" << be_idt_nl;
- if (is_valuetype)
+ if (pt->node_type () == AST_Decl::NT_valuetype)
{
*os << "if (tmp[i] != 0)" << be_idt_nl
<< "tmp[i]->_remove_ref ();" << be_uidt_nl
@@ -348,7 +331,7 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
*os << "CORBA::release (tmp[i]);" << be_nl
<< "tmp[i] = ";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "::_nil ();";
}
@@ -369,25 +352,25 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
<< "TAO_Bounded_Base_Sequence::operator= (rhs);" << be_nl
<< be_nl;
- bt->accept(visitor);
+ bt->accept (&visitor);
*os <<" **tmp1 = ACE_reinterpret_cast (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " **, this->buffer_);" << be_nl;
- bt->accept(visitor);
+ bt->accept (&visitor);
*os <<" ** const tmp2 = ACE_reinterpret_cast (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " ** ACE_CAST_CONST, rhs.buffer_);" << be_nl
<< "for (CORBA::ULong i=0; i < rhs.length_; ++i)" << be_idt_nl
<< "{" << be_idt_nl;
- if (is_valuetype)
+ if (pt->node_type () == AST_Decl::NT_valuetype)
{
*os << "if (tmp2[i] != 0)" << be_idt_nl
<< "tmp2[i]->_add_ref ();" << be_uidt_nl
@@ -396,16 +379,17 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
else
{
*os << "tmp1[i] = ";
- if (bt_is_defined)
- {
- bt->accept (visitor);
- *os << "::_duplicate (tmp2[i]);";
- }
- else
- {
- *os << "tao_" << pt->flat_name () << "_duplicate (tmp2[i]);";
- }
+ if (bt_is_defined)
+ {
+ bt->accept (&visitor);
+
+ *os << "::_duplicate (tmp2[i]);";
+ }
+ else
+ {
+ *os << "tao_" << pt->flat_name () << "_duplicate (tmp2[i]);";
+ }
}
*os << be_uidt_nl
@@ -419,9 +403,9 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
int is_pseudo_object =
pt->node_type () == AST_Decl::NT_pre_defined
- && prim && prim->pt () == AST_PredefinedType::PT_pseudo
- && ACE_OS::strcmp (prim->local_name ()->get_string (),
- "Object") != 0;
+ && prim
+ && prim->pt () == AST_PredefinedType::PT_object;
+
// operator[].
if (is_pseudo_object)
{
@@ -429,10 +413,18 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
}
else
{
- if (is_valuetype)
- *os << "TAO_Valuetype_Manager<";
+ if (pt->node_type () == AST_Decl::NT_valuetype)
+ {
+ *os << "ACE_INLINE TAO_Valuetype_Manager<";
+ }
+ else if (node->base_type ()->is_abstract ())
+ {
+ *os << "ACE_INLINE TAO_Abstract_Manager<";
+ }
else
- *os << "ACE_INLINE TAO_Object_Manager<";
+ {
+ *os << "ACE_INLINE TAO_Object_Manager<";
+ }
}
*os << bt->name () << ","
@@ -442,11 +434,11 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
<< "{" << be_idt_nl
<< "ACE_ASSERT (index < this->maximum_);" << be_nl;
- bt->accept(visitor);
+ bt->accept (&visitor);
*os <<" **const tmp = ACE_reinterpret_cast (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " ** ACE_CAST_CONST, this->buffer_);" << be_nl;
@@ -456,10 +448,18 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
}
else
{
- if (is_valuetype)
- *os << "return TAO_Valuetype_Manager<";
+ if (pt->node_type () == AST_Decl::NT_valuetype)
+ {
+ *os << "return TAO_Valuetype_Manager<";
+ }
+ else if (node->base_type()->is_abstract ())
+ {
+ *os << "return TAO_Abstract_Manager<";
+ }
else
- *os << "return TAO_Object_Manager<";
+ {
+ *os << "return TAO_Object_Manager<";
+ }
}
*os << bt->name () << ","
@@ -471,14 +471,14 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
// get_buffer
*os << "ACE_INLINE ";
- bt->accept(visitor);
+ bt->accept (&visitor);
*os << " **" << be_nl;
*os << full_class_name << "::get_buffer (CORBA::Boolean orphan)"
<< be_nl
<< "{" << be_idt_nl;
- bt->accept(visitor);
+ bt->accept (&visitor);
*os << " **result = 0;" << be_nl
<< "if (orphan == 0)" << be_nl
@@ -495,7 +495,7 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
<< "{" << be_idt_nl
<< "result = ACE_reinterpret_cast (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "**, this->buffer_);" << be_uidt_nl
<< "}" << be_uidt_nl
@@ -509,7 +509,7 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
<< "result = ACE_reinterpret_cast(";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "**,this->buffer_);" << be_nl
<< "this->maximum_ = 0;" << be_nl
<< "this->length_ = 0;" << be_nl
@@ -524,14 +524,14 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
// get_buffer.
*os << "ACE_INLINE const ";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "* *" << be_nl
<< full_class_name << "::get_buffer (void) const" << be_nl
<< "{" << be_idt_nl
<< "return ACE_reinterpret_cast(const ";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " ** ACE_CAST_CONST, this->buffer_);" << be_uidt_nl
<< "}" << be_nl
@@ -542,6 +542,5 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
// Generate #endif for AHETI.
os->gen_endif_AHETI();
- delete visitor;
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_cs.cpp
index f144dd55c62..14e7c6a4703 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_cs.cpp
@@ -19,21 +19,15 @@
// Modifications by Aniruddha Gokhale
// ============================================================================
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, gen_bounded_obj_sequence_cs, "$Id$")
+ACE_RCSID (be_visitor_sequence,
+ gen_bounded_obj_sequence_cs,
+ "$Id$")
int
be_visitor_sequence_cs::gen_bounded_obj_sequence (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 ());
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
if (!bt)
{
@@ -80,19 +74,6 @@ be_visitor_sequence_cs::gen_bounded_obj_sequence (be_sequence *node)
bt_is_defined = ibt->is_defined ();
}
- int is_valuetype = 0;
- {
- be_interface *bf = be_interface::narrow_from_decl (pt);
- if (bf != 0)
- is_valuetype = bf->is_valuetype ();
- else
- {
- be_interface_fwd *bff = be_interface_fwd::narrow_from_decl (pt);
- if (bff != 0)
- is_valuetype = bff->is_valuetype ();
- }
- }
-
const char * class_name = node->instance_name ();
static char full_class_name [NAMEBUFSIZE];
@@ -118,14 +99,15 @@ be_visitor_sequence_cs::gen_bounded_obj_sequence (be_sequence *node)
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_sequence_base visitor (&ctx);
+
+ *os << be_nl << "// TAO_IDL - Generated from "
+ << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
// Branching in either compile time template instantiation
// or manual template instatiation.
os->gen_ifdef_AHETI();
-
os->gen_ifdef_macro (class_name);
-
os->indent ();
// First generate the static methods since they are used by others. Since
@@ -154,11 +136,11 @@ be_visitor_sequence_cs::gen_bounded_obj_sequence (be_sequence *node)
<< "if (this->buffer_ == 0 || this->release_ == 0)" << be_idt_nl
<< "return;" << be_uidt_nl;
- bt->accept (visitor);
+ bt->accept (&visitor);
*os <<" **tmp = ACE_reinterpret_cast (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " **, this->buffer_);" << be_nl
<< class_name << "::freebuf (tmp);" << be_nl
@@ -181,21 +163,20 @@ be_visitor_sequence_cs::gen_bounded_obj_sequence (be_sequence *node)
<< be_nl
<< "{" << be_idt_nl;
- bt->accept (visitor);
+ bt->accept (&visitor);
*os <<" **tmp = ACE_reinterpret_cast (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " **, this->buffer_);" << be_nl
<< be_nl
<< "for (CORBA::ULong i = nl; i < ol; ++i)" << be_nl
<< "{" << be_idt_nl;
- if (is_valuetype)
+ if (pt->node_type () == AST_Decl::NT_valuetype)
{
- *os << "if (tmp[i] != 0)" << be_idt_nl
- << "tmp[i]->_remove_ref ();" << be_uidt_nl
+ *os << "tao_" << pt->flat_name () << "_remove_ref (tmp[i]);" << be_nl
<< "tmp[i] = 0;";
}
else if (bt_is_defined)
@@ -203,7 +184,7 @@ be_visitor_sequence_cs::gen_bounded_obj_sequence (be_sequence *node)
*os << "CORBA::release (tmp[i]);" << be_nl
<< "tmp[i] = ";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "::_nil ();";
}
@@ -220,10 +201,9 @@ be_visitor_sequence_cs::gen_bounded_obj_sequence (be_sequence *node)
be_predefined_type *prim = be_predefined_type::narrow_from_decl (pt);
- if ((pt->node_type () != AST_Decl::NT_pre_defined)
+ if (pt->node_type () != AST_Decl::NT_pre_defined
|| (prim
- && (prim->pt () == AST_PredefinedType::PT_pseudo)
- && (!ACE_OS::strcmp (prim->local_name ()->get_string (), "Object"))))
+ && prim->pt () == AST_PredefinedType::PT_object))
{
// Pseudo objects do not require these methods.
*os << "void" << be_nl
@@ -234,18 +214,18 @@ be_visitor_sequence_cs::gen_bounded_obj_sequence (be_sequence *node)
<< ")" << be_uidt_nl
<< "{" << be_idt_nl;
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " **tmp = ACE_static_cast (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "**, target);" << be_nl
<< "*tmp = ";
if (bt_is_defined)
{
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "::_narrow (src ACE_ENV_ARG_PARAMETER);";
}
@@ -257,30 +237,30 @@ be_visitor_sequence_cs::gen_bounded_obj_sequence (be_sequence *node)
*os << be_nl
<< "ACE_CHECK;" << be_uidt_nl
- << "}\n" << be_nl;
+ << "}\n" << be_nl;
*os << "CORBA_Object*" << be_nl
<< full_class_name << "::_upcast (void *src) const" << be_nl
- << "{" << be_idt_nl;
+ << "{" << be_idt_nl;
if (bt_is_defined)
{
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " **tmp = ACE_static_cast (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "**, src);" << be_nl
<< "return *tmp;";
}
else
{
- *os << "return tao_" << pt->flat_name () << "_upcast (src);";
+ *os << "return tao_" << pt->flat_name () << "_upcast (src);";
}
*os << be_uidt_nl
- << "}" << be_nl;
+ << "}" << be_nl;
}
os->gen_endif ();
@@ -288,6 +268,5 @@ be_visitor_sequence_cs::gen_bounded_obj_sequence (be_sequence *node)
// Generate #endif for AHETI.
os->gen_endif_AHETI();
- delete visitor;
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_sequence_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_sequence_ch.cpp
index ee01027a5ff..8a4c1dd9f63 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_sequence_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_sequence_ch.cpp
@@ -18,24 +18,16 @@
//
// ============================================================================
-//#include "idl.h"
-//#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, gen_bounded_sequence_ch, "$Id$")
-
+ACE_RCSID (be_visitor_sequence,
+ gen_bounded_sequence_ch,
+ "$Id$")
int
be_visitor_sequence_ch::gen_bounded_sequence (be_sequence *node)
{
TAO_OutStream *os = this->ctx_->stream ();
- be_type *bt;
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
- // retrieve the base type since we may need to do some code
- // generation for the base type.
- bt = be_type::narrow_from_decl (node->base_type ());
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -48,9 +40,11 @@ be_visitor_sequence_ch::gen_bounded_sequence (be_sequence *node)
// generate code for that sequence here.
if (bt->node_type () == AST_Decl::NT_sequence)
{
- if (this->gen_anonymous_base_type (bt,
- TAO_CodeGen::TAO_SEQUENCE_CH)
- == -1)
+ int status =
+ this->gen_anonymous_base_type (bt,
+ TAO_CodeGen::TAO_SEQUENCE_CH);
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ch::"
@@ -62,15 +56,16 @@ be_visitor_sequence_ch::gen_bounded_sequence (be_sequence *node)
const char * class_name = node->instance_name ();
-
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_sequence_base visitor (&ctx);
+
+ *os << be_nl << "// TAO_IDL - Generated from "
+ << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
// !! branching in either compile time template instantiation
// or manual template instatiation
os->gen_ifdef_AHETI();
-
os->gen_ifdef_macro (class_name);
*os << "class TAO_EXPORT_MACRO " << class_name << be_idt_nl
@@ -86,7 +81,7 @@ be_visitor_sequence_ch::gen_bounded_sequence (be_sequence *node)
*os << class_name << " (" << be_idt << be_idt_nl
<< "CORBA::ULong length," << be_nl;
- bt->accept (visitor);
+ bt->accept (&visitor);
*os <<" *data," << be_nl
<< "CORBA::Boolean release = 0" << be_uidt_nl
@@ -109,32 +104,35 @@ be_visitor_sequence_ch::gen_bounded_sequence (be_sequence *node)
// operator[]
*os << "// = Accessors." << be_nl;
- bt->accept(visitor);
+ bt->accept (&visitor);
*os <<" &operator[] (CORBA::ULong i);" << be_nl;
// operator[]
*os << "const ";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << " &operator[] (CORBA::ULong i) const;" << be_nl << be_nl;
// Static Operations
*os << "// = Static operations." << be_nl
<< "static ";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " *allocbuf (CORBA::ULong);" << be_nl;
// free_buf
*os << "static void freebuf (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " *buffer);" << be_nl << be_nl;
// Implement the TAO_Base_Sequence methods (see Sequence.h)
- *os << "// Implement the TAO_Base_Sequence methods (see Sequence.h)" << be_nl;
+ *os << "// Implement the TAO_Base_Sequence methods (see Sequence.h)"
+ << be_nl;
// allocate_buffer
*os << "virtual void _allocate_buffer (CORBA::ULong length);" << be_nl;
@@ -143,13 +141,13 @@ be_visitor_sequence_ch::gen_bounded_sequence (be_sequence *node)
*os << "virtual void _deallocate_buffer (void);" << be_nl;
// get_buffer
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " *get_buffer (CORBA::Boolean orphan = 0);" << be_nl;
// get_buffer
*os << "const ";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " *get_buffer (void) const;" << be_nl;
@@ -158,7 +156,7 @@ be_visitor_sequence_ch::gen_bounded_sequence (be_sequence *node)
<< "CORBA::ULong max," << be_nl
<< "CORBA::ULong length," << be_nl;
- bt->accept (visitor);
+ bt->accept (&visitor);
*os <<" *data," << be_nl
<< "CORBA::Boolean release = 0" << be_uidt_nl
@@ -171,6 +169,5 @@ be_visitor_sequence_ch::gen_bounded_sequence (be_sequence *node)
// generate #endif for AHETI
os->gen_endif_AHETI();
- delete visitor;
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_sequence_ci.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_sequence_ci.cpp
index 0a239629207..12c65e6b954 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_sequence_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_sequence_ci.cpp
@@ -18,11 +18,9 @@
//
// ============================================================================
-#include "be.h"
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, gen_bounded_sequence_ci, "$Id$")
-
+ACE_RCSID (be_visitor_sequence,
+ gen_bounded_sequence_ci,
+ "$Id$")
int
be_visitor_sequence_ci::gen_bounded_sequence (be_sequence *node)
@@ -33,12 +31,14 @@ be_visitor_sequence_ci::gen_bounded_sequence (be_sequence *node)
// 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_ci::"
"visit_sequence - "
- "Bad element type\n"), -1);
+ "Bad element type\n"),
+ -1);
}
// If we contain an anonymous sequence,
@@ -98,14 +98,15 @@ be_visitor_sequence_ci::gen_bounded_sequence (be_sequence *node)
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CI);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_sequence_base visitor (&ctx);
+
+ *os << be_nl << "// TAO_IDL - Generated from "
+ << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
// !! Branching in either compile time template instantiation
// or manual template instatiation
os->gen_ifdef_AHETI();
-
os->gen_ifdef_macro (class_name);
-
os->indent ();
// First generate the static methods since they are used by others. Since
@@ -120,7 +121,7 @@ be_visitor_sequence_ci::gen_bounded_sequence (be_sequence *node)
// The accept is used the first time here, and if an
// error occurs, it will occur here. Later, no check
// for errors will be done.
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence::"
@@ -133,10 +134,14 @@ be_visitor_sequence_ci::gen_bounded_sequence (be_sequence *node)
<< full_class_name << "::allocbuf (CORBA::ULong) "
<< "// Allocate storage for the sequence." << be_nl
<< "{" << be_idt_nl;
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << " *retval = 0;" << be_nl
<< "ACE_NEW_RETURN (retval, ";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << "[" << node->max_size () << "], 0);" << be_nl
<< "return retval;" << be_uidt_nl
<< "}" << be_nl
@@ -145,7 +150,9 @@ be_visitor_sequence_ci::gen_bounded_sequence (be_sequence *node)
// free_buf.
*os << "ACE_INLINE void " << be_nl
<< full_class_name << "::freebuf (";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << " *buffer) // Free the sequence." << be_nl
<< "{" << be_idt_nl
<< "delete [] buffer;" << be_uidt_nl
@@ -164,12 +171,16 @@ be_visitor_sequence_ci::gen_bounded_sequence (be_sequence *node)
// Constructor.
*os << "ACE_INLINE" << be_nl;
- *os << full_class_name << "::" << class_name << " (CORBA::ULong length," << be_idt_nl;
- bt->accept (visitor);
+ *os << full_class_name << "::" << class_name
+ << " (CORBA::ULong length," << be_idt_nl;
+
+ bt->accept (&visitor);
+
*os <<" *data," << be_nl
<< "CORBA::Boolean release)" << be_uidt_nl
<< "// Constructor using the data and memory management flag." << be_nl
- << " : TAO_Bounded_Base_Sequence (" << node->max_size () << ", length, data, release)" << be_nl
+ << " : TAO_Bounded_Base_Sequence (" << node->max_size ()
+ << ", length, data, release)" << be_nl
<< "{" << be_nl
<< "}" << be_nl
<< be_nl;
@@ -183,20 +194,26 @@ be_visitor_sequence_ci::gen_bounded_sequence (be_sequence *node)
<< "{" << be_idt_nl
<< "if (rhs.buffer_ != 0)" << be_nl
<< "{" << be_idt_nl;
- bt->accept(visitor);
+
+ bt->accept (&visitor);
+
*os <<" *tmp1 = " << class_name << "::allocbuf (" << node->max_size ()
<< ");" << be_nl
<< be_nl;
- bt->accept(visitor);
+
+ bt->accept (&visitor);
+
*os <<" * const tmp2 = ACE_reinterpret_cast (";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << " * ACE_CAST_CONST, rhs.buffer_);" << be_nl
<< be_nl
<< "for (CORBA::ULong i = 0; i < this->length_; ++i)" << be_idt_nl;
if (pt->node_type () == AST_Decl::NT_array)
{
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "_var::copy (tmp1[i], tmp2[i]);" << be_uidt_nl;
}
else
@@ -216,7 +233,8 @@ be_visitor_sequence_ci::gen_bounded_sequence (be_sequence *node)
// operator=.
*os << "ACE_INLINE " << full_class_name << " &" << be_nl
- << full_class_name << "::operator= (const " << class_name << " &rhs)" << be_nl
+ << full_class_name << "::operator= (const "
+ << class_name << " &rhs)" << be_nl
<< "// Assignment operator. " << be_nl
<< "{" << be_idt_nl
<< "if (this == &rhs)" << be_idt_nl
@@ -226,24 +244,33 @@ be_visitor_sequence_ci::gen_bounded_sequence (be_sequence *node)
<< "{" << be_nl
<< "}" << be_nl
<< "else" << be_idt_nl
- << "this->buffer_ = " << class_name << "::allocbuf (rhs.maximum_);" << be_uidt_nl
+ << "this->buffer_ = " << class_name
+ << "::allocbuf (rhs.maximum_);" << be_uidt_nl
<< be_nl
<<"TAO_Bounded_Base_Sequence::operator= (rhs);" << be_nl
<< be_nl;
- bt->accept(visitor);
+
+ bt->accept (&visitor);
+
*os <<"* tmp1 = ACE_reinterpret_cast (";
- bt->accept(visitor);
+
+ bt->accept (&visitor);
+
*os << " *, this->buffer_);" << be_nl;
- bt->accept(visitor);
+
+ bt->accept (&visitor);
+
*os <<"* const tmp2 = ACE_reinterpret_cast (";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << " * ACE_CAST_CONST, rhs.buffer_);" << be_nl
<< be_nl
<< "for (CORBA::ULong i = 0; i < this->length_; ++i)" << be_idt_nl;
if (pt->node_type () == AST_Decl::NT_array)
{
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "_var::copy (tmp1[i], tmp2[i]);" << be_uidt_nl;
}
else
@@ -259,28 +286,40 @@ be_visitor_sequence_ci::gen_bounded_sequence (be_sequence *node)
// Accessors.
*os << "// = Accessors." << be_nl;
*os << "ACE_INLINE ";
- bt->accept(visitor);
+
+ bt->accept (&visitor);
+
*os << " &" << be_nl;
- *os << full_class_name << "::operator[] (CORBA::ULong i)// operator []" << be_nl
+ *os << full_class_name << "::operator[] (CORBA::ULong i)" << be_nl
<< "{" << be_idt_nl
<< "ACE_ASSERT (i < this->maximum_);" << be_nl;
- bt->accept(visitor);
+
+ bt->accept (&visitor);
+
*os <<" *tmp = ACE_reinterpret_cast (";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << "*,this->buffer_);" << be_nl
<< "return tmp[i];" << be_uidt_nl
<< "}" << be_nl;
-
*os << "ACE_INLINE const ";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << " &" << be_nl
- << full_class_name << "::operator[] (CORBA::ULong i) const// operator []" << be_nl
+ << full_class_name << "::operator[] (CORBA::ULong i) const"
+ << be_nl
<< "{" << be_idt_nl
<< "ACE_ASSERT (i < this->maximum_);" << be_nl
<< "const ";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << "* tmp = ACE_reinterpret_cast (const ";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << "* ACE_CAST_CONST,this->buffer_);" << be_nl
<< "return tmp[i];" << be_uidt_nl
<< "}" << be_nl
@@ -288,11 +327,15 @@ be_visitor_sequence_ci::gen_bounded_sequence (be_sequence *node)
// get_buffer.
*os << "ACE_INLINE ";
- bt->accept(visitor);
+
+ bt->accept (&visitor);
+
*os << " *" << be_nl
<< full_class_name << "::get_buffer (CORBA::Boolean orphan)" << be_nl
<< "{" << be_idt_nl;
- bt->accept(visitor);
+
+ bt->accept (&visitor);
+
*os << " *result = 0;" << be_nl
<< "if (orphan == 0)" << be_nl
<< "{" << be_idt_nl
@@ -306,7 +349,9 @@ be_visitor_sequence_ci::gen_bounded_sequence (be_sequence *node)
<< "else" << be_nl
<< "{" << be_idt_nl
<< "result = ACE_reinterpret_cast (";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << "*, this->buffer_);" << be_uidt_nl
<< "}" << be_uidt_nl
<< "}" << be_nl
@@ -317,7 +362,9 @@ be_visitor_sequence_ci::gen_bounded_sequence (be_sequence *node)
<< "// We set the state back to default and relinquish" << be_nl
<< "// ownership." << be_nl
<< "result = ACE_reinterpret_cast(";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << "*,this->buffer_);" << be_nl
<< "this->maximum_ = 0;" << be_nl
<< "this->length_ = 0;" << be_nl
@@ -331,12 +378,16 @@ be_visitor_sequence_ci::gen_bounded_sequence (be_sequence *node)
// get_buffer.
*os << "ACE_INLINE const ";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << " *" << be_nl
<< full_class_name << "::get_buffer (void) const" << be_nl
<< "{" << be_idt_nl
<< "return ACE_reinterpret_cast(const ";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << " * ACE_CAST_CONST, this->buffer_);" << be_uidt_nl
<< "}" << be_nl
<< be_nl;
@@ -345,7 +396,9 @@ be_visitor_sequence_ci::gen_bounded_sequence (be_sequence *node)
*os << "ACE_INLINE void " << be_nl
<< full_class_name << "::replace (CORBA::ULong max," << be_idt_nl
<< "CORBA::ULong length," << be_nl;
- bt->accept(visitor);
+
+ bt->accept (&visitor);
+
*os <<" *data," << be_nl
<< "CORBA::Boolean release)" << be_uidt_nl
<< "{" << be_idt_nl
@@ -353,9 +406,13 @@ be_visitor_sequence_ci::gen_bounded_sequence (be_sequence *node)
<< "this->length_ = length;" << be_nl
<< "if (this->buffer_ && this->release_ == 1)" << be_nl
<< "{" << be_idt_nl;
- bt->accept(visitor);
+
+ bt->accept (&visitor);
+
*os <<"* tmp = ACE_reinterpret_cast(";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << "* ACE_CAST_CONST, this->buffer_);" << be_nl
<< class_name << "::freebuf (tmp);" << be_uidt_nl
<< "}" << be_nl
@@ -368,6 +425,5 @@ be_visitor_sequence_ci::gen_bounded_sequence (be_sequence *node)
// Generate #endif for AHETI.
os->gen_endif_AHETI();
- delete visitor;
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_sequence_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_sequence_cs.cpp
index 8bb053c1a9e..bff0ecd7d6a 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_sequence_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_sequence_cs.cpp
@@ -18,21 +18,16 @@
//
// ============================================================================
-#include "be.h"
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, gen_bounded_sequence_cs, "$Id$")
-
+ACE_RCSID (be_visitor_sequence,
+ gen_bounded_sequence_cs,
+ "$Id$")
int
be_visitor_sequence_cs::gen_bounded_sequence (be_sequence *node)
{
TAO_OutStream *os = this->ctx_->stream ();
- be_type *bt;
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
- // retrieve the base type since we may need to do some code
- // generation for the base type.
- bt = be_type::narrow_from_decl (node->base_type ());
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -45,9 +40,11 @@ be_visitor_sequence_cs::gen_bounded_sequence (be_sequence *node)
// generate code for that sequence here.
if (bt->node_type () == AST_Decl::NT_sequence)
{
- if (this->gen_anonymous_base_type (bt,
- TAO_CodeGen::TAO_SEQUENCE_CS)
- == -1)
+ int status =
+ this->gen_anonymous_base_type (bt,
+ TAO_CodeGen::TAO_SEQUENCE_CS);
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_cs::"
@@ -57,55 +54,48 @@ be_visitor_sequence_cs::gen_bounded_sequence (be_sequence *node)
}
}
-// May not need variable 'pt' at all
-#if 0
- // generate the class name
- be_type *pt; // base types
-
- if (bt->node_type () == AST_Decl::NT_typedef)
- {
- // get the primitive base type of this typedef node
- be_typedef *t = be_typedef::narrow_from_decl (bt);
- pt = t->primitive_base_type ();
- }
- else
- pt = bt;
-#endif /* 0 */
-
const char * class_name = node->instance_name ();
-
static char full_class_name [NAMEBUFSIZE];
- ACE_OS::memset (full_class_name, '\0', NAMEBUFSIZE);
+
+ ACE_OS::memset (full_class_name,
+ '\0',
+ NAMEBUFSIZE);
+
+ be_decl *tmp =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
if (node->is_nested ())
{
- ACE_OS::sprintf (full_class_name, "%s::%s",
- be_scope::narrow_from_scope (node->defined_in ())->decl ()->full_name (),
+ ACE_OS::sprintf (full_class_name,
+ "%s::%s",
+ tmp->full_name (),
class_name);
}
else
{
- ACE_OS::sprintf (full_class_name, "%s",
+ ACE_OS::sprintf (full_class_name,
+ "%s",
class_name);
}
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_sequence_base visitor (&ctx);
- // !! branching in either compile time template instantiation
- // or manual template instatiation
- os->gen_ifdef_AHETI();
+ *os << be_nl << "// TAO_IDL - Generated from "
+ << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ os->gen_ifdef_AHETI();
os->gen_ifdef_macro (class_name);
-
os->indent ();
// allocate_buffer
*os << "void " << be_nl
- << full_class_name << "::_allocate_buffer (CORBA::ULong /* length */)" << be_nl
- << "// allocate a buffer of the requested length. The buffer is allocated for the" << be_nl
+ << full_class_name << "::_allocate_buffer (CORBA::ULong /* length */)"
+ << be_nl
+ << "// allocate a buffer of the requested length. "
+ << "The buffer is allocated for the" << be_nl
<< "// right type" << be_nl
<< "{" << be_idt_nl
<< "this->buffer_ = " << class_name << "::allocbuf ("
@@ -120,9 +110,13 @@ be_visitor_sequence_cs::gen_bounded_sequence (be_sequence *node)
<< "{" << be_idt_nl
<< "if (this->buffer_ == 0 || this->release_ == 0)" << be_idt_nl
<< "return;" << be_uidt_nl;
- bt->accept(visitor);
+
+ bt->accept (&visitor);
+
*os <<" *tmp = ACE_reinterpret_cast (";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << " *, this->buffer_);" << be_nl
<< class_name << "::freebuf (tmp);" << be_nl
<< "this->buffer_ = 0;" << be_uidt_nl
@@ -130,7 +124,8 @@ be_visitor_sequence_cs::gen_bounded_sequence (be_sequence *node)
<< be_nl;
// destructor
- *os << full_class_name << "::~" << class_name << " (void) // Dtor." << be_nl
+ *os << full_class_name << "::~" << class_name
+ << " (void) // Dtor." << be_nl
<< "{" << be_idt_nl
<< "this->_deallocate_buffer ();" << be_uidt_nl
<< "}" << be_nl
@@ -141,6 +136,5 @@ be_visitor_sequence_cs::gen_bounded_sequence (be_sequence *node)
// generate #endif for AHETI
os->gen_endif_AHETI();
- delete visitor;
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_str_sequence_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_str_sequence_ch.cpp
index 89fc707468b..77aa4f0f9a7 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_str_sequence_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_str_sequence_ch.cpp
@@ -19,69 +19,21 @@
// Modifications by Aniruddha Gokhale
// ============================================================================
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, gen_bounded_str_sequence_ch, "$Id$")
-
+ACE_RCSID (be_visitor_sequence,
+ gen_bounded_str_sequence_ch,
+ "$Id$")
int
be_visitor_sequence_ch::gen_bounded_str_sequence (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 class name.
- be_type *pt;
-
- if (bt->node_type () == AST_Decl::NT_typedef)
- {
- // Get the primitive base type of this typedef node.
- be_typedef *t = be_typedef::narrow_from_decl (bt);
- pt = t->primitive_base_type ();
- }
- else
- {
- pt = bt;
- }
-
- const char * class_name = node->instance_name ();
-
- // get the visitor for the type of the sequence
- be_visitor_context ctx (*this->ctx_);
- ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
-
- // !! branching in either compile time template instantiation
- // or manual template instatiation
- os->gen_ifdef_AHETI();
+ const char *class_name = node->instance_name ();
- os->gen_ifdef_macro (class_name);
+ *os << be_nl << "// TAO_IDL - Generated from "
+ << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
- // The accept is used here the first time and if an
- // error occurs, it will occur here. Later no check
- // for errors will be done.
- if (pt->accept (visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_sequence_ch::"
- "visit_sequence - "
- "base type visit failed\n"),
- -1);
- }
+ os->gen_ifdef_AHETI();
+ os->gen_ifdef_macro (class_name);
*os << "class TAO_EXPORT_MACRO " << class_name << be_idt_nl
<< ": public TAO_Bounded_Base_Sequence" << be_uidt_nl
@@ -156,7 +108,5 @@ be_visitor_sequence_ch::gen_bounded_str_sequence (be_sequence *node)
// generate #endif for AHETI
os->gen_endif_AHETI();
-
- delete visitor;
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_str_sequence_ci.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_str_sequence_ci.cpp
index 4837f699946..1d812a7a7ed 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_str_sequence_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_str_sequence_ci.cpp
@@ -20,59 +20,43 @@
//
// ============================================================================
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, gen_bounded_str_sequence_ci, "$Id$")
-
+ACE_RCSID (be_visitor_sequence,
+ gen_bounded_str_sequence_ci,
+ "$Id$")
int
be_visitor_sequence_ci::gen_bounded_str_sequence (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_ci::"
- "visit_sequence - "
- "Bad element type\n"), -1);
- }
-
const char * class_name = node->instance_name ();
static char full_class_name [NAMEBUFSIZE];
- ACE_OS::memset (full_class_name, '\0', NAMEBUFSIZE);
+ ACE_OS::memset (full_class_name,
+ '\0',
+ NAMEBUFSIZE);
if (node->is_nested ())
{
- ACE_OS::sprintf (full_class_name, "%s::%s",
- be_scope::narrow_from_scope (node->defined_in ())->decl ()->full_name (),
+ be_decl *tmp =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
+
+ ACE_OS::sprintf (full_class_name,
+ "%s::%s",
+ tmp->full_name (),
class_name);
}
else
{
- ACE_OS::sprintf (full_class_name, "%s",
+ ACE_OS::sprintf (full_class_name,
+ "%s",
class_name);
}
+ *os << be_nl << "// TAO_IDL - Generated from "
+ << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
- // get the visitor for the type of the sequence
- be_visitor_context ctx (*this->ctx_);
- ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CI);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
-
- // !! branching in either compile time template instantiation
- // or manual template instatiation
os->gen_ifdef_AHETI();
-
os->gen_ifdef_macro (class_name);
-
os->indent ();
// first generate the static methods since they are used by others. Since
@@ -241,7 +225,5 @@ be_visitor_sequence_ci::gen_bounded_str_sequence (be_sequence *node)
// generate #endif for AHETI
os->gen_endif_AHETI();
-
- delete visitor;
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_str_sequence_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_str_sequence_cs.cpp
index dee7d1881bd..f9c52236c97 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_str_sequence_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_str_sequence_cs.cpp
@@ -20,59 +20,43 @@
//
// ============================================================================
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, gen_bounded_str_sequence_cs, "$Id$")
-
+ACE_RCSID (be_visitor_sequence,
+ gen_bounded_str_sequence_cs,
+ "$Id$")
int
be_visitor_sequence_cs::gen_bounded_str_sequence (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::"
- "visit_sequence - "
- "Bad element type\n"), -1);
- }
-
const char * class_name = node->instance_name ();
static char full_class_name [NAMEBUFSIZE];
- ACE_OS::memset (full_class_name, '\0', NAMEBUFSIZE);
+ ACE_OS::memset (full_class_name,
+ '\0',
+ NAMEBUFSIZE);
if (node->is_nested ())
{
- ACE_OS::sprintf (full_class_name, "%s::%s",
- be_scope::narrow_from_scope (node->defined_in ())->decl ()->full_name (),
+ be_decl *tmp =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
+
+ ACE_OS::sprintf (full_class_name,
+ "%s::%s",
+ tmp->full_name (),
class_name);
}
else
{
- ACE_OS::sprintf (full_class_name, "%s",
+ ACE_OS::sprintf (full_class_name,
+ "%s",
class_name);
}
+ *os << be_nl << "// TAO_IDL - Generated from "
+ << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
- // get the visitor for the type of the sequence
- be_visitor_context ctx (*this->ctx_);
- ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
-
- // !! branching in either compile time template instantiation
- // or manual template instatiation
os->gen_ifdef_AHETI();
-
os->gen_ifdef_macro (class_name);
-
os->indent ();
// allocate_buffer
@@ -126,7 +110,5 @@ be_visitor_sequence_cs::gen_bounded_str_sequence (be_sequence *node)
// generate #endif for AHETI
os->gen_endif_AHETI();
-
- delete visitor;
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_wstr_sequence_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_wstr_sequence_ch.cpp
index 75654b7c89c..5765060d42b 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_wstr_sequence_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_wstr_sequence_ch.cpp
@@ -18,69 +18,22 @@
//
// ============================================================================
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
+ACE_RCSID (be_visitor_sequence,
+ gen_bounded_wstr_sequence_ch,
+ "$Id$")
int
be_visitor_sequence_ch::gen_bounded_wstr_sequence (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 class name.
- be_type *pt;
-
- if (bt->node_type () == AST_Decl::NT_typedef)
- {
- // Get the primitive base type of this typedef node.
- be_typedef *t = be_typedef::narrow_from_decl (bt);
- pt = t->primitive_base_type ();
- }
- else
- {
- pt = bt;
- }
-
const char * class_name = node->instance_name ();
+ *os << be_nl << "// TAO_IDL - Generated from "
+ << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
- // get the visitor for the type of the sequence
- be_visitor_context ctx (*this->ctx_);
- ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
-
- // !! branching in either compile time template instantiation
- // or manual template instatiation
os->gen_ifdef_AHETI();
-
os->gen_ifdef_macro (class_name);
-
os->indent ();
- // the accept is here the first time used and if an
- // error occurs, it will occur here. Later no check
- // for errors will be done.
- if (pt->accept (visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_sequence_ch::"
- "visit_sequence - "
- "base type visit failed\n"),
- -1);
- }
*os << "class TAO_EXPORT_MACRO " << class_name << be_idt_nl
<< ": public TAO_Bounded_Base_Sequence" << be_uidt_nl
@@ -155,7 +108,5 @@ be_visitor_sequence_ch::gen_bounded_wstr_sequence (be_sequence *node)
// generate #endif for AHETI
os->gen_endif_AHETI();
-
- delete visitor;
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_wstr_sequence_ci.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_wstr_sequence_ci.cpp
index 164e72ff3c3..a53dc89ec60 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_wstr_sequence_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_wstr_sequence_ci.cpp
@@ -18,60 +18,46 @@
//
// ============================================================================
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
+ACE_RCSID (be_visitor_sequence,
+ gen_bounded_wstr_sequence_ci,
+ "$Id$")
int
be_visitor_sequence_ci::gen_bounded_wstr_sequence (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_ci::"
- "visit_sequence - "
- "Bad element type\n"), -1);
- }
-
const char * class_name = node->instance_name ();
static char full_class_name [NAMEBUFSIZE];
- ACE_OS::memset (full_class_name, '\0', NAMEBUFSIZE);
+ ACE_OS::memset (full_class_name,
+ '\0',
+ NAMEBUFSIZE);
if (node->is_nested ())
{
- ACE_OS::sprintf (full_class_name, "%s::%s",
- be_scope::narrow_from_scope (node->defined_in ())->decl ()->full_name (),
+ be_decl *tmp =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
+
+ ACE_OS::sprintf (full_class_name,
+ "%s::%s",
+ tmp->full_name (),
class_name);
}
else
{
- ACE_OS::sprintf (full_class_name, "%s",
+ ACE_OS::sprintf (full_class_name,
+ "%s",
class_name);
}
+ *os << be_nl << "// TAO_IDL - Generated from "
+ << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
- // get the visitor for the type of the sequence
- be_visitor_context ctx (*this->ctx_);
- ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CI);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
-
- // !! branching in either compile time template instantiation
- // or manual template instatiation
os->gen_ifdef_AHETI();
-
os->gen_ifdef_macro (class_name);
-
os->indent ();
- // first generate the static methods since they are used by others. Since
+ // First generate the static methods since they are used by others. Since
// they are inlined, their definition needs to come before their use else
// some compilers (e.g., g++) produce lots of warnings.
@@ -251,7 +237,5 @@ be_visitor_sequence_ci::gen_bounded_wstr_sequence (be_sequence *node)
// generate #endif for AHETI
os->gen_endif_AHETI();
-
- delete visitor;
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_wstr_sequence_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_wstr_sequence_cs.cpp
index d6c0170bdb2..ea70ec143bc 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_wstr_sequence_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_wstr_sequence_cs.cpp
@@ -18,28 +18,14 @@
//
// ============================================================================
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
+ACE_RCSID (be_visitor_sequence,
+ gen_bounded_wstr_sequence_cs,
+ "$Id$")
int
be_visitor_sequence_cs::gen_bounded_wstr_sequence (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::"
- "visit_sequence - "
- "Bad element type\n"), -1);
- }
-
const char * class_name = node->instance_name ();
static char full_class_name [NAMEBUFSIZE];
@@ -47,28 +33,26 @@ be_visitor_sequence_cs::gen_bounded_wstr_sequence (be_sequence *node)
if (node->is_nested ())
{
- ACE_OS::sprintf (full_class_name, "%s::%s",
- be_scope::narrow_from_scope (node->defined_in ())->decl ()->full_name (),
+ be_decl *tmp =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
+
+ ACE_OS::sprintf (full_class_name,
+ "%s::%s",
+ tmp->full_name (),
class_name);
}
else
{
- ACE_OS::sprintf (full_class_name, "%s",
+ ACE_OS::sprintf (full_class_name,
+ "%s",
class_name);
}
+ *os << be_nl << "// TAO_IDL - Generated from "
+ << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
- // get the visitor for the type of the sequence
- be_visitor_context ctx (*this->ctx_);
- ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
-
- // !! branching in either compile time template instantiation
- // or manual template instatiation
os->gen_ifdef_AHETI();
-
os->gen_ifdef_macro (class_name);
-
os->indent ();
// allocate_buffer
@@ -123,7 +107,5 @@ be_visitor_sequence_cs::gen_bounded_wstr_sequence (be_sequence *node)
// generate #endif for AHETI
os->gen_endif_AHETI();
-
- delete visitor;
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ch.cpp
index d7b421b58d7..a1018f6013c 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ch.cpp
@@ -20,23 +20,15 @@
//
// ============================================================================
-
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, gen_unbounded_obj_sequence_ch, "$Id$")
-
+ACE_RCSID (be_visitor_sequence,
+ gen_unbounded_obj_sequence_ch,
+ "$Id$")
int
be_visitor_sequence_ch::gen_unbounded_obj_sequence (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 ());
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
if (!bt)
{
@@ -46,8 +38,7 @@ be_visitor_sequence_ch::gen_unbounded_obj_sequence (be_sequence *node)
"Bad element type\n"), -1);
}
- // Generate the class name.
- be_type *pt;
+ be_type *pt;
if (bt->node_type () == AST_Decl::NT_typedef)
{
@@ -60,16 +51,17 @@ be_visitor_sequence_ch::gen_unbounded_obj_sequence (be_sequence *node)
pt = bt;
}
- const char * class_name = node->instance_name ();
+ // Generate the class name.
+ const char *class_name = node->instance_name ();
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_sequence_base visitor (&ctx);
- // !! Branching in either compile time template instantiation
- // or manual template instatiation.
- os->gen_ifdef_AHETI();
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
+ os->gen_ifdef_AHETI();
os->gen_ifdef_macro (class_name);
*os << "class TAO_EXPORT_MACRO " << class_name << be_idt_nl
@@ -89,7 +81,7 @@ be_visitor_sequence_ch::gen_unbounded_obj_sequence (be_sequence *node)
<< "CORBA::ULong maximum," << be_nl
<< "CORBA::ULong length," << be_nl;
- bt->accept (visitor);
+ bt->accept (&visitor);
*os <<"* *value," << be_nl
<< "CORBA::Boolean release = 0" << be_uidt_nl
@@ -111,34 +103,30 @@ be_visitor_sequence_ch::gen_unbounded_obj_sequence (be_sequence *node)
// Accessors
*os << "// = Accessors." << be_nl;
+ AST_Decl::NodeType nt = pt->node_type ();
+
// operator[]
be_predefined_type *prim = be_predefined_type::narrow_from_decl (pt);
+
int is_pseudo_object =
- pt->node_type () == AST_Decl::NT_pre_defined
- && prim && prim->pt () == AST_PredefinedType::PT_pseudo
- && ACE_OS::strcmp (prim->local_name ()->get_string (),
- "Object") != 0;
- int is_valuetype = 0;
+ nt == AST_Decl::NT_pre_defined
+ && prim
+ && prim->pt () == AST_PredefinedType::PT_object;
if (is_pseudo_object)
{
*os << "TAO_Pseudo_Object_Manager<";
}
+ else if (nt == AST_Decl::NT_valuetype)
+ {
+ *os << "TAO_Valuetype_Manager<";
+ }
+ else if (node->base_type ()->is_abstract ())
+ {
+ *os << "TAO_Abstract_Manager<";
+ }
else
{
- be_interface *bf = be_interface::narrow_from_decl (pt);
- if (bf != 0)
- is_valuetype = bf->is_valuetype ();
- else
- {
- be_interface_fwd *bff = be_interface_fwd::narrow_from_decl (pt);
- if (bff != 0)
- is_valuetype = bff->is_valuetype ();
- }
-
- if (is_valuetype)
- *os << "TAO_Valuetype_Manager<";
- else
*os << "TAO_Object_Manager<";
}
@@ -152,14 +140,14 @@ be_visitor_sequence_ch::gen_unbounded_obj_sequence (be_sequence *node)
// allocbuf
*os << "static ";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " **allocbuf (CORBA::ULong nelems);" << be_nl;
// freebuf
*os << "static void freebuf (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " **buffer);" << be_nl << be_nl;
@@ -173,14 +161,14 @@ be_visitor_sequence_ch::gen_unbounded_obj_sequence (be_sequence *node)
*os << "virtual void _deallocate_buffer (void);" << be_nl;
// get_buffer
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "* *get_buffer (CORBA::Boolean orphan = 0);" << be_nl;
// get_buffer
*os << "const ";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "* *get_buffer (void) const;" << be_nl;
@@ -188,27 +176,27 @@ be_visitor_sequence_ch::gen_unbounded_obj_sequence (be_sequence *node)
*os << "virtual void _shrink_buffer (" << be_idt << be_idt_nl
<< "CORBA::ULong nl," << be_nl
<< "CORBA::ULong ol" << be_uidt_nl
- << ");" << be_uidt_nl << be_nl;
+ << ");";
- if (! (is_pseudo_object || is_valuetype))
+ if (! (is_pseudo_object || nt == AST_Decl::NT_valuetype))
{
// Pseudo objects do not require these methods.
- *os << "virtual void _downcast (" << be_idt << be_idt_nl
- << "void* target," << be_nl
- << "CORBA_Object *src" << be_nl
- << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
- << ");" << be_uidt_nl;
+ *os << be_uidt_nl << be_nl
+ << "virtual void _downcast (" << be_idt << be_idt_nl
+ << "void* target," << be_nl
+ << "CORBA_Object *src" << be_nl
+ << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
+ << ");" << be_uidt_nl;
*os << "virtual CORBA_Object* _upcast (void *src) const;";
}
- *os << be_uidt_nl << "};" << be_nl;
+ *os << be_uidt << be_uidt_nl << "};" << be_nl;
os->gen_endif (); // endif macro
// generate #endif for AHETI
os->gen_endif_AHETI();
- delete visitor;
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ci.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ci.cpp
index ca6c891e885..79fe87eda25 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ci.cpp
@@ -19,11 +19,9 @@
// Modifications by Aniruddha Gokhale
// ============================================================================
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, gen_unbounded_obj_sequence_ci, "$Id$")
+ACE_RCSID (be_visitor_sequence,
+ gen_unbounded_obj_sequence_ci,
+ "$Id$")
int
be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
@@ -104,14 +102,13 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CI);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_sequence_base visitor (&ctx);
- // !Branching in either compile time template instantiation
- // or manual template instatiation.
- os->gen_ifdef_AHETI();
+ *os << be_nl << "// TAO_IDL - Generated from "
+ << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ os->gen_ifdef_AHETI();
os->gen_ifdef_macro (class_name);
-
os->indent ();
// allocbuf.
@@ -120,7 +117,7 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
// The accept is here the first time used and if an
// error occurs, it will occur here. Later no check
// for errors will be done.
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ci::"
@@ -133,13 +130,13 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
<< full_class_name << "::allocbuf (CORBA::ULong nelems)" << be_nl
<< "{" << be_idt_nl;
- bt->accept (visitor);
+ bt->accept (&visitor);
*os <<" **buf = 0;" << be_nl
<< be_nl
<< "ACE_NEW_RETURN (buf, "
;
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "*[nelems], 0);" << be_nl
<< be_nl
@@ -147,26 +144,13 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
<< "{" << be_idt_nl
<< "buf[i] = ";
- int is_valuetype = 0;
- {
- be_interface *bf = be_interface::narrow_from_decl (pt);
- if (bf != 0)
- is_valuetype = bf->is_valuetype ();
- else
- {
- be_interface_fwd *bff = be_interface_fwd::narrow_from_decl (pt);
- if (bff != 0)
- is_valuetype = bff->is_valuetype ();
- }
- }
-
- if (is_valuetype)
+ if (pt->node_type () == AST_Decl::NT_valuetype)
{
*os << "0;";
}
else if (bt_is_defined)
{
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "::_nil ();";
}
@@ -184,7 +168,7 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
*os << "ACE_INLINE void " << be_nl
<< full_class_name << "::freebuf (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " **buffer)" << be_nl
<< "{" << be_idt_nl
@@ -217,7 +201,7 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
<< " (CORBA::ULong maximum," << be_idt_nl
<< "CORBA::ULong length," << be_nl;
- bt->accept (visitor);
+ bt->accept (&visitor);
*os <<"* *value," << be_nl
<< "CORBA::Boolean release)" << be_uidt_nl
@@ -236,23 +220,23 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
<< "if (rhs.buffer_ != 0)" << be_nl
<< "{" << be_idt_nl;
- bt->accept(visitor);
+ bt->accept (&visitor);
*os <<" **tmp1 = " << class_name << "::allocbuf (this->maximum_);"
<< be_nl;
- bt->accept (visitor);
+ bt->accept (&visitor);
*os <<" ** const tmp2 = ACE_reinterpret_cast (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " ** ACE_CAST_CONST, rhs.buffer_);" << be_nl
<< be_nl
<< "for (CORBA::ULong i = 0; i < rhs.length_; ++i)" << be_idt_nl
<< "{" << be_idt_nl;
- if (is_valuetype)
+ if (pt->node_type () == AST_Decl::NT_valuetype)
{
*os << "if (tmp2[i] != 0)" << be_idt_nl
<< "tmp2[i]->_add_ref ();" << be_uidt_nl
@@ -261,16 +245,17 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
else
{
*os << "tmp1[i] = ";
- if (bt_is_defined)
- {
- bt->accept (visitor);
- *os << "::_duplicate (tmp2[i]);";
- }
- else
- {
- *os << "tao_" << pt->flat_name () << "_duplicate (tmp2[i]);";
- }
+ if (bt_is_defined)
+ {
+ bt->accept (&visitor);
+
+ *os << "::_duplicate (tmp2[i]);";
+ }
+ else
+ {
+ *os << "tao_" << pt->flat_name () << "_duplicate (tmp2[i]);";
+ }
}
*os << be_uidt_nl
@@ -295,18 +280,18 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
<< "if (this->release_)" << be_nl
<< "{" << be_idt_nl;
- bt->accept (visitor);
+ bt->accept (&visitor);
*os <<" **tmp = ACE_reinterpret_cast (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " **, this->buffer_);" << be_nl
<< be_nl
<< "for (CORBA::ULong i = 0; i < this->length_; ++i)" << be_nl
<< "{" << be_idt_nl;
- if (is_valuetype)
+ if (pt->node_type () == AST_Decl::NT_valuetype)
{
*os << "if (tmp[i] != 0)" << be_idt_nl
<< "tmp[i]->_remove_ref ();" << be_uidt_nl
@@ -317,7 +302,7 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
*os << "CORBA::release (tmp[i]);" << be_nl
<< "tmp[i] = ";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "::_nil ();";
}
@@ -344,26 +329,26 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
<< "TAO_Unbounded_Base_Sequence::operator= (rhs);" << be_nl
<< be_nl;
- bt->accept (visitor);
+ bt->accept (&visitor);
*os <<" **tmp1 = ACE_reinterpret_cast (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " **, this->buffer_);" << be_nl;
- bt->accept (visitor);
+ bt->accept (&visitor);
*os <<" ** const tmp2 = ACE_reinterpret_cast (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " ** ACE_CAST_CONST, rhs.buffer_);" << be_nl
<< be_nl
<< "for (CORBA::ULong i = 0; i < rhs.length_; ++i)" << be_idt_nl
<< "{" << be_idt_nl;
- if (is_valuetype)
+ if (pt->node_type () == AST_Decl::NT_valuetype)
{
*os << "if (tmp2[i] != 0)" << be_idt_nl
<< "tmp2[i]->_add_ref ();" << be_uidt_nl
@@ -372,17 +357,19 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
else
{
*os << "tmp1[i] = ";
- if (bt_is_defined)
- {
- bt->accept (visitor);
- *os << "::_duplicate (tmp2[i]);";
- }
- else
- {
- *os << "tao_" << pt->flat_name () << "_duplicate (tmp2[i]);";
- }
+ if (bt_is_defined)
+ {
+ bt->accept (&visitor);
+
+ *os << "::_duplicate (tmp2[i]);";
+ }
+ else
+ {
+ *os << "tao_" << pt->flat_name () << "_duplicate (tmp2[i]);";
+ }
}
+
*os << be_uidt_nl
<< "}" << be_uidt_nl << be_nl
<< "return *this;" << be_uidt_nl
@@ -391,21 +378,30 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
// Operator[].
be_predefined_type *prim = be_predefined_type::narrow_from_decl (pt);
+
int is_pseudo_object =
pt->node_type () == AST_Decl::NT_pre_defined
- && prim && prim->pt () == AST_PredefinedType::PT_pseudo
- && ACE_OS::strcmp (prim->local_name ()->get_string (),
- "Object") != 0;
+ && prim
+ && prim->pt () == AST_PredefinedType::PT_object;
+
if (is_pseudo_object)
{
*os << "ACE_INLINE TAO_Pseudo_Object_Manager<";
}
else
{
- if (is_valuetype)
- *os << "ACE_INLINE TAO_Valuetype_Manager<";
+ if (pt->node_type () == AST_Decl::NT_valuetype)
+ {
+ *os << "ACE_INLINE TAO_Valuetype_Manager<";
+ }
+ else if (node->base_type ()->is_abstract ())
+ {
+ *os << "ACE_INLINE TAO_Abstract_Manager<";
+ }
else
- *os << "ACE_INLINE TAO_Object_Manager<";
+ {
+ *os << "ACE_INLINE TAO_Object_Manager<";
+ }
}
*os << bt->name () << ","
@@ -416,11 +412,11 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
<< "{" << be_idt_nl
<< "ACE_ASSERT (index < this->maximum_);" << be_nl;
- bt->accept(visitor);
+ bt->accept (&visitor);
*os <<" ** const tmp = ACE_reinterpret_cast (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " ** ACE_CAST_CONST, this->buffer_);" << be_nl;
@@ -430,10 +426,18 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
}
else
{
- if (is_valuetype)
- *os << "return TAO_Valuetype_Manager<";
+ if (pt->node_type () == AST_Decl::NT_valuetype)
+ {
+ *os << "return TAO_Valuetype_Manager<";
+ }
+ else if (node->base_type ()->is_abstract ())
+ {
+ *os << "return TAO_Abstract_Manager<";
+ }
else
- *os << "return TAO_Object_Manager<";
+ {
+ *os << "return TAO_Object_Manager<";
+ }
}
*os << bt->name () << ","
@@ -445,13 +449,13 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
// get_buffer
*os << "ACE_INLINE ";
- bt->accept(visitor);
+ bt->accept (&visitor);
*os << "* *" << be_nl
<< full_class_name << "::get_buffer (CORBA::Boolean orphan)" << be_nl
<< "{" << be_idt_nl;
- bt->accept(visitor);
+ bt->accept (&visitor);
*os << " **result = 0;" << be_nl
<< "if (orphan == 0)" << be_nl
@@ -468,7 +472,7 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
<< "{" << be_idt_nl
<< "result = ACE_reinterpret_cast (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "**, this->buffer_);" << be_uidt_nl
<< "}" << be_uidt_nl
@@ -481,7 +485,7 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
<< "// ownership." << be_nl
<< "result = ACE_reinterpret_cast(";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "**,this->buffer_);" << be_nl
<< "this->maximum_ = 0;" << be_nl
@@ -498,14 +502,14 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
*os << "ACE_INLINE ";
*os << "const ";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "* *" << be_nl
<< full_class_name << "::get_buffer (void) const" << be_nl
<< "{" << be_idt_nl
<< "return ACE_reinterpret_cast(const ";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " ** ACE_CAST_CONST, this->buffer_);" << be_uidt_nl
<< "}" << be_nl
@@ -516,6 +520,5 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
// Generate #endif for AHETI.
os->gen_endif_AHETI();
- delete visitor;
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_cs.cpp
index b9e9880dbdd..f0c57e1a88a 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_cs.cpp
@@ -19,21 +19,15 @@
// Modifications by Aniruddha Gokhale
// ============================================================================
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, gen_unbounded_obj_sequence_cs, "$Id$")
+ACE_RCSID (be_visitor_sequence,
+ gen_unbounded_obj_sequence_cs,
+ "$Id$")
int
be_visitor_sequence_cs::gen_unbounded_obj_sequence (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 ());
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
if (!bt)
{
@@ -57,8 +51,7 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node)
pt = bt;
}
- const char *name =
- be_decl::narrow_from_decl (pt)->full_name ();
+ const char *name = be_decl::narrow_from_decl (pt)->full_name ();
idl_bool bt_is_defined;
@@ -79,19 +72,6 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node)
bt_is_defined = ibt->is_defined ();
}
- int is_valuetype = 0;
- {
- be_interface *bf = be_interface::narrow_from_decl (pt);
- if (bf != 0)
- is_valuetype = bf->is_valuetype ();
- else
- {
- be_interface_fwd *bff = be_interface_fwd::narrow_from_decl (pt);
- if (bff != 0)
- is_valuetype = bff->is_valuetype ();
- }
- }
-
const char * class_name = node->instance_name ();
static char full_class_name [NAMEBUFSIZE];
@@ -117,14 +97,13 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node)
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_sequence_base visitor (&ctx);
- // Branching in either compile time template instantiation
- // or manual template instatiation.
- os->gen_ifdef_AHETI();
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
+ os->gen_ifdef_AHETI();
os->gen_ifdef_macro (class_name);
-
os->indent ();
// allocate_buffer.
@@ -135,7 +114,7 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node)
<< be_nl
<< "{" << be_idt_nl;
- bt->accept (visitor);
+ bt->accept (&visitor);
*os <<" **tmp = 0;" << be_nl
<< "tmp = " << class_name << "::allocbuf (length);" << be_nl
@@ -143,11 +122,11 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node)
<< "if (this->buffer_ != 0)" << be_nl
<< "{" << be_idt_nl;
- bt->accept(visitor);
+ bt->accept (&visitor);
*os <<" **old = ACE_reinterpret_cast (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "**, this->buffer_);" << be_nl
<< "for (CORBA::ULong i = 0; i < this->length_; ++i)" << be_idt_nl
@@ -155,25 +134,25 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node)
<< "if (!this->release_)" << be_idt_nl
<< "{" << be_idt_nl;
- if (is_valuetype)
+ if (pt->node_type () == AST_Decl::NT_valuetype)
{
- *os << "if (old[i] != 0)" << be_idt_nl
- << "old[i]->_add_ref ();" << be_uidt_nl
+ *os << "tao_" << pt->flat_name () << "_add_ref (old[i]);" << be_nl
<< "tmp[i] = old[i];";
}
else
{
*os << "tmp[i] = ";
- if (bt_is_defined)
- {
- bt->accept (visitor);
- *os << "::_duplicate (old[i]);";
- }
- else
- {
- *os << "tao_" << pt->flat_name () << "_duplicate (old[i]);";
- }
+ if (bt_is_defined)
+ {
+ bt->accept (&visitor);
+
+ *os << "::_duplicate (old[i]);";
+ }
+ else
+ {
+ *os << "tao_" << pt->flat_name () << "_duplicate (old[i]);";
+ }
}
*os << be_uidt_nl
@@ -185,7 +164,7 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node)
<< "}" << be_uidt_nl << be_nl
<< "if (this->release_)" << be_idt_nl
<< "{" << be_idt_nl
- << "delete[] old;" << be_uidt_nl
+ << "delete [] old;" << be_uidt_nl
<< "}" << be_uidt << be_uidt_nl
<< "}" << be_nl
<< "this->buffer_ = tmp;" << be_uidt_nl
@@ -199,20 +178,19 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node)
<< "if (this->buffer_ == 0 || this->release_ == 0)" << be_idt_nl
<< "return;" << be_uidt_nl;
- bt->accept (visitor);
+ bt->accept (&visitor);
*os <<" **tmp = ACE_reinterpret_cast (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "**, this->buffer_);" << be_nl << be_nl
<< "for (CORBA::ULong i = 0; i < this->length_; ++i)" << be_idt_nl
<< "{" << be_idt_nl;
- if (is_valuetype)
+ if (pt->node_type () == AST_Decl::NT_valuetype)
{
- *os << "if (tmp[i] != 0)" << be_idt_nl
- << "tmp[i]->_remove_ref ();" << be_uidt_nl
+ *os << "tao_" << pt->flat_name () << "_remove_ref (tmp[i]);" << be_nl
<< "tmp[i] = 0;";
}
else if (bt_is_defined)
@@ -220,7 +198,7 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node)
*os << "CORBA::release (tmp[i]);" << be_nl
<< "tmp[i] = ";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "::_nil ();";
}
@@ -251,20 +229,19 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node)
<< "::_shrink_buffer (CORBA::ULong nl, CORBA::ULong ol)" << be_nl
<< "{" << be_idt_nl;
- bt->accept (visitor);
+ bt->accept (&visitor);
*os <<" **tmp = ACE_reinterpret_cast (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "**, this->buffer_);" << be_nl << be_nl
<< "for (CORBA::ULong i = nl; i < ol; ++i)" << be_idt_nl
<< "{" << be_idt_nl;
- if (is_valuetype)
+ if (pt->node_type () == AST_Decl::NT_valuetype)
{
- *os << "if (tmp[i] != 0)" << be_idt_nl
- << "tmp[i]->_remove_ref ();" << be_uidt_nl
+ *os << "tao_" << pt->flat_name () << "_remove_ref (tmp[i]);" << be_nl
<< "tmp[i] = 0;";
}
else if (bt_is_defined)
@@ -272,7 +249,7 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node)
*os << "CORBA::release (tmp[i]);" << be_nl
<< "tmp[i] = ";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "::_nil ();";
}
@@ -290,10 +267,10 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node)
be_predefined_type *prim = be_predefined_type::narrow_from_decl (pt);
- if (! is_valuetype
- && (pt->node_type () != AST_Decl::NT_pre_defined) ||
- (prim && (prim->pt () == AST_PredefinedType::PT_pseudo) &&
- (!ACE_OS::strcmp (prim->local_name ()->get_string (), "Object"))))
+ if (pt->node_type () != AST_Decl::NT_valuetype
+ && (pt->node_type () != AST_Decl::NT_pre_defined)
+ || (prim &&
+ prim->pt () == AST_PredefinedType::PT_object))
{
// Pseudo objects do not require these methods.
*os << "void " << be_nl
@@ -304,18 +281,18 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node)
<< ")" << be_uidt_nl
<< "{" << be_idt_nl;
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " **tmp = ACE_static_cast (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "**, target);" << be_nl
<< "*tmp = ";
if (bt_is_defined)
{
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "::_narrow (src ACE_ENV_ARG_PARAMETER);";
}
@@ -331,26 +308,26 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node)
*os << "CORBA_Object*" << be_nl
<< full_class_name << "::_upcast (void *src) const" << be_nl
- << "{" << be_idt_nl;
+ << "{" << be_idt_nl;
if (bt_is_defined)
{
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " **tmp = ACE_static_cast (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "**, src);" << be_nl
<< "return *tmp;";
}
else
{
- *os << "return tao_" << pt->flat_name () << "_upcast (src);";
+ *os << "return tao_" << pt->flat_name () << "_upcast (src);";
}
*os << be_uidt_nl
- << "}" << be_nl;
+ << "}" << be_nl;
}
os->gen_endif ();
@@ -358,6 +335,5 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node)
// Generate #endif for AHETI.
os->gen_endif_AHETI();
- delete visitor;
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_ch.cpp
index 7a1810b92f9..f66a9d87529 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_ch.cpp
@@ -18,22 +18,15 @@
//
// ============================================================================
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, gen_unbounded_sequence_ch, "$Id$")
-
+ACE_RCSID (be_visitor_sequence,
+ gen_unbounded_sequence_ch,
+ "$Id$")
int
be_visitor_sequence_ch::gen_unbounded_sequence (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 ());
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
if (!bt)
{
@@ -47,9 +40,11 @@ be_visitor_sequence_ch::gen_unbounded_sequence (be_sequence *node)
// generate code for that sequence here.
if (bt->node_type () == AST_Decl::NT_sequence)
{
- if (this->gen_anonymous_base_type (bt,
- TAO_CodeGen::TAO_SEQUENCE_CH)
- == -1)
+ int status =
+ this->gen_anonymous_base_type (bt,
+ TAO_CodeGen::TAO_SEQUENCE_CH);
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ch::"
@@ -61,15 +56,15 @@ be_visitor_sequence_ch::gen_unbounded_sequence (be_sequence *node)
const char * class_name = node->instance_name ();
- // get the visitor for the type of the sequence
+ // Get the visitor for the type of the sequence.
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_sequence_base visitor (&ctx);
- // !! branching in either compile time template instantiation
- // or manual template instatiation
- os->gen_ifdef_AHETI ();
+ *os << be_nl << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ os->gen_ifdef_AHETI ();
os->gen_ifdef_macro (class_name);
*os << "class TAO_EXPORT_MACRO "
@@ -92,7 +87,7 @@ be_visitor_sequence_ch::gen_unbounded_sequence (be_sequence *node)
// The accept is used here the first time and if an
// error occurs, it will occur here. Later no check
// for errors will be done.
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ch::"
@@ -121,14 +116,14 @@ be_visitor_sequence_ch::gen_unbounded_sequence (be_sequence *node)
// Accessors
*os << "// = Accessors." << be_nl;
- bt->accept (visitor);
+ bt->accept (&visitor);
*os <<" &operator[] (CORBA::ULong i);" << be_nl;
// operator[]
*os << "const ";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " &operator[] (CORBA::ULong i) const;" << be_nl << be_nl;
@@ -136,18 +131,19 @@ be_visitor_sequence_ch::gen_unbounded_sequence (be_sequence *node)
*os << "// = Static operations." << be_nl
<< "static ";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " *allocbuf (CORBA::ULong size);" << be_nl;
*os << "static void freebuf (";
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << " *buffer);" << be_nl << be_nl;
// Implement the TAO_Base_Sequence methods (see Sequence.h)
- *os << "// Implement the TAO_Base_Sequence methods (see Sequence.h)" << be_nl;
+ *os << "// Implement the TAO_Base_Sequence methods (see Sequence.h)"
+ << be_nl;
// allocate_buffer
*os << "virtual void _allocate_buffer (CORBA::ULong length);" << be_nl;
@@ -155,12 +151,15 @@ be_visitor_sequence_ch::gen_unbounded_sequence (be_sequence *node)
// deallocate_buffer
*os << "virtual void _deallocate_buffer (void);" << be_nl;
- bt->accept(visitor);
+ bt->accept (&visitor);
+
*os << " *get_buffer (CORBA::Boolean orphan = 0);" << be_nl;
// get_buffer
*os << "const ";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << " *get_buffer (void) const;" << be_nl;
// replace
@@ -168,7 +167,7 @@ be_visitor_sequence_ch::gen_unbounded_sequence (be_sequence *node)
<< "CORBA::ULong max," << be_nl
<< "CORBA::ULong length," << be_nl;
- bt->accept(visitor);
+ bt->accept (&visitor);
*os <<" *data," << be_nl
<< "CORBA::Boolean release" << be_uidt_nl
@@ -181,6 +180,5 @@ be_visitor_sequence_ch::gen_unbounded_sequence (be_sequence *node)
// generate #endif for AHETI
os->gen_endif_AHETI();
- delete visitor;
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_ci.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_ci.cpp
index efde5904e65..9c558ec65bc 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_ci.cpp
@@ -18,39 +18,34 @@
//
// ============================================================================
-//#include "idl.h"
-//#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, gen_unbounded_sequence_ci, "$Id$")
-
+ACE_RCSID (be_visitor_sequence,
+ gen_unbounded_sequence_ci,
+ "$Id$")
int
be_visitor_sequence_ci::gen_unbounded_sequence (be_sequence *node)
{
TAO_OutStream *os = this->ctx_->stream ();
- be_type *bt;
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
- // retrieve the base type since we may need to do some code
- // generation for the base type.
- bt = be_type::narrow_from_decl (node->base_type ());
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ci::"
"visit_sequence - "
- "Bad element type\n"), -1);
+ "Bad element type\n"),
+ -1);
}
// If we contain an anonymous sequence,
// generate code for that sequence here.
if (bt->node_type () == AST_Decl::NT_sequence)
{
- if (this->gen_anonymous_base_type (bt,
- TAO_CodeGen::TAO_SEQUENCE_CI)
- == -1)
+ int status =
+ this->gen_anonymous_base_type (bt,
+ TAO_CodeGen::TAO_SEQUENCE_CI);
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ci::"
@@ -60,12 +55,12 @@ be_visitor_sequence_ci::gen_unbounded_sequence (be_sequence *node)
}
}
- // generate the class name
- be_type *pt; // base types
+ // Generate the class name
+ be_type *pt;
if (bt->node_type () == AST_Decl::NT_typedef)
{
- // get the primitive base type of this typedef node
+ // Get the primitive base type of this typedef node.
be_typedef *t = be_typedef::narrow_from_decl (bt);
pt = t->primitive_base_type ();
}
@@ -80,27 +75,31 @@ be_visitor_sequence_ci::gen_unbounded_sequence (be_sequence *node)
if (node->is_nested ())
{
- ACE_OS::sprintf (full_class_name, "%s::%s",
- be_scope::narrow_from_scope (node->defined_in ())->decl ()->full_name (),
+ be_decl *tmp =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
+
+ ACE_OS::sprintf (full_class_name,
+ "%s::%s",
+ tmp->full_name (),
class_name);
}
else
{
- ACE_OS::sprintf (full_class_name, "%s",
+ ACE_OS::sprintf (full_class_name,
+ "%s",
class_name);
}
- // get the visitor for the type of the sequence
+ // Get the visitor for the type of the sequence.
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CI);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_sequence_base visitor (&ctx);
- // !! branching in either compile time template instantiation
- // or manual template instatiation
- os->gen_ifdef_AHETI();
+ *os << be_nl << "// TAO_IDL - Generated from "
+ << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ os->gen_ifdef_AHETI();
os->gen_ifdef_macro (class_name);
-
os->indent ();
// Static operations
@@ -110,7 +109,7 @@ be_visitor_sequence_ci::gen_unbounded_sequence (be_sequence *node)
// the accept is here the first time used and if an
// error occurs, it will occur here. Later no check
// for errors will be done.
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ci::"
@@ -118,14 +117,19 @@ be_visitor_sequence_ci::gen_unbounded_sequence (be_sequence *node)
"base type visit failed\n"),
-1);
}
+
*os << " *" << be_nl
<< full_class_name << "::allocbuf (CORBA::ULong size)" << be_nl
<< "// Allocate storage for the sequence." << be_nl
<< "{" << be_idt_nl;
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << " *retval = 0;" << be_nl
<< "ACE_NEW_RETURN (retval, ";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << "[size], 0);" << be_nl
<< "return retval;" << be_uidt_nl
<< "}" << be_nl
@@ -133,7 +137,9 @@ be_visitor_sequence_ci::gen_unbounded_sequence (be_sequence *node)
*os << "ACE_INLINE void "
<< full_class_name << "::freebuf (";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << " *buffer)" << be_nl
<< "// Free the sequence." << be_nl
<< "{" << be_idt_nl
@@ -143,7 +149,8 @@ be_visitor_sequence_ci::gen_unbounded_sequence (be_sequence *node)
// constructor
*os << "ACE_INLINE" << be_nl
- << full_class_name << "::" << class_name << " (void) // Default constructor." << be_nl
+ << full_class_name << "::" << class_name
+ << " (void) // Default constructor." << be_nl
<< "{" << be_nl
<< "}" << be_nl
<< be_nl;
@@ -161,12 +168,16 @@ be_visitor_sequence_ci::gen_unbounded_sequence (be_sequence *node)
// constructor
*os << "ACE_INLINE" << be_nl
- << full_class_name << "::" << class_name << " (CORBA::ULong maximum," << be_idt_nl
+ << full_class_name << "::" << class_name
+ << " (CORBA::ULong maximum," << be_idt_nl
<< "CORBA::ULong length," << be_nl;
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << " *data," << be_nl
<< "CORBA::Boolean release)" << be_uidt_nl
- << ": TAO_Unbounded_Base_Sequence (maximum, length, data, release)" << be_nl
+ << ": TAO_Unbounded_Base_Sequence (maximum, length, data, release)"
+ << be_nl
<< "{" << be_nl
<< "}" << be_nl
<< be_nl;
@@ -180,18 +191,24 @@ be_visitor_sequence_ci::gen_unbounded_sequence (be_sequence *node)
<< "{" << be_idt_nl
<< "if (rhs.buffer_ != 0)" << be_nl
<< "{" << be_idt_nl;
- bt->accept(visitor);
+
+ bt->accept (&visitor);
+
*os <<" *tmp1 = " << class_name << "::allocbuf (this->maximum_);" << be_nl;
- bt->accept(visitor);
+
+ bt->accept (&visitor);
+
*os << " * const tmp2 = ACE_reinterpret_cast (";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << " * ACE_CAST_CONST, rhs.buffer_);" << be_nl
<< be_nl
<< "for (CORBA::ULong i = 0; i < this->length_; ++i)" << be_idt_nl;
if (pt->node_type () == AST_Decl::NT_array)
{
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "_var::copy (tmp1[i], tmp2[i]);" << be_uidt_nl;
}
else
@@ -222,9 +239,13 @@ be_visitor_sequence_ci::gen_unbounded_sequence (be_sequence *node)
<< "if (this->maximum_ < rhs.maximum_)" << be_nl
<< "{" << be_idt_nl
<< "// free the old buffer" << be_nl;
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os <<" *tmp = ACE_reinterpret_cast (";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << " *, this->buffer_);" << be_nl
<< class_name << "::freebuf (tmp);" << be_nl
<< "this->buffer_ = " << class_name
@@ -237,20 +258,28 @@ be_visitor_sequence_ci::gen_unbounded_sequence (be_sequence *node)
<< be_nl
<< "TAO_Unbounded_Base_Sequence::operator= (rhs);" << be_nl
<< be_nl;
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os <<" *tmp1 = ACE_reinterpret_cast (";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << " *, this->buffer_);" << be_nl;
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os <<" * const tmp2 = ACE_reinterpret_cast (";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << " * ACE_CAST_CONST, rhs.buffer_);" << be_nl
<< be_nl
<< "for (CORBA::ULong i = 0; i < this->length_; ++i)" << be_idt_nl;
if (pt->node_type () == AST_Decl::NT_array)
{
- bt->accept (visitor);
+ bt->accept (&visitor);
*os << "_var::copy (tmp1[i], tmp2[i]);" << be_uidt_nl;
}
else
@@ -266,15 +295,21 @@ be_visitor_sequence_ci::gen_unbounded_sequence (be_sequence *node)
// Accessors
*os << "// = Accessors." << be_nl;
*os << "ACE_INLINE ";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os <<" &" << be_nl
<< full_class_name << "::operator[] (CORBA::ULong i)" << be_nl
<< "// operator []" << be_nl
<< "{" << be_idt_nl
<< "ACE_ASSERT (i < this->maximum_);" << be_nl;
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os <<"* tmp = ACE_reinterpret_cast(";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << "*,this->buffer_);" << be_nl
<< "return tmp[i];" << be_uidt_nl
<< "}" << be_nl
@@ -282,15 +317,21 @@ be_visitor_sequence_ci::gen_unbounded_sequence (be_sequence *node)
// operator[]
*os << "ACE_INLINE const ";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << " &" << be_nl
<< full_class_name << "::operator[] (CORBA::ULong i) const" << be_nl
<< "// operator []" << be_nl
<< "{" << be_idt_nl
<< "ACE_ASSERT (i < this->maximum_);" << be_nl;
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os <<" * const tmp = ACE_reinterpret_cast (";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << "* ACE_CAST_CONST, this->buffer_);" << be_nl
<< "return tmp[i];" << be_uidt_nl
<< "}" << be_nl
@@ -300,11 +341,15 @@ be_visitor_sequence_ci::gen_unbounded_sequence (be_sequence *node)
*os << "// Implement the TAO_Base_Sequence methods (see Sequence.h)" << be_nl
<< be_nl;
*os << "ACE_INLINE ";
- bt->accept(visitor);
+
+ bt->accept (&visitor);
+
*os << " *" << be_nl
<< full_class_name << "::get_buffer (CORBA::Boolean orphan)" << be_nl
<< "{" << be_idt_nl;
- bt->accept(visitor);
+
+ bt->accept (&visitor);
+
*os <<" *result = 0;" << be_nl
<< "if (orphan == 0)" << be_nl
<< "{" << be_idt_nl
@@ -318,7 +363,9 @@ be_visitor_sequence_ci::gen_unbounded_sequence (be_sequence *node)
<< "else" << be_nl
<< "{" << be_idt_nl
<< "result = ACE_reinterpret_cast (";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << "*, this->buffer_);" << be_uidt_nl
<< "}" << be_uidt_nl
<< "}" << be_nl
@@ -329,7 +376,9 @@ be_visitor_sequence_ci::gen_unbounded_sequence (be_sequence *node)
<< "// We set the state back to default and relinquish" << be_nl
<< "// ownership." << be_nl
<< "result = ACE_reinterpret_cast(";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << "*,this->buffer_);" << be_nl
<< "this->maximum_ = 0;" << be_nl
<< "this->length_ = 0;" << be_nl
@@ -343,12 +392,16 @@ be_visitor_sequence_ci::gen_unbounded_sequence (be_sequence *node)
// get_buffer
*os << "ACE_INLINE const ";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << " *" << be_nl
<< full_class_name << "::get_buffer (void) const" << be_nl
<< "{" << be_idt_nl
<< "return ACE_reinterpret_cast(const ";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << " * ACE_CAST_CONST, this->buffer_);" << be_uidt_nl
<< "}" << be_nl
<< be_nl;
@@ -357,7 +410,9 @@ be_visitor_sequence_ci::gen_unbounded_sequence (be_sequence *node)
*os << "ACE_INLINE void" << be_nl
<< full_class_name << "::replace (CORBA::ULong max," << be_nl
<< "CORBA::ULong length," << be_nl;
- bt->accept(visitor);
+
+ bt->accept (&visitor);
+
*os <<" *data," << be_nl
<< "CORBA::Boolean release)" << be_nl
<< "{" << be_idt_nl
@@ -365,9 +420,13 @@ be_visitor_sequence_ci::gen_unbounded_sequence (be_sequence *node)
<< "this->length_ = length;" << be_nl
<< "if (this->buffer_ && this->release_ == 1)" << be_nl
<< "{" << be_idt_nl;
- bt->accept(visitor);
+
+ bt->accept (&visitor);
+
*os <<" *tmp = ACE_reinterpret_cast(";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << "*,this->buffer_);" << be_nl
<< class_name << "::freebuf (tmp);" << be_uidt_nl
<< "}" << be_nl
@@ -380,6 +439,5 @@ be_visitor_sequence_ci::gen_unbounded_sequence (be_sequence *node)
// generate #endif for AHETI
os->gen_endif_AHETI();
- delete visitor;
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_cs.cpp
index 4fe9def4d30..23546d87070 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_cs.cpp
@@ -18,24 +18,16 @@
//
// ============================================================================
-//#include "idl.h"
-//#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, gen_unbounded_sequence_cs, "$Id$")
-
+ACE_RCSID (be_visitor_sequence,
+ gen_unbounded_sequence_cs,
+ "$Id$")
int
be_visitor_sequence_cs::gen_unbounded_sequence (be_sequence *node)
{
TAO_OutStream *os = this->ctx_->stream ();
- be_type *bt;
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
- // retrieve the base type since we may need to do some code
- // generation for the base type.
- bt = be_type::narrow_from_decl (node->base_type ());
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -48,9 +40,11 @@ be_visitor_sequence_cs::gen_unbounded_sequence (be_sequence *node)
// generate code for that sequence here.
if (bt->node_type () == AST_Decl::NT_sequence)
{
- if (this->gen_anonymous_base_type (bt,
- TAO_CodeGen::TAO_SEQUENCE_CS)
- == -1)
+ int status =
+ this->gen_anonymous_base_type (bt,
+ TAO_CodeGen::TAO_SEQUENCE_CS);
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_cs::"
@@ -60,69 +54,83 @@ be_visitor_sequence_cs::gen_unbounded_sequence (be_sequence *node)
}
}
- // generate the class name
- be_type *pt; // base types
+ // Generate the class name.
+ be_type *pt;
if (bt->node_type () == AST_Decl::NT_typedef)
- {
- // get the primitive base type of this typedef node
- be_typedef *t = be_typedef::narrow_from_decl (bt);
- pt = t->primitive_base_type ();
- }
+ {
+ // Get the primitive base type of this typedef node.
+ be_typedef *t = be_typedef::narrow_from_decl (bt);
+ pt = t->primitive_base_type ();
+ }
else
- pt = bt;
-
+ {
+ pt = bt;
+ }
const char * class_name = node->instance_name ();
static char full_class_name [NAMEBUFSIZE];
- ACE_OS::memset (full_class_name, '\0', NAMEBUFSIZE);
+ ACE_OS::memset (full_class_name,
+ '\0',
+ NAMEBUFSIZE);
if (node->is_nested ())
{
- ACE_OS::sprintf (full_class_name, "%s::%s",
- be_scope::narrow_from_scope (node->defined_in ())->decl ()->full_name (),
+ be_decl *tmp =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
+
+ ACE_OS::sprintf (full_class_name,
+ "%s::%s",
+ tmp->full_name (),
class_name);
}
else
{
- ACE_OS::sprintf (full_class_name, "%s",
+ ACE_OS::sprintf (full_class_name,
+ "%s",
class_name);
}
- // get the visitor for the type of the sequence
+ // Get the visitor for the type of the sequence.
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_sequence_base visitor (&ctx);
- // !! branching in either compile time template instantiation
- // or manual template instatiation
- os->gen_ifdef_AHETI();
+ *os << be_nl << "// TAO_IDL - Generated from "
+ << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ os->gen_ifdef_AHETI();
os->gen_ifdef_macro (class_name);
-
os->indent ();
// allocate_buffer
*os << "void" << be_nl
<< full_class_name << "::_allocate_buffer (CORBA::ULong length)" << be_nl
<< "{" << be_idt_nl;
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << "* tmp = 0;" << be_nl
<< "tmp = " << class_name << "::allocbuf (length);" << be_nl
<< be_nl
<< "if (this->buffer_ != 0)" << be_nl
<< "{" << be_idt_nl;
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os <<" *old = ACE_reinterpret_cast (";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << " *,this->buffer_);" << be_nl
<< be_nl
<< "for (CORBA::ULong i = 0; i < this->length_; ++i)" << be_idt_nl;
if (pt->node_type () == AST_Decl::NT_array)
{
- bt->accept (visitor);
+ bt->accept (&visitor);
+
*os << "_var::copy (tmp[i], old[i]);" << be_uidt_nl;
}
else
@@ -145,9 +153,13 @@ be_visitor_sequence_cs::gen_unbounded_sequence (be_sequence *node)
<< "if (this->buffer_ == 0 || this->release_ == 0)" << be_idt_nl
<< "return;" << be_uidt_nl
<< be_nl;
- bt->accept(visitor);
+
+ bt->accept (&visitor);
+
*os <<" *tmp = ACE_reinterpret_cast (";
- bt->accept (visitor);
+
+ bt->accept (&visitor);
+
*os << " *,this->buffer_);" << be_nl
<< be_nl
<< class_name << "::freebuf (tmp);" << be_nl
@@ -167,6 +179,5 @@ be_visitor_sequence_cs::gen_unbounded_sequence (be_sequence *node)
// generate #endif for AHETI
os->gen_endif_AHETI();
- delete visitor;
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
index cef298252f5..1277fd82ccf 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_base.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_base.cpp
@@ -18,22 +18,16 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, sequence_base, "$Id$")
-
+ACE_RCSID (be_visitor_sequence,
+ sequence_base,
+ "$Id$")
// ****************************************************************
// 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_sequence_base::be_visitor_sequence_base (be_visitor_context *ctx)
: be_visitor_decl (ctx)
{
}
@@ -47,7 +41,9 @@ int
be_visitor_sequence_base::visit_predefined_type (be_predefined_type *node)
{
TAO_OutStream *os = this->ctx_->stream ();
+
*os << node->name ();
+
return 0;
}
@@ -133,12 +129,24 @@ be_visitor_sequence_base::visit_structure (be_structure *node)
}
int
+be_visitor_sequence_base::visit_structure_fwd (be_structure_fwd *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_union_fwd (be_union_fwd *node)
+{
+ return this->visit_node (node);
+}
+
+int
be_visitor_sequence_base::visit_enum (be_enum *node)
{
return this->visit_node (node);
@@ -176,8 +184,8 @@ be_visitor_sequence_base::visit_typedef (be_typedef *node)
}
be_visitor_sequence_base_template_args::
- be_visitor_sequence_base_template_args (be_visitor_context *ctx,
- be_sequence *seq)
+be_visitor_sequence_base_template_args (be_visitor_context *ctx,
+ be_sequence *seq)
: be_visitor_sequence_base (ctx),
beseq_ (seq)
{
@@ -186,7 +194,7 @@ be_visitor_sequence_base_template_args::
be_visitor_sequence_base_template_args::
- ~be_visitor_sequence_base_template_args (void)
+~be_visitor_sequence_base_template_args (void)
{
//no-op
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp
index c5c3cdb1cde..d21e37a7b34 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, sequence_ch, "$Id$")
-
+ACE_RCSID (be_visitor_sequence,
+ sequence_ch,
+ "$Id$")
// Root visitor for client header.
be_visitor_sequence_ch::be_visitor_sequence_ch (be_visitor_context *ctx)
@@ -41,23 +36,17 @@ int
be_visitor_sequence_ch::gen_base_sequence_class (be_sequence *node)
{
TAO_OutStream *os = this->ctx_->stream ();
- be_type *bt = 0;
-
- // 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 ());
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
if (bt == 0)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ch::"
"visit_sequence - "
- "Bad element type\n"), -1);
+ "Bad element type\n"),
+ -1);
}
-
- // !! Branching in either compile time template instantiation
- // or manual template instatiation.
os->gen_ifdef_AHETI ();
// This is the instantiation branch.
@@ -79,6 +68,17 @@ be_visitor_sequence_ch::gen_base_sequence_class (be_sequence *node)
}
break;
+ case be_sequence::MNG_ABSTRACT:
+ if (node->unbounded ())
+ {
+ *os << "TAO_Unbounded_Abstract_Sequence<";
+ }
+ else
+ {
+ *os << "TAO_Bounded_Abstract_Sequence<";
+ }
+
+ break;
case be_sequence::MNG_PSEUDO:
if (node->unbounded ())
{
@@ -150,15 +150,12 @@ be_visitor_sequence_ch::gen_base_sequence_class (be_sequence *node)
break;
}
- be_visitor_context *ctx = 0;
- ACE_NEW_RETURN (ctx,
- be_visitor_context (*this->ctx_),
- 0);
+ be_visitor_context ctx (*this->ctx_);
- be_visitor_sequence_base_template_args visitor (ctx,
+ be_visitor_sequence_base_template_args visitor (&ctx,
node);
- ctx->state (TAO_CodeGen::TAO_SEQUENCE_BASE_CH);
+ ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CH);
if (bt->accept (&visitor) == -1)
{
@@ -188,7 +185,7 @@ be_visitor_sequence_ch::gen_base_sequence_class (be_sequence *node)
*os << ", ";
// So the call to nested_type_name will have "_var" suffix.
- ctx->sub_state (TAO_CodeGen::TAO_ARRAY_SEQ_CH_TEMPLATE_VAR);
+ ctx.sub_state (TAO_CodeGen::TAO_ARRAY_SEQ_CH_TEMPLATE_VAR);
if (bt->accept (&visitor) == -1)
{
@@ -199,7 +196,7 @@ be_visitor_sequence_ch::gen_base_sequence_class (be_sequence *node)
-1);
}
- ctx->sub_state (TAO_CodeGen::TAO_SUB_STATE_UNKNOWN);
+ ctx.sub_state (TAO_CodeGen::TAO_SUB_STATE_UNKNOWN);
}
if (node->unbounded ())
@@ -228,7 +225,8 @@ be_visitor_sequence_ch::instantiate_sequence (be_sequence *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ch::"
"gen_instantiate_template_name - "
- "Bad element type\n"), -1);
+ "Bad element type\n"),
+ -1);
}
// Generate the appropriate sequence type.
@@ -237,6 +235,7 @@ be_visitor_sequence_ch::instantiate_sequence (be_sequence *node)
case be_sequence::MNG_PSEUDO:
case be_sequence::MNG_OBJREF:
case be_sequence::MNG_VALUE:
+ case be_sequence::MNG_ABSTRACT:
if (node->unbounded ())
{
this->gen_unbounded_obj_sequence (node);
@@ -327,7 +326,8 @@ int be_visitor_sequence_ch::visit_sequence (be_sequence *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ch::"
"visit_sequence - "
- "failed creating name\n"), -1);
+ "failed creating name\n"),
+ -1);
}
if (node->cli_hdr_gen () || node->imported ())
@@ -342,7 +342,8 @@ int be_visitor_sequence_ch::visit_sequence (be_sequence *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ch::"
"visit_sequence - "
- "codegen. for the primitive type sequence\n"), -1);
+ "codegen. for the primitive type sequence\n"),
+ -1);
}
// End of instantiation.
@@ -359,7 +360,8 @@ int be_visitor_sequence_ch::visit_sequence (be_sequence *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ch::"
"visit_sequence - "
- "Bad element type\n"), -1);
+ "Bad element type\n"),
+ -1);
}
*os << "class " << node->local_name () << ";" << be_nl;
@@ -378,6 +380,9 @@ int be_visitor_sequence_ch::visit_sequence (be_sequence *node)
<< "// *************************************************************"
<< be_nl << be_nl;
+ *os << be_nl << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Generate a typedef to a parametrized sequence.
*os << "class " << be_global->stub_export_macro ()
<< " " << node->local_name () << " : public ";
@@ -415,18 +420,9 @@ int be_visitor_sequence_ch::visit_sequence (be_sequence *node)
// 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);
+ be_visitor_sequence_buffer_type bt_visitor (&ctx);
- if (visitor == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_sequence_ch::"
- "visit_sequence - "
- "Bad visitor\n"),
- -1);
- }
-
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&bt_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ch::"
@@ -435,8 +431,6 @@ int be_visitor_sequence_ch::visit_sequence (be_sequence *node)
-1);
}
- delete visitor;
-
*os << " *buffer, " << be_nl
<< "CORBA::Boolean release = 0" << be_uidt_nl
<< ");" << be_uidt_nl;
@@ -445,14 +439,11 @@ int be_visitor_sequence_ch::visit_sequence (be_sequence *node)
*os << "~" << node->local_name () << " (void);" << be_nl
<< "static void _tao_any_destructor (void*);" << be_nl;
- // Generate the _var_type typedef (only if we are not anonymous),
- // but we must protect against certain versions of g++.
+ // Generate the _var_type typedef (only if we are not anonymous).
if (this->ctx_->tdef () != 0)
{
- *os << "\n#if !defined(__GNUC__) || !defined (ACE_HAS_GNUG_PRE_2_8)"
- << be_nl;
- *os << "typedef " << node->local_name () << "_var _var_type;\n"
- << "#endif /* ! __GNUC__ || g++ >= 2.8 */" << be_nl << be_nl;
+ *os << "typedef " << node->local_name () << "_var _var_type;"
+ << be_nl << be_nl;
}
// TAO provides extensions for octet sequences, first find out if
@@ -507,7 +498,8 @@ int be_visitor_sequence_ch::visit_sequence (be_sequence *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ch::"
"visit_sequence - "
- "codegen for _var failed\n"), -1);
+ "codegen for _var failed\n"),
+ -1);
}
os->gen_endif ();
@@ -538,7 +530,6 @@ be_visitor_sequence_ch::gen_var_defn (be_sequence *node)
{
TAO_OutStream *os = this->ctx_->stream ();
char namebuf [NAMEBUFSIZE];
- be_type *bt = 0;
ACE_OS::memset (namebuf,
'\0',
@@ -555,7 +546,7 @@ be_visitor_sequence_ch::gen_var_defn (be_sequence *node)
<< be_nl << be_nl;
// Retrieve base type.
- bt = be_type::narrow_from_decl (node->base_type ());
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
if (!bt)
{
@@ -585,7 +576,7 @@ be_visitor_sequence_ch::gen_var_defn (be_sequence *node)
*os << namebuf << " (const " << namebuf << " &);" << be_nl;
// Fixed-size base types only.
- if (bt->size_type () == be_decl::FIXED)
+ if (bt->size_type () == AST_Type::FIXED)
{
*os << "// Fixed-size base types only." << be_nl;
*os << namebuf << " (const " << node->local_name ()
@@ -604,7 +595,7 @@ be_visitor_sequence_ch::gen_var_defn (be_sequence *node)
*os << namebuf << " &operator= (const " << namebuf << " &);" << be_nl;
// Fixed-size base types only.
- if (bt->size_type () == be_decl::FIXED)
+ if (bt->size_type () == AST_Type::FIXED)
{
*os << "// Fixed-size base types only." << be_nl;
*os << namebuf << " &operator= (const " << node->local_name ()
@@ -624,7 +615,7 @@ be_visitor_sequence_ch::gen_var_defn (be_sequence *node)
*os << "operator " << node->local_name () << " &();" << be_nl;
*os << "operator " << node->local_name () << " &() const;" << be_nl;
- if (bt->size_type () == be_decl::VARIABLE)
+ if (bt->size_type () == AST_Type::VARIABLE)
{
*os << "operator " << node->local_name ()
<< " *&(); // variable-size base types only" << be_nl;
@@ -635,17 +626,9 @@ be_visitor_sequence_ch::gen_var_defn (be_sequence *node)
// Overloaded [] operators.
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_SEQELEM_RETTYPE_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
-
- if (visitor == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_sequence_ch::"
- "gen_var_defn - "
- "Bad visitor\n"), -1);
- }
+ be_visitor_sequence_elemtype sr_visitor (&ctx);
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&sr_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_sequence::"
@@ -685,12 +668,14 @@ be_visitor_sequence_ch::gen_var_defn (be_sequence *node)
&& nt != AST_Decl::NT_wstring
&& nt != AST_Decl::NT_interface
&& nt != AST_Decl::NT_interface_fwd
+ && nt != AST_Decl::NT_valuetype
&& nt != AST_Decl::NT_array
- && pdt != AST_PredefinedType::PT_pseudo)
+ && pdt != AST_PredefinedType::PT_pseudo
+ && pdt != AST_PredefinedType::PT_object)
{
*os << "const ";
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&sr_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_sequence::"
@@ -702,8 +687,6 @@ be_visitor_sequence_ch::gen_var_defn (be_sequence *node)
*os << " operator[] (CORBA::ULong index) const;" << be_nl;
}
- delete visitor;
-
*os << be_nl;
*os << "// in, inout, out, _retn " << be_nl;
@@ -734,7 +717,6 @@ be_visitor_sequence_ch::gen_out_defn (be_sequence *node)
{
TAO_OutStream *os = this->ctx_->stream ();
char namebuf [NAMEBUFSIZE];
- be_type *bt = 0;
ACE_OS::memset (namebuf,
'\0',
@@ -744,7 +726,7 @@ be_visitor_sequence_ch::gen_out_defn (be_sequence *node)
node->local_name ()->get_string ());
// Retrieve base type.
- bt = be_type::narrow_from_decl (node->base_type ());
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
if (bt == 0)
{
@@ -794,17 +776,9 @@ be_visitor_sequence_ch::gen_out_defn (be_sequence *node)
// 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 == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_sequence_ch::"
- "gen_out_defn - "
- "Bad visitor\n"), -1);
- }
+ be_visitor_sequence_elemtype sr_visitor (&ctx);
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&sr_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_sequence::"
@@ -813,16 +787,12 @@ be_visitor_sequence_ch::gen_out_defn (be_sequence *node)
-1);
}
- delete visitor;
-
*os << " operator[] (CORBA::ULong index);" << be_uidt_nl << be_nl;
*os << "private:" << be_idt_nl;
-
*os << node->local_name () << " *&ptr_;" << be_nl;
*os << "// Assignment from T_var not allowed." << be_nl;
*os << "void operator= (const " << node->local_name ()
<< "_var &);" << be_uidt_nl;
-
*os << "};" << be_nl << be_nl;
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
index 8b902e3326c..0213f8a7498 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp
@@ -18,17 +18,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, sequence_ci, "$Id$")
-
+ACE_RCSID (be_visitor_sequence,
+ sequence_ci,
+ "$Id$")
// ***********************************************************
-// sequence visitor for inline generation
+// Sequence visitor for inline generation.
// ***********************************************************
@@ -76,7 +71,8 @@ be_visitor_sequence_ci::visit_sequence (be_sequence *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ci::"
"visit_sequence - "
- "codegen for _var failed\n"), -1);
+ "codegen for _var failed\n"),
+ -1);
}
if (this->gen_out_impl (node) == -1)
@@ -84,7 +80,8 @@ be_visitor_sequence_ci::visit_sequence (be_sequence *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ci::"
"visit_sequence - "
- "codegen for _out failed\n"), -1);
+ "codegen for _out failed\n"),
+ -1);
}
// Generate the endif macro for the sequence type.
@@ -106,7 +103,8 @@ be_visitor_sequence_ci::instantiate_sequence (be_sequence *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ch::"
"gen_instantiate_template_name - "
- "Bad element type\n"), -1);
+ "Bad element type\n"),
+ -1);
}
// Generate the appropriate sequence type.
@@ -115,6 +113,7 @@ be_visitor_sequence_ci::instantiate_sequence (be_sequence *node)
case be_sequence::MNG_PSEUDO:
case be_sequence::MNG_OBJREF:
case be_sequence::MNG_VALUE:
+ case be_sequence::MNG_ABSTRACT:
if (node->unbounded ())
{
this->gen_unbounded_obj_sequence (node);
@@ -219,12 +218,16 @@ be_visitor_sequence_ci::gen_var_impl (be_sequence *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ci::"
"visit_sequence - "
- "Bad element type\n"), -1);
+ "Bad element type\n"),
+ -1);
}
// Generate the var implementation in the inline file.
os->indent ();
+ *os << be_nl << "// TAO_IDL - Generated from "
+ << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
*os << "// *************************************************************"
<< be_nl;
*os << "// Inline operations for class " << fname << be_nl;
@@ -234,11 +237,11 @@ be_visitor_sequence_ci::gen_var_impl (be_sequence *node)
// Default constuctor.
*os << "ACE_INLINE" << be_nl
<< fname << "::" << lname
- << " (void) // default constructor" << be_nl
+ << " (void)" << be_nl
<< " " << ": ptr_ (0)" << be_nl
<< "{}" << be_nl << be_nl;
- // Constuctorr from a _ptr.
+ // Constuctor from a _ptr.
*os << "ACE_INLINE" << be_nl;
*os << fname << "::" << lname << " (" << node->local_name ()
<< " *p)" << be_nl;
@@ -248,7 +251,7 @@ be_visitor_sequence_ci::gen_var_impl (be_sequence *node)
// Copy constructor.
*os << "ACE_INLINE" << be_nl;
*os << fname << "::" << lname << " (const ::" << fname
- << " &p) // copy constructor" << be_nl;
+ << " &p)" << be_nl;
*os << "{" << be_idt_nl;
*os << "if (p.ptr_)" << be_idt_nl;
*os << "ACE_NEW (this->ptr_, ::" << node->name ()
@@ -258,7 +261,7 @@ be_visitor_sequence_ci::gen_var_impl (be_sequence *node)
*os << "}" << be_nl << be_nl;
// Fixed-size base types only.
- if (bt->size_type () == be_decl::FIXED)
+ if (bt->size_type () == AST_Type::FIXED)
{
*os << "// fixed-size base types only" << be_nl;
*os << "ACE_INLINE" << be_nl;
@@ -272,7 +275,7 @@ be_visitor_sequence_ci::gen_var_impl (be_sequence *node)
// Destructor.
*os << "ACE_INLINE" << be_nl;
- *os << fname << "::~" << lname << " (void) // destructor" << be_nl;
+ *os << fname << "::~" << lname << " (void)" << be_nl;
*os << "{" << be_idt_nl;
*os << "delete this->ptr_;" << be_uidt_nl;
*os << "}" << be_nl << be_nl;
@@ -317,7 +320,7 @@ be_visitor_sequence_ci::gen_var_impl (be_sequence *node)
<< "}\n\n";
// Fixed-size base types only.
- if (bt->size_type () == be_decl::FIXED)
+ if (bt->size_type () == AST_Type::FIXED)
{
*os << "// fixed-size types only" << be_nl;
*os << "ACE_INLINE ::" << fname << " &" << be_nl;
@@ -370,7 +373,7 @@ be_visitor_sequence_ci::gen_var_impl (be_sequence *node)
*os << "}" << be_nl << be_nl;
// Variable-size base types only.
- if (bt->size_type () == be_decl::VARIABLE)
+ if (bt->size_type () == AST_Type::VARIABLE)
{
*os << "// variable-size types only" << be_nl;
*os << "ACE_INLINE" << be_nl;
@@ -388,17 +391,9 @@ be_visitor_sequence_ci::gen_var_impl (be_sequence *node)
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_SEQELEM_RETTYPE_CI);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_sequence_elemtype sr_visitor (&ctx);
- if (visitor == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_sequence_ci::"
- "gen_var_impl - "
- "Bad visitor\n"), -1);
- }
-
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&sr_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ci::"
@@ -442,13 +437,15 @@ be_visitor_sequence_ci::gen_var_impl (be_sequence *node)
&& nt != AST_Decl::NT_wstring
&& nt != AST_Decl::NT_interface
&& nt != AST_Decl::NT_interface_fwd
+ && nt != AST_Decl::NT_valuetype
&& nt != AST_Decl::NT_array
- && pdt != AST_PredefinedType::PT_pseudo)
+ && pdt != AST_PredefinedType::PT_pseudo
+ && pdt != AST_PredefinedType::PT_object)
{
// Const.
*os << "ACE_INLINE const ";
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&sr_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ci::"
@@ -463,7 +460,7 @@ be_visitor_sequence_ci::gen_var_impl (be_sequence *node)
*os << "return ACE_const_cast (const ";
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&sr_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ci::"
@@ -477,8 +474,6 @@ be_visitor_sequence_ci::gen_var_impl (be_sequence *node)
*os << "}" << be_nl << be_nl;
}
- delete visitor;
-
// in, inout, out, and _retn.
*os << "ACE_INLINE const ::" << node->name () << " &" << be_nl;
*os << fname << "::in (void) const" << be_nl;
@@ -527,11 +522,21 @@ be_visitor_sequence_ci::gen_out_impl (be_sequence *node)
char lname [NAMEBUFSIZE];
- ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (fname, "%s_out", node->full_name ());
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
+
+ ACE_OS::sprintf (fname,
+ "%s_out",
+ node->full_name ());
+
+ ACE_OS::memset (lname,
+ '\0',
+ NAMEBUFSIZE);
- ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (lname, "%s_out", node->local_name ()->get_string ());
+ ACE_OS::sprintf (lname,
+ "%s_out",
+ node->local_name ()->get_string ());
// Retrieve base type.
be_type *bt = be_type::narrow_from_decl (node->base_type ());
@@ -548,6 +553,9 @@ be_visitor_sequence_ci::gen_out_impl (be_sequence *node)
os->indent ();
+ *os << be_nl << "// TAO_IDL - Generated from "
+ << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
*os << "// *************************************************************"
<< be_nl;
*os << "// Inline operations for class " << fname << be_nl;
@@ -629,17 +637,9 @@ be_visitor_sequence_ci::gen_out_impl (be_sequence *node)
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_SEQELEM_RETTYPE_CI);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
-
- if (visitor == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_sequence_ci::"
- "gen_out_impl - "
- "Bad visitor\n"), -1);
- }
+ be_visitor_sequence_elemtype sr_visitor (&ctx);
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&sr_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ci::"
@@ -648,8 +648,6 @@ be_visitor_sequence_ci::gen_out_impl (be_sequence *node)
-1);
}
- delete visitor;
-
*os << be_nl;
*os << fname << "::operator[] (CORBA::ULong index)" << be_nl;
*os << "{" << be_idt_nl;
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp
index e02b632b837..5677be4cf09 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_sequence.h"
-
-ACE_RCSID(be_visitor_sequence, sequence_cs, "$Id$")
-
+ACE_RCSID (be_visitor_sequence,
+ sequence_cs,
+ "$Id$")
// ************************************************************
// Root visitor for client stub class
@@ -40,91 +35,131 @@ 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;
-
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
- // retrieve the base type since we may need to do some code
- // generation for the base type.
- bt = be_type::narrow_from_decl (node->base_type ());
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_cs::"
"gen_base_sequence_class - "
- "Bad element type\n"), -1);
+ "Bad element type\n"),
+ -1);
}
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
os->gen_ifdef_AHETI();
- // this is the instantiation branch
+ // This is the instantiation branch.
*os << node->instance_name ();
os->gen_else_AHETI();
- // generate the appropriate sequence type
+ // Generate the appropriate sequence type.
switch (node->managed_type ())
{
case be_sequence::MNG_OBJREF:
if (node->unbounded ())
- *os << "TAO_Unbounded_Object_Sequence<";
+ {
+ *os << "TAO_Unbounded_Object_Sequence<";
+ }
+ else
+ {
+ *os << "TAO_Bounded_Object_Sequence<";
+ }
+
+ break;
+ case be_sequence::MNG_ABSTRACT:
+ if (node->unbounded ())
+ {
+ *os << "TAO_Unbounded_Abstract_Sequence<";
+ }
else
- *os << "TAO_Bounded_Object_Sequence<";
+ {
+ *os << "TAO_Bounded_Abstract_Sequence<";
+ }
+
break;
case be_sequence::MNG_PSEUDO:
if (node->unbounded ())
- *os << "TAO_Unbounded_Pseudo_Sequence<";
+ {
+ *os << "TAO_Unbounded_Pseudo_Sequence<";
+ }
else
- *os << "TAO_Bounded_Pseudo_Sequence<";
+ {
+ *os << "TAO_Bounded_Pseudo_Sequence<";
+ }
+
break;
case be_sequence::MNG_VALUE:
if (node->unbounded ())
- *os << "TAO_Unbounded_Valuetype_Sequence<";
+ {
+ *os << "TAO_Unbounded_Valuetype_Sequence<";
+ }
else
- *os << "TAO_Bounded_Valuetype_Sequence<";
+ {
+ *os << "TAO_Bounded_Valuetype_Sequence<";
+ }
+
break;
case be_sequence::MNG_STRING:
if (node->unbounded ())
- *os << "TAO_Unbounded_String_Sequence";
+ {
+ *os << "TAO_Unbounded_String_Sequence";
+ }
else
- *os << "TAO_Bounded_String_Sequence";
+ {
+ *os << "TAO_Bounded_String_Sequence";
+ }
+
break;
case be_sequence::MNG_WSTRING:
if (node->unbounded ())
- *os << "TAO_Unbounded_WString_Sequence";
+ {
+ *os << "TAO_Unbounded_WString_Sequence";
+ }
else
- *os << "TAO_Bounded_WString_Sequence";
+ {
+ *os << "TAO_Bounded_WString_Sequence";
+ }
+
break;
default: // not a managed type
if (bt->base_node_type () == AST_Decl::NT_array)
{
if (node->unbounded ())
- *os << "TAO_Unbounded_Array_Sequence<";
+ {
+ *os << "TAO_Unbounded_Array_Sequence<";
+ }
else
- *os << "TAO_Bounded_Array_Sequence<";
+ {
+ *os << "TAO_Bounded_Array_Sequence<";
+ }
}
else
{
if (node->unbounded ())
- *os << "TAO_Unbounded_Sequence<";
+ {
+ *os << "TAO_Unbounded_Sequence<";
+ }
else
- *os << "TAO_Bounded_Sequence<";
+ {
+ *os << "TAO_Bounded_Sequence<";
+ }
}
+
break;
}
- be_visitor_context *ctx;
- ACE_NEW_RETURN (ctx,
- be_visitor_context (*this->ctx_),
- 0);
- be_visitor_sequence_base_template_args visitor (ctx,node);
- ctx->state (TAO_CodeGen::TAO_SEQUENCE_BASE_CS);
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_sequence_base_template_args visitor (&ctx,
+ node);
+ ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CS);
if (bt->accept (&visitor) == -1)
{
@@ -135,7 +170,7 @@ be_visitor_sequence_cs::gen_base_sequence_class (be_sequence *node)
-1);
}
- // find out if the sequence is of a managed type and if it is bounded or not
+ // 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
|| node->managed_type () == be_sequence::MNG_WSTRING)
{
@@ -181,33 +216,31 @@ be_visitor_sequence_cs::gen_base_sequence_class (be_sequence *node)
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;
-
- // instantiation
+ {
+ return 0;
+ }
if (this->instantiate_sequence (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_ch::"
"visit_sequence - "
- "codegen. for the primitive type sequence\n"), -1);
+ "codegen. for the primitive type sequence\n"),
+ -1);
}
- // end of instantiation
-
- // generate the ifdefined macro for the sequence type
+ // Generate the ifdefined macro for the sequence type.
os->gen_ifdef_macro (node->flat_name ());
os->indent (); // start with the current indentation level
- // retrieve the base type since we may need to do some code
+ // 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 ());
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -216,6 +249,9 @@ int be_visitor_sequence_cs::visit_sequence (be_sequence *node)
"Bad element type\n"), -1);
}
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
*os << "// *************************************************************"
<< be_nl
<< "// " << node->name () << be_nl
@@ -249,24 +285,19 @@ int be_visitor_sequence_cs::visit_sequence (be_sequence *node)
// 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_cs::"
- "visit_sequence - "
- "Bad visitor\n"), -1);
- }
+ be_visitor_sequence_buffer_type bt_visitor (&ctx);
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&bt_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_sequence_cs::"
@@ -274,48 +305,56 @@ int be_visitor_sequence_cs::visit_sequence (be_sequence *node)
"base type visit failed\n"),
-1);
}
- delete visitor;
+
*os << " *buffer, CORBA::Boolean release)" << be_nl
<< " : ";
- // pass it to the base constructor
+
+ // 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);
+ "codegen for base sequence class\n"),
+ -1);
}
+
*os << " (";
+
if (node->unbounded ())
{
*os << "max, ";
}
+
*os << "length, buffer, release)" << be_nl
<< "{}" << be_nl;
- // copy constructor
+ // Copy constructor.
*os << node->name () << "::" << node->local_name ()
<< " (const " << node->local_name ()
<< " &seq) // copy ctor" << be_nl
<< " : ";
- // pass it to the base constructor
+
+ // 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);
+ "codegen for base sequence class\n"),
+ -1);
}
+
*os << " (seq)" << be_nl
<< "{}" << be_nl;
- // destructor
+ // Destructor.
*os << node->name () << "::~" << node->local_name ()
<< " (void) // dtor" << be_nl
<< "{}" << be_nl
-
<< "void "
- << node->name () << "::_tao_any_destructor (void *_tao_void_pointer)" << be_nl
+ << node->name () << "::_tao_any_destructor (void *_tao_void_pointer)"
+ << be_nl
<< "{" << be_idt_nl
<< node->local_name () << " *tmp = ACE_static_cast ("
<< node->local_name () << "*, _tao_void_pointer);" << be_nl
@@ -331,9 +370,8 @@ int be_visitor_sequence_cs::visit_sequence (be_sequence *node)
int
be_visitor_sequence_cs::instantiate_sequence (be_sequence *node)
{
- be_type *bt;
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
- bt = be_type::narrow_from_decl (node->base_type ());
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -342,35 +380,44 @@ be_visitor_sequence_cs::instantiate_sequence (be_sequence *node)
"Bad element type\n"), -1);
}
- // generate the appropriate sequence type
+ // Generate the appropriate sequence type.
switch (node->managed_type ())
{
case be_sequence::MNG_PSEUDO:
case be_sequence::MNG_OBJREF:
case be_sequence::MNG_VALUE:
+ case be_sequence::MNG_ABSTRACT:
if (node->unbounded ())
- this->gen_unbounded_obj_sequence (node);
+ {
+ this->gen_unbounded_obj_sequence (node);
+ }
else
- this->gen_bounded_obj_sequence (node);
+ {
+ this->gen_bounded_obj_sequence (node);
+ }
+
break;
- case be_sequence::MNG_STRING: // sequence of strings
+ case be_sequence::MNG_STRING:
if (!node->unbounded ())
- this->gen_bounded_str_sequence (node);
- // else
- // inheriting from the right class is enough
+ {
+ this->gen_bounded_str_sequence (node);
+ }
+
break;
- case be_sequence::MNG_WSTRING: // sequence of strings
+ case be_sequence::MNG_WSTRING:
if (!node->unbounded ())
- this->gen_bounded_wstr_sequence (node);
- // else
- // inheriting from the right class is enough
+ {
+ this->gen_bounded_wstr_sequence (node);
+ }
+
break;
- default: // not a managed type
+ default:
if (node->unbounded ())
{
// TAO provides extensions for octet sequences, first find out
- // if the base type is an octet (or an alias for octet)
+ // if the base type is an octet (or an alias for octet).
be_predefined_type *predef = 0;
+
if (bt->base_node_type () == AST_Type::NT_pre_defined)
{
be_typedef* alias =
@@ -389,6 +436,7 @@ be_visitor_sequence_cs::instantiate_sequence (be_sequence *node)
);
}
}
+
if (predef != 0)
{
if (predef->pt() != AST_PredefinedType::PT_octet)
diff --git a/TAO/TAO_IDL/be/be_visitor_structure.cpp b/TAO/TAO_IDL/be/be_visitor_structure.cpp
index 53305f2da63..288b9ef1fc4 100644
--- a/TAO/TAO_IDL/be/be_visitor_structure.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_structure.cpp
@@ -18,13 +18,16 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_field.h"
+#include "be_structure.h"
+#include "be_helper.h"
+#include "be_extern.h"
#include "be_visitor_structure.h"
+#include "be_visitor_field.h"
+#include "be_visitor_typecode.h"
+#include "be_visitor_context.h"
-// include all the individual files
#include "be_visitor_structure/structure.cpp"
#include "be_visitor_structure/structure_ch.cpp"
#include "be_visitor_structure/structure_ci.cpp"
@@ -35,4 +38,6 @@
#include "be_visitor_structure/cdr_op_ci.cpp"
#include "be_visitor_structure/cdr_op_cs.cpp"
-ACE_RCSID(be, be_visitor_structure, "$Id$")
+ACE_RCSID (be,
+ be_visitor_structure,
+ "$Id$")
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
index ccade4c7415..20dc1453dfe 100644
--- a/TAO/TAO_IDL/be/be_visitor_structure/any_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_structure/any_op_ch.cpp
@@ -18,13 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_structure.h"
-
-ACE_RCSID(be_visitor_structure, any_op_ch, "$Id$")
-
+ACE_RCSID (be_visitor_structure,
+ any_op_ch,
+ "$Id$")
// ***************************************************************************
// Structure visitor for generating Any operator declarations in the client header
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
index 0f17e8aaf8d..b7aafca737d 100644
--- a/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp
@@ -18,13 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_structure.h"
-
-ACE_RCSID(be_visitor_structure, any_op_cs, "$Id$")
-
+ACE_RCSID (be_visitor_structure,
+ any_op_cs,
+ "$Id$")
// ***************************************************************************
// Structure visitor for generating Any operator declarations in the client
diff --git a/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ch.cpp
index 4f561b10d61..4185d0e2669 100644
--- a/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ch.cpp
@@ -19,20 +19,17 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_structure.h"
-
-ACE_RCSID(be_visitor_structure, cdr_op_ch, "$Id$")
+ACE_RCSID (be_visitor_structure,
+ cdr_op_ch,
+ "$Id$")
// ***************************************************************************
// Structure visitor for generating CDR operator declarations in the client header
// ***************************************************************************
-be_visitor_structure_cdr_op_ch::be_visitor_structure_cdr_op_ch
-(be_visitor_context *ctx)
+be_visitor_structure_cdr_op_ch::be_visitor_structure_cdr_op_ch (
+ be_visitor_context *ctx
+ )
: be_visitor_structure (ctx)
{
}
@@ -44,15 +41,18 @@ be_visitor_structure_cdr_op_ch::~be_visitor_structure_cdr_op_ch (void)
int
be_visitor_structure_cdr_op_ch::visit_structure (be_structure *node)
{
- if (node->cli_hdr_cdr_op_gen () ||
- node->imported () ||
- node->is_local ())
- return 0;
+ if (node->cli_hdr_cdr_op_gen ()
+ || node->imported ()
+ || node->is_local ())
+ {
+ return 0;
+ }
TAO_OutStream *os = this->ctx_->stream ();
- // generate the CDR << and >> operator declarations
+ // Generate the CDR << and >> operator declarations.
os->indent ();
+
*os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator<< (TAO_OutputCDR &, const " << node->name ()
<< " &);" << be_nl;
@@ -61,15 +61,16 @@ be_visitor_structure_cdr_op_ch::visit_structure (be_structure *node)
<< node->name () << " &);\n";
- // set the substate as generating code for the types defined in our scope
+ // Set the substate as generating code for the types defined in our scope.
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
- // 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_cdr_op_ch::"
"visit_structure - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
diff --git a/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ci.cpp
index 395750ef6a2..0b273e9ebb3 100644
--- a/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ci.cpp
@@ -18,22 +18,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_structure.h"
-#include "be_visitor_field.h"
-
-ACE_RCSID(be_visitor_structure, cdr_op_ci, "$Id$")
+ACE_RCSID (be_visitor_structure,
+ cdr_op_ci,
+ "$Id$")
// ***************************************************************************
// Structure visitor for generating CDR operator declarations in the client
// stubs file
// ***************************************************************************
-be_visitor_structure_cdr_op_ci::be_visitor_structure_cdr_op_ci
-(be_visitor_context *ctx)
+be_visitor_structure_cdr_op_ci::be_visitor_structure_cdr_op_ci (
+ be_visitor_context *ctx
+ )
: be_visitor_structure (ctx)
{
}
@@ -46,85 +42,102 @@ int
be_visitor_structure_cdr_op_ci::visit_structure (be_structure *node)
{
// already generated and/or we are imported. Don't do anything.
- if (node->cli_inline_cdr_op_gen () ||
- node->imported () ||
- node->is_local ())
- return 0;
+ if (node->cli_inline_cdr_op_gen ()
+ || node->imported ()
+ || node->is_local ())
+ {
+ return 0;
+ }
TAO_OutStream *os = this->ctx_->stream ();
// First generate code for our children. The reason we do this first is
// because the inlined code for our children must be available before we use
- // it in our parent
+ // it in our parent.
+
+ // Set the substate as generating code for the types defined in our scope.
+ this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_SCOPE);
- // set the substate as generating code for the types defined in our scope
- this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
- // 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_cdr_op_ci"
"::visit_structure - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
- // set the sub state as generating code for the output operator
- this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_OUTPUT);
- *os << "ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &strm, "
- << "const " << node->name () << " &_tao_aggregate)" << be_nl
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Set the sub state as generating code for the output operator.
+ this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_OUTPUT);
+
+ *os << "ACE_INLINE" << be_nl
+ << "CORBA::Boolean operator<< (" << be_idt << be_idt_nl
+ << "TAO_OutputCDR &strm," << be_nl
+ << "const " << node->name () << " &_tao_aggregate" << be_uidt_nl
+ << ")" << be_uidt_nl
<< "{" << be_idt_nl;
- {
- be_visitor_context* new_ctx =
- new be_visitor_context (*this->ctx_);
- be_visitor_cdr_op_field_decl field_decl (new_ctx);
- field_decl.visit_scope (node);
- }
+ be_visitor_context new_ctx (*this->ctx_);
+ be_visitor_cdr_op_field_decl field_decl (&new_ctx);
+ field_decl.visit_scope (node);
+
*os << "if (" << be_idt_nl;
- // 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_cdr_op_ci::"
"visit_structure - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
- *os << be_uidt_nl << ")"
- << be_idt_nl
+
+ *os << be_uidt_nl << " )"<< be_idt_nl
+ << "{" << be_idt_nl
<< "return 1;" << be_uidt_nl
+ << "}" << be_uidt_nl
<< "else" << be_idt_nl
- << "return 0;" << be_uidt_nl << be_uidt_nl
- << "}\n\n";
-
- // set the substate as generating code for the input operator
- this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_INPUT);
- *os << "ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &strm, "
- << node->name () << " &_tao_aggregate)" << be_nl
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Set the substate as generating code for the input operator.
+ this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_INPUT);
+
+ *os << "ACE_INLINE" << be_nl
+ << "CORBA::Boolean operator>> (" << be_idt << be_idt_nl
+ << "TAO_InputCDR &strm," << be_nl
+ << node->name () << " &_tao_aggregate" << be_uidt_nl
+ << ")" << be_uidt_nl
<< "{" << be_idt_nl;
- {
- be_visitor_context* new_ctx =
- new be_visitor_context (*this->ctx_);
- be_visitor_cdr_op_field_decl field_decl (new_ctx);
- field_decl.visit_scope (node);
- }
+ new_ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT);
+ field_decl.visit_scope (node);
+
*os << "if (" << be_idt_nl;
- // 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_cdr_op_ci"
"::visit_structure - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
- *os << be_uidt_nl << ")"
- << be_idt_nl
+
+ *os << be_uidt_nl << " )" << be_idt_nl
+ << "{" << be_idt_nl
<< "return 1;" << be_uidt_nl
+ << "}" << be_uidt_nl
<< "else" << be_idt_nl
- << "return 0;" << be_uidt_nl << be_uidt_nl
- << "}\n\n";
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
node->cli_inline_cdr_op_gen (1);
return 0;
@@ -149,5 +162,6 @@ be_visitor_structure_cdr_op_ci::post_process (be_decl *bd)
break;
};
}
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_cs.cpp
index db7f2e7cbc6..7c9c1797e4d 100644
--- a/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_cs.cpp
@@ -18,16 +18,13 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+ACE_RCSID (be_visitor_structure,
+ cdr_op_cs,
+ "$Id$")
-#include "be_visitor_structure.h"
-#include "be_visitor_field.h"
-
-ACE_RCSID(be_visitor_structure, cdr_op_cs, "$Id$")
-
-be_visitor_structure_cdr_op_cs::be_visitor_structure_cdr_op_cs (be_visitor_context *ctx)
+be_visitor_structure_cdr_op_cs::be_visitor_structure_cdr_op_cs (
+ be_visitor_context *ctx
+ )
: be_visitor_structure (ctx)
{
}
@@ -39,23 +36,25 @@ be_visitor_structure_cdr_op_cs::~be_visitor_structure_cdr_op_cs (void)
int
be_visitor_structure_cdr_op_cs::visit_structure (be_structure *node)
{
- if (node->cli_stub_cdr_op_gen () ||
- node->imported () ||
- node->is_local ())
- return 0;
+ if (node->cli_stub_cdr_op_gen ()
+ || node->imported ()
+ || node->is_local ())
+ {
+ return 0;
+ }
- // set the substate as generating code for the types defined in our scope
+ // Set the substate as generating code for the types defined in our scope.
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
- // 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_cdr_op_cs::"
"visit_structure - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
-
node->cli_stub_cdr_op_gen (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
index 518345c6d28..33a1ec1fa86 100644
--- a/TAO/TAO_IDL/be/be_visitor_structure/structure.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_structure/structure.cpp
@@ -18,16 +18,10 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+ACE_RCSID (be_visitor_structure,
+ structure,
+ "$Id$")
-#include "be_visitor_structure.h"
-
-ACE_RCSID(be_visitor_structure, structure, "$Id$")
-
-
-// generic struct visitor
be_visitor_structure::be_visitor_structure (be_visitor_context *ctx)
: be_visitor_scope (ctx)
{
@@ -37,74 +31,83 @@ be_visitor_structure::~be_visitor_structure (void)
{
}
-// visit the Structure node and its scope
int
be_visitor_structure::visit_structure (be_structure *)
{
- return -1; // must be overriden
+ 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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_STRUCT_CH:
- ctx.state (TAO_CodeGen::TAO_FIELD_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_FIELD_CH);
+ be_visitor_field_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_STRUCT_CI:
- ctx.state (TAO_CodeGen::TAO_FIELD_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_FIELD_CI);
+ be_visitor_field_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_STRUCT_CS:
- ctx.state (TAO_CodeGen::TAO_FIELD_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_FIELD_CS);
+ be_visitor_field_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_STRUCT_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_FIELD_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_FIELD_CDR_OP_CH);
+ be_visitor_field_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_STRUCT_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_FIELD_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_FIELD_CDR_OP_CI);
+ be_visitor_field_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_STRUCT_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_FIELD_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_FIELD_CDR_OP_CS);
+ be_visitor_field_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_structure::"
"visit_field - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_structure::"
"visit_field - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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
index c116228fb52..bb5fce26466 100644
--- a/TAO/TAO_IDL/be/be_visitor_structure/structure_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_structure/structure_ch.cpp
@@ -18,13 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_structure.h"
-
-ACE_RCSID(be_visitor_structure, structure_ch, "$Id$")
-
+ACE_RCSID (be_visitor_structure,
+ structure_ch,
+ "$Id$")
// ******************************************************
// for client header
@@ -48,19 +44,15 @@ int be_visitor_structure_ch::visit_structure (be_structure *node)
{
os = this->ctx_->stream ();
- *os << "struct " << node->local_name () << ";" << be_nl;
*os << "class " << node->local_name () << "_var;" << be_nl << be_nl;
*os << "struct " << be_global->stub_export_macro () << " "
<< node->local_name () << be_nl
- << "{" << be_idt << be_nl;
+ << "{" << be_idt_nl;
- // Generate the _ptr_type and _var_type typedefs
- // but we must protect against certain versions of g++
- *os << "\n#if !defined(__GNUC__) || !defined (ACE_HAS_GNUG_PRE_2_8)"
+ // Generate the _ptr_type and _var_type typedefs.
+ *os << "typedef " << node->local_name () << "_var _var_type;"
<< be_nl;
- *os << "typedef " << node->local_name () << "_var _var_type;\n"
- << "#endif /* ! __GNUC__ || g++ >= 2.8 */\n" << be_nl;
*os << "static void _tao_any_destructor (void*);"
<< be_nl << be_nl;
@@ -90,7 +82,7 @@ int be_visitor_structure_ch::visit_structure (be_structure *node)
// A class is generated for an out defn only for a variable
// length struct.
- if (node->size_type () == be_decl::VARIABLE)
+ if (node->size_type () == AST_Type::VARIABLE)
{
if (node->gen_out_defn () == -1)
{
@@ -107,19 +99,20 @@ int be_visitor_structure_ch::visit_structure (be_structure *node)
<< node->local_name () << "_out;" << be_nl << be_nl;
}
- 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))
+ if (be_global->tc_support ())
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_structure_ch::"
- "visit_structure - "
- "TypeCode declaration failed\n"
- ),
- -1);
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL);
+ be_visitor_typecode_decl visitor (&ctx);
+
+ if (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);
diff --git a/TAO/TAO_IDL/be/be_visitor_structure/structure_ci.cpp b/TAO/TAO_IDL/be/be_visitor_structure/structure_ci.cpp
index 8271008eb2b..c80cd5f007d 100644
--- a/TAO/TAO_IDL/be/be_visitor_structure/structure_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_structure/structure_ci.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_structure.h"
-
-ACE_RCSID(be_visitor_structure, structure_ci, "$Id$")
-
+ACE_RCSID (be_visitor_structure,
+ structure_ci,
+ "$Id$")
// ******************************************************
// for client inline
@@ -50,25 +45,32 @@ int be_visitor_structure_ci::visit_structure (be_structure *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_structure_ci::"
"visit_structure - "
- "codegen for _var failed\n"), -1);
+ "codegen for _var failed\n"),
+ -1);
}
- if (node->size_type () == be_decl::VARIABLE &&
+
+ if (node->size_type () == AST_Type::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);
+ "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);
+ "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
index 223d8e547d7..e17860f3972 100644
--- a/TAO/TAO_IDL/be/be_visitor_structure/structure_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_structure/structure_cs.cpp
@@ -18,18 +18,14 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_structure.h"
-#include "be_visitor_typecode/typecode_defn.h"
-
-ACE_RCSID(be_visitor_structure, structure_cs, "$Id$")
-
+ACE_RCSID (be_visitor_structure,
+ structure_cs,
+ "$Id$")
// ***************************************************************************
-// for client stubs
+// For client stubs.
// ***************************************************************************
+
be_visitor_structure_cs::be_visitor_structure_cs (be_visitor_context *ctx)
: be_visitor_structure (ctx)
{
@@ -39,8 +35,8 @@ be_visitor_structure_cs::~be_visitor_structure_cs (void)
{
}
-// Visit the structure node and its scope.
-int be_visitor_structure_cs::visit_structure (be_structure *node)
+int
+be_visitor_structure_cs::visit_structure (be_structure *node)
{
if (!node->cli_stub_gen () && !node->imported ())
{
@@ -88,4 +84,5 @@ int be_visitor_structure_cs::visit_structure (be_structure *node)
}
return 0;
+
}
diff --git a/TAO/TAO_IDL/be/be_visitor_structure_fwd.cpp b/TAO/TAO_IDL/be/be_visitor_structure_fwd.cpp
new file mode 100644
index 00000000000..3d9cd997639
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_structure_fwd.cpp
@@ -0,0 +1,31 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_structure_fwd.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for be_structure_fwd
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#include "be_structure_fwd.h"
+
+#include "be_visitor_structure_fwd.h"
+#include "be_visitor_context.h"
+#include "be_helper.h"
+
+#include "be_visitor_structure_fwd/structure_fwd_ch.cpp"
+
+ACE_RCSID (be,
+ be_visitor_structure_fwd,
+ "$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_structure_fwd/structure_fwd_ch.cpp b/TAO/TAO_IDL/be/be_visitor_structure_fwd/structure_fwd_ch.cpp
new file mode 100644
index 00000000000..c923cfa3987
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_structure_fwd/structure_fwd_ch.cpp
@@ -0,0 +1,53 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// structure_fwd_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for be_structure_fwd node in the client header.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_structure_fwd,
+ structure_fwd_ch,
+ "$Id$")
+
+be_visitor_structure_fwd_ch::be_visitor_structure_fwd_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_structure_fwd_ch::~be_visitor_structure_fwd_ch (void)
+{
+}
+
+// Visit the interface_fwd_ch node and its scope.
+int
+be_visitor_structure_fwd_ch::visit_structure_fwd (be_structure_fwd *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ // Generate a forward declaration of the class.
+ *os << "struct " << node->local_name () << ";" << be_nl;
+
+ node->cli_hdr_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 9267ece581e..9f39e9c258a 100644
--- a/TAO/TAO_IDL/be/be_visitor_typecode.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typecode.cpp
@@ -18,15 +18,34 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_array.h"
+#include "be_enum.h"
+#include "be_enum_val.h"
+#include "be_exception.h"
+#include "be_field.h"
+#include "be_interface.h"
+#include "be_module.h"
+#include "be_predefined_type.h"
+#include "be_sequence.h"
+#include "be_string.h"
+#include "be_structure.h"
+#include "be_type.h"
+#include "be_typedef.h"
+#include "be_union.h"
+#include "be_union_branch.h"
+#include "be_valuetype.h"
+#include "be_helper.h"
+#include "be_extern.h"
+#include "utl_identifier.h"
+#include "ast_union_label.h"
#include "be_visitor_typecode.h"
+#include "be_visitor_context.h"
-// include all the individual files
#include "be_visitor_typecode/typecode_decl.cpp"
#include "be_visitor_typecode/typecode_defn.cpp"
-ACE_RCSID(be, be_visitor_typecode, "$Id$")
+ACE_RCSID (be,
+ be_visitor_typecode,
+ "$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp
index aac1ea44444..5b371afd375 100644
--- a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_typecode.h"
-
-ACE_RCSID(be_visitor_typecode, typecode_decl, "$Id$")
-
+ACE_RCSID (be_visitor_typecode,
+ typecode_decl,
+ "$Id$")
// ******************************************************
// TypeCode declarations
@@ -45,6 +40,9 @@ be_visitor_typecode_decl::visit_type (be_type *node)
{
TAO_OutStream *os = this->ctx_->stream ();
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
if (node->is_nested ())
{
// We have a scoped name.
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp
index ad6851a9c3b..b5f83a29753 100644
--- a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp
@@ -18,19 +18,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+ACE_RCSID (be_visitor_typecode,
+ typecode_defn,
+ "$Id$")
-#include "be_visitor_typecode.h"
-
-ACE_RCSID(be_visitor_typecode, typecode_defn, "$Id$")
-
-
-//
// This is an implementation of C++ "scoped lock" idiom in order to
// avoid repetitive code.
-//
class Scoped_Compute_Queue_Guard
{
public:
@@ -48,17 +41,18 @@ Scoped_Compute_Queue_Guard::Scoped_Compute_Queue_Guard (
{
if (customer_ != 0)
{
- // reset the compute queue to set the stage for computing our
- // encapsulation length
+ // Reset the compute queue to set the stage for computing our
+ // encapsulation length.
customer_->queue_reset (customer_->compute_queue_);
}
}
+
Scoped_Compute_Queue_Guard::~Scoped_Compute_Queue_Guard (void)
{
if (customer_ != 0)
{
- // reset the compute queue since we must not affect computation of other
- // nodes
+ // Reset the compute queue since we must not affect computation of other
+ // nodes.
customer_->queue_reset (customer_->compute_queue_);
}
}
@@ -286,6 +280,9 @@ be_visitor_typecode_defn::visit_type (be_type *node)
-1);
}
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
os->indent (); // start from current indentation level
// Generate the typecode information here
@@ -336,19 +333,11 @@ be_visitor_typecode_defn::visit_type (be_type *node)
*os << "CORBA::tk_except";
break;
case AST_Decl::NT_interface:
- {
- // Yet another fruit of interface being a valuetype sometimes :-(
- AST_Interface* iface = AST_Interface::narrow_from_decl (node);
- if (iface != 0 && iface->is_valuetype ())
- {
- *os << "CORBA::tk_value";
- }
- else
- {
- *os << "CORBA::tk_objref";
- }
- break;
- }
+ *os << "CORBA::tk_objref";
+ break;
+ case AST_Decl::NT_valuetype:
+ *os << "CORBA::tk_value";
+ break;
case AST_Decl::NT_sequence:
*os << "CORBA::tk_sequence";
break;
@@ -391,6 +380,7 @@ be_visitor_typecode_defn::visit_type (be_type *node)
{
*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,
@@ -398,17 +388,21 @@ be_visitor_typecode_defn::visit_type (be_type *node)
"Error parsing nested name\n"),
-1);
}
- *os << "TAO_NAMESPACE_DEFINE (::CORBA::TypeCode_ptr, _tc_";
+
+ *os << "TAO_NAMESPACE_DEFINE (" << be_idt << be_idt_nl
+ << "::CORBA::TypeCode_ptr," << be_nl
+ << "_tc_";
// Local name generation.
*os << node->local_name ();
- *os << ", &_tc_TAO_tc_";
+ *os << "," << be_nl
+ << "&_tc_TAO_tc_";
// Flat name generation.
*os << node->flat_name ();
- *os << ")" << be_nl;
+ *os << be_uidt_nl << ")" << be_uidt_nl;
if (this->gen_nested_namespace_end (module) == -1)
{
@@ -1285,7 +1279,7 @@ be_visitor_typecode_defn::gen_encapsulation (be_field *node)
node->visibility() == AST_Field::vis_PRIVATE ? 0 : 1;
os->indent (); // start from current indentation level
- *os << visibility << ", // data memeber visibility marker"
+ *os << visibility << ", // data member visibility marker"
<< "\n\n";
this->tc_offset_ += sizeof (ACE_CDR::ULong);
@@ -2095,7 +2089,7 @@ be_visitor_typecode_defn::gen_encapsulation (be_union_branch *node)
this->tc_offset_ += sizeof (ACE_CDR::ULong);
break;
- case AST_Expression::EV_any:
+ case AST_Expression::EV_enum:
// enum
os->print ("0x%08.8x", (unsigned long)ev->u.eval);
// size of any aligned to 4 bytes
@@ -2178,7 +2172,7 @@ be_visitor_typecode_defn::gen_encapsulation (be_union_branch *node)
this->tc_offset_ += sizeof (ACE_CDR::ULong);
break;
- case AST_Expression::EV_any:
+ case AST_Expression::EV_enum:
// enum
os->print ("0x%08.8x", (unsigned long)dv.u.enum_val);
// size of short/wchar aligned to 4 bytes
@@ -2327,7 +2321,7 @@ be_visitor_typecode_defn::gen_encapsulation (be_valuetype *node)
// TAO doesn't support neither CUSTOM nor TRUNCATABLE
// valuetypes. So basically need to choose between
// VM_NONE = 0 and VM_ABSTRACT = 2
- ACE_CDR::ULong value_modifier = node->is_abstract_valuetype () ? 2 : 0;
+ ACE_CDR::ULong value_modifier = node->is_abstract () ? 2 : 0;
*os << value_modifier << ", // value modifier" << "\n";
@@ -2335,19 +2329,14 @@ be_visitor_typecode_defn::gen_encapsulation (be_valuetype *node)
//STEP 4: generate TypeCode of concrete base
- AST_Interface *inherited = 0;
- if (node->n_inherits () > 0 &&
- ( // Statefull base valuetype is always first
- inherited =
- AST_Interface::narrow_from_decl(node->inherits ()[0])
- ) != 0 &&
- inherited->is_valuetype () &&
- !inherited->is_abstract ()
- )
+ AST_ValueType *concrete_inherited = node->inherits_concrete ();
+
+ if (concrete_inherited != 0)
{
// Got non-abstract base valuetype. Now emit its typecode
- be_valuetype *vt = be_valuetype::narrow_from_decl(node->inherits ()[0]);
+ be_valuetype *vt = be_valuetype::narrow_from_decl(concrete_inherited);
this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE_NESTED);
+
if (!vt || vt->accept (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -2356,6 +2345,7 @@ be_visitor_typecode_defn::gen_encapsulation (be_valuetype *node)
ACE_TEXT ("failed to generate typecode\n")),
-1);
}
+
// revert the state to what it was before
this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_SCOPE);
}
@@ -3270,22 +3260,17 @@ be_visitor_typecode_defn::compute_encap_length (be_valuetype *node)
// STEP 5: get encapsulation length for concrete base valuetype
- AST_Interface *inherited = 0;
- if (node->n_inherits () > 0 &&
- ( // Statefull abse valuetype is always first
- inherited =
- AST_Interface::narrow_from_decl(node->inherits ()[0])
- ) != 0 &&
- inherited->is_valuetype () &&
- !inherited->is_abstract ()
- )
+ AST_ValueType *concrete_inherited = node->inherits_concrete ();
+
+ if (concrete_inherited != 0)
{
// Got non-abstract base valuetype.
this->computed_tc_size_ = 0;
- be_valuetype *vt = be_valuetype::narrow_from_decl(node->inherits ()[0]);
+ be_valuetype *vt = be_valuetype::narrow_from_decl (concrete_inherited);
this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_TC_SIZE);
+
if (!vt || vt->accept (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
diff --git a/TAO/TAO_IDL/be/be_visitor_typedef.cpp b/TAO/TAO_IDL/be/be_visitor_typedef.cpp
index c9ca1e8818f..964aa163a76 100644
--- a/TAO/TAO_IDL/be/be_visitor_typedef.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typedef.cpp
@@ -18,13 +18,28 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_array.h"
+#include "be_enum.h"
+#include "be_interface.h"
+#include "be_predefined_type.h"
+#include "be_sequence.h"
+#include "be_string.h"
+#include "be_structure.h"
+#include "be_type.h"
+#include "be_typedef.h"
+#include "be_union.h"
+#include "be_extern.h"
+#include "be_helper.h"
#include "be_visitor_typedef.h"
+#include "be_visitor_array.h"
+#include "be_visitor_enum.h"
+#include "be_visitor_sequence.h"
+#include "be_visitor_structure.h"
+#include "be_visitor_typecode.h"
+#include "be_visitor_union.h"
+#include "be_visitor_context.h"
-// include all the individual files
#include "be_visitor_typedef/typedef.cpp"
#include "be_visitor_typedef/typedef_ch.cpp"
#include "be_visitor_typedef/typedef_ci.cpp"
@@ -35,4 +50,6 @@
#include "be_visitor_typedef/cdr_op_ci.cpp"
#include "be_visitor_typedef/cdr_op_cs.cpp"
-ACE_RCSID(be, be_visitor_typedef, "$Id$")
+ACE_RCSID (be,
+ be_visitor_typedef,
+ "$Id$")
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
index 0d6aec20e8d..2340ba59374 100644
--- a/TAO/TAO_IDL/be/be_visitor_typedef/any_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typedef/any_op_ch.cpp
@@ -18,21 +18,17 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_typedef.h"
-
-ACE_RCSID(be_visitor_typedef, any_op_ch, "$Id$")
-
+ACE_RCSID (be_visitor_typedef,
+ any_op_ch,
+ "$Id$")
// ***************************************************************************
// 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_any_op_ch::be_visitor_typedef_any_op_ch (
+ be_visitor_context *ctx
+ )
: be_visitor_typedef (ctx)
{
}
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
index 6d8a868df16..9e01f31dc19 100644
--- a/TAO/TAO_IDL/be/be_visitor_typedef/any_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typedef/any_op_cs.cpp
@@ -18,22 +18,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_typedef.h"
-
-ACE_RCSID(be_visitor_typedef, any_op_cs, "$Id$")
-
+ACE_RCSID (be_visitor_typedef,
+ any_op_cs,
+ "$Id$")
// ***************************************************************************
// 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_any_op_cs::be_visitor_typedef_any_op_cs (
+ be_visitor_context *ctx
+ )
: be_visitor_typedef (ctx)
{
}
diff --git a/TAO/TAO_IDL/be/be_visitor_typedef/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_typedef/cdr_op_ch.cpp
index 59c3cfc9187..733e20b1715 100644
--- a/TAO/TAO_IDL/be/be_visitor_typedef/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typedef/cdr_op_ch.cpp
@@ -18,21 +18,17 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_typedef.h"
-
-ACE_RCSID(be_visitor_typedef, cdr_op_ch, "$Id$")
-
+ACE_RCSID (be_visitor_typedef,
+ cdr_op_ch,
+ "$Id$")
// ***************************************************************************
// Typedef visitor for generating Cdr operator declarations in the client header
// ***************************************************************************
-be_visitor_typedef_cdr_op_ch::be_visitor_typedef_cdr_op_ch
-(be_visitor_context *ctx)
+be_visitor_typedef_cdr_op_ch::be_visitor_typedef_cdr_op_ch (
+ be_visitor_context *ctx
+ )
: be_visitor_typedef (ctx)
{
}
@@ -51,7 +47,7 @@ be_visitor_typedef_cdr_op_ch::visit_typedef (be_typedef *node)
TAO_OutStream *os = this->ctx_->stream ();
- // generate the CDR << and >> operator declarations
+ // Generate the CDR << and >> operator declarations.
os->indent ();
// In general, we may have a chain of typedefs. i.e.,
diff --git a/TAO/TAO_IDL/be/be_visitor_typedef/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_typedef/cdr_op_ci.cpp
index 99b7c108306..573a3125c1f 100644
--- a/TAO/TAO_IDL/be/be_visitor_typedef/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typedef/cdr_op_ci.cpp
@@ -18,22 +18,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_typedef.h"
-
-ACE_RCSID(be_visitor_typedef, cdr_op_ci, "$Id$")
-
+ACE_RCSID (be_visitor_typedef,
+ cdr_op_ci,
+ "$Id$")
// ***************************************************************************
// Typedef visitor for generating CDR operator declarations in the client
// stubs file
// ***************************************************************************
-be_visitor_typedef_cdr_op_ci::be_visitor_typedef_cdr_op_ci
-(be_visitor_context *ctx)
+be_visitor_typedef_cdr_op_ci::be_visitor_typedef_cdr_op_ci (
+ be_visitor_context *ctx
+ )
: be_visitor_typedef (ctx)
{
}
@@ -50,12 +46,6 @@ be_visitor_typedef_cdr_op_ci::visit_typedef (be_typedef *node)
return 0;
}
- TAO_OutStream *os = this->ctx_->stream ();
-
- // generate the CDR << and >> operator impls
-
- os->indent ();
-
// In general, we may have a chain of typedefs. i.e.,
// typedef sequence<long> X;
// typedef X Y;
diff --git a/TAO/TAO_IDL/be/be_visitor_typedef/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_typedef/cdr_op_cs.cpp
index 91ab655906d..ba1e87f43be 100644
--- a/TAO/TAO_IDL/be/be_visitor_typedef/cdr_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typedef/cdr_op_cs.cpp
@@ -18,22 +18,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_typedef.h"
-
-ACE_RCSID(be_visitor_typedef, cdr_op_cs, "$Id$")
-
+ACE_RCSID (be_visitor_typedef,
+ cdr_op_cs,
+ "$Id$")
// ***************************************************************************
// Typedef visitor for generating CDR operator declarations in the client
// stubs file
// ***************************************************************************
-be_visitor_typedef_cdr_op_cs::be_visitor_typedef_cdr_op_cs
-(be_visitor_context *ctx)
+be_visitor_typedef_cdr_op_cs::be_visitor_typedef_cdr_op_cs (
+ be_visitor_context *ctx
+ )
: be_visitor_typedef (ctx)
{
}
@@ -46,13 +42,9 @@ int
be_visitor_typedef_cdr_op_cs::visit_typedef (be_typedef *node)
{
if (node->cli_stub_cdr_op_gen () || node->imported ())
- return 0;
-
- TAO_OutStream *os = this->ctx_->stream ();
-
- // generate the CDR << and >> operator impls
-
- os->indent ();
+ {
+ return 0;
+ }
// In general, we may have a chain of typedefs. i.e.,
// typedef sequence<long> X;
@@ -88,13 +80,14 @@ be_visitor_typedef_cdr_op_cs::visit_typedef (be_typedef *node)
// 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_cdr_op_cs::"
"visit_typedef - "
- "bad primitive base type\n"
- ), -1);
+ "bad primitive base type\n"),
+ -1);
}
// accept on this base type, but generate code for the typedef node
@@ -103,9 +96,10 @@ be_visitor_typedef_cdr_op_cs::visit_typedef (be_typedef *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef_cdr_op_cs::"
"visit_typedef - "
- "failed to accept visitor\n"
- ), -1);
+ "failed to accept visitor\n"),
+ -1);
}
+
this->ctx_->alias (0); // reset
}
else
@@ -116,13 +110,14 @@ be_visitor_typedef_cdr_op_cs::visit_typedef (be_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_cdr_op_cs::"
"visit_typedef - "
- "bad base type\n"
- ), -1);
+ "bad base type\n"),
+ -1);
}
// accept on this base type, but generate code for the typedef node
@@ -131,8 +126,8 @@ be_visitor_typedef_cdr_op_cs::visit_typedef (be_typedef *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef_cdr_op_cs::"
"visit_typedef - "
- "failed to accept visitor\n"
- ), -1);
+ "failed to accept visitor\n"),
+ -1);
}
this->ctx_->tdef (0); // reset
@@ -148,9 +143,13 @@ be_visitor_typedef_cdr_op_cs::visit_array (be_array *node)
be_type *bt;
if (this->ctx_->alias ()) // typedef of a typedef
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (!bt->imported () &&
bt->node_type () == AST_Decl::NT_array) // direct typedef of a base node
@@ -162,8 +161,8 @@ be_visitor_typedef_cdr_op_cs::visit_array (be_array *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef_cdr_op_cs::"
"visit_array - "
- "base class visitor failed \n"
- ), -1);
+ "base class visitor failed \n"),
+ -1);
}
}
@@ -171,41 +170,18 @@ be_visitor_typedef_cdr_op_cs::visit_array (be_array *node)
}
int
-be_visitor_typedef_cdr_op_cs::visit_enum (be_enum *node)
+be_visitor_typedef_cdr_op_cs::visit_sequence (be_sequence *node)
{
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_cdr_op_cs::"
- "visit_enum - "
- "base class visitor failed \n"
- ), -1);
- }
+ bt = this->ctx_->alias ();
}
-
- return 0;
-}
-
-int
-be_visitor_typedef_cdr_op_cs::visit_sequence (be_sequence *node)
-{
- be_type *bt;
-
- if (this->ctx_->alias ()) // typedef of a typedef
- bt = this->ctx_->alias ();
else
- bt = node;
+ {
+ bt = node;
+ }
if (bt->node_type () == AST_Decl::NT_sequence) // direct typedef of a base node
// type
@@ -216,8 +192,8 @@ be_visitor_typedef_cdr_op_cs::visit_sequence (be_sequence *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef_cdr_op_cs::"
"visit_sequence - "
- "base class visitor failed \n"
- ), -1);
+ "base class visitor failed \n"),
+ -1);
}
}
@@ -230,9 +206,13 @@ be_visitor_typedef_cdr_op_cs::visit_structure (be_structure *node)
be_type *bt;
if (this->ctx_->alias ()) // typedef of a typedef
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (bt->node_type () == AST_Decl::NT_struct) // direct typedef of a base node
// type
@@ -243,8 +223,8 @@ be_visitor_typedef_cdr_op_cs::visit_structure (be_structure *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef_cdr_op_cs::"
"visit_structure - "
- "base class visitor failed \n"
- ), -1);
+ "base class visitor failed \n"),
+ -1);
}
}
@@ -257,9 +237,13 @@ be_visitor_typedef_cdr_op_cs::visit_union (be_union *node)
be_type *bt;
if (this->ctx_->alias ()) // typedef of a typedef
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (bt->node_type () == AST_Decl::NT_union) // direct typedef of a base node
// type
@@ -270,8 +254,8 @@ be_visitor_typedef_cdr_op_cs::visit_union (be_union *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef_cdr_op_cs::"
"visit_union - "
- "base class visitor failed \n"
- ), -1);
+ "base class visitor failed \n"),
+ -1);
}
}
diff --git a/TAO/TAO_IDL/be/be_visitor_typedef/typedef.cpp b/TAO/TAO_IDL/be/be_visitor_typedef/typedef.cpp
index 26c232861b3..baa0f690316 100644
--- a/TAO/TAO_IDL/be/be_visitor_typedef/typedef.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typedef/typedef.cpp
@@ -18,17 +18,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_typedef.h"
-
-ACE_RCSID(be_visitor_typedef, typedef, "$Id$")
-
+ACE_RCSID (be_visitor_typedef,
+ typedef,
+ "$Id$")
// ******************************************************
-// Generic Typedef visitor
+// Generic typedef visitor.
// ******************************************************
be_visitor_typedef::be_visitor_typedef (be_visitor_context *ctx)
@@ -40,123 +35,156 @@ be_visitor_typedef::~be_visitor_typedef (void)
{
}
-// visit the Typedef node and its scope
int be_visitor_typedef::visit_typedef (be_typedef *)
{
- return -1; // must be overridden
+ return -1; // Must be overridden.
}
-// =all common visit methods for typedef visitor
+// 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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_TYPEDEF_CH:
- ctx.state (TAO_CodeGen::TAO_ARRAY_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARRAY_CH);
+ be_visitor_array_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_CS:
- ctx.state (TAO_CodeGen::TAO_ARRAY_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARRAY_CI);
+ be_visitor_array_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_CI:
- ctx.state (TAO_CodeGen::TAO_ARRAY_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARRAY_CS);
+ be_visitor_array_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_ARRAY_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARRAY_ANY_OP_CH);
+ be_visitor_array_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_ARRAY_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARRAY_ANY_OP_CS);
+ be_visitor_array_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_ARRAY_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARRAY_CDR_OP_CH);
+ be_visitor_array_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_ARRAY_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARRAY_CDR_OP_CI);
+ be_visitor_array_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_ARRAY_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARRAY_CDR_OP_CS);
+ be_visitor_array_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef::"
"visit_array - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef::"
"visit_array - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_TYPEDEF_CH:
- ctx.state (TAO_CodeGen::TAO_ENUM_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_CH);
+ be_visitor_enum_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_CS:
- ctx.state (TAO_CodeGen::TAO_ENUM_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_CS);
+ be_visitor_enum_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CH);
+ be_visitor_enum_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CS);
+ be_visitor_enum_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CH);
+ be_visitor_enum_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CI);
+ be_visitor_enum_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CS);
- break;
case TAO_CodeGen::TAO_TYPEDEF_CI:
return 0; // nothing to be done
default:
@@ -164,316 +192,287 @@ be_visitor_typedef::visit_enum (be_enum *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef::"
"visit_enum - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef::"
"visit_enum - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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 *)
-{
- 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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_TYPEDEF_CH:
- ctx.state (TAO_CodeGen::TAO_SEQUENCE_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_SEQUENCE_CH);
+ be_visitor_sequence_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_CI:
- ctx.state (TAO_CodeGen::TAO_SEQUENCE_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_SEQUENCE_CI);
+ be_visitor_sequence_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_CS:
- ctx.state (TAO_CodeGen::TAO_SEQUENCE_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_SEQUENCE_CS);
+ be_visitor_sequence_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_SEQUENCE_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_SEQUENCE_ANY_OP_CH);
+ be_visitor_sequence_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_SEQUENCE_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_SEQUENCE_ANY_OP_CS);
+ be_visitor_sequence_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CH);
+ be_visitor_sequence_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CI);
+ be_visitor_sequence_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CS);
+ be_visitor_sequence_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef::"
"visit_sequence - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef::"
"visit_sequence - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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)
+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
+ // 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
+ ctx.node (node);
+ int status = 0;
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_CDR_OP_CH:
- case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CI:
- case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CS:
- return 0; // nothing to be done
- default:
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typedef::"
- "visit_string - "
- "Bad context state\n"
- ), -1);
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CH);
+ be_visitor_structure_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ 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;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CI);
+ be_visitor_structure_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_CS:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CS);
+ be_visitor_structure_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CH);
+ be_visitor_structure_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CS);
+ be_visitor_structure_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CH);
+ be_visitor_structure_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CI);
+ be_visitor_structure_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CS);
+ be_visitor_structure_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef::"
"visit_structure - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef::"
"visit_structure - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_TYPEDEF_CH:
- ctx.state (TAO_CodeGen::TAO_UNION_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CH);
+ be_visitor_union_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_CI:
- ctx.state (TAO_CodeGen::TAO_UNION_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CI);
+ be_visitor_union_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_CS:
- ctx.state (TAO_CodeGen::TAO_UNION_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CS);
+ be_visitor_union_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CH);
+ be_visitor_union_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CS);
+ be_visitor_union_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CH);
+ be_visitor_union_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CI);
+ be_visitor_union_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CS);
+ be_visitor_union_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef::"
"visit_union - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef::"
"visit_union - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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
index 6a7af384273..87f974ce764 100644
--- a/TAO/TAO_IDL/be/be_visitor_typedef/typedef_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typedef/typedef_ch.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_typedef.h"
-
-ACE_RCSID(be_visitor_typedef, typedef_ch, "$Id$")
-
+ACE_RCSID(be_visitor_typedef,
+ typedef_ch,
+ "$Id$")
// ******************************************************
// Typedef visitor for client header
@@ -83,8 +78,7 @@ be_visitor_typedef_ch::visit_typedef (be_typedef *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef_ch::"
"visit_typedef - "
- "bad primitive base type\n"
- ),
+ "bad primitive base type\n"),
-1);
}
@@ -94,8 +88,7 @@ be_visitor_typedef_ch::visit_typedef (be_typedef *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef_ch::"
"visit_typedef - "
- "failed to accept visitor\n"
- ),
+ "failed to accept visitor\n"),
-1);
}
@@ -115,9 +108,8 @@ be_visitor_typedef_ch::visit_typedef (be_typedef *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef_ch::"
"visit_typedef - "
- "bad base type\n"
- ),
- -1);
+ "bad base type\n"),
+ -1);
}
// accept on this base type, but generate code for the typedef node.
@@ -126,28 +118,23 @@ be_visitor_typedef_ch::visit_typedef (be_typedef *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef_ch::"
"visit_typedef - "
- "failed to accept visitor\n"
- ),
- -1);
+ "failed to accept visitor\n"),
+ -1);
}
// Generate the typecode decl for this typedef node.
- // @@ NW: !bt->is_local () is a hack. There should be a way to
- // propagate bt's info up to typedef.
- if (!node->imported ())
+ if (!node->imported () && be_global->tc_support ())
{
- be_visitor *visitor;
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL);
- visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_typecode_decl visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef_ch::"
"visit_typedef - "
- "TypeCode declaration failed\n"
- ),
+ "TypeCode declaration failed\n"),
-1);
}
}
@@ -264,8 +251,7 @@ be_visitor_typedef_ch::visit_enum (be_enum *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef_ch::"
"visit_enum - "
- "base class visitor failed \n"
- ),
+ "base class visitor failed \n"),
-1);
}
}
@@ -339,8 +325,11 @@ be_visitor_typedef_ch::visit_predefined_type (be_predefined_type *node)
*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))
+ AST_PredefinedType::PredefinedType pt = node->pt ();
+
+ if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_any
+ || pt == AST_PredefinedType::PT_object)
{
// Typedef the _ptr and _var.
*os << "typedef " << bt->nested_type_name (scope, "_ptr")
@@ -413,8 +402,8 @@ be_visitor_typedef_ch::visit_sequence (be_sequence *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef_ch::"
"visit_sequence - "
- "base class visitor failed \n"
- ), -1);
+ "base class visitor failed \n"),
+ -1);
}
}
else
@@ -458,8 +447,8 @@ be_visitor_typedef_ch::visit_structure (be_structure *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef_ch::"
"visit_structure - "
- "base class visitor failed \n"
- ), -1);
+ "base class visitor failed \n"),
+ -1);
}
}
@@ -501,8 +490,8 @@ be_visitor_typedef_ch::visit_union (be_union *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef_ch::"
"visit_union - "
- "base class visitor failed \n"
- ), -1);
+ "base class visitor failed \n"),
+ -1);
}
}
diff --git a/TAO/TAO_IDL/be/be_visitor_typedef/typedef_ci.cpp b/TAO/TAO_IDL/be/be_visitor_typedef/typedef_ci.cpp
index b52ec2b573d..8e0587ef0a1 100644
--- a/TAO/TAO_IDL/be/be_visitor_typedef/typedef_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typedef/typedef_ci.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_typedef.h"
-
-ACE_RCSID(be_visitor_typedef, typedef_ci, "$Id$")
-
+ACE_RCSID (be_visitor_typedef,
+ typedef_ci,
+ "$Id$")
// ******************************************************
// Typedef visitor for client inline
@@ -77,22 +72,24 @@ be_visitor_typedef_ci::visit_typedef (be_typedef *node)
// 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);
+ "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);
+ "failed to accept visitor\n"),
+ -1);
}
this->ctx_->alias (0);
@@ -105,26 +102,29 @@ be_visitor_typedef_ci::visit_typedef (be_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);
+ "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);
+ "failed to accept visitor\n"),
+ -1);
}
this->ctx_->tdef (0);
}
+
return 0;
}
@@ -213,6 +213,7 @@ be_visitor_typedef_ci::visit_array (be_array *node)
*os << bt->name () << "_free (_tao_src);" << be_uidt_nl;
*os << "}\n\n";
}
+
return 0;
}
@@ -222,9 +223,13 @@ be_visitor_typedef_ci::visit_sequence (be_sequence *node)
be_type *bt;
if (this->ctx_->alias ()) // typedef of a typedef
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (bt->node_type () == AST_Decl::NT_sequence) // direct typedef of a base node
// type
@@ -235,10 +240,11 @@ be_visitor_typedef_ci::visit_sequence (be_sequence *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef_ci::"
"visit_sequence - "
- "base class visitor failed \n"
- ), -1);
+ "base class visitor failed \n"),
+ -1);
}
}
+
return 0;
}
@@ -248,9 +254,13 @@ be_visitor_typedef_ci::visit_structure (be_structure *node)
be_type *bt;
if (this->ctx_->alias ()) // typedef of a typedef
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (bt->node_type () == AST_Decl::NT_struct) // direct typedef of a base node
// type
@@ -261,10 +271,11 @@ be_visitor_typedef_ci::visit_structure (be_structure *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef_ci::"
"visit_structure - "
- "base class visitor failed \n"
- ), -1);
+ "base class visitor failed \n"),
+ -1);
}
}
+
return 0;
}
@@ -274,9 +285,13 @@ be_visitor_typedef_ci::visit_union (be_union *node)
be_type *bt;
if (this->ctx_->alias ()) // typedef of a typedef
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (bt->node_type () == AST_Decl::NT_union) // direct typedef of a base node
// type
@@ -287,9 +302,10 @@ be_visitor_typedef_ci::visit_union (be_union *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef_ci::"
"visit_union - "
- "base class visitor failed \n"
- ), -1);
+ "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
index 24e8b23599d..d0cc395424e 100644
--- a/TAO/TAO_IDL/be/be_visitor_typedef/typedef_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typedef/typedef_cs.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_typedef.h"
-
-ACE_RCSID(be_visitor_typedef, typedef_cs, "$Id$")
-
+ACE_RCSID (be_visitor_typedef,
+ typedef_cs,
+ "$Id$")
// ******************************************************
// Typedef visitor for client stubs
@@ -68,82 +63,83 @@ be_visitor_typedef_cs::visit_typedef (be_typedef *node)
if (this->ctx_->tdef ())
{
- // the fact that we are here indicates that we were generating code for a
+ // 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
+ // (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
+ // 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);
+ "bad primitive base type\n"),
+ -1);
}
- // accept on this base type
+
+ // 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);
+ "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
+ // The context has not stored any "tdef" node. So we must be in here for
+ // the first time.
+ this->ctx_->tdef (node);
- // grab the immediate base type 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);
+ "bad base type\n"),
+ -1);
}
- // accept on this base type
+
+ // 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);
+ "failed to accept visitor\n"),
+ -1);
}
- // @@ NW: !bt->is_local () is a hack. There should be a way to
- // propagate bt's info up to typedef.
- if (!node->imported ())
+ if (!node->imported () && be_global->tc_support ())
{
- // 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);
ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ be_visitor_typecode_defn visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_typedef_cs::"
"visit_typedef - "
- "TypeCode definition failed\n"
- ), -1);
+ "TypeCode definition failed\n"),
+ -1);
}
}
+
this->ctx_->tdef (0);
}
diff --git a/TAO/TAO_IDL/be/be_visitor_union.cpp b/TAO/TAO_IDL/be/be_visitor_union.cpp
index 17db8dd01ab..74e16f5ad55 100644
--- a/TAO/TAO_IDL/be/be_visitor_union.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union.cpp
@@ -18,13 +18,22 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_enum.h"
+#include "be_typedef.h"
+#include "be_predefined_type.h"
+#include "be_union.h"
+#include "be_union_branch.h"
+#include "be_helper.h"
+#include "be_extern.h"
+#include "ast_union_label.h"
#include "be_visitor_union.h"
+#include "be_visitor_enum.h"
+#include "be_visitor_context.h"
+#include "be_visitor_union_branch.h"
+#include "be_visitor_typecode.h"
+#include "be_visitor_context.h"
-// include all the individual files
#include "be_visitor_union/discriminant_ch.cpp"
#include "be_visitor_union/discriminant_ci.cpp"
#include "be_visitor_union/discriminant_cs.cpp"
@@ -38,4 +47,6 @@
#include "be_visitor_union/cdr_op_ci.cpp"
#include "be_visitor_union/cdr_op_cs.cpp"
-ACE_RCSID(be, be_visitor_union, "$Id$")
+ACE_RCSID (be,
+ be_visitor_union,
+ "$Id$")
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
index 3c5a274d353..8f1c86c4cbf 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/any_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/any_op_ch.cpp
@@ -18,13 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_union.h"
-
-ACE_RCSID(be_visitor_union, any_op_ch, "$Id$")
-
+ACE_RCSID (be_visitor_union,
+ any_op_ch,
+ "$Id$")
// ***************************************************************************
// Union visitor for generating Any operator declarations in the client header
@@ -45,7 +41,8 @@ int
be_visitor_union_any_op_ch::visit_union (be_union *node)
{
if (node->cli_hdr_any_op_gen ()
- || node->imported ())
+ || node->imported ()
+ || node->is_local ())
{
return 0;
}
@@ -68,8 +65,6 @@ be_visitor_union_any_op_ch::visit_union (be_union *node)
<< " operator>>= (const CORBA::Any &, const "
<< 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,
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
index 7d1f3b73b84..5590f63a5af 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp
@@ -18,13 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_union.h"
-
-ACE_RCSID(be_visitor_union, any_op_cs, "$Id$")
-
+ACE_RCSID (be_visitor_union,
+ any_op_cs,
+ "$Id$")
// ***************************************************************************
// Union visitor for generating Any operator declarations in the client
@@ -53,17 +49,10 @@ be_visitor_union_any_op_cs::visit_union (be_union *node)
TAO_OutStream *os = this->ctx_->stream ();
- // Generate the Any <<= and >>= operator definitions.
+ // Generate the Any <<= and >>= operator declarations.
os->indent ();
- *os << be_nl
- << "// TAO_IDL - Generated from " << be_nl
- << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
-
- // Copying insertion oeprator.
-
- *os << "// Copying insertion." << be_nl
- << "void operator<<= (" << be_idt << be_idt_nl
+ *os << "void operator<<= (" << be_idt << be_idt_nl
<< "CORBA::Any &_tao_any," << be_nl
<< "const " << node->name () << " &_tao_elem" << be_uidt_nl
<< ")" << be_uidt_nl
@@ -261,10 +250,7 @@ be_visitor_union_any_op_cs::visit_union (be_union *node)
int
be_visitor_union_any_op_cs::visit_union_branch (be_union_branch *node)
{
- be_type *bt;
-
- // First generate the type information.
- bt = be_type::narrow_from_decl (node->field_type ());
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
if (!bt)
{
diff --git a/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ch.cpp
index 80cb8e824ba..12169e60ba5 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ch.cpp
@@ -19,20 +19,17 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_union.h"
-
-ACE_RCSID(be_visitor_union, cdr_op_ch, "$Id$")
+ACE_RCSID (be_visitor_union,
+ cdr_op_ch,
+ "$Id$")
// ***************************************************************************
// Union visitor for generating CDR operator declarations in the client header
// ***************************************************************************
-be_visitor_union_cdr_op_ch::be_visitor_union_cdr_op_ch
-(be_visitor_context *ctx)
+be_visitor_union_cdr_op_ch::be_visitor_union_cdr_op_ch (
+ be_visitor_context *ctx
+ )
: be_visitor_union (ctx)
{
}
@@ -44,15 +41,18 @@ be_visitor_union_cdr_op_ch::~be_visitor_union_cdr_op_ch (void)
int
be_visitor_union_cdr_op_ch::visit_union (be_union *node)
{
- if (node->cli_hdr_cdr_op_gen () ||
- node->imported () ||
- node->is_local ())
- return 0;
+ if (node->cli_hdr_cdr_op_gen ()
+ || node->imported ()
+ || node->is_local ())
+ {
+ return 0;
+ }
TAO_OutStream *os = this->ctx_->stream ();
- // generate the CDR << and >> operator declarations
+ // Generate the CDR << and >> operator declarations.
os->indent ();
+
*os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator<< (TAO_OutputCDR &, const " << node->name ()
<< " &);" << be_nl;
@@ -61,15 +61,16 @@ be_visitor_union_cdr_op_ch::visit_union (be_union *node)
<< node->name () << " &);\n";
- // set the substate as generating code for the types defined in our scope
+ // Set the substate as generating code for the types defined in our scope.
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
- // 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_cdr_op_ch::"
"visit_union - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
node->cli_hdr_cdr_op_gen (1);
diff --git a/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ci.cpp
index ae148558877..cf17212389f 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ci.cpp
@@ -18,21 +18,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_union.h"
-
-ACE_RCSID(be_visitor_union, cdr_op_ci, "$Id$")
+ACE_RCSID (be_visitor_union,
+ cdr_op_ci,
+ "$Id$")
// ***************************************************************************
// Union visitor for generating CDR operator declarations in the client
// stubs file
// ***************************************************************************
-be_visitor_union_cdr_op_ci::be_visitor_union_cdr_op_ci
-(be_visitor_context *ctx)
+be_visitor_union_cdr_op_ci::be_visitor_union_cdr_op_ci (
+ be_visitor_context *ctx
+ )
: be_visitor_union (ctx)
{
}
@@ -45,28 +42,35 @@ int
be_visitor_union_cdr_op_ci::visit_union (be_union *node)
{
// already generated and/or we are imported. Don't do anything.
- if (node->cli_inline_cdr_op_gen () ||
- node->imported () ||
- node->is_local ())
- return 0;
+ if (node->cli_inline_cdr_op_gen ()
+ || node->imported ()
+ || node->is_local ())
+ {
+ return 0;
+ }
- // set the substate as generating code for the types defined in our scope
+ // Set the substate as generating code for the types defined in our scope.
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
- // 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_cdr_op_ci"
"::visit_union - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
TAO_OutStream *os = this->ctx_->stream ();
- // set the sub state as generating code for the output operator
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Set the sub state as generating code for the output operator.
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_OUTPUT);
- *os << "ACE_INLINE CORBA::Boolean operator<< (" << be_idt << be_idt_nl
+ *os << "ACE_INLINE" << be_nl
+ << "CORBA::Boolean operator<< (" << be_idt << be_idt_nl
<< "TAO_OutputCDR &strm," << be_nl
<< "const " << node->name () << " &_tao_union" << be_uidt_nl
<< ")" << be_uidt_nl
@@ -77,27 +81,28 @@ be_visitor_union_cdr_op_ci::visit_union (be_union *node)
case AST_Expression::EV_bool:
*os << "CORBA_Any::from_boolean tmp (_tao_union._d ());" << be_nl
<< "if ( !(strm << tmp) )" << be_idt_nl;
- break;
+ break;
case AST_Expression::EV_char:
*os << "CORBA_Any::from_char tmp (_tao_union._d ());" << be_nl
<< "if ( !(strm << tmp) )" << be_idt_nl;
- break;
+ break;
case AST_Expression::EV_wchar:
*os << "CORBA_Any::from_wchar tmp (_tao_union._d ());" << be_nl
<< "if ( !(strm << tmp) )" << be_idt_nl;
- break;
+ break;
default:
*os << "if ( !(strm << _tao_union._d ()) )" << be_idt_nl;
+
break;
}
*os << "{" << be_idt_nl
<< "return 0;" << be_uidt_nl
- << "}" << be_uidt_nl
- << "CORBA::Boolean result = 1;" << be_nl
+ << "}" << be_uidt_nl << be_nl
+ << "CORBA::Boolean result = 1;" << be_nl << be_nl
<< "switch (_tao_union._d ())" << be_nl
<< "{" << be_idt_nl;
@@ -106,7 +111,8 @@ be_visitor_union_cdr_op_ci::visit_union (be_union *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_cdr_op_ci::"
"visit_union - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
// If there is no explicit default case, but there
@@ -123,13 +129,14 @@ be_visitor_union_cdr_op_ci::visit_union (be_union *node)
*os << "break;";
}
- *os << be_uidt_nl << "}" << be_nl
+ *os << be_uidt_nl << "}" << be_nl << be_nl
<< "return result;" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
- // set the substate as generating code for the input operator
+ // Set the substate as generating code for the input operator.
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_INPUT);
- *os << "ACE_INLINE CORBA::Boolean operator>> (" << be_idt << be_idt_nl
+ *os << "ACE_INLINE" << be_nl
+ << "CORBA::Boolean operator>> (" << be_idt << be_idt_nl
<< "TAO_InputCDR &strm," << be_nl
<< node->name () << " &_tao_union" << be_uidt_nl
<< ")" << be_uidt_nl
@@ -147,27 +154,28 @@ be_visitor_union_cdr_op_ci::visit_union (be_union *node)
case AST_Expression::EV_bool:
*os << "CORBA_Any::to_boolean tmp (_tao_discriminant);" << be_nl
<< "if ( !(strm >> tmp) )" << be_idt_nl;
- break;
+ break;
case AST_Expression::EV_char:
*os << "CORBA_Any::to_char tmp (_tao_discriminant);" << be_nl
<< "if ( !(strm >> tmp) )" << be_idt_nl;
- break;
+ break;
case AST_Expression::EV_wchar:
*os << "CORBA_Any::to_wchar tmp (_tao_discriminant);" << be_nl
<< "if ( !(strm >> tmp) )" << be_idt_nl;
- break;
+ break;
default:
*os << "if ( !(strm >> _tao_discriminant) )" << be_idt_nl;
+
break;
}
*os << "{" << be_idt_nl
<< "return 0;" << be_uidt_nl
- << "}" << be_uidt_nl
- << "CORBA::Boolean result = 1;" << be_nl
+ << "}" << be_uidt_nl << be_nl
+ << "CORBA::Boolean result = 1;" << be_nl << be_nl
<< "switch (_tao_discriminant)" << be_nl
<< "{" << be_idt_nl;
@@ -176,7 +184,8 @@ be_visitor_union_cdr_op_ci::visit_union (be_union *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_cdr_op_ci::"
"visit_union - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
// If there is no explicit default case, but there
@@ -194,9 +203,9 @@ be_visitor_union_cdr_op_ci::visit_union (be_union *node)
*os << "break;" << be_uidt << be_uidt_nl;
}
- *os << "}" << be_nl
+ *os << "}" << be_nl << be_nl
<< "return result;" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
node->cli_inline_cdr_op_gen (1);
return 0;
@@ -210,6 +219,14 @@ be_visitor_union_cdr_op_ci::pre_process (be_decl *bd)
return 0;
}
+ // Enum val nodes are added just to help check reference
+ // clashes, since an enum declared in our scope is not itself
+ // a scope.
+ if (bd->node_type () == AST_Decl::NT_enum_val)
+ {
+ return 0;
+ }
+
TAO_OutStream *os = this->ctx_->stream ();
be_union_branch* b =
@@ -244,13 +261,18 @@ be_visitor_union_cdr_op_ci::pre_process (be_decl *bd)
}
int
-be_visitor_union_cdr_op_ci::post_process (be_decl *)
+be_visitor_union_cdr_op_ci::post_process (be_decl *bd)
{
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_SCOPE)
{
return 0;
}
+ if (bd->node_type () == AST_Decl::NT_enum_val)
+ {
+ return 0;
+ }
+
TAO_OutStream *os = this->ctx_->stream ();
*os << be_uidt_nl << "}" << be_nl
diff --git a/TAO/TAO_IDL/be/be_visitor_union/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union/cdr_op_cs.cpp
index 507a62dd743..05092325e82 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/cdr_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/cdr_op_cs.cpp
@@ -18,21 +18,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_union.h"
-
-ACE_RCSID(be_visitor_union, cdr_op_cs, "$Id$")
+ACE_RCSID (be_visitor_union,
+ cdr_op_cs,
+ "$Id$")
// ***************************************************************************
// Union visitor for generating CDR operator declarations in the client
// stubs file
// ***************************************************************************
-be_visitor_union_cdr_op_cs::be_visitor_union_cdr_op_cs
-(be_visitor_context *ctx)
+be_visitor_union_cdr_op_cs::be_visitor_union_cdr_op_cs (
+ be_visitor_context *ctx
+ )
: be_visitor_union (ctx)
{
}
@@ -45,20 +42,23 @@ int
be_visitor_union_cdr_op_cs::visit_union (be_union *node)
{
// already generated and/or we are imported. Don't do anything.
- if (node->cli_stub_cdr_op_gen () ||
- node->imported () ||
- node->is_local ())
- return 0;
+ if (node->cli_stub_cdr_op_gen ()
+ || node->imported ()
+ || node->is_local ())
+ {
+ return 0;
+ }
- // set the substate as generating code for the types defined in our scope
+ // Set the substate as generating code for the types defined in our scope
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
- // 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_cdr_op_cs"
"::visit_union - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
node->cli_stub_cdr_op_gen (1);
diff --git a/TAO/TAO_IDL/be/be_visitor_union/discriminant_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union/discriminant_ch.cpp
index 8995f570b1e..6e376df059f 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/discriminant_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/discriminant_ch.cpp
@@ -18,21 +18,17 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_union.h"
-
-ACE_RCSID(be_visitor_union, discriminant_ch, "$Id$")
-
+ACE_RCSID (be_visitor_union,
+ discriminant_ch,
+ "$Id$")
// *************************************************************************
-// be_visitor_discriminant_ch - visitor for discriminant in client header file
+// Visitor for discriminant in client header file.
// *************************************************************************
-be_visitor_union_discriminant_ch::be_visitor_union_discriminant_ch
-(be_visitor_context *ctx)
+be_visitor_union_discriminant_ch::be_visitor_union_discriminant_ch (
+ be_visitor_context *ctx
+ )
: be_visitor_decl (ctx)
{
}
@@ -71,27 +67,16 @@ be_visitor_union_discriminant_ch::visit_enum (be_enum *node)
// 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);
- }
+ be_visitor_enum_ch visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_discriminant_ch::"
"visit_enum - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
-
- delete visitor;
}
// The set method.
@@ -143,8 +128,8 @@ be_visitor_union_discriminant_ch::visit_typedef (be_typedef *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_discriminant_ch::"
"visit_typedef - "
- "Bad primitive type\n"
- ), -1);
+ "Bad primitive type\n"),
+ -1);
}
this->ctx_->alias (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
index 08611d4a894..3e5a4ce5809 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/discriminant_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/discriminant_ci.cpp
@@ -18,21 +18,17 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_union.h"
-
-ACE_RCSID(be_visitor_union, discriminant_ci, "$Id$")
-
+ACE_RCSID (be_visitor_union,
+ discriminant_ci,
+ "$Id$")
// *************************************************************************
// 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_union_discriminant_ci::be_visitor_union_discriminant_ci (
+ be_visitor_context *ctx
+ )
: be_visitor_decl (ctx)
{
}
@@ -44,21 +40,24 @@ 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
+ this->ctx_->be_node_as_union ();
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 ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
- os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream ();
// now check if we need to generate the _default () method
be_union::DefaultValue dv;
+
if (bu->default_value (dv) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -67,11 +66,14 @@ be_visitor_union_discriminant_ci::visit_enum (be_enum *node)
"computing default value failed\n"),
-1);
}
+
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
if ((dv.computed_ != 0) && (bu->default_index () == -1))
{
// only if all cases are not covered AND there is no explicit
// default, we get the _default () method
- os->indent ();
*os << "// the implicit _default () method" << be_nl;
*os << "ACE_INLINE void " << be_nl
<< bu->name () << "::_default ()" << be_nl
@@ -80,13 +82,17 @@ be_visitor_union_discriminant_ci::visit_enum (be_enum *node)
be_type* dt =
be_type::narrow_from_decl (bu->disc_type ());
+
if (dt == 0)
- return -1;
+ {
+ return -1;
+ }
// Find where was the enum defined, if it was defined in the globa
// scope, then it is easy to generate the enum values....
be_scope* scope =
be_scope::narrow_from_scope (dt->defined_in ());
+
if (scope == 0)
{
*os << node->value_to_name (dv.u.enum_val);
@@ -99,7 +105,6 @@ be_visitor_union_discriminant_ci::visit_enum (be_enum *node)
*os << ";" << be_uidt_nl << "}\n\n";
}
- os->indent ();
// the set method
*os << "// accessor to set the discriminant" << be_nl
<< "ACE_INLINE void" << be_nl
@@ -116,28 +121,33 @@ be_visitor_union_discriminant_ci::visit_enum (be_enum *node)
<< "{" << 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)
+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 ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
- os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream ();
- // now check if we need to generate the _default () method
+ // Now check if we need to generate the _default () method.
be_union::DefaultValue dv;
+
if (bu->default_value (dv) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -146,29 +156,38 @@ be_visitor_union_discriminant_ci::visit_predefined_type (be_predefined_type
"computing default value failed\n"),
-1);
}
+
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
if ((dv.computed_ != 0) && (bu->default_index () == -1))
{
- // only if all cases are not covered AND there is no explicit
- // default, we get the _default () method
- os->indent ();
+ // Only if all cases are not covered AND there is no explicit
+ // default, we get the _default () method.
+
*os << "// the implicit _default () method" << be_nl;
*os << "ACE_INLINE void " << be_nl
<< bu->name () << "::_default ()" << be_nl
<< "{" << be_idt_nl
<< "this->disc_ = ";
+
switch (bu->udisc_type ())
{
case AST_Expression::EV_short:
*os << dv.u.short_val;
+
break;
case AST_Expression::EV_ushort:
*os << dv.u.ushort_val;
+
break;
case AST_Expression::EV_long:
*os << dv.u.long_val;
+
break;
case AST_Expression::EV_ulong:
*os << dv.u.ulong_val;
+
break;
case AST_Expression::EV_char:
os->print ("'\\%d'", dv.u.char_val);
@@ -178,23 +197,26 @@ be_visitor_union_discriminant_ci::visit_predefined_type (be_predefined_type
break;
case AST_Expression::EV_bool:
*os << dv.u.bool_val;
+
break;
case AST_Expression::EV_longlong:
case AST_Expression::EV_ulonglong:
- // unimplemented
+ // Unimplemented.
default:
- // error caught earlier.
+ // Error caught earlier.
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_discriminant_ci::"
"visit_predefined_type - "
"bad or unimplemented discriminant type\n"),
-1);
}
+
*os << ";" << be_uidt_nl << "}\n\n";
}
os->indent ();
- // the set method
+
+ // The set method.
*os << "// accessor to set the discriminant" << be_nl
<< "ACE_INLINE void" << be_nl
<< bu->name () << "::_d (" << bt->name ()
@@ -203,33 +225,34 @@ be_visitor_union_discriminant_ci::visit_predefined_type (be_predefined_type
<< "this->disc_ = discval;" << be_uidt_nl
<< "}" << be_nl;
- // the get method
+ // 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)
{
- this->ctx_->alias (node); // save the typedef node for use in code generation
- // as we visit the base type
+ this->ctx_->alias (node);
- // the node to be visited in the base primitve type that gets typedefed
+ // 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);
+ "Bad primitive type\n"),
+ -1);
}
- this->ctx_->alias (0);
+ 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
index 79f75f66a28..e7c719f34da 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/discriminant_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/discriminant_cs.cpp
@@ -18,21 +18,17 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_union.h"
-
-ACE_RCSID(be_visitor_union, discriminant_cs, "$Id$")
-
+ACE_RCSID (be_visitor_union,
+ discriminant_cs,
+ "$Id$")
// *************************************************************************
-// be_visitor_discriminant_cs - visitor for discriminant in client stubs
+// Visitor for discriminant in client stubs.
// *************************************************************************
-be_visitor_union_discriminant_cs::be_visitor_union_discriminant_cs
-(be_visitor_context *ctx)
+be_visitor_union_discriminant_cs::be_visitor_union_discriminant_cs (
+ be_visitor_context *ctx
+ )
: be_visitor_decl (ctx)
{
}
@@ -48,41 +44,36 @@ be_visitor_union_discriminant_cs::visit_enum (be_enum *node)
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 ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
- if (bt->node_type () != AST_Decl::NT_typedef // not a typedef
- && bt->is_child (bu)) // bt is defined inside the union
+ if (bt->node_type () != AST_Decl::NT_typedef
+ && bt->is_child (bu))
{
- // instantiate a visitor context with a copy of our context. This info
- // will be modified based on what type of node we are visiting
+ // 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
+ ctx.node (node);
// 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)
+ be_visitor_enum_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_discriminant_cs::"
"visit_enum - "
- "codegen failed\n"
- ), -1);
+ "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
index 2b04aff5d46..46990af1820 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/union.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/union.cpp
@@ -18,16 +18,10 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+ACE_RCSID (be_visitor_union,
+ union,
+ "$Id$")
-#include "be_visitor_union.h"
-
-ACE_RCSID(be_visitor_union, union, "$Id$")
-
-
-// generic struct visitor
be_visitor_union::be_visitor_union (be_visitor_context *ctx)
: be_visitor_scope (ctx)
{
@@ -37,86 +31,104 @@ be_visitor_union::~be_visitor_union (void)
{
}
-// visit the Union node and its scope
int
be_visitor_union::visit_union (be_union *)
{
- return -1; // must be overriden
+ 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
+ // 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
+ ctx.node (node);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_UNION_PUBLIC_CH:
- ctx.state (TAO_CodeGen::TAO_UNION_PUBLIC_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_PUBLIC_CH);
+ be_visitor_union_branch_public_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_UNION_PRIVATE_CH:
- ctx.state (TAO_CodeGen::TAO_UNION_PRIVATE_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_PRIVATE_CH);
+ be_visitor_union_branch_private_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_UNION_PUBLIC_CI:
- ctx.state (TAO_CodeGen::TAO_UNION_PUBLIC_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_PUBLIC_CI);
+ be_visitor_union_branch_public_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_UNION_PUBLIC_CS:
- ctx.state (TAO_CodeGen::TAO_UNION_PUBLIC_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_PUBLIC_CS);
+ be_visitor_union_branch_public_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_UNION_PUBLIC_ASSIGN_CS:
- ctx.state (TAO_CodeGen::TAO_UNION_PUBLIC_ASSIGN_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_PUBLIC_ASSIGN_CS);
+ be_visitor_union_branch_public_assign_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_UNION_PUBLIC_RESET_CS:
- ctx.state (TAO_CodeGen::TAO_UNION_PUBLIC_RESET_CS);
- break;
- case TAO_CodeGen::TAO_UNION_PUBLIC_ACCESS_CS:
- ctx.state (TAO_CodeGen::TAO_UNION_PUBLIC_ACCESS_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_PUBLIC_RESET_CS);
+ be_visitor_union_branch_public_reset_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_UNION_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_UNION_BRANCH_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_BRANCH_CDR_OP_CH);
+ be_visitor_union_branch_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_UNION_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_UNION_BRANCH_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_BRANCH_CDR_OP_CI);
+ be_visitor_union_branch_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_UNION_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_UNION_BRANCH_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_BRANCH_CDR_OP_CS);
+ be_visitor_union_branch_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union::"
"visit_union_branch - "
- "Bad context state\n"
- ), -1);
+ "Bad context state\n"),
+ -1);
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union::"
"visit_union_branch - "
- "NUL visitor\n"
- ), -1);
+ "failed to accept 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
index 4744bff8f77..7a60fc6bbbb 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp
@@ -18,17 +18,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_union.h"
-#include "be_visitor_typecode/typecode_decl.h"
-
-ACE_RCSID(be_visitor_union, union_ch, "$Id$")
-
+ACE_RCSID (be_visitor_union,
+ union_ch,
+ "$Id$")
// ******************************************************
-// for client header
+// For client header.
// ******************************************************
be_visitor_union_ch::be_visitor_union_ch (be_visitor_context *ctx)
@@ -40,200 +35,197 @@ 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;
- be_type *bt;
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
// 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);
- if (!node->cli_hdr_gen () && !node->imported ())
- {
- os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream ();
- // Generate the ifdefined macro for the union type.
- os->gen_ifdef_macro (node->flat_name ());
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
- *os << "class " << node->local_name () << ";" << be_nl;
- *os << "class " << node->local_name () << "_var;" << be_nl << be_nl;
+ // Generate the ifdefined macro for the union type.
+ os->gen_ifdef_macro (node->flat_name ());
- *os << "class " << be_global->stub_export_macro () << " "
- << node->local_name () << be_nl
- << "{" << be_nl
- << "public:" << be_idt_nl
+ *os << "class " << node->local_name () << "_var;" << be_nl << be_nl;
- // Generate default and copy constructors.
- << node->local_name () << " (void);" << be_nl
- << node->local_name () << " (const " << node->local_name ()
- << " &);" << be_nl
- // Generate destructor.
- << "~" << node->local_name () << " (void);" << be_nl;
+ *os << "class " << be_global->stub_export_macro () << " "
+ << node->local_name () << be_nl
+ << "{" << be_nl
+ << "public:" << be_idt_nl
- *os << "static void _tao_any_destructor (void*);"
- << be_nl << be_nl;
+ // Generate default and copy constructors.
+ << node->local_name () << " (void);" << be_nl
+ << node->local_name () << " (const " << node->local_name ()
+ << " &);" << be_nl
+ // Generate destructor.
+ << "~" << node->local_name () << " (void);" << be_nl;
- // Generate assignment operator.
- *os << node->local_name () << " &operator= (const "
- << node->local_name () << " &);" << be_nl << be_nl;
+ *os << "static void _tao_any_destructor (void*);"
+ << be_nl << be_nl;
- // Retrieve the disriminant type.
- bt = be_type::narrow_from_decl (node->disc_type ());
+ // Generate assignment operator.
+ *os << node->local_name () << " &operator= (const "
+ << node->local_name () << " &);" << be_nl << be_nl;
- if (!bt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_ch::"
- "visit_union - "
- "bad disciminant type\n"),
- -1);
- }
+ // Retrieve the disriminant type.
+ be_type *bt = be_type::narrow_from_decl (node->disc_type ());
- // The discriminant type may have to be defined here if it was an enum
- // declaration inside of the union statement.
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_ch::"
+ "visit_union - "
+ "bad disciminant type\n"),
+ -1);
+ }
- ctx.state (TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CH);
- be_visitor_union_discriminant_ch visitor (&ctx);
+ // The discriminant type may have to be defined here if it was an enum
+ // declaration inside of the union statement.
- if (bt->accept (&visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_ch::"
- " visit_union - "
- "codegen for discriminant failed\n"), -1);
- }
+ ctx.state (TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CH);
+ be_visitor_union_discriminant_ch ud_visitor (&ctx);
- // Generate the _var_type typedef
- // but we must protect against certain versions of g++.
- *os << "\n#if !defined(__GNUC__) || !defined (ACE_HAS_GNUG_PRE_2_8)"
- << be_nl;
- *os << "typedef " << node->local_name () << "_var _var_type;\n"
- << "#endif /* ! __GNUC__ || g++ >= 2.8 */" << be_nl << be_nl;
+ if (bt->accept (&ud_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_ch::"
+ " visit_union - "
+ "codegen for discriminant failed\n"),
+ -1);
+ }
- // 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);
+ // Generate the _var_type typedef.
+ *os << "typedef " << node->local_name () << "_var _var_type;"
+ << be_nl << be_nl;
- 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 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);
- // Now check if we need to generate the _default () method.
- be_union::DefaultValue dv;
+ 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);
+ }
- if (node->default_value (dv) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_ch::"
- "visit_union - "
- "computing default value failed\n"),
- -1);
- }
+ // Now check if we need to generate the _default () method.
+ be_union::DefaultValue dv;
- if ((dv.computed_ != 0) && (node->default_index () == -1))
- {
- // Only if all cases are not covered AND there is no explicit
- // default, we get the _default () method.
- *os << "void _default (void);";
- }
+ if (node->default_value (dv) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_ch::"
+ "visit_union - "
+ "computing default value failed\n"),
+ -1);
+ }
- *os << be_uidt_nl;
+ if ((dv.computed_ != 0) && (node->default_index () == -1))
+ {
+ // Only if all cases are not covered AND there is no explicit
+ // default, we get the _default () method.
+ *os << "void _default (void);";
+ }
- // Now generate the private data members of the union.
- *os << "private:" << be_idt_nl;
- *os << bt->nested_type_name (node) << " disc_;" << be_nl;
- *os << bt->nested_type_name (node) << " holder_;" << be_nl << be_nl;
- // Emit the ACE_NESTED_CLASS macro.
+ *os << be_uidt_nl;
- // The members are inside of a union.
- *os << "union" << be_nl;
- *os << "{" << be_idt_nl;
- this->ctx_->state (TAO_CodeGen::TAO_UNION_PRIVATE_CH);
+ // Now generate the private data members of the union.
+ *os << "private:" << be_idt_nl;
+ *os << bt->nested_type_name (node) << " disc_;" << be_nl;
+ *os << bt->nested_type_name (node) << " holder_;" << be_nl << be_nl;
+ // Emit the ACE_NESTED_CLASS macro.
- 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);
- }
+ // The members are inside of a union.
+ *os << "union" << be_nl;
+ *os << "{" << be_idt_nl;
- *os << be_uidt_nl;
- *os << "} u_;" << be_nl << be_nl;
+ this->ctx_->state (TAO_CodeGen::TAO_UNION_PRIVATE_CH);
- // The reset method (TAO extension).
- *os << "// TAO extension." << be_nl;
- *os << "void _reset (" << bt->nested_type_name (node)
- << ", CORBA::Boolean /* finalize */);" << be_nl;
- *os << "// Frees any allocated storage." << be_uidt_nl;
- *os << "}; //" << node->name () << be_nl << be_nl;
+ 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);
+ }
- if (be_global->tc_support ())
- {
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL);
- be_visitor_typecode_decl tc_visitor (&ctx);
-
- if (tc_visitor.visit_union (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_ch::"
- "visit_union - "
- "TypeCode declaration failed\n"),
- -1);
- }
- }
+ *os << be_uidt_nl;
+ *os << "} u_;" << be_nl << be_nl;
- os->gen_endif ();
+ // The reset method (TAO extension).
+ *os << "// TAO extension." << be_nl;
+ *os << "void _reset (" << bt->nested_type_name (node)
+ << ", CORBA::Boolean /* finalize */);" << be_nl;
+ *os << "// Frees any allocated storage." << be_uidt_nl;
+ *os << "}; //" << node->name () << be_nl << be_nl;
- // Generate the ifdefined macro for the _var type.
- os->gen_ifdef_macro (node->flat_name (), "_var");
+ if (be_global->tc_support ())
+ {
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL);
+ be_visitor_typecode_decl tc_visitor (&ctx);
- // Generate var definition.
- if (node->gen_var_defn () == -1)
+ if (node->accept (&tc_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_ch::"
"visit_union - "
- "codegen for _var\n"),
+ "TypeCode declaration failed\n"),
-1);
}
+ }
- os->gen_endif ();
+ os->gen_endif ();
- // Generate the ifdefined macro for the array type.
- os->gen_ifdef_macro (node->flat_name (), "_out");
+ // Generate the ifdefined macro for the _var type.
+ os->gen_ifdef_macro (node->flat_name (), "_var");
- // 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
+ // Generate var definition.
+ 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->flat_name (), "_out");
+
+ // A class is generated for an out defn only for a variable
+ // length struct.
+ if (node->size_type () == AST_Type::VARIABLE)
+ {
+ if (node->gen_out_defn () == -1)
{
- *os << "typedef " << node->local_name () << " &"
- << node->local_name () << "_out;" << be_nl << be_nl;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_ch::"
+ "visit_union - "
+ "codegen for _out\n"), -1);
}
-
- os->gen_endif ();
- node->cli_hdr_gen (I_TRUE);
+ }
+ else
+ {
+ *os << "typedef " << node->local_name () << " &"
+ << node->local_name () << "_out;" << be_nl << be_nl;
}
+ 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
index 8edc9fa72a0..fdfac26e17a 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/union_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/union_ci.cpp
@@ -18,17 +18,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_union.h"
-
-ACE_RCSID(be_visitor_union, union_ci, "$Id$")
-
+ACE_RCSID (be_visitor_union,
+ union_ci,
+ "$Id$")
// ******************************************************
-// for client inline
+// For client inline.
// ******************************************************
be_visitor_union_ci::be_visitor_union_ci (be_visitor_context *ctx)
@@ -40,21 +35,14 @@ 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
-
+ ctx.node (node);
if (!node->cli_inline_gen () && !node->imported ())
{
- os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream ();
*os << "// *************************************************************"
<< be_nl;
@@ -64,70 +52,75 @@ int be_visitor_union_ci::visit_union (be_union *node)
// 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 ());
+ be_type *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);
+ "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)
+ ctx.state (TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CI);
+
+ be_visitor_union_discriminant_ci visitor (&ctx);
+
+ if (bt->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_ci::"
"visit union - "
- "codegen for discrminant failed\n"), -1);
+ "codegen for discrminant failed\n"),
+ -1);
}
- // now generate the implementation of the access methods for the
- // union. For this set our state
+ // 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);
+ "codegen for scope failed\n"),
+ -1);
}
- // generate the ifdefined macro for the array type
+ // Generate the ifdefined macro for the array type.
os->gen_ifdef_macro (node->flat_name (), "_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);
+ "codegen for _var failed\n"),
+ -1);
}
+
os->gen_endif ();
- // generate the ifdefined macro for the array type then generate the _out
- // impl
+ // Generate the ifdefined macro for the array type then generate the
+ // _out impl
os->gen_ifdef_macro (node->flat_name (), "_out");
- if (node->size_type () == be_decl::VARIABLE
+
+ if (node->size_type () == AST_Type::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);
+ "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
index 344a86f3c85..755939de49d 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_union.h"
-#include "be_visitor_typecode/typecode_defn.h"
-
-ACE_RCSID(be_visitor_union, union_cs, "$Id$")
-
+ACE_RCSID (be_visitor_union,
+ union_cs,
+ "$Id$")
// ******************************************************
// For client stubs.
@@ -43,143 +38,152 @@ 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;
- be_type *bt = 0;
-
- if (!node->cli_stub_gen () && !node->imported ())
+ 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);
- }
+ return 0;
+ }
- ctx.state (TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CS);
- be_visitor_union_discriminant_cs disc_visitor (&ctx);
+ TAO_OutStream *os = this->ctx_->stream ();
- if (bt->accept (&disc_visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_cs::"
- "visit union - "
- "codegen for discrminant failed\n"),
- -1);
- }
+ 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.
- // 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);
+ be_type *bt = be_type::narrow_from_decl (node->disc_type ());
- 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);
- }
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_cs::"
+ "visit_union - "
+ "bad discriminant type\n"), -1);
+ }
- // Now generate the operations on the union such as the copy constructor
- // and the assignment operator.
+ ctx.state (TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CS);
+ be_visitor_union_discriminant_cs disc_visitor (&ctx);
- *os << "// *************************************************************"
- << be_nl;
- *os << "// Operations for union " << node->name () << be_nl
- << "// TAO_IDL - Generated from" << be_nl
- << "// " << __FILE__ << ":" << __LINE__ << be_nl;
- *os << "// *************************************************************\n\n";
+ if (bt->accept (&disc_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_cs::"
+ "visit union - "
+ "codegen for discrminant failed\n"),
+ -1);
+ }
- // Generate the copy constructor and the assignment operator here.
- os->indent ();
- *os << node->name () << "::" << node->local_name () << " (void)" << be_nl
- << "{" << be_idt_nl
- << "ACE_OS::memset (&this->disc_, 0, sizeof (this->disc_));" << be_nl
- << "ACE_OS::memset (&this->u_, 0, sizeof (this->u_));" << be_nl
- << "this->disc_ = ";
+ // 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);
- // The default constructor must initialize the discriminator
- // to the first case label value found in the union declaration
- // so that, if the uninitialized union is inserted into an Any,
- // the Any destructor's call to deep_free() will work properly.
- UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ 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
+ << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
+ *os << "// *************************************************************\n\n";
+
+ // Generate the copy constructor and the assignment operator here.
+ os->indent ();
+ *os << node->name () << "::" << node->local_name () << " (void)" << be_nl
+ << "{" << be_idt_nl
+ << "ACE_OS::memset (&this->disc_, 0, sizeof (this->disc_));" << be_nl
+ << "ACE_OS::memset (&this->u_, 0, sizeof (this->u_));" << be_nl
+ << "this->disc_ = ";
+
+ // The default constructor must initialize the discriminator
+ // to the first case label value found in the union declaration
+ // so that, if the uninitialized union is inserted into an Any,
+ // the Any destructor's call to deep_free() will work properly.
+ UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ be_union_branch *ub = 0;
+
+ // In case we have some bogus enum values from an enum declared
+ // in our scope.
+ while (ub == 0)
+ {
// Just get the union's first member.
AST_Decl *d = si.item ();
- be_union_branch *ub = be_union_branch::narrow_from_decl (d);
+ ub = be_union_branch::narrow_from_decl (d);
+ si.next ();
+ }
- // Get the first label in its list.
- AST_UnionLabel *ul = ub->label (0);
+ // Get the first label in its list.
+ AST_UnionLabel *ul = ub->label (0);
- if (ul->label_kind () == AST_UnionLabel::UL_label)
- {
- ub->gen_label_value (os);
- }
- else
- {
- ub->gen_default_label_value (os, node);
- }
+ if (ul->label_kind () == AST_UnionLabel::UL_label)
+ {
+ ub->gen_label_value (os);
+ }
+ else
+ {
+ ub->gen_default_label_value (os, node);
+ }
- *os << ";";
+ *os << ";";
- *os << be_uidt_nl << "}" << be_nl << be_nl;
+ *os << be_uidt_nl << "}" << be_nl << be_nl;
- this->ctx_->state (TAO_CodeGen::TAO_UNION_PUBLIC_ASSIGN_CS);
+ this->ctx_->state (TAO_CodeGen::TAO_UNION_PUBLIC_ASSIGN_CS);
- // So we know we are generating the copy constructor.
- this->ctx_->sub_state (TAO_CodeGen::TAO_UNION_COPY_CONSTRUCTOR);
+ // So we know we are generating the copy constructor.
+ this->ctx_->sub_state (TAO_CodeGen::TAO_UNION_COPY_CONSTRUCTOR);
- *os << node->name () << "::" << node->local_name ()
- << " (const ::" << node->name () << " &u)"
- << be_nl;
- *os << "{" << be_idt_nl;
- *os << "this->disc_ = u.disc_;" << be_nl;
- *os << "switch (this->disc_)" << be_nl;
- *os << "{" << be_idt_nl;
+ *os << node->name () << "::" << node->local_name ()
+ << " (const ::" << node->name () << " &u)"
+ << be_nl;
+ *os << "{" << be_idt_nl;
+ *os << "this->disc_ = u.disc_;" << be_nl;
+ *os << "switch (this->disc_)" << be_nl;
+ *os << "{" << be_idt_nl;
- 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);
- }
+ 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);
+ }
- // If there is no explicit default case, but there
- // is an implicit one, and the discriminant is an enum,
- // we need this to avert warnings in some compilers that
- // not all case values are included. If there is no
- // implicit default case, or the discriminator is not
- // an enum, this does no harm.
- if (node->default_index () == -1)
- {
- *os << "default:" << be_nl
- << "break;";
- }
+ // If there is no explicit default case, but there
+ // is an implicit one, and the discriminant is an enum,
+ // we need this to avert warnings in some compilers that
+ // not all case values are included. If there is no
+ // implicit default case, or the discriminator is not
+ // an enum, this does no harm.
+ if (node->default_index () == -1)
+ {
+ *os << "default:" << be_nl
+ << "break;";
+ }
- *os << be_uidt_nl << "}" << be_uidt_nl
- << "}" << be_nl << be_nl;
+ *os << be_uidt_nl << "}" << be_uidt_nl
+ << "}" << be_nl << be_nl;
- *os << "// destructor" << be_nl
- << node->name () << "::~" << node->local_name ()
- << " (void)" << be_nl
- << "{" << be_idt_nl
- << "// finalize" << be_nl
- << "this->_reset (this->disc_, 1);" << be_uidt_nl
- << "}" << be_nl << be_nl;
+ *os << "// destructor" << be_nl
+ << node->name () << "::~" << node->local_name ()
+ << " (void)" << be_nl
+ << "{" << be_idt_nl
+ << "// finalize" << be_nl
+ << "this->_reset (this->disc_, 1);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ if (!node->is_local ())
+ {
*os << "void "
<< node->name ()
<< "::_tao_any_destructor (void *_tao_void_pointer)" << be_nl
@@ -188,116 +192,115 @@ int be_visitor_union_cs::visit_union (be_union *node)
<< node->local_name () << "*, _tao_void_pointer);" << be_nl
<< "delete tmp;" << be_uidt_nl
<< "}\n" << be_nl;
+ }
- this->ctx_->state (TAO_CodeGen::TAO_UNION_PUBLIC_ASSIGN_CS);
+ this->ctx_->state (TAO_CodeGen::TAO_UNION_PUBLIC_ASSIGN_CS);
+
+ // Reset this for generating the assignment operator.
+ this->ctx_->sub_state (TAO_CodeGen::TAO_SUB_STATE_UNKNOWN);
+
+ // Assignment operator.
+ os->indent ();
+ *os << "// assignment operator" << be_nl;
+ *os << node->name () << " &" << be_nl;
+ *os << node->name () << "::operator= (const ::"
+ << node->name () << " &u)" << be_nl;
+ *os << "{" << be_idt_nl;
+ // First check for self-assignment.
+ *os << "if (&u == this)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return *this;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+ // Reset and set the discriminant.
+ *os << "this->_reset (u.disc_, 0);" << be_nl;
+ *os << "this->disc_ = u.disc_;" << be_nl << be_nl;
+ // now switch based on the disc value
+ *os << "switch (this->disc_)" << be_nl;
+ *os << "{" << be_idt_nl;
+
+ 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);
+ }
- // Reset this for generating the assignment operator.
- this->ctx_->sub_state (TAO_CodeGen::TAO_SUB_STATE_UNKNOWN);
+ // If there is no explicit default case, but there
+ // is an implicit one, and the discriminant is an enum,
+ // we need this to avert warnings in some compilers that
+ // not all case values are included. If there is no
+ // implicit default case, or the discriminator is not
+ // an enum, this does no harm.
+ if (node->default_index () == -1)
+ {
+ *os << "default:" << be_nl
+ << "break;" << be_uidt_nl;
+ }
+ else
+ {
+ *os << be_uidt_nl;
+ }
- // Assignment operator.
- os->indent ();
- *os << "// assignment operator" << be_nl;
- *os << node->name () << " &" << be_nl;
- *os << node->name () << "::operator= (const ::"
- << node->name () << " &u)" << be_nl;
- *os << "{" << be_idt_nl;
- // First check for self-assignment.
- *os << "if (&u == this)" << be_idt_nl
- << "{" << be_idt_nl
- << "return *this;" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl;
- // Reset and set the discriminant.
- *os << "this->_reset (u.disc_, 0);" << be_nl;
- *os << "this->disc_ = u.disc_;" << be_nl << be_nl;
- // now switch based on the disc value
- *os << "switch (this->disc_)" << be_nl;
- *os << "{" << be_idt_nl;
-
- 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 << "}" << be_nl << be_nl;
+ *os << "return *this;" << be_uidt_nl;
+ *os << "}\n\n";
+
+ // The reset method.
+ this->ctx_->state (TAO_CodeGen::TAO_UNION_PUBLIC_RESET_CS);
+ os->indent ();
+ *os << "// reset method to reset old values of a union" << be_nl;
+ *os << "void " << node->name () << "::_reset (" << bt->name ()
+ << ", CORBA::Boolean /*finalize*/)" << be_nl;
+ *os << "{" << be_idt_nl;
+ *os << "switch (this->disc_)" << be_nl;
+ *os << "{" << be_idt_nl;
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_cs"
+ "visit_union - "
+ "codegen for reset failed\n"),
+ -1);
+ }
- // If there is no explicit default case, but there
- // is an implicit one, and the discriminant is an enum,
- // we need this to avert warnings in some compilers that
- // not all case values are included. If there is no
- // implicit default case, or the discriminator is not
- // an enum, this does no harm.
- if (node->default_index () == -1)
- {
- *os << "default:" << be_nl
- << "break;" << be_uidt_nl;
- }
- else
- {
- *os << be_uidt_nl;
- }
+ // If there is no explicit default case, but there
+ // is an implicit one, and the discriminant is an enum,
+ // we need this to avert warnings in some compilers that
+ // not all case values are included. If there is no
+ // implicit default case, or the discriminator is not
+ // an enum, this does no harm.
+ if (node->default_index () == -1)
+ {
+ os->decr_indent (0);
+ *os << "default:" << be_nl;
+ os->incr_indent ();
+ *os << "break;";
+ }
- *os << "}" << be_nl << be_nl;
- *os << "return *this;" << be_uidt_nl;
- *os << "}\n\n";
-
- // The reset method.
- this->ctx_->state (TAO_CodeGen::TAO_UNION_PUBLIC_RESET_CS);
- os->indent ();
- *os << "// reset method to reset old values of a union" << be_nl;
- *os << "void " << node->name () << "::_reset (" << bt->name ()
- << ", CORBA::Boolean /*finalize*/)" << be_nl;
- *os << "{" << be_idt_nl;
- *os << "switch (this->disc_)" << be_nl;
- *os << "{" << be_idt_nl;
-
- if (this->visit_scope (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_cs"
- "visit_union - "
- "codegen for reset failed\n"),
- -1);
- }
+ *os << be_uidt_nl << "}" << be_uidt_nl
+ << "}\n\n";
- // If there is no explicit default case, but there
- // is an implicit one, and the discriminant is an enum,
- // we need this to avert warnings in some compilers that
- // not all case values are included. If there is no
- // implicit default case, or the discriminator is not
- // an enum, this does no harm.
- if (node->default_index () == -1)
- {
- os->decr_indent (0);
- *os << "default:" << be_nl;
- os->incr_indent ();
- *os << "break;";
- }
+ if (!node->is_local () && be_global->tc_support ())
+ {
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN);
+ ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
- *os << be_uidt_nl << "}" << be_uidt_nl
- << "}\n\n";
+ be_visitor_typecode_defn tc_visitor (&ctx);
- if (be_global->tc_support ())
+ if (tc_visitor.visit_union (node) == -1)
{
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN);
- ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
-
- be_visitor_typecode_defn tc_visitor (&ctx);
-
- if (tc_visitor.visit_union (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_cs::"
- "visit_union - "
- "TypeCode definition failed\n"),
- -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);
}
+ 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 0898d4cc7ad..21dd19b7c64 100644
--- a/TAO/TAO_IDL/be/be_visitor_union_branch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch.cpp
@@ -17,17 +17,34 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_array.h"
+#include "be_enum.h"
+#include "be_interface.h"
+#include "be_interface_fwd.h"
+#include "be_predefined_type.h"
+#include "be_sequence.h"
+#include "be_string.h"
+#include "be_structure.h"
+#include "be_typedef.h"
+#include "be_union.h"
+#include "be_union_branch.h"
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
+#include "be_helper.h"
+#include "ast_union_label.h"
+#include "utl_identifier.h"
#include "be_visitor_union_branch.h"
+#include "be_visitor_array.h"
+#include "be_visitor_enum.h"
+#include "be_visitor_sequence.h"
+#include "be_visitor_structure.h"
+#include "be_visitor_union.h"
+#include "be_visitor_context.h"
-// 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_reset_cs.cpp"
-#include "be_visitor_union_branch/public_access_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"
@@ -35,4 +52,6 @@
#include "be_visitor_union_branch/cdr_op_ci.cpp"
#include "be_visitor_union_branch/cdr_op_cs.cpp"
-ACE_RCSID(be, be_visitor_union_branch, "$Id$")
+ACE_RCSID (be,
+ be_visitor_union_branch,
+ "$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ch.cpp
index d066471016b..50a96af0e65 100644
--- a/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ch.cpp
@@ -19,276 +19,203 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_union_branch.h"
-
-ACE_RCSID(be_visitor_union_branch, cdr_op_ch, "$Id$")
-
+ACE_RCSID (be_visitor_union_branch,
+ cdr_op_ch,
+ "$Id$")
// **********************************************
-// visitor for union_branch in the client header file
+// Visitor for union_branch in the client header file.
// **********************************************
-// constructor
-be_visitor_union_branch_cdr_op_ch::be_visitor_union_branch_cdr_op_ch (be_visitor_context *ctx)
+be_visitor_union_branch_cdr_op_ch::be_visitor_union_branch_cdr_op_ch (
+ be_visitor_context *ctx
+ )
: be_visitor_decl (ctx)
{
}
-// destructor
be_visitor_union_branch_cdr_op_ch::~be_visitor_union_branch_cdr_op_ch (void)
{
}
-// visit the union_branch node
int
be_visitor_union_branch_cdr_op_ch::visit_union_branch (be_union_branch *node)
{
be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_cdr_op_ch::"
"visit_union_branch - "
- "Bad union_branch type\n"
- ), -1);
+ "Bad union_branch type\n"),
+ -1);
}
- this->ctx_->node (node); // save the node
+ this->ctx_->node (node);
+
if (bt->accept (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_cdr_op_ch::"
"visit_union_branch - "
- "codegen for union_branch type failed\n"
- ), -1);
+ "codegen for union_branch type failed\n"),
+ -1);
}
return 0;
}
-// =visit operations on all possible data types that a union_branch can be
+// Visit operations on all possible data types that a union_branch can be.
-// visit array type
int
be_visitor_union_branch_cdr_op_ch::visit_array (be_array *node)
{
- // if not a typedef and we are defined in the use scope, we must be defined
+ // If not a typedef and we are defined in the use scope, we must be defined.
- if (!this->ctx_->alias () // not a typedef
+ if (!this->ctx_->alias ()
&& node->is_child (this->ctx_->scope ()))
{
- // this is the case for anonymous arrays.
+ // This is the case for anonymous arrays.
- // 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
+ ctx.node (node);
- // first generate the struct declaration
ctx.state (TAO_CodeGen::TAO_ARRAY_CDR_OP_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_cdr_op_ch::"
- "visit_array - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_array_cdr_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_cdr_op_ch::"
"visit_array - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
return 0;
}
-// visit enum type
int
be_visitor_union_branch_cdr_op_ch::visit_enum (be_enum *node)
{
- // if not a typedef and we are defined in the use scope, we must be defined
- if (!this->ctx_->alias () // not a typedef
+ // If not a typedef and we are defined in the use scope, we must be defined.
+ if (!this->ctx_->alias ()
&& 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
+ ctx.node (node);
- // first generate the enum declaration
ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_cdr_op_ch::"
- "visit_enum - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_enum_cdr_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_cdr_op_ch::"
"visit_enum - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
return 0;
}
-// visit sequence type
int
be_visitor_union_branch_cdr_op_ch::visit_sequence (be_sequence *node)
{
- // if not a typedef and we are defined in the use scope, we must be defined
- if (!this->ctx_->alias () // not a typedef
+ // If not a typedef and we are defined in the use scope, we must be defined.
+ if (!this->ctx_->alias ()
&& 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
+ ctx.node (node);
- // first generate the sequence declaration
ctx.state (TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_cdr_op_ch::"
- "visit_sequence - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_sequence_cdr_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_cdr_op_ch::"
"visit_sequence - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
return 0;
}
-// visit structure type
int
be_visitor_union_branch_cdr_op_ch::visit_structure (be_structure *node)
{
- // if not a typedef and we are defined in the use scope, we must be defined
-
- if (!this->ctx_->alias () // not a typedef
+ // If not a typedef and we are defined in the use scope, we must be defined.
+ if (!this->ctx_->alias ()
&& 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
+ ctx.node (node);
- // first generate the struct declaration
ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_cdr_op_ch::"
- "visit_struct - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_structure_cdr_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_cdr_op_ch::"
"visit_struct - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
return 0;
}
-// visit typedefed type
int
be_visitor_union_branch_cdr_op_ch::visit_typedef (be_typedef *node)
{
- // save the node for use in code generation and
- // indicate that the union_branch of the union_branch node
- // is a typedefed quantity
this->ctx_->alias (node);
- // 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_cdr_op_ch::"
"visit_typedef - "
- "Bad primitive type\n"
- ), -1);
+ "Bad primitive type\n"),
+ -1);
}
+
this->ctx_->alias (0);
return 0;
}
-// visit union type
int
be_visitor_union_branch_cdr_op_ch::visit_union (be_union *node)
{
- // if not a typedef and we are defined in the use scope, we must be defined
- if (!this->ctx_->alias () // not a typedef
+ // If not a typedef and we are defined in the use scope, we must be defined.
+ if (!this->ctx_->alias ()
&& 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
+ ctx.node (node);
- // first generate the enum declaration
ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_cdr_op_ch::"
- "visit_enum - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_union_cdr_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_cdr_op_ch::"
"visit_enum - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ci.cpp
index 6545710d540..dd4e8b98fd1 100644
--- a/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ci.cpp
@@ -18,18 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_union_branch.h"
-#include "be_visitor_array.h"
-#include "be_visitor_enum.h"
-#include "be_visitor_sequence.h"
-#include "be_visitor_structure.h"
-#include "be_visitor_union.h"
-
-ACE_RCSID(be_visitor_union_branch, cdr_op_ci, "$Id$")
-
+ACE_RCSID (be_visitor_union_branch,
+ cdr_op_ci,
+ "$Id$")
// **********************************************
// Visitor for union_branch in the client stubs file.
@@ -295,7 +286,7 @@ be_visitor_union_branch_cdr_op_ci::visit_interface (be_interface *node)
{
case TAO_CodeGen::TAO_CDR_INPUT:
*os << node->name () << "_var _tao_union_tmp;" << be_nl
- << "result = strm >> _tao_union_tmp.inout ();" << be_nl
+ << "result = strm >> _tao_union_tmp.inout ();" << be_nl << be_nl
<< "if (result)" << be_idt_nl
<< "{" << be_idt_nl
<< "_tao_union."
@@ -350,7 +341,7 @@ be_visitor_union_branch_cdr_op_ci::visit_interface_fwd (be_interface_fwd *node)
{
case TAO_CodeGen::TAO_CDR_INPUT:
*os << node->name () << "_var _tao_union_tmp;" << be_nl
- << "result = strm >> _tao_union_tmp.inout ();" << be_nl
+ << "result = strm >> _tao_union_tmp.inout ();" << be_nl << be_nl
<< "if (result)" << be_idt_nl
<< "{" << be_idt_nl
<< "_tao_union."
@@ -383,6 +374,116 @@ be_visitor_union_branch_cdr_op_ci::visit_interface_fwd (be_interface_fwd *node)
}
int
+be_visitor_union_branch_cdr_op_ci::visit_valuetype (be_valuetype *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the union_branch node.
+ be_union_branch *f = this->ctx_->be_node_as_union_branch ();
+
+ if (!f)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_cdr_op_ci::"
+ "visit_valuetype - "
+ "cannot retrieve union_branch node\n"),
+ -1);
+ }
+
+ // Check what is the code generations substate. Are we generating code for
+ // the in/out operators for our parent or for us?
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ *os << node->name () << "_var _tao_union_tmp;" << be_nl
+ << "result = strm >> _tao_union_tmp.inout ();" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union."
+ << f->local_name () << " (_tao_union_tmp.in ());" << be_nl
+ << "_tao_union._d (_tao_discriminant);" << be_uidt_nl
+ << "}" << be_uidt;
+
+ break;
+
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "result = strm << _tao_union."
+ << f->local_name () << " ();";
+ break;
+
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Nothing to be done because an interface cannot be declared inside a
+ // union.
+ break;
+
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_cdr_op_ci::"
+ "visit_valuetype - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_cdr_op_ci::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the union_branch node.
+ be_union_branch *f = this->ctx_->be_node_as_union_branch ();
+
+ if (!f)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_cdr_op_ci::"
+ "visit_valuetype_fwd - "
+ "cannot retrieve union_branch node\n"),
+ -1);
+ }
+
+ // Check what is the code generations substate. Are we generating code for
+ // the in/out operators for our parent or for us?
+ switch (this->ctx_->sub_state ())
+ {
+ case TAO_CodeGen::TAO_CDR_INPUT:
+ *os << node->name () << "_var _tao_union_tmp;" << be_nl
+ << "result = strm >> _tao_union_tmp.inout ();" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union."
+ << f->local_name () << " (_tao_union_tmp.in ());" << be_nl
+ << "_tao_union._d (_tao_discriminant);" << be_uidt_nl
+ << "}" << be_uidt;
+
+ break;
+
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "result = strm << _tao_union."
+ << f->local_name () << " ();";
+ break;
+
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Nothing to be done because an interface cannot be forward declared
+ // inside a union.
+ break;
+
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_cdr_op_ci::"
+ "visit_valuetype_fwd - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
be_visitor_union_branch_cdr_op_ci::visit_predefined_type (be_predefined_type *node)
{
TAO_OutStream *os = this->ctx_->stream ();
@@ -399,24 +500,30 @@ be_visitor_union_branch_cdr_op_ci::visit_predefined_type (be_predefined_type *no
-1);
}
+ AST_PredefinedType::PredefinedType pt = node->pt ();
+
// Check what is the code generations substate. Are we generating code for
// the in/out operators for our parent or for us?
switch (this->ctx_->sub_state ())
{
case TAO_CodeGen::TAO_CDR_INPUT:
+ if (pt == AST_PredefinedType::PT_object)
+ {
+ char *local_name = node->local_name ()->get_string ();
+
+ *os << "CORBA::Object_var _tao_union_tmp;" << be_nl;
+
+ *os << "result = strm >> _tao_union_tmp.out ();" << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name () << " (_tao_union_tmp.in ());";
- if (node->pt () == AST_PredefinedType::PT_pseudo)
+ }
+ else if (pt == AST_PredefinedType::PT_pseudo)
{
char *local_name = node->local_name ()->get_string ();
- if (!ACE_OS::strcmp (local_name, "TypeCode"))
- {
- *os << "CORBA::TypeCode_var _tao_union_tmp;" << be_nl;
- }
- else if (!ACE_OS::strcmp (local_name, "Object"))
- {
- *os << "CORBA::Object_var _tao_union_tmp;" << be_nl;
- }
+ *os << "CORBA::TypeCode_var _tao_union_tmp;" << be_nl;
//@@TODO - case for ValueBase.
@@ -426,7 +533,7 @@ be_visitor_union_branch_cdr_op_ci::visit_predefined_type (be_predefined_type *no
<< "_tao_union." << f->local_name () << " (_tao_union_tmp.in ());";
}
- else if (node->pt () == AST_PredefinedType::PT_char)
+ else if (pt == AST_PredefinedType::PT_char)
{
*os << "CORBA::Char _tao_union_tmp;" << be_nl
<< "CORBA::Any::to_char _tao_union_helper "
@@ -437,7 +544,7 @@ be_visitor_union_branch_cdr_op_ci::visit_predefined_type (be_predefined_type *no
<< "_tao_union." << f->local_name ()
<< " (_tao_union_tmp);";
}
- else if (node->pt () == AST_PredefinedType::PT_wchar)
+ else if (pt == AST_PredefinedType::PT_wchar)
{
*os << "CORBA::WChar _tao_union_tmp;" << be_nl
<< "CORBA::Any::to_wchar _tao_union_helper "
@@ -448,7 +555,7 @@ be_visitor_union_branch_cdr_op_ci::visit_predefined_type (be_predefined_type *no
<< "_tao_union." << f->local_name ()
<< " (_tao_union_tmp);";
}
- else if (node->pt () == AST_PredefinedType::PT_octet)
+ else if (pt == AST_PredefinedType::PT_octet)
{
*os << "CORBA::Octet _tao_union_tmp;" << be_nl
<< "CORBA::Any::to_octet _tao_union_helper "
@@ -459,7 +566,7 @@ be_visitor_union_branch_cdr_op_ci::visit_predefined_type (be_predefined_type *no
<< "_tao_union." << f->local_name ()
<< " (_tao_union_tmp);";
}
- else if (node->pt () == AST_PredefinedType::PT_boolean)
+ else if (pt == AST_PredefinedType::PT_boolean)
{
*os << "CORBA::Boolean _tao_union_tmp;" << be_nl
<< "CORBA::Any::to_boolean _tao_union_helper "
@@ -490,26 +597,27 @@ be_visitor_union_branch_cdr_op_ci::visit_predefined_type (be_predefined_type *no
*os << "result = ";
- if (node->pt () == AST_PredefinedType::PT_pseudo)
+ if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
{
*os << "strm << _tao_union." << f->local_name () << " ();";
}
- else if (node->pt () == AST_PredefinedType::PT_char)
+ else if (pt == AST_PredefinedType::PT_char)
{
*os << "strm << CORBA::Any::from_char (_tao_union."
<< f->local_name () << " ());";
}
- else if (node->pt () == AST_PredefinedType::PT_wchar)
+ else if (pt == AST_PredefinedType::PT_wchar)
{
*os << "strm << CORBA::Any::from_wchar (_tao_union."
<< f->local_name () << " ());";
}
- else if (node->pt () == AST_PredefinedType::PT_octet)
+ else if (pt == AST_PredefinedType::PT_octet)
{
*os << "strm << CORBA::Any::from_octet (_tao_union."
<< f->local_name () << " ());";
}
- else if (node->pt () == AST_PredefinedType::PT_boolean)
+ else if (pt == AST_PredefinedType::PT_boolean)
{
*os << "strm << CORBA::Any::from_boolean (_tao_union."
<< f->local_name () << " ());";
diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_cs.cpp
index 37bbb15f6a4..0be5d282013 100644
--- a/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_cs.cpp
@@ -18,132 +18,82 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_union_branch.h"
-
-ACE_RCSID(be_visitor_union_branch, cdr_op_cs, "$Id$")
-
+ACE_RCSID (be_visitor_union_branch,
+ cdr_op_cs,
+ "$Id$")
// **********************************************
-// visitor for union_branch in the client stubs file
+// Visitor for union_branch in the client stubs file.
// **********************************************
-// constructor
-be_visitor_union_branch_cdr_op_cs::be_visitor_union_branch_cdr_op_cs (be_visitor_context *ctx)
+be_visitor_union_branch_cdr_op_cs::be_visitor_union_branch_cdr_op_cs (
+ be_visitor_context *ctx
+ )
: be_visitor_decl (ctx)
{
}
-// destructor
be_visitor_union_branch_cdr_op_cs::~be_visitor_union_branch_cdr_op_cs (void)
{
}
-// visit the union_branch node
int
be_visitor_union_branch_cdr_op_cs::visit_union_branch (be_union_branch *node)
{
be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_cdr_op_cs::"
"visit_union_branch - "
- "Bad union_branch type\n"
- ), -1);
+ "Bad union_branch type\n"),
+ -1);
}
- this->ctx_->node (node); // save the node
+ this->ctx_->node (node);
+
if (bt->accept (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_cdr_op_cs::"
"visit_union_branch - "
- "codegen for union_branch type failed\n"
- ), -1);
+ "codegen for union_branch type failed\n"),
+ -1);
}
+
return 0;
}
-// visit array
int
be_visitor_union_branch_cdr_op_cs::visit_array (be_array *node)
{
- // if not a typedef and we are defined in the use scope, we must be defined
-
+ // 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 ()))
{
- // this is the case for anonymous arrays.
-
- // instantiate a visitor context with a copy of our context. This info
- // will be modified based on what type of node we are visiting
+ // This is the case for anonymous arrays.
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 declaration
+ ctx.node (node);
ctx.state (TAO_CodeGen::TAO_ARRAY_CDR_OP_CS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_cdr_op_cs::"
- "visit_array - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_array_cdr_op_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_cdr_op_cs::"
"visit_array - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
+
return 0;
}
-// visit enum type
int
be_visitor_union_branch_cdr_op_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_CDR_OP_CS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_cdr_op_cs::"
- "visit_enum - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_cdr_op_cs::"
- "visit_enum - "
- "codegen failed\n"
- ), -1);
- }
- delete visitor;
- }
return 0;
}
@@ -152,134 +102,91 @@ be_visitor_union_branch_cdr_op_cs::visit_sequence (be_sequence *node)
{
if (node->node_type () != AST_Decl::NT_typedef
&& node->is_child (this->ctx_->scope ()))
- // not a typedef AND
- // node is defined inside the structure
{
// Anonymous sequence
- // 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.node (node);
ctx.state (TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_cdr_op_cs::"
- "visit_sequence - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_sequence_cdr_op_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_cdr_op_cs::"
"visit_sequence - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
+
return 0;
}
-// visit structure type
int
be_visitor_union_branch_cdr_op_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
+ if (node->node_type () != AST_Decl::NT_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
-
- // generate the inline code for structs
+ ctx.node (node);
ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_cdr_op_cs::"
- "visit_struct - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_structure_cdr_op_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_cdr_op_cs::"
"visit_struct - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
+
return 0;
}
-// visit typedef type
int
be_visitor_union_branch_cdr_op_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
+ this->ctx_->alias (node);
- // the node to be visited in the base primitve type that gets typedefed
+ // 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);
+ "Bad primitive type\n"),
+ -1);
}
this->ctx_->alias (0);
return 0;
}
-// visit union type
int
be_visitor_union_branch_cdr_op_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
+ if (node->node_type () != AST_Decl::NT_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
-
- // generate the inline code for union
+ ctx.node (node);
ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_cdr_op_cs::"
- "visit_union - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_union_cdr_op_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_cdr_op_cs::"
"visit_union - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
+
return 0;
}
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
index 3b71f0e6d59..884c849fef8 100644
--- a/TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp
@@ -19,21 +19,18 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_union_branch.h"
-
-ACE_RCSID(be_visitor_union_branch, private_ch, "$Id$")
-
+ACE_RCSID (be_visitor_union_branch,
+ private_ch,
+ "$Id$")
// **********************************************
// 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_union_branch_private_ch::be_visitor_union_branch_private_ch (
+ be_visitor_context *ctx
+ )
: be_visitor_decl (ctx)
{
}
@@ -54,8 +51,7 @@ be_visitor_union_branch_private_ch::visit_union_branch (be_union_branch *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_private_ch::"
"visit_union_branch - "
- "Bad union_branch type\n"
- ),
+ "Bad union_branch type\n"),
-1);
}
@@ -66,16 +62,13 @@ be_visitor_union_branch_private_ch::visit_union_branch (be_union_branch *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_private_ch::"
"visit_union_branch - "
- "codegen for union_branch type failed\n"
- ),
+ "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)
{
@@ -83,7 +76,7 @@ be_visitor_union_branch_private_ch::visit_array (be_array *node)
be_decl *bu = this->ctx_->scope ();
be_type *bt;
- // Check if we are visiting this node via a visit to a typedef node
+ // Check if we are visiting this node via a visit to a typedef node.
if (this->ctx_->alias ())
{
bt = this->ctx_->alias ();
@@ -98,8 +91,7 @@ be_visitor_union_branch_private_ch::visit_array (be_array *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_private_ch::"
"visit_array - "
- "bad context information\n"
- ),
+ "bad context information\n"),
-1);
}
@@ -144,8 +136,7 @@ be_visitor_union_branch_private_ch::visit_enum (be_enum *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_private_ch::"
"visit_enum - "
- "bad context information\n"
- ),
+ "bad context information\n"),
-1);
}
@@ -179,8 +170,7 @@ be_visitor_union_branch_private_ch::visit_interface (be_interface *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_private_ch::"
"visit_interface - "
- "bad context information\n"
- ),
+ "bad context information\n"),
-1);
}
@@ -214,8 +204,75 @@ be_visitor_union_branch_private_ch::visit_interface_fwd (be_interface_fwd *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_private_ch::"
"visit_interface_fwd - "
- "bad context information\n"
- ),
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << bt->nested_type_name (bu, "_var")
+ << " *" << ub->local_name () << "_;" << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_private_ch::visit_valuetype (be_valuetype *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+ 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);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << bt->nested_type_name (bu, "_var")
+ << " *" << ub->local_name () << "_;" << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_private_ch::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+ 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);
}
@@ -251,25 +308,21 @@ be_visitor_union_branch_private_ch::visit_predefined_type (
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_private_ch::"
"visit_predefined_type - "
- "bad context information\n"
- ),
+ "bad context information\n"),
-1);
}
TAO_OutStream *os = this->ctx_->stream ();
- if (node->pt () == AST_PredefinedType::PT_pseudo)
+ if (node->pt () == AST_PredefinedType::PT_object)
+ {
+ *os << bt->name () << "_var"
+ << " *" << ub->local_name () << "_;" << be_nl;
+ }
+ else if (node->pt () == AST_PredefinedType::PT_pseudo)
{
- // Cannot have an object inside of a union.
- // Check if we are dealing with a CORBA::Object
- if (!ACE_OS::strcmp (node->local_name ()->get_string (), "Object"))
- {
- *os << bt->name () << "_var"
- << " *" << ub->local_name () << "_;" << be_nl;
- }
- else
- *os << bt->nested_type_name (bu, "_ptr") << " " << ub->local_name ()
- << "_;" << be_nl;
+ *os << bt->nested_type_name (bu, "_ptr") << " " << ub->local_name ()
+ << "_;" << be_nl;
}
else if (node->pt () == AST_PredefinedType::PT_any)
{
@@ -309,8 +362,7 @@ be_visitor_union_branch_private_ch::visit_sequence (be_sequence *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_private_ch::"
"visit_sequence - "
- "bad context information\n"
- ),
+ "bad context information\n"),
-1);
}
@@ -335,8 +387,7 @@ be_visitor_union_branch_private_ch::visit_string (be_string *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_private_ch::"
"visit_string - "
- "bad context information\n"
- ),
+ "bad context information\n"),
-1);
}
@@ -376,15 +427,14 @@ be_visitor_union_branch_private_ch::visit_structure (be_structure *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_private_ch::"
"visit_structure - "
- "bad context information\n"
- ),
+ "bad context information\n"),
-1);
}
TAO_OutStream *os = this->ctx_->stream ();
// If we are variable sized, we need a pointer type.
- if (node->size_type () == be_decl::VARIABLE
+ if (node->size_type () == AST_Type::VARIABLE
|| node->has_constructor ())
{
*os << bt->nested_type_name (bu) << " *" << ub->local_name ()
@@ -412,8 +462,7 @@ be_visitor_union_branch_private_ch::visit_typedef (be_typedef *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_private_ch::"
"visit_typedef - "
- "Bad primitive type\n"
- ),
+ "Bad primitive type\n"),
-1);
}
@@ -443,8 +492,7 @@ be_visitor_union_branch_private_ch::visit_union (be_union *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_private_ch::"
"visit_union - "
- "bad context information\n"
- ),
+ "bad context information\n"),
-1);
}
diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/public_access_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_access_cs.cpp
deleted file mode 100644
index bce48e20e18..00000000000
--- a/TAO/TAO_IDL/be/be_visitor_union_branch/public_access_cs.cpp
+++ /dev/null
@@ -1,446 +0,0 @@
-//
-// $Id$
-//
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO IDL
-//
-// = FILENAME
-// public_access_cs.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"
-
-ACE_RCSID(be_visitor_union_branch, public_access_cs, "$Id$")
-
-
-// *****************************************************
-// visitor for union_branch in the client
-// stubs file for the access method
-// *****************************************************
-
-// constructor
-be_visitor_union_branch_public_access_cs::
-be_visitor_union_branch_public_access_cs (be_visitor_context *ctx)
- : be_visitor_decl (ctx)
-{
-}
-
-// destructor
-be_visitor_union_branch_public_access_cs::
-~be_visitor_union_branch_public_access_cs (void)
-{
-}
-
-// visit the union_branch node
-int
-be_visitor_union_branch_public_access_cs::
-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
-
- for (unsigned long i = 0;
- i < node->label_list_length ();
- ++i)
- {
- // check if we are printing the default case
- if (node->label (i)->label_kind () == AST_UnionLabel::UL_default)
- *os << "default:";
- else
- {
- *os << "case ";
- node->gen_label_value (os, i);
- *os << ":";
- }
- if (i == (node->label_list_length () - 1))
- *os << be_idt_nl;
- else
- *os << be_nl;
- }
-
- 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_access_cs::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_access_cs::"
- "visit_enum - "
- "bad context information\n"
- ), -1);
- }
-
- // for anonymous arrays, the type name has a _ prepended. We compute the
- // fullname with or without the underscore and use it later on.
- char fname [NAMEBUFSIZE]; // to hold the full and
-
- // save the node's local name and full name in a buffer for quick use later
- // on
- ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
- if (bt->node_type () != AST_Decl::NT_typedef // not a typedef
- && bt->is_child (bu)) // bt is defined inside the union
- {
- // for anonymous arrays ...
- // we have to generate a name for us that has an underscope prepended to
- // our local name. This needs to be inserted after the parents's name
-
- if (bt->is_nested ())
- {
- be_decl *parent = be_scope::narrow_from_scope (bt->defined_in ())->decl ();
- ACE_OS::sprintf (fname, "%s::_%s", parent->full_name (),
- bt->local_name ()->get_string ());
- }
- else
- {
- ACE_OS::sprintf (fname, "_%s", bt->full_name ());
- }
- }
- else
- {
- // typedefed node
- ACE_OS::sprintf (fname, "%s", bt->full_name ());
- }
-
- os = this->ctx_->stream ();
- *os << "if (alloc_flag)" << be_idt_nl
- << "this->u_." << ub->local_name () << "_ = " << fname
- << "_alloc ();" << be_uidt_nl
- << "return this->u_." << ub->local_name () << "_;" << be_uidt_nl;
-
- return 0;
-}
-
-int
-be_visitor_union_branch_public_access_cs::visit_enum (be_enum *)
-{
- 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
-
- if (!ub || !bu)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_public_access_cs::"
- "visit_enum - "
- "bad context information\n"
- ), -1);
- }
- TAO_OutStream *os = this->ctx_->stream ();
- *os << "ACE_UNUSED_ARG (alloc_flag);" << be_nl
- << "return &this->u_." << ub->local_name () << "_;" << be_uidt_nl;
-
- return 0;
-}
-
-int
-be_visitor_union_branch_public_access_cs::visit_interface (be_interface *node)
-{
- 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_access_cs::"
- "visit_interface - "
- "bad context information\n"
- ), -1);
- }
- TAO_OutStream *os = this->ctx_->stream ();
- *os << "if (alloc_flag)" << be_idt_nl
- << "ACE_NEW_RETURN (this->u_." << ub->local_name () << "_, "
- << "("
- << bt->name () << "_var), 0);" << be_uidt_nl
- << "return this->u_." << ub->local_name () << "_;" << be_uidt_nl;
-
- return 0;
-}
-
-int
-be_visitor_union_branch_public_access_cs::visit_interface_fwd (be_interface_fwd *)
-{
- 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
-
- if (!ub || !bu)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_public_access_cs::"
- "visit_interface - "
- "bad context information\n"
- ), -1);
- }
- TAO_OutStream *os = this->ctx_->stream ();
- *os << "ACE_UNUSED_ARG (alloc_flag);" << be_nl
- << "return (CORBA::Object_ptr) &this->u_." << ub->local_name ()
- << "_->inout ();" << be_uidt_nl;
-
- return 0;
-}
-
-int
-be_visitor_union_branch_public_access_cs::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_access_cs::"
- "visit_interface - "
- "bad context information\n"
- ), -1);
- }
- os = this->ctx_->stream ();
-
- switch (node->pt ())
- {
- case AST_PredefinedType::PT_pseudo:
- *os << "ACE_UNUSED_ARG (alloc_flag);" << be_nl
- << "return &this->u_." << ub->local_name () << "_;" << be_uidt_nl;
- break;
- case AST_PredefinedType::PT_any:
- *os << "if (alloc_flag)" << be_idt_nl
- << "ACE_NEW_RETURN (this->u_." << ub->local_name ()
- << "_, " << bt->name () << ", 0);" << be_uidt_nl
- << "return this->u_." << ub->local_name () << "_;" << be_uidt_nl;
- break;
- case AST_PredefinedType::PT_void:
- *os << "ACE_UNUSED_ARG (alloc_flag);" << be_nl;
- break;
- default:
- *os << "ACE_UNUSED_ARG (alloc_flag);" << be_nl
- << "return &this->u_." << ub->local_name () << "_;" << be_uidt_nl;
- }
- return 0;
-}
-
-int
-be_visitor_union_branch_public_access_cs::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_access_cs::"
- "visit_sequence - "
- "bad context information\n"
- ), -1);
- }
- os = this->ctx_->stream ();
- *os << "if (alloc_flag)" << be_idt_nl
- << "ACE_NEW_RETURN (this->u_." << ub->local_name ()
- << "_, " << bt->name () << ", 0);" << be_uidt_nl
- << "return this->u_." << ub->local_name () << "_;" << be_uidt_nl;
-
- return 0;
-}
-
-int
-be_visitor_union_branch_public_access_cs::visit_string (be_string *)
-{
- 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
-
- if (!ub || !bu)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_public_access_cs::"
- "visit_string - "
- "bad context information\n"
- ), -1);
- }
- TAO_OutStream *os = this->ctx_->stream ();
- *os << "ACE_UNUSED_ARG (alloc_flag);" << be_nl
- << "return &this->u_." << ub->local_name () << "_;" << be_uidt_nl;
-
- return 0;
-}
-
-int
-be_visitor_union_branch_public_access_cs::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_access_cs::"
- "visit_structure - "
- "bad context information\n"
- ), -1);
- }
- os = this->ctx_->stream ();
- if (bt->size_type () == be_type::VARIABLE
- || node->has_constructor ())
- {
- *os << "if (alloc_flag)" << be_idt_nl
- << "ACE_NEW_RETURN (this->u_." << ub->local_name ()
- << "_, " << bt->name () << ", 0);" << be_uidt_nl
- << "return this->u_." << ub->local_name () << "_;" << be_uidt_nl;
- }
- else
- {
- *os << "ACE_UNUSED_ARG (alloc_flag);" << be_nl
- << "return &this->u_." << ub->local_name () << "_;" << be_uidt_nl;
- }
-
- return 0;
-}
-
-int
-be_visitor_union_branch_public_access_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_access_cs::"
- "visit_typedef - "
- "Bad primitive type\n"
- ), -1);
- }
-
- this->ctx_->alias (0);
- return 0;
-}
-
-int
-be_visitor_union_branch_public_access_cs::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_access_cs::"
- "visit_union - "
- "bad context information\n"
- ), -1);
- }
- os = this->ctx_->stream ();
- *os << "if (alloc_flag)" << be_idt_nl
- << "ACE_NEW_RETURN (this->u_." << ub->local_name ()
- << "_, " << bt->name () << ", 0);" << be_uidt_nl
- << "return this->u_." << ub->local_name () << "_;" << be_uidt_nl;
-
- 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
index 6349e48d814..1f04625d53c 100644
--- 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
@@ -18,14 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_union_branch.h"
-
-ACE_RCSID(be_visitor_union_branch, public_assign_cs, "$Id$")
-
+ACE_RCSID (be_visitor_union_branch,
+ public_assign_cs,
+ "$Id$")
// **********************************************
// visitor for union_branch in the client stubs file generating the code for
@@ -33,21 +28,23 @@ ACE_RCSID(be_visitor_union_branch, public_assign_cs, "$Id$")
// **********************************************
// constructor
-be_visitor_union_branch_public_assign_cs::be_visitor_union_branch_public_assign_cs
-(be_visitor_context *ctx)
+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)
+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)
+be_visitor_union_branch_public_assign_cs::visit_union_branch (
+ be_union_branch *node
+ )
{
TAO_OutStream *os = this->ctx_->stream ();
@@ -386,6 +383,146 @@ be_visitor_union_branch_public_assign_cs::visit_interface_fwd (
}
int
+be_visitor_union_branch_public_assign_cs::visit_valuetype (be_valuetype *node)
+{
+ 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_assign_cs::"
+ "visit_valuetype - "
+ "bad context information\n"
+ ), -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ idl_bool bt_is_defined = node->is_defined ();
+
+ *os << "if (u.u_." << ub->local_name () << "_ == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "this->u_." << ub->local_name () << "_ = 0;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "else" << be_idt_nl
+ << "{" << be_idt_nl;
+
+ // So the template will work with the macro.
+ *os << "typedef "
+ << bt->name () << "_var OBJECT_FIELD;" << be_nl;
+ *os << "CORBA::add_ref (u.u_." << ub->local_name ()
+ << "_->ptr ());" << be_nl;
+
+ if (this->ctx_->sub_state () == TAO_CodeGen::TAO_UNION_COPY_CONSTRUCTOR)
+ {
+ // We are generating the copy constructor.
+ *os << "ACE_NEW (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << "OBJECT_FIELD (u.u_." << ub->local_name () << "_->ptr ())"
+ << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl;
+ }
+ else
+ {
+ // We are generating the assignment operator.
+ *os << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << "OBJECT_FIELD (u.u_." << ub->local_name () << "_->ptr ()),"
+ << be_nl
+ << "*this" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl;
+ }
+
+ *os << "}" << be_uidt << be_uidt_nl;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_assign_cs::visit_valuetype_fwd (
+ be_valuetype_fwd *node
+ )
+{
+ 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_assign_cs::"
+ "visit_valuetype_fwd - "
+ "bad context information\n"
+ ), -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ idl_bool bt_is_defined = node->full_definition ()->is_defined ();
+
+ *os << "if (u.u_." << ub->local_name () << "_ == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "this->u_." << ub->local_name () << "_ = 0;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "else" << be_idt_nl
+ << "{" << be_idt_nl;
+
+ // So the template will work with the macro.
+ *os << "typedef "
+ << bt->name () << "_var OBJECT_FIELD;" << be_nl;
+
+ if (this->ctx_->sub_state () == TAO_CodeGen::TAO_UNION_COPY_CONSTRUCTOR)
+ {
+ // We are generating the copy constructor.
+ *os << "ACE_NEW (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << "OBJECT_FIELD (u.u_." << ub->local_name () << "_->ptr ())"
+ << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl;
+ }
+ else
+ {
+ // We are generating the assignment operator.
+ *os << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << "OBJECT_FIELD (u.u_." << ub->local_name () << "_->ptr ()),"
+ << be_nl
+ << "*this" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl;
+ }
+
+ *os << "}" << be_uidt << be_uidt_nl;
+
+ return 0;
+}
+
+int
be_visitor_union_branch_public_assign_cs::visit_predefined_type (
be_predefined_type *node
)
@@ -420,36 +557,38 @@ be_visitor_union_branch_public_assign_cs::visit_predefined_type (
// set the discriminant to the appropriate label
switch (node->pt ())
{
- case AST_PredefinedType::PT_pseudo:
- if (!ACE_OS::strcmp (node->local_name ()->get_string (), "Object"))
+ case AST_PredefinedType::PT_object:
+ // So the template will work with the macro.
+ *os << "typedef CORBA::Object_var OBJECT_FIELD;" << be_nl;
+
+ if (this->ctx_->sub_state () == TAO_CodeGen::TAO_UNION_COPY_CONSTRUCTOR)
{
- // So the template will work with the macro.
- *os << "typedef CORBA::Object_var OBJECT_FIELD;" << be_nl;
-
- if (this->ctx_->sub_state () == TAO_CodeGen::TAO_UNION_COPY_CONSTRUCTOR)
- // We are generating the copy constructor.
- *os << "ACE_NEW (" << be_idt << be_idt_nl
- << "this->u_." << ub->local_name () << "_," << be_nl
- << "OBJECT_FIELD (CORBA::Object"
- << "::_duplicate (u.u_." << ub->local_name ()
- << "_->ptr ()))" << be_uidt_nl
- << ");" << be_uidt << be_uidt_nl;
- else
- // We are generating the assignment operator.
- *os << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
- << "this->u_." << ub->local_name () << "_," << be_nl
- << "OBJECT_FIELD (CORBA::Object"
- << "::_duplicate (u.u_." << ub->local_name ()
- << "_->ptr ()))," << be_nl
- << "*this" << be_uidt_nl
- << ");" << be_uidt << be_uidt_nl;
+ // We are generating the copy constructor.
+ *os << "ACE_NEW (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << "OBJECT_FIELD (CORBA::Object"
+ << "::_duplicate (u.u_." << ub->local_name ()
+ << "_->ptr ()))" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl;
}
else
{
- *os << "this->u_." << ub->local_name () << "_ = "
- << bt->name () << "::_duplicate (u.u_."
- << ub->local_name () << "_);" << be_uidt_nl;
+ // We are generating the assignment operator.
+ *os << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << "OBJECT_FIELD (CORBA::Object"
+ << "::_duplicate (u.u_." << ub->local_name ()
+ << "_->ptr ()))," << be_nl
+ << "*this" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl;
}
+
+ break;
+ case AST_PredefinedType::PT_pseudo:
+ *os << "this->u_." << ub->local_name () << "_ = "
+ << bt->name () << "::_duplicate (u.u_."
+ << ub->local_name () << "_);" << be_uidt_nl;
+
break;
case AST_PredefinedType::PT_any:
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_UNION_COPY_CONSTRUCTOR)
@@ -483,6 +622,7 @@ be_visitor_union_branch_public_assign_cs::visit_predefined_type (
<< ");" << be_uidt << be_uidt_nl
<< "}" << be_uidt << be_uidt_nl;
}
+
break;
case AST_PredefinedType::PT_void:
break;
@@ -490,6 +630,7 @@ be_visitor_union_branch_public_assign_cs::visit_predefined_type (
*os << "// set the value" << be_nl
<< "this->u_." << ub->local_name () << "_ = "
<< "u.u_." << ub->local_name () << "_;" << be_uidt_nl;
+
break;
}
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
index 4d184a3099d..0341c745ea1 100644
--- a/TAO/TAO_IDL/be/be_visitor_union_branch/public_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_ch.cpp
@@ -18,32 +18,25 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_union_branch.h"
-
-ACE_RCSID(be_visitor_union_branch, public_ch, "$Id$")
-
+ACE_RCSID (be_visitor_union_branch,
+ public_ch,
+ "$Id$")
// **********************************************
-// visitor for union_branch in the client header file
+// 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_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)
{
@@ -66,8 +59,7 @@ be_visitor_union_branch_public_ch::visit_union_branch (be_union_branch *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ch::"
"visit_union_branch - "
- "codegen for union_branch type failed\n"
- ),
+ "codegen for union_branch type failed\n"),
-1);
}
@@ -76,7 +68,6 @@ be_visitor_union_branch_public_ch::visit_union_branch (be_union_branch *node)
// 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)
{
@@ -99,8 +90,7 @@ be_visitor_union_branch_public_ch::visit_array (be_array *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ch::"
"visit_array - "
- "bad context information\n"
- ),
+ "bad context information\n"),
-1);
}
@@ -112,26 +102,12 @@ be_visitor_union_branch_public_ch::visit_array (be_array *node)
{
// This is the case of an anonymous array inside a 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);
-
- // First generate the array 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);
- }
+ be_visitor_array_ch visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ch::"
@@ -141,8 +117,6 @@ be_visitor_union_branch_public_ch::visit_array (be_array *node)
-1);
}
- delete visitor;
-
// Now use this array as a "type" for the subsequent declarator
// the set method.
*os << "void " << ub->local_name () << " ("
@@ -166,7 +140,6 @@ be_visitor_union_branch_public_ch::visit_array (be_array *node)
return 0;
}
-// Visit enum type.
int
be_visitor_union_branch_public_ch::visit_enum (be_enum *node)
{
@@ -189,47 +162,29 @@ be_visitor_union_branch_public_ch::visit_enum (be_enum *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ch::"
"visit_enum - "
- "bad context information\n"
- ),
+ "bad context information\n"),
-1);
}
TAO_OutStream *os = this->ctx_->stream ();
// Not a typedef and bt is defined inside the union.
- if (bt->node_type () != AST_Decl::NT_typedef // not a typedef
- && bt->is_child (bu)) // bt is defined inside the union
+ if (bt->node_type () != AST_Decl::NT_typedef
+ && bt->is_child (bu))
{
- // 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);
-
- // 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);
- }
+ be_visitor_enum_ch visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ch::"
"visit_enum - "
- "codegen failed\n"
- ),
+ "codegen failed\n"),
-1);
}
-
- delete visitor;
}
// Now use this enum as a "type" for the subsequent declarator
@@ -244,7 +199,6 @@ be_visitor_union_branch_public_ch::visit_enum (be_enum *node)
return 0;
}
-// Visit interface type.
int
be_visitor_union_branch_public_ch::visit_interface (be_interface *node)
{
@@ -267,8 +221,7 @@ be_visitor_union_branch_public_ch::visit_interface (be_interface *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ch::"
"visit_interface - "
- "bad context information\n"
- ),
+ "bad context information\n"),
-1);
}
@@ -281,10 +234,10 @@ be_visitor_union_branch_public_ch::visit_interface (be_interface *node)
// Get method.
*os << bt->nested_type_name (bu, "_ptr") << " " << ub->local_name ()
<< " (void) const;" << be_nl << be_nl;
+
return 0;
}
-// Visit interface forward type.
int
be_visitor_union_branch_public_ch::visit_interface_fwd (be_interface_fwd *node)
{
@@ -307,8 +260,7 @@ be_visitor_union_branch_public_ch::visit_interface_fwd (be_interface_fwd *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ch::"
"visit_interface_fwd - "
- "bad context information\n"
- ),
+ "bad context information\n"),
-1);
}
@@ -325,7 +277,6 @@ be_visitor_union_branch_public_ch::visit_interface_fwd (be_interface_fwd *node)
return 0;
}
-// Visit valuetype type.
int
be_visitor_union_branch_public_ch::visit_valuetype (be_valuetype *node)
{
@@ -348,8 +299,7 @@ be_visitor_union_branch_public_ch::visit_valuetype (be_valuetype *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ch::"
"visit_valuetype - "
- "bad context information\n"
- ),
+ "bad context information\n"),
-1);
}
@@ -366,7 +316,6 @@ be_visitor_union_branch_public_ch::visit_valuetype (be_valuetype *node)
return 0;
}
-// Visit valuetype forward type.
int
be_visitor_union_branch_public_ch::visit_valuetype_fwd (be_valuetype_fwd *node)
{
@@ -389,8 +338,7 @@ be_visitor_union_branch_public_ch::visit_valuetype_fwd (be_valuetype_fwd *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ch::"
"visit_valuetype_fwd - "
- "bad context information\n"
- ),
+ "bad context information\n"),
-1);
}
@@ -407,7 +355,6 @@ be_visitor_union_branch_public_ch::visit_valuetype_fwd (be_valuetype_fwd *node)
return 0;
}
-// Visit predefined type.
int
be_visitor_union_branch_public_ch::visit_predefined_type (be_predefined_type *node)
{
@@ -430,8 +377,7 @@ be_visitor_union_branch_public_ch::visit_predefined_type (be_predefined_type *no
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ch::"
"visit_predefined_type - "
- "bad context information\n"
- ),
+ "bad context information\n"),
-1);
}
@@ -440,6 +386,7 @@ be_visitor_union_branch_public_ch::visit_predefined_type (be_predefined_type *no
switch (node->pt ())
{
case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
*os << "void " << ub->local_name () << " ("
<< bt->nested_type_name (bu, "_ptr") << ");" << be_nl;
*os << bt->nested_type_name (bu, "_ptr") << " " << ub->local_name ()
@@ -447,10 +394,10 @@ be_visitor_union_branch_public_ch::visit_predefined_type (be_predefined_type *no
break;
case AST_PredefinedType::PT_any:
*os << "void " << ub->local_name () << " ("
- << bt->nested_type_name (bu) << ");" << be_nl;
- *os << "const " << bt->nested_type_name (bu) << " "
+ << bt->nested_type_name (bu) << " &);" << be_nl;
+ *os << "const " << bt->nested_type_name (bu) << " &"
<< ub->local_name () << " (void) const;" << be_nl << be_nl;
- *os << bt->nested_type_name (bu) << " "
+ *os << bt->nested_type_name (bu) << " &"
<< ub->local_name () << " (void);" << be_nl << be_nl;
break;
case AST_PredefinedType::PT_void:
@@ -465,7 +412,6 @@ be_visitor_union_branch_public_ch::visit_predefined_type (be_predefined_type *no
return 0;
}
-// visit sequence type
int
be_visitor_union_branch_public_ch::visit_sequence (be_sequence *node)
{
@@ -488,8 +434,7 @@ be_visitor_union_branch_public_ch::visit_sequence (be_sequence *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ch::"
"visit_sequence - "
- "bad context information\n"
- ),
+ "bad context information\n"),
-1);
}
@@ -499,47 +444,25 @@ be_visitor_union_branch_public_ch::visit_sequence (be_sequence *node)
if (bt->node_type () != AST_Decl::NT_typedef
&& bt->is_child (bu))
{
- // 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);
-
- // 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);
- }
+ be_visitor_sequence_ch visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ch::"
"visit_sequence - "
- "codegen failed\n"
- ),
+ "codegen failed\n"),
-1);
}
- delete visitor;
-
- // Generate the anonymous sequence member typedef
- // but we must protect against certain versions of g++.
+ // Generate the anonymous sequence member typedef.
// This provides a consistent name to use instead of the
// implementation-specific name.
- *os << "\n#if !defined (__GNUC__) || !defined (ACE_HAS_GNUG_PRE_2_8)"
- << be_nl
- << "typedef " << bt->nested_type_name (bu)
- << " _" << ub->local_name () << "_seq;\n";
- *os << "#endif /* ! __GNUC__ || ACE_HAS_GNUG_PRE_2_8 */"
- << be_nl << be_nl;
+ *os << "typedef " << bt->nested_type_name (bu)
+ << " _" << ub->local_name () << "_seq;" << be_nl << be_nl;
}
*os << "void " << ub->local_name () << " (const "
@@ -553,7 +476,6 @@ be_visitor_union_branch_public_ch::visit_sequence (be_sequence *node)
return 0;
}
-// Visit string type.
int
be_visitor_union_branch_public_ch::visit_string (be_string *node)
{
@@ -565,8 +487,7 @@ be_visitor_union_branch_public_ch::visit_string (be_string *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ch::"
"visit_string - "
- "bad context information\n"
- ),
+ "bad context information\n"),
-1);
}
@@ -597,7 +518,6 @@ be_visitor_union_branch_public_ch::visit_string (be_string *node)
return 0;
}
-// Visit structure type.
int
be_visitor_union_branch_public_ch::visit_structure (be_structure *node)
{
@@ -620,8 +540,7 @@ be_visitor_union_branch_public_ch::visit_structure (be_structure *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ch::"
"visit_structure - "
- "bad context information\n"
- ),
+ "bad context information\n"),
-1);
}
@@ -631,37 +550,19 @@ be_visitor_union_branch_public_ch::visit_structure (be_structure *node)
if (bt->node_type () != AST_Decl::NT_typedef
&& bt->is_child (bu))
{
- // 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.node (node);
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);
- }
+ be_visitor_structure_ch visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ch::"
"visit_structure - "
- "codegen failed\n"
- ),
+ "codegen failed\n"),
-1);
}
-
- delete visitor;
}
*os << "void " << ub->local_name () << " (const "
@@ -675,7 +576,6 @@ be_visitor_union_branch_public_ch::visit_structure (be_structure *node)
return 0;
}
-// Visit typedefed type.
int
be_visitor_union_branch_public_ch::visit_typedef (be_typedef *node)
{
@@ -689,8 +589,7 @@ be_visitor_union_branch_public_ch::visit_typedef (be_typedef *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_spec_ch::"
"visit_typedef - "
- "Bad primitive type\n"
- ),
+ "Bad primitive type\n"),
-1);
}
@@ -698,7 +597,6 @@ be_visitor_union_branch_public_ch::visit_typedef (be_typedef *node)
return 0;
}
-// Visit union type.
int
be_visitor_union_branch_public_ch::visit_union (be_union *node)
{
@@ -732,36 +630,19 @@ be_visitor_union_branch_public_ch::visit_union (be_union *node)
if (bt->node_type () != AST_Decl::NT_typedef
&& bt->is_child (bu))
{
- // 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);
-
- // First generate the union declaration.
ctx.state (TAO_CodeGen::TAO_UNION_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_union_ch visitor (&ctx);
- if (!visitor)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ch::"
"visit_union - "
- "Bad visitor\n"
- ),
+ "codegen failed\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 << "void " << ub->local_name () << " (const "
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
index 593c57366b6..cd85b6701f1 100644
--- a/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp
@@ -18,17 +18,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_union_branch.h"
-
-ACE_RCSID(be_visitor_union_branch, public_ci, "$Id$")
-
+ACE_RCSID (be_visitor_union_branch,
+ public_ci,
+ "$Id$")
// *****************************************************
-// visitor for union_branch in the client inline file
+// Visitor for union_branch in the client inline file.
// *****************************************************
// constructor
@@ -55,33 +50,31 @@ be_visitor_union_branch_public_ci::visit_union_branch (be_union_branch *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_cs::"
"visit_union_branch - "
- "Bad union_branch type\n"
- ), -1);
+ "Bad union_branch type\n"),
+ -1);
}
- this->ctx_->node (node); // save the node
+ this->ctx_->node (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);
+ "codegen for union_branch type failed\n"),
+ -1);
}
return 0;
}
-// =visit operations on all possible data types that a union_branch can be
+// 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)
{
- be_union_branch *ub =
- this->ctx_->be_node_as_union_branch ();
- be_union *bu =
- this->ctx_->be_scope_as_union ();
+ be_union_branch *ub = this->ctx_->be_node_as_union_branch ();
+ be_union *bu = this->ctx_->be_scope_as_union ();
be_type *bt;
// Check if we are visiting this node via a visit to a typedef node.
@@ -99,45 +92,35 @@ be_visitor_union_branch_public_ci::visit_array (be_array *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ci::"
"visit_enum - "
- "bad context information\n"
- ), -1);
+ "bad context information\n"),
+ -1);
}
TAO_OutStream *os = this->ctx_->stream ();
- // If bt is not a typedef and is defined inside the union
+ // If bt is not a typedef and is defined inside the union.
if (bt->node_type () != AST_Decl::NT_typedef
&& bt->is_child (bu))
{
// 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_);
+
// Set the node to be the node being visited. Scope is still the same.
ctx.node (node);
// First generate the inline operations for this anonymous array type.
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);
- }
+ be_visitor_array_ci visitor (&ctx);
- if (node->accept (visitor) == -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);
+ "codegen failed\n"),
+ -1);
}
-
- delete visitor;
}
// For anonymous arrays, the type name has a _ prepended. We compute the
@@ -180,44 +163,50 @@ be_visitor_union_branch_public_ci::visit_array (be_array *node)
}
// Set method.
- os->indent ();
- *os << "// accessor to set the member" << be_nl
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "// Accessor to set the member." << be_nl
<< "ACE_INLINE void" << be_nl
<< bu->name () << "::" << ub->local_name () << " (" << fname
- << " val)// set" << be_nl
+ << " val)" << be_nl
<< "{" << be_idt_nl
- << "// set the discriminant val" << be_nl
+ << "// Set the discriminant value." << be_nl
<< "this->_reset (";
if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
{
ub->gen_label_value (os);
+
*os << ", 0);" << be_nl
<< "this->disc_ = ";
+
ub->gen_label_value (os);
}
// Default label.
else
{
ub->gen_default_label_value (os, bu);
+
*os << ", 0);" << be_nl
<< "this->disc_ = ";
+
ub->gen_default_label_value (os, bu);
}
*os << ";" << be_nl
- << "// set the value" << be_nl
+ << "// Set the value." << be_nl
<< "this->u_." << ub->local_name () << "_ = "
<< fname << "_dup (val);" << be_uidt_nl
<< "}" << be_nl << be_nl;
// Get method.
- *os << "// retrieve the member" << be_nl
+ *os << "// Retrieve the member." << be_nl
<< "ACE_INLINE " << fname << "_slice *" << be_nl
<< bu->name () << "::" << ub->local_name () << " (void) const" << be_nl
<< "{" << be_idt_nl
<< "return this->u_." << ub->local_name () << "_;" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
return 0;
}
@@ -225,13 +214,11 @@ be_visitor_union_branch_public_ci::visit_array (be_array *node)
int
be_visitor_union_branch_public_ci::visit_enum (be_enum *node)
{
- be_union_branch *ub =
- this->ctx_->be_node_as_union_branch ();
- be_union *bu =
- this->ctx_->be_scope_as_union ();
+ be_union_branch *ub = this->ctx_->be_node_as_union_branch ();
+ be_union *bu = this->ctx_->be_scope_as_union ();
be_type *bt;
- // check if we are visiting this node via a visit to a typedef node
+ // heck if we are visiting this node via a visit to a typedef node.
if (this->ctx_->alias ())
{
bt = this->ctx_->alias ();
@@ -246,50 +233,56 @@ be_visitor_union_branch_public_ci::visit_enum (be_enum *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ci::"
"visit_enum - "
- "bad context information\n"
- ), -1);
+ "bad context information\n"),
+ -1);
}
TAO_OutStream *os = this->ctx_->stream ();
// Set method.
- os->indent ();
- *os << "// accessor to set the member" << be_nl
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "// Accessor to set the member." << be_nl
<< "ACE_INLINE void" << be_nl
<< bu->name () << "::" << ub->local_name () << " (" << bt->name ()
- << " val)// set" << be_nl
+ << " val)" << be_nl
<< "{" << be_idt_nl
- << "// set the discriminant val" << be_nl
+ << "// Set the discriminant value." << be_nl
<< "this->_reset (";
if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
{
ub->gen_label_value (os);
+
*os << ", 0);" << be_nl
<< "this->disc_ = ";
+
ub->gen_label_value (os);
}
// Default label.
else
{
ub->gen_default_label_value (os, bu);
+
*os << ", 0);" << be_nl
<< "this->disc_ = ";
+
ub->gen_default_label_value (os, bu);
}
*os << ";" << be_nl
- << "// set the value" << be_nl
+ << "// Set the value." << be_nl
<< "this->u_." << ub->local_name () << "_ = val;" << be_uidt_nl
<< "}" << be_nl << be_nl;
// Get method.
- *os << "// retrieve the member" << be_nl
+ *os << "// Retrieve the member." << be_nl
<< "ACE_INLINE " << bt->name () << be_nl
<< bu->name () << "::" << ub->local_name () << " (void) const" << be_nl
<< "{" << be_idt_nl
<< "return this->u_." << ub->local_name () << "_;" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
return 0;
}
@@ -297,10 +290,8 @@ be_visitor_union_branch_public_ci::visit_enum (be_enum *node)
int
be_visitor_union_branch_public_ci::visit_interface (be_interface *node)
{
- be_union_branch *ub =
- this->ctx_->be_node_as_union_branch ();
- be_union *bu =
- this->ctx_->be_scope_as_union ();
+ be_union_branch *ub = this->ctx_->be_node_as_union_branch ();
+ be_union *bu = this->ctx_->be_scope_as_union ();
be_type *bt;
// Check if we are visiting this node via a visit to a typedef node.
@@ -318,35 +309,41 @@ be_visitor_union_branch_public_ci::visit_interface (be_interface *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ci::"
"visit_interface - "
- "bad context information\n"
- ), -1);
+ "bad context information\n"),
+ -1);
}
TAO_OutStream *os = this->ctx_->stream ();
// Set method.
- os->indent ();
- *os << "// accessor to set the member" << be_nl
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *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
+ << "_ptr val)" << be_nl
<< "{" << be_idt_nl
- << "// set the discriminant val" << be_nl
+ << "// Set the discriminant value." << be_nl
<< "this->_reset (";
if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
{
ub->gen_label_value (os);
+
*os << ", 0);" << be_nl
<< "this->disc_ = ";
+
ub->gen_label_value (os);
}
// Default label.
else
{
ub->gen_default_label_value (os, bu);
+
*os << ", 0);" << be_nl
<< "this->disc_ = ";
+
ub->gen_default_label_value (os, bu);
}
@@ -373,12 +370,12 @@ be_visitor_union_branch_public_ci::visit_interface (be_interface *node)
<< "}" << be_nl << be_nl;
// Get method.
- *os << "// retrieve the member" << be_nl
+ *os << "// Retrieve the member." << be_nl
<< "ACE_INLINE " << bt->name () << "_ptr " << be_nl
<< bu->name () << "::" << ub->local_name () << " (void) const" << be_nl
<< "{" << be_idt_nl
<< "return this->u_." << ub->local_name () << "_->ptr ();" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
return 0;
}
@@ -386,10 +383,8 @@ be_visitor_union_branch_public_ci::visit_interface (be_interface *node)
int
be_visitor_union_branch_public_ci::visit_interface_fwd (be_interface_fwd *node)
{
- be_union_branch *ub =
- this->ctx_->be_node_as_union_branch ();
- be_union *bu =
- this->ctx_->be_scope_as_union ();
+ be_union_branch *ub = this->ctx_->be_node_as_union_branch ();
+ be_union *bu = this->ctx_->be_scope_as_union ();
be_type *bt;
// Check if we are visiting this node via a visit to a typedef node.
@@ -406,36 +401,42 @@ be_visitor_union_branch_public_ci::visit_interface_fwd (be_interface_fwd *node)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ci::"
- "visit_interface - "
- "bad context information\n"
- ), -1);
+ "visit_interface_fwd - "
+ "bad context information\n"),
+ -1);
}
TAO_OutStream *os = this->ctx_->stream ();
// Set method.
- os->indent ();
- *os << "// accessor to set the member" << be_nl
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *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
+ << "_ptr val)" << be_nl
<< "{" << be_idt_nl
- << "// set the discriminant val" << be_nl
+ << "// Set the discriminant value." << be_nl
<< "this->_reset (";
if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
{
ub->gen_label_value (os);
+
*os << ", 0);" << be_nl
<< "this->disc_ = ";
+
ub->gen_label_value (os);
}
// Default label.
else
{
ub->gen_default_label_value (os, bu);
+
*os << ", 0);" << be_nl
<< "this->disc_ = ";
+
ub->gen_default_label_value (os, bu);
}
@@ -462,12 +463,189 @@ be_visitor_union_branch_public_ci::visit_interface_fwd (be_interface_fwd *node)
<< "}" << be_nl << be_nl;
// Get method.
- *os << "// retrieve the member" << be_nl
+ *os << "// Retrieve the member." << be_nl
<< "ACE_INLINE " << bt->name () << "_ptr " << be_nl
<< bu->name () << "::" << ub->local_name () << " (void) const" << be_nl
<< "{" << be_idt_nl
<< "return this->u_." << ub->local_name () << "_->ptr ();" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_ci::visit_valuetype (be_valuetype *node)
+{
+ be_union_branch *ub = this->ctx_->be_node_as_union_branch ();
+ be_union *bu = this->ctx_->be_scope_as_union ();
+ 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_valuetype - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Set method.
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "// Accessor to set the member." << be_nl
+ << "ACE_INLINE void" << be_nl
+ << bu->name () << "::" << ub->local_name () << " (" << bt->name ()
+ << " *val)" << be_nl
+ << "{" << be_idt_nl
+ << "// Set the discriminant value." << be_nl
+ << "this->_reset (";
+
+ if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
+ {
+ ub->gen_label_value (os);
+
+ *os << ", 0);" << be_nl
+ << "this->disc_ = ";
+
+ ub->gen_label_value (os);
+ }
+ // Default label.
+ else
+ {
+ ub->gen_default_label_value (os, bu);
+
+ *os << ", 0);" << be_nl
+ << "this->disc_ = ";
+
+ ub->gen_default_label_value (os, bu);
+ }
+
+ idl_bool bt_is_defined = node->is_defined ();
+
+ *os << ";" << be_nl
+ << "CORBA::add_ref (val);" << be_nl
+ << "typedef "
+ << bt->nested_type_name (bu, "_var")
+ << " OBJECT_FIELD;" << be_nl
+ << "ACE_NEW (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << "OBJECT_FIELD (val)" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_nl << 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
+ << "{" << be_idt_nl
+ << "return this->u_." << ub->local_name () << "_->ptr ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_ci::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ be_union_branch *ub = this->ctx_->be_node_as_union_branch ();
+ be_union *bu = this->ctx_->be_scope_as_union ();
+ 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_valuetype_fwd - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Set method.
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "// Accessor to set the member." << be_nl
+ << "ACE_INLINE void" << be_nl
+ << bu->name () << "::" << ub->local_name () << " (" << bt->name ()
+ << " *val)" << be_nl
+ << "{" << be_idt_nl
+ << "// Set the discriminant value." << be_nl
+ << "this->_reset (";
+
+ if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
+ {
+ ub->gen_label_value (os);
+
+ *os << ", 0);" << be_nl
+ << "this->disc_ = ";
+
+ ub->gen_label_value (os);
+ }
+ // Default label.
+ else
+ {
+ ub->gen_default_label_value (os, bu);
+
+ *os << ", 0);" << be_nl
+ << "this->disc_ = ";
+
+ ub->gen_default_label_value (os, bu);
+ }
+
+ idl_bool bt_is_defined = node->full_definition ()->is_defined ();
+
+ *os << ";" << be_nl
+ << "typedef "
+ << bt->nested_type_name (bu, "_var")
+ << " OBJECT_FIELD;" << be_nl
+ << "ACE_NEW (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl;
+
+ if (bt_is_defined)
+ {
+ *os << "OBJECT_FIELD (" << bt->name () << "::";
+ }
+ else
+ {
+ *os << "OBJECT_FIELD (tao_" << node->flat_name ();
+ }
+
+ *os << "_duplicate (val))" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_nl << 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
+ << "{" << be_idt_nl
+ << "return this->u_." << ub->local_name () << "_->ptr ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
return 0;
}
@@ -477,10 +655,8 @@ be_visitor_union_branch_public_ci::visit_predefined_type (
be_predefined_type *node
)
{
- be_union_branch *ub =
- this->ctx_->be_node_as_union_branch ();
- be_union *bu =
- this->ctx_->be_scope_as_union ();
+ be_union_branch *ub = this->ctx_->be_node_as_union_branch ();
+ be_union *bu = this->ctx_->be_scope_as_union ();
be_type *bt;
// Check if we are visiting this node via a visit to a typedef node.
@@ -498,111 +674,125 @@ be_visitor_union_branch_public_ci::visit_predefined_type (
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ci::"
"visit_interface - "
- "bad context information\n"
- ), -1);
+ "bad context information\n"),
+ -1);
}
TAO_OutStream *os = this->ctx_->stream ();
// Set method.
- os->indent ();
- *os << "// accessor to set the member" << be_nl
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *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)
+ AST_PredefinedType::PredefinedType pt = node->pt ();
+
+ if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
{
*os << "_ptr";
}
+ else if (pt == AST_PredefinedType::PT_any)
+ {
+ *os << " &";
+ }
*os << " val)" << be_nl
<< "{" << be_idt_nl
- << "// set the discriminant val" << be_nl
+ << "// Set the discriminant value." << be_nl
<< "this->_reset (";
if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
{
ub->gen_label_value (os);
+
*os << ", 0);" << be_nl
<< "this->disc_ = ";
+
ub->gen_label_value (os);
}
else
// We have an explicit default case.
{
ub->gen_default_label_value (os, bu);
+
*os << ", 0);" << be_nl
<< "this->disc_ = ";
+
ub->gen_default_label_value (os, bu);
}
*os << ";" << be_nl;
- switch (node->pt ())
+ switch (pt)
{
- case AST_PredefinedType::PT_pseudo:
- if (!ACE_OS::strcmp (node->local_name ()->get_string (), "Object"))
- {
- *os << "typedef CORBA::Object_var OBJECT_FIELD;" << be_nl
- << "ACE_NEW (" << be_idt << be_idt_nl
- << "this->u_." << ub->local_name () << "_," << be_nl
- << "OBJECT_FIELD (CORBA::Object::_duplicate (val))"
- << be_uidt_nl
- << ");" << be_uidt << be_uidt_nl;
- }
- else
- {
- *os << "this->u_." << ub->local_name () << "_ = "
- << bt->name () << "::_duplicate (val);" << be_uidt_nl;
- }
+ case AST_PredefinedType::PT_object:
+ *os << "typedef CORBA::Object_var OBJECT_FIELD;" << be_nl
+ << "ACE_NEW (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << "OBJECT_FIELD (CORBA::Object::_duplicate (val))"
+ << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl;
+
break;
+ case AST_PredefinedType::PT_pseudo:
+ *os << "this->u_." << ub->local_name () << "_ = "
+ << bt->name () << "::_duplicate (val);" << be_uidt_nl;
+ break;
case AST_PredefinedType::PT_any:
*os << "ACE_NEW (" << be_idt << be_idt_nl
<< "this->u_." << ub->local_name ()
<< "_," << be_nl
<< bt->name () << " (val)" << be_uidt_nl
<< ");" << be_uidt << be_uidt_nl;
- break;
+ break;
case AST_PredefinedType::PT_void:
break;
-
default:
- *os << "// set the value" << be_nl
+ *os << "// Set the value." << be_nl
<< "this->u_." << ub->local_name ()
<< "_ = val;" << be_uidt_nl;
+
+ break;
}
*os << "}" << be_nl << be_nl;
- switch (node->pt ())
+ switch (pt)
{
- case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
// Get method.
- *os << "// retrieve the member" << be_nl
+ *os << "// Retrieve the member." << be_nl
<< "ACE_INLINE " << bt->name () << "_ptr" << be_nl
<< bu->name () << "::" << ub->local_name ()
<< " (void) const" << be_nl
<< "{" << be_idt_nl;
+ *os << "return this->u_." << ub->local_name ()
+ << "_->ptr ();" << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
- if (!ACE_OS::strcmp (bt->local_name ()->get_string (), "Object"))
- {
- *os << "return this->u_." << ub->local_name ()
- << "_->ptr ();" << be_uidt_nl;
- }
- else
- {
- *os << "return this->u_." << ub->local_name ()
- << "_;" << be_uidt_nl;
- }
+ break;
+ case AST_PredefinedType::PT_pseudo:
+ // Get method.
+ *os << "// Retrieve the member." << be_nl
+ << "ACE_INLINE " << bt->name () << "_ptr" << be_nl
+ << bu->name () << "::" << ub->local_name ()
+ << " (void) const" << be_nl
+ << "{" << be_idt_nl;
+ *os << "return this->u_." << ub->local_name ()
+ << "_;" << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
- *os << "}\n\n";
break;
case AST_PredefinedType::PT_any:
// Get method with read-only access.
*os << "// retrieve the member" << be_nl
- << "ACE_INLINE const " << bt->name () << be_nl
+ << "ACE_INLINE const " << bt->name () << " &" << be_nl
<< bu->name () << "::" << ub->local_name ()
<< " (void) const" << be_nl
<< "{" << be_idt_nl
@@ -611,12 +801,12 @@ be_visitor_union_branch_public_ci::visit_predefined_type (
// Get method with read/write access
*os << "// retrieve the member" << be_nl
- << "ACE_INLINE " << bt->name () << be_nl
+ << "ACE_INLINE " << bt->name () << " &" << be_nl
<< bu->name () << "::" << ub->local_name ()
<< " (void)" << be_nl
<< "{" << be_idt_nl
<< "return *this->u_." << ub->local_name () << "_;" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
break;
case AST_PredefinedType::PT_void:
break;
@@ -628,7 +818,9 @@ be_visitor_union_branch_public_ci::visit_predefined_type (
<< " (void) const" << be_nl
<< "{" << be_idt_nl
<< "return this->u_." << ub->local_name () << "_;" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
+
+ break;
}
return 0;
@@ -637,10 +829,8 @@ be_visitor_union_branch_public_ci::visit_predefined_type (
int
be_visitor_union_branch_public_ci::visit_sequence (be_sequence *node)
{
- be_union_branch *ub =
- this->ctx_->be_node_as_union_branch ();
- be_union *bu =
- this->ctx_->be_scope_as_union ();
+ be_union_branch *ub = this->ctx_->be_node_as_union_branch ();
+ be_union *bu = this->ctx_->be_scope_as_union ();
be_type *bt;
// Check if we are visiting this node via a visit to a typedef node.
@@ -658,69 +848,66 @@ be_visitor_union_branch_public_ci::visit_sequence (be_sequence *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ci::"
"visit_sequence - "
- "bad context information\n"
- ), -1);
+ "bad context information\n"),
+ -1);
}
TAO_OutStream *os = this->ctx_->stream ();
- // If bt is not a typedef and is defined inside the union
+ // If bt is not a typedef and is defined inside the union.
if (bt->node_type () != AST_Decl::NT_typedef
&& bt->is_child (bu))
{
// 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_);
+
// Set the node to be the node being visited. Scope is still the same.
ctx.node (node);
// First generate inline operations for this anonymous sequence type.
ctx.state (TAO_CodeGen::TAO_SEQUENCE_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_sequence - "
- "Bad visitor\n"
- ), -1);
- }
+ be_visitor_sequence_ci visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ci::"
"visit_sequence - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
-
- delete visitor;
}
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// (1) Set from a const.
- *os << "// accessor to set the member" << be_nl
+ *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 val" << be_nl
+ << "// Set the discriminant value." << be_nl
<< "this->_reset (";
if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
{
ub->gen_label_value (os);
+
*os << ", 0);" << be_nl
<< "this->disc_ = ";
+
ub->gen_label_value (os);
}
else
// We have an explicit default case.
{
ub->gen_default_label_value (os, bu);
+
*os << ", 0);" << be_nl
<< "this->disc_ = ";
+
ub->gen_default_label_value (os, bu);
}
@@ -732,7 +919,7 @@ be_visitor_union_branch_public_ci::visit_sequence (be_sequence *node)
<< "}" << be_nl << be_nl;
// Readonly get method.
- *os << "// readonly get method " << be_nl
+ *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
@@ -740,12 +927,12 @@ be_visitor_union_branch_public_ci::visit_sequence (be_sequence *node)
<< "}" << be_nl << be_nl;
// Read/write get method.
- *os << "// read/write get method " << be_nl
+ *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->u_." << ub->local_name () << "_;" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
return 0;
}
@@ -753,18 +940,16 @@ be_visitor_union_branch_public_ci::visit_sequence (be_sequence *node)
int
be_visitor_union_branch_public_ci::visit_string (be_string *node)
{
- 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_union_branch *ub = this->ctx_->be_node_as_union_branch ();
+ be_union *bu = this->ctx_->be_scope_as_union ();
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ci::"
"visit_string - "
- "bad context information\n"
- ), -1);
+ "bad context information\n"),
+ -1);
}
TAO_OutStream *os = this->ctx_->stream ();
@@ -772,8 +957,10 @@ be_visitor_union_branch_public_ci::visit_string (be_string *node)
// Three methods to set the string value.
// (1) Set method from char* or wchar*.
- os->indent ();
- *os << "// accessor to set the member" << be_nl
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "// Accessor to set the member." << be_nl
<< "ACE_INLINE void" << be_nl;
if (node->width () == (long) sizeof (char))
@@ -788,22 +975,26 @@ be_visitor_union_branch_public_ci::visit_string (be_string *node)
*os << be_nl
<< "{" << be_idt_nl
- << "// set the discriminant val" << be_nl
+ << "// Set the discriminant value." << be_nl
<< "this->_reset (";
if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
{
ub->gen_label_value (os);
+
*os << ", 0);" << be_nl
<< "this->disc_ = ";
+
ub->gen_label_value (os);
}
else
// We have an explicit default case.
{
ub->gen_default_label_value (os, bu);
+
*os << ", 0);" << be_nl
<< "this->disc_ = ";
+
ub->gen_default_label_value (os, bu);
}
@@ -813,7 +1004,7 @@ be_visitor_union_branch_public_ci::visit_string (be_string *node)
<< "}" << be_nl << be_nl;
// (2) Set method from const char * or const wchar *.
- *os << "// accessor to set the member" << be_nl
+ *os << "// Accessor to set the member." << be_nl
<< "ACE_INLINE void" << be_nl
<< bu->name () << "::" << ub->local_name ();
@@ -826,27 +1017,31 @@ be_visitor_union_branch_public_ci::visit_string (be_string *node)
*os << " (const CORBA::WChar *val)" << be_nl << "{" << be_idt_nl;
}
- *os << "// set the discriminant val" << be_nl
+ *os << "// Set the discriminant value." << be_nl
<< "this->_reset (";
if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
{
ub->gen_label_value (os);
+
*os << ", 0);" << be_nl
<< "this->disc_ = ";
+
ub->gen_label_value (os);
}
else
// We have an explicit default case.
{
ub->gen_default_label_value (os, bu);
+
*os << ", 0);" << be_nl
<< "this->disc_ = ";
+
ub->gen_default_label_value (os, bu);
}
*os << ";" << be_nl
- << "// set the value" << be_nl
+ << "// Set the value." << be_nl
<< "this->u_." << ub->local_name () << "_ = ";
if (node->width () == (long) sizeof (char))
@@ -861,7 +1056,7 @@ be_visitor_union_branch_public_ci::visit_string (be_string *node)
}
// (3) Set from const String_var& or WString_var&
- *os << "// accessor to set the member" << be_nl
+ *os << "// Accessor to set the member." << be_nl
<< "ACE_INLINE void" << be_nl
<< bu->name () << "::" << ub->local_name ();
@@ -875,27 +1070,31 @@ be_visitor_union_branch_public_ci::visit_string (be_string *node)
}
*os << "{" << be_idt_nl
- << "// set the discriminant val" << be_nl
+ << "// Set the discriminant value." << be_nl
<< "this->_reset (";
if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
{
ub->gen_label_value (os);
+
*os << ", 0);" << be_nl
<< "this->disc_ = ";
+
ub->gen_label_value (os);
}
else
// We have an explicit default case.
{
ub->gen_default_label_value (os, bu);
+
*os << ", 0);" << be_nl
<< "this->disc_ = ";
+
ub->gen_default_label_value (os, bu);
}
*os << ";" << be_nl
- << "// set the value" << be_nl;
+ << "// Set the value." << be_nl;
if (node->width () == (long) sizeof (char))
{
@@ -925,7 +1124,7 @@ be_visitor_union_branch_public_ci::visit_string (be_string *node)
<< " (void) const // get method" << be_nl
<< "{" << be_idt_nl
<< "return this->u_." << ub->local_name () << "_;" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
return 0;
}
@@ -933,10 +1132,8 @@ be_visitor_union_branch_public_ci::visit_string (be_string *node)
int
be_visitor_union_branch_public_ci::visit_structure (be_structure *node)
{
- be_union_branch *ub =
- this->ctx_->be_node_as_union_branch ();
- be_union *bu =
- this->ctx_->be_scope_as_union ();
+ be_union_branch *ub = this->ctx_->be_node_as_union_branch ();
+ be_union *bu = this->ctx_->be_scope_as_union ();
be_type *bt;
// Check if we are visiting this node via a visit to a typedef node.
@@ -954,8 +1151,8 @@ be_visitor_union_branch_public_ci::visit_structure (be_structure *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ci::"
"visit_structure - "
- "bad context information\n"
- ), -1);
+ "bad context information\n"),
+ -1);
}
TAO_OutStream *os = this->ctx_->stream ();
@@ -967,56 +1164,53 @@ be_visitor_union_branch_public_ci::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_);
+
// Set the node to be the node being visited. Scope is still the same.
ctx.node (node);
// First generate the struct 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);
- }
+ be_visitor_structure_ci visitor (&ctx);
- if (node->accept (visitor) == -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);
+ "codegen failed\n"),
+ -1);
}
-
- delete visitor;
}
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// (1) Set from a const.
- *os << "// accessor to set the member" << be_nl
+ *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 val" << be_nl
+ << "// Set the discriminant value." << be_nl
<< "this->_reset (";
if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
{
ub->gen_label_value (os);
+
*os << ", 0);" << be_nl
<< "this->disc_ = ";
+
ub->gen_label_value (os);
}
else
// We have an explicit default case.
{
ub->gen_default_label_value (os, bu);
+
*os << ", 0);" << be_nl
<< "this->disc_ = ";
+
ub->gen_default_label_value (os, bu);
}
@@ -1038,7 +1232,7 @@ be_visitor_union_branch_public_ci::visit_structure (be_structure *node)
*os << "}" << be_nl << be_nl;
// Readonly get method.
- *os << "// readonly get method " << be_nl
+ *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;
@@ -1056,7 +1250,7 @@ be_visitor_union_branch_public_ci::visit_structure (be_structure *node)
*os << "}" << be_nl << be_nl;
// Read/write get method.
- *os << "// read/write get method " << be_nl
+ *os << "// Read/write get method." << be_nl
<< "ACE_INLINE " << bt->name () << " &" << be_nl
<< bu->name () << "::" << ub->local_name () << " (void)" << be_nl
<< "{" << be_idt_nl;
@@ -1071,7 +1265,7 @@ be_visitor_union_branch_public_ci::visit_structure (be_structure *node)
*os << "return this->u_." << ub->local_name () << "_;" << be_uidt_nl;
}
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
return 0;
}
@@ -1090,8 +1284,8 @@ be_visitor_union_branch_public_ci::visit_typedef (be_typedef *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ci::"
"visit_typedef - "
- "Bad primitive type\n"
- ), -1);
+ "Bad primitive type\n"),
+ -1);
}
this->ctx_->alias (0);
@@ -1101,10 +1295,8 @@ be_visitor_union_branch_public_ci::visit_typedef (be_typedef *node)
int
be_visitor_union_branch_public_ci::visit_union (be_union *node)
{
- be_union_branch *ub =
- this->ctx_->be_node_as_union_branch ();
- be_union *bu =
- this->ctx_->be_scope_as_union ();
+ be_union_branch *ub = this->ctx_->be_node_as_union_branch ();
+ be_union *bu = this->ctx_->be_scope_as_union ();
be_type *bt;
// Check if we are visiting this node via a visit to a typedef node.
@@ -1122,8 +1314,8 @@ be_visitor_union_branch_public_ci::visit_union (be_union *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ci::"
"visit_union - "
- "bad context information\n"
- ), -1);
+ "bad context information\n"),
+ -1);
}
TAO_OutStream *os = this->ctx_->stream ();
@@ -1135,56 +1327,53 @@ be_visitor_union_branch_public_ci::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_);
+
// Set the node to be the node being visited. Scope is still the same.
ctx.node (node);
// First generate the union declaration.
ctx.state (TAO_CodeGen::TAO_UNION_CI);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_union_ci visitor (&ctx);
- if (!visitor)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ci::"
"visit_union - "
- "Bad visitor\n"
- ), -1);
+ "codegen failed\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;
}
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// (1) Set from a const.
- *os << "// accessor to set the member" << be_nl
+ *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 val" << be_nl
+ << "// Set the discriminant value." << be_nl
<< "this->_reset (";
if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
{
ub->gen_label_value (os);
+
*os << ", 0);" << be_nl
<< "this->disc_ = ";
+
ub->gen_label_value (os);
}
else
// We have an explicit default case.
{
ub->gen_default_label_value (os, bu);
+
*os << ", 0);" << be_nl
<< "this->disc_ = ";
+
ub->gen_default_label_value (os, bu);
}
@@ -1196,7 +1385,7 @@ be_visitor_union_branch_public_ci::visit_union (be_union *node)
<< "}" << be_nl << be_nl;
// Readonly get method.
- *os << "// readonly get method " << be_nl
+ *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
@@ -1204,12 +1393,12 @@ be_visitor_union_branch_public_ci::visit_union (be_union *node)
<< "}" << be_nl << be_nl;
// Read/write get method.
- *os << "// read/write get method " << be_nl
+ *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->u_." << ub->local_name () << "_;" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
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
index 5d8424c9b92..b71a82bb660 100644
--- a/TAO/TAO_IDL/be/be_visitor_union_branch/public_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_cs.cpp
@@ -18,244 +18,170 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_union_branch.h"
-
-ACE_RCSID(be_visitor_union_branch, public_cs, "$Id$")
-
+ACE_RCSID (be_visitor_union_branch,
+ public_cs,
+ "$Id$")
// **********************************************
-// visitor for union_branch in the client stubs file
+// 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_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)
{
be_type *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);
+ "Bad union_branch type\n"),
+ -1);
}
- this->ctx_->node (node); // save the node
+ this->ctx_->node (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);
+ "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)
{
- // if not a typedef and we are defined in the use scope, we must be
- // defined
-
- if (!this->ctx_->alias () // not a typedef
+ // If not a typedef and we are defined in the use scope, we must be
+ // defined.
+ if (!this->ctx_->alias ()
&& node->is_child (this->ctx_->scope ()))
{
- // anonymous array case
-
- // instantiate a visitor context with a copy of our context. This info
- // will be modified based on what type of node we are visiting
+ // Anonymous array case.
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 inline operations for this anonymous array type
+ ctx.node (node);
ctx.state (TAO_CodeGen::TAO_ARRAY_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_array - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_array_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_cs::"
"visit_array - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
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.node (node);
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)
+ be_visitor_enum_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_cs::"
"visit_enum - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
+
return 0;
}
-// visit sequence type
int
be_visitor_union_branch_public_cs::visit_sequence (be_sequence *node)
{
- // if not a typedef and we are defined in the use scope, we must be
- // defined
+ // If not a typedef and we are defined in the use scope, we must be
+ // defined.
- if (!this->ctx_->alias () // not a typedef
+ if (!this->ctx_->alias ()
&& node->is_child (this->ctx_->scope ()))
{
- // anonymous array case
-
- // instantiate a visitor context with a copy of our context. This info
- // will be modified based on what type of node we are visiting
+ // Anonymous sequence case.
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 inline operations for this anonymous sequence type
+ ctx.node (node);
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_union_branch_public_cs::"
- "visit_sequence - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_sequence_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_cs::"
"visit_sequence - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
return 0;
}
-// visit string type
int
be_visitor_union_branch_public_cs::visit_string (be_string *)
{
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.node (node);
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)
+ be_visitor_structure_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_cs::"
"visit_struct - "
- "codegen failed\n"
- ), -1);
+ "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.node (node);
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)
+ be_visitor_union_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_cs::"
"visit_union - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/public_reset_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_reset_cs.cpp
index 3f5e80ba612..523b1e310c1 100644
--- a/TAO/TAO_IDL/be/be_visitor_union_branch/public_reset_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_reset_cs.cpp
@@ -18,28 +18,21 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_union_branch.h"
-
-ACE_RCSID(be_visitor_union_branch, public_reset_cs, "$Id$")
-
+ACE_RCSID (be_visitor_union_branch,
+ public_reset_cs,
+ "$Id$")
// *****************************************************
// visitor for union_branch in the client
// stubs file for the reset method
// *****************************************************
-// constructor
be_visitor_union_branch_public_reset_cs::
be_visitor_union_branch_public_reset_cs (be_visitor_context *ctx)
: be_visitor_decl (ctx)
{
}
-// destructor
be_visitor_union_branch_public_reset_cs::
~be_visitor_union_branch_public_reset_cs (void)
{
@@ -47,33 +40,31 @@ be_visitor_union_branch_public_reset_cs::
// visit the union_branch node
int
-be_visitor_union_branch_public_reset_cs::
-visit_union_branch (be_union_branch *node)
+be_visitor_union_branch_public_reset_cs::visit_union_branch (
+ be_union_branch *node
+ )
{
- TAO_OutStream *os;
- be_type *bt; // union_branch's type
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt = be_type::narrow_from_decl (node->field_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);
+ "Bad union_branch type\n"),
+ -1);
}
this->ctx_->node (node); // save the node
- for (unsigned long i = 0;
- i < node->label_list_length ();
- ++i)
+ for (unsigned long i = 0; i < node->label_list_length (); ++i)
{
// check if we are printing the default case
if (node->label (i)->label_kind () == AST_UnionLabel::UL_default)
- *os << "default:";
+ {
+ *os << "default:";
+ }
else
{
*os << "case ";
@@ -91,52 +82,56 @@ visit_union_branch (be_union_branch *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_cs::"
"visit_union_branch - "
- "codegen for union_branch type failed\n"
- ), -1);
+ "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_reset_cs::visit_array (be_array *node)
{
- TAO_OutStream *os; // output stream
be_union_branch *ub =
- this->ctx_->be_node_as_union_branch (); // get union branch
+ this->ctx_->be_node_as_union_branch ();
be_union *bu =
- this->ctx_->be_scope_as_union (); // get the enclosing union backend
+ this->ctx_->be_scope_as_union ();
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 ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_reset_cs::"
"visit_enum - "
- "bad context information\n"
- ), -1);
+ "bad context information\n"),
+ -1);
}
- // for anonymous arrays, the type name has a _ prepended. We compute the
+ // For anonymous arrays, the type name has a _ prepended. We compute the
// full_name with or without the underscore and use it later on.
- char fname [NAMEBUFSIZE]; // to hold the full and
+ char fname [NAMEBUFSIZE]; // to hold the full and.
// save the node's local name and full name in a buffer for quick use later
// on
- ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
+
if (bt->node_type () != AST_Decl::NT_typedef // not a typedef
&& bt->is_child (bu)) // bt is defined inside the union
{
- // for anonymous arrays ...
- // we have to generate a name for us that has an underscope prepended to
- // our local name. This needs to be inserted after the parents's name
+ // For anonymous arrays ...
+ // We have to generate a name for us that has an underscope prepended to
+ // our local name. This needs to be inserted after the parents's name.
if (bt->is_nested ())
{
@@ -151,15 +146,16 @@ be_visitor_union_branch_public_reset_cs::visit_array (be_array *node)
}
else
{
- // typedefed node
ACE_OS::sprintf (fname, "%s", bt->full_name ());
}
- os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream ();
+
*os << fname << "_free (this->u_." << ub->local_name ()
<< "_);" << be_nl
<< "this->u_." << ub->local_name () << "_ = 0;" << be_nl
<< "break;" << be_uidt_nl;
+
return 0;
}
@@ -167,17 +163,17 @@ int
be_visitor_union_branch_public_reset_cs::visit_enum (be_enum *)
{
be_union_branch *ub =
- this->ctx_->be_node_as_union_branch (); // get union branch
+ this->ctx_->be_node_as_union_branch ();
be_union *bu =
- this->ctx_->be_scope_as_union (); // get the enclosing union backend
+ this->ctx_->be_scope_as_union ();
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_reset_cs::"
"visit_enum - "
- "bad context information\n"
- ), -1);
+ "bad context information\n"),
+ -1);
}
TAO_OutStream *os = this->ctx_->stream ();
@@ -190,20 +186,21 @@ int
be_visitor_union_branch_public_reset_cs::visit_interface (be_interface *)
{
be_union_branch *ub =
- this->ctx_->be_node_as_union_branch (); // get union branch
+ this->ctx_->be_node_as_union_branch ();
be_union *bu =
- this->ctx_->be_scope_as_union (); // get the enclosing union backend
+ this->ctx_->be_scope_as_union ();
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_reset_cs::"
"visit_interface - "
- "bad context information\n"
- ), -1);
+ "bad context information\n"),
+ -1);
}
TAO_OutStream *os = this->ctx_->stream ();
+
*os << "delete this->u_."
<< ub->local_name () << "_;" << be_nl
<< "this->u_." << ub->local_name ()
@@ -217,19 +214,77 @@ int
be_visitor_union_branch_public_reset_cs::visit_interface_fwd (be_interface_fwd *)
{
be_union_branch *ub =
- this->ctx_->be_node_as_union_branch (); // get union branch
+ this->ctx_->be_node_as_union_branch ();
be_union *bu =
- this->ctx_->be_scope_as_union (); // get the enclosing union backend
+ this->ctx_->be_scope_as_union ();
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_reset_cs::"
- "visit_interface - "
- "bad context information\n"
- ), -1);
+ "visit_interface_fwd - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "delete this->u_."
+ << ub->local_name () << "_;" << be_nl
+ << "this->u_." << ub->local_name ()
+ << "_ = 0;" << be_nl
+ << "break;" << be_uidt_nl;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_reset_cs::visit_valuetype (be_valuetype *)
+{
+ be_union_branch *ub =
+ this->ctx_->be_node_as_union_branch ();
+ be_union *bu =
+ this->ctx_->be_scope_as_union ();
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_reset_cs::"
+ "visit_valuetype - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "delete this->u_."
+ << ub->local_name () << "_;" << be_nl
+ << "this->u_." << ub->local_name ()
+ << "_ = 0;" << be_nl
+ << "break;" << be_uidt_nl;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_reset_cs::visit_valuetype_fwd (be_valuetype_fwd *)
+{
+ be_union_branch *ub =
+ this->ctx_->be_node_as_union_branch ();
+ be_union *bu =
+ this->ctx_->be_scope_as_union ();
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_reset_cs::"
+ "visit_valuetype_fwd - "
+ "bad context information\n"),
+ -1);
}
+
TAO_OutStream *os = this->ctx_->stream ();
+
*os << "delete this->u_."
<< ub->local_name () << "_;" << be_nl
<< "this->u_." << ub->local_name ()
@@ -240,40 +295,43 @@ be_visitor_union_branch_public_reset_cs::visit_interface_fwd (be_interface_fwd *
}
int
-be_visitor_union_branch_public_reset_cs::visit_predefined_type (be_predefined_type *node)
+be_visitor_union_branch_public_reset_cs::visit_predefined_type (
+ be_predefined_type *node
+ )
{
be_union_branch *ub =
- this->ctx_->be_node_as_union_branch (); // get union branch
+ this->ctx_->be_node_as_union_branch ();
be_union *bu =
- this->ctx_->be_scope_as_union (); // get the enclosing union backend
+ this->ctx_->be_scope_as_union ();
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_reset_cs::"
"visit_predefined_type - "
- "bad context information\n"
- ), -1);
+ "bad context information\n"),
+ -1);
}
TAO_OutStream *os = this->ctx_->stream ();
switch (node->pt ())
{
+ case AST_PredefinedType::PT_object:
+ *os << "delete this->u_."
+ << ub->local_name () << "_;" << be_nl;
+ *os << "this->u_." << ub->local_name ()
+ << "_ = 0;" << be_nl
+ << "break;" << be_uidt_nl;
+
+ break;
case AST_PredefinedType::PT_pseudo:
- if (!ACE_OS::strcmp (node->local_name ()->get_string (), "Object"))
- {
- *os << "delete this->u_."
- << ub->local_name () << "_;" << be_nl;
- }
- else
- {
- *os << "CORBA::release (this->u_."
- << ub->local_name () << "_);" << be_nl;
- }
+ *os << "CORBA::release (this->u_."
+ << ub->local_name () << "_);" << be_nl;
*os << "this->u_." << ub->local_name ()
<< "_ = 0;" << be_nl
<< "break;" << be_uidt_nl;
+
break;
case AST_PredefinedType::PT_any:
*os << "delete this->u_."
@@ -281,12 +339,16 @@ be_visitor_union_branch_public_reset_cs::visit_predefined_type (be_predefined_ty
<< "this->u_." << ub->local_name ()
<< "_ = 0;" << be_nl
<< "break;" << be_uidt_nl;
+
break;
case AST_PredefinedType::PT_void:
break;
default:
*os << "break;" << be_uidt_nl;
+
+ break;
}
+
return 0;
}
@@ -294,20 +356,21 @@ int
be_visitor_union_branch_public_reset_cs::visit_sequence (be_sequence *)
{
be_union_branch *ub =
- this->ctx_->be_node_as_union_branch (); // get union branch
+ this->ctx_->be_node_as_union_branch ();
be_union *bu =
- this->ctx_->be_scope_as_union (); // get the enclosing union backend
+ this->ctx_->be_scope_as_union ();
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_reset_cs::"
"visit_sequence - "
- "bad context information\n"
- ), -1);
+ "bad context information\n"),
+ -1);
}
TAO_OutStream *os = this->ctx_->stream ();
+
*os << "delete this->u_."
<< ub->local_name () << "_;" << be_nl
<< "this->u_."
@@ -322,17 +385,17 @@ int
be_visitor_union_branch_public_reset_cs::visit_string (be_string *node)
{
be_union_branch *ub =
- this->ctx_->be_node_as_union_branch (); // get union branch
+ this->ctx_->be_node_as_union_branch ();
be_union *bu =
- this->ctx_->be_scope_as_union (); // get the enclosing union backend
+ this->ctx_->be_scope_as_union ();
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_reset_cs::"
"visit_string - "
- "bad context information\n"
- ), -1);
+ "bad context information\n"),
+ -1);
}
TAO_OutStream *os = this->ctx_->stream ();
@@ -358,28 +421,32 @@ be_visitor_union_branch_public_reset_cs::visit_string (be_string *node)
int
be_visitor_union_branch_public_reset_cs::visit_structure (be_structure *node)
{
- TAO_OutStream *os; // output stream
be_union_branch *ub =
- this->ctx_->be_node_as_union_branch (); // get union branch
+ this->ctx_->be_node_as_union_branch ();
be_union *bu =
- this->ctx_->be_scope_as_union (); // get the enclosing union backend
+ this->ctx_->be_scope_as_union ();
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 ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_reset_cs::"
"visit_structure - "
- "bad context information\n"
- ), -1);
+ "bad context information\n"),
+ -1);
}
- os = this->ctx_->stream ();
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
if (bt->size_type () == be_type::VARIABLE
|| node->has_constructor ())
{
@@ -398,18 +465,18 @@ be_visitor_union_branch_public_reset_cs::visit_structure (be_structure *node)
int
be_visitor_union_branch_public_reset_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
+ this->ctx_->alias (node);
- // the node to be visited in the base primitve type that gets typedefed
+ // 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_reset_cs::"
"visit_typedef - "
- "Bad primitive type\n"
- ), -1);
+ "Bad primitive type\n"),
+ -1);
}
this->ctx_->alias (0);
@@ -420,20 +487,21 @@ int
be_visitor_union_branch_public_reset_cs::visit_union (be_union *)
{
be_union_branch *ub =
- this->ctx_->be_node_as_union_branch (); // get union branch
+ this->ctx_->be_node_as_union_branch ();
be_union *bu =
- this->ctx_->be_scope_as_union (); // get the enclosing union backend
+ this->ctx_->be_scope_as_union ();
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_reset_cs::"
"visit_union - "
- "bad context information\n"
- ), -1);
+ "bad context information\n"),
+ -1);
}
TAO_OutStream *os = this->ctx_->stream ();
+
*os << "delete this->u_."
<< ub->local_name () << "_;" << be_nl
<< "this->u_."
diff --git a/TAO/TAO_IDL/be/be_visitor_union_fwd.cpp b/TAO/TAO_IDL/be/be_visitor_union_fwd.cpp
new file mode 100644
index 00000000000..79ed60e34cc
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union_fwd.cpp
@@ -0,0 +1,31 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_union_fwd.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for be_union_fwd
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#include "be_union_fwd.h"
+
+#include "be_visitor_union_fwd.h"
+#include "be_visitor_context.h"
+#include "be_helper.h"
+
+#include "be_visitor_union_fwd/union_fwd_ch.cpp"
+
+ACE_RCSID (be,
+ be_visitor_union_fwd,
+ "$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_union_fwd/union_fwd_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union_fwd/union_fwd_ch.cpp
new file mode 100644
index 00000000000..ad86bed923b
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union_fwd/union_fwd_ch.cpp
@@ -0,0 +1,53 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// union_fwd_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for be_union_fwd node in the client header.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_union_fwd,
+ union_fwd_ch,
+ "$Id$")
+
+be_visitor_union_fwd_ch::be_visitor_union_fwd_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_union_fwd_ch::~be_visitor_union_fwd_ch (void)
+{
+}
+
+// Visit the interface_fwd_ch node and its scope.
+int
+be_visitor_union_fwd_ch::visit_union_fwd (be_union_fwd *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ // Generate a forward declaration of the class.
+ *os << "class " << node->local_name () << ";" << be_nl;
+
+ node->cli_hdr_gen (I_TRUE);
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype.cpp
index 662f378433f..fd38a0cb138 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype.cpp
@@ -18,20 +18,58 @@
//
// ============================================================================
+#include "be_argument.h"
+#include "be_array.h"
+#include "be_attribute.h"
+#include "be_constant.h"
+#include "be_enum.h"
+#include "be_exception.h"
+#include "be_factory.h"
+#include "be_field.h"
+#include "be_interface_fwd.h"
+#include "be_module.h"
+#include "be_predefined_type.h"
+#include "be_operation.h"
+#include "be_sequence.h"
+#include "be_string.h"
+#include "be_structure.h"
+#include "be_structure_fwd.h"
+#include "be_typedef.h"
+#include "be_union.h"
+#include "be_union_fwd.h"
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
+#include "be_helper.h"
+#include "be_extern.h"
+#include "utl_identifier.h"
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
+#include "be_visitor_argument.h"
+#include "be_visitor_array.h"
#include "be_visitor_valuetype.h"
+#include "be_visitor_field.h"
+#include "be_visitor_constant.h"
+#include "be_visitor_enum.h"
+#include "be_visitor_exception.h"
+#include "be_visitor_operation.h"
+#include "be_visitor_sequence.h"
+#include "be_visitor_structure.h"
+#include "be_visitor_structure_fwd.h"
+#include "be_visitor_typecode.h"
+#include "be_visitor_typedef.h"
+#include "be_visitor_union.h"
+#include "be_visitor_union_fwd.h"
+#include "be_visitor_context.h"
#include "be_visitor_valuetype/valuetype.cpp"
#include "be_visitor_valuetype/valuetype_ch.cpp"
+#include "be_visitor_valuetype/valuetype_ci.cpp"
+#include "be_visitor_valuetype/valuetype_cs.cpp"
+#include "be_visitor_valuetype/valuetype_sh.cpp"
+#include "be_visitor_valuetype/valuetype_si.cpp"
+#include "be_visitor_valuetype/valuetype_ss.cpp"
#include "be_visitor_valuetype/valuetype_obv_ch.cpp"
#include "be_visitor_valuetype/valuetype_obv_ci.cpp"
#include "be_visitor_valuetype/valuetype_obv_cs.cpp"
-#include "be_visitor_valuetype/valuetype_ci.cpp"
-#include "be_visitor_valuetype/valuetype_cs.cpp"
#include "be_visitor_valuetype/any_op_ch.cpp"
#include "be_visitor_valuetype/any_op_cs.cpp"
#include "be_visitor_valuetype/cdr_op_ch.cpp"
@@ -54,3 +92,6 @@
#include "be_visitor_valuetype/valuetype_init_cs.cpp"
#include "be_visitor_valuetype/valuetype_init_arglist_ch.cpp"
+ACE_RCSID (be,
+ be_visitor_valuetype,
+ "$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_ch.cpp
index 129104f1a06..1fa8514f202 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_ch.cpp
@@ -18,33 +18,33 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_valuetype.h"
-
-ACE_RCSID(be_visitor_valuetype, ami_exception_holder_ch, "$Id$")
+ACE_RCSID (be_visitor_valuetype,
+ ami_exception_holder_ch,
+ "$Id$")
// ******************************************************
-// Interface visitor for client header
+// Interface visitor for client header.
// ******************************************************
-be_visitor_valuetype_ami_exception_holder_ch::be_visitor_valuetype_ami_exception_holder_ch (be_visitor_context *ctx)
+be_visitor_valuetype_ami_exception_holder_ch::
+be_visitor_valuetype_ami_exception_holder_ch (be_visitor_context *ctx)
: be_visitor_valuetype (ctx)
{
}
-be_visitor_valuetype_ami_exception_holder_ch::~be_visitor_valuetype_ami_exception_holder_ch (void)
+be_visitor_valuetype_ami_exception_holder_ch::
+~be_visitor_valuetype_ami_exception_holder_ch (void)
{
}
int
-be_visitor_valuetype_ami_exception_holder_ch::visit_valuetype (be_valuetype *node)
+be_visitor_valuetype_ami_exception_holder_ch::visit_valuetype (
+ be_valuetype *node
+ )
{
TAO_OutStream *os = this->ctx_->stream ();
- // Generate the implemenation of the Messaging aware ORB
+ // Generate the implemenation of the Messaging aware ORB.
*os << be_nl
<< "class _tao_" << node->local_name () << be_idt_nl
<< ": public ";
@@ -58,17 +58,15 @@ be_visitor_valuetype_ami_exception_holder_ch::visit_valuetype (be_valuetype *nod
<< " public virtual OBV_Messaging::ExceptionHolder," << be_nl
<< " public virtual CORBA::DefaultValueRefCountBase" << be_uidt_nl
<< "{" << be_nl;
-
*os << "public:" << be_idt_nl;
-
*os << "_tao_" << node->local_name () << " ();" << be_nl << be_nl;
-
*os << "~_tao_" << node->local_name () << " ();" << be_nl << be_nl;
if (this->visit_valuetype_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_ami_exception_holder_cs::"
+ "(%N:%l) be_visitor_valuetype_ami_"
+ "exception_holder_cs::"
"visit_valuetype - "
"codegen for scope failed\n"),
-1);
@@ -76,36 +74,28 @@ be_visitor_valuetype_ami_exception_holder_ch::visit_valuetype (be_valuetype *nod
*os << be_uidt_nl
<< "};" << be_nl << be_nl;
+
return 0;
}
int
-be_visitor_valuetype_ami_exception_holder_ch::visit_operation (be_operation *node)
+be_visitor_valuetype_ami_exception_holder_ch::visit_operation (
+ be_operation *node
+ )
{
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_OPERATION_IH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_ih visitor (&ctx);
- if (!visitor)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_ami_exception_holder_ch::"
- "visit_operation - "
- "Bad visitor to argument list\n"),
- -1);
- }
-
- if (node->accept (visitor) == -1)
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_ami_exception_holder_ch::"
+ "(%N:%l) be_visitor_valuetype_"
+ "ami_exception_holder_ch::"
"visit_operation - "
"codegen for argument list failed\n"),
-1);
}
- delete visitor;
-
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_cs.cpp
index 8d22f9cdae1..924091b2ace 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_cs.cpp
@@ -18,56 +18,58 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_valuetype.h"
-
-ACE_RCSID(be_visitor_valuetype, ami_exception_holder_cs, "$Id$")
-
+ACE_RCSID (be_visitor_valuetype,
+ ami_exception_holder_cs,
+ "$Id$")
// ************************************************************
// Interface visitor for client stubs
// ************************************************************
-be_visitor_valuetype_ami_exception_holder_cs::be_visitor_valuetype_ami_exception_holder_cs (be_visitor_context *ctx)
+be_visitor_valuetype_ami_exception_holder_cs::
+be_visitor_valuetype_ami_exception_holder_cs (be_visitor_context *ctx)
: be_visitor_valuetype (ctx)
{
}
-be_visitor_valuetype_ami_exception_holder_cs::~be_visitor_valuetype_ami_exception_holder_cs (void)
+be_visitor_valuetype_ami_exception_holder_cs::
+~be_visitor_valuetype_ami_exception_holder_cs (void)
{
}
int
-be_visitor_valuetype_ami_exception_holder_cs::visit_valuetype (be_valuetype *node)
+be_visitor_valuetype_ami_exception_holder_cs::visit_valuetype (
+ be_valuetype *node
+ )
{
- TAO_OutStream *os; // output stream
+ TAO_OutStream *os = this->ctx_->stream ();
- os = this->ctx_->stream ();
-
- if (node->is_nested () &&
- node->defined_in ()->scope_node_type () == AST_Decl::NT_module)
- *os << "OBV_";
+ if (node->is_nested ()
+ && node->defined_in ()->scope_node_type () == AST_Decl::NT_module)
+ {
+ *os << "OBV_";
+ }
*os << node->compute_name ("_tao_", "") << "::"
<< node->compute_local_name ("_tao_", "") << " () { }" << be_nl << be_nl;
- if (node->is_nested () &&
- node->defined_in ()->scope_node_type () == AST_Decl::NT_module)
- *os << "OBV_";
+ if (node->is_nested ()
+ && node->defined_in ()->scope_node_type () == AST_Decl::NT_module)
+ {
+ *os << "OBV_";
+ }
*os << node->compute_name ("_tao_", "") << "::~"
<< node->compute_local_name ("_tao_", "") << " () { }" << be_nl << be_nl;
- // generate code for the elements of the interface
+ // Generate code for the elements of the interface
if (this->visit_valuetype_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_ami_exception_holder_cs::"
"visit_valuetype - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
return 0;
@@ -79,28 +81,16 @@ be_visitor_valuetype_ami_exception_holder_cs::visit_operation (be_operation *nod
{
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_RAISE_OPERATION_CS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_operation_ami_exception_holder_operation_cs visitor (&ctx);
- if (!visitor)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_ami_exception_holder_ch::"
"visit_operation - "
- "Bad visitor to argument list\n"),
- -1);
- }
-
- if (node->accept (visitor) == -1)
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_ami_exception_holder_ch::"
- "visit_operation - "
"codegen for argument list failed\n"),
-1);
}
- delete visitor;
-
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/any_op_ch.cpp
index 008b53322a9..69cf3eb4a34 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/any_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/any_op_ch.cpp
@@ -20,13 +20,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_valuetype.h"
-
-ACE_RCSID(be_visitor_valuetype, any_op_ch, "$Id$")
-
+ACE_RCSID (be_visitor_valuetype,
+ any_op_ch,
+ "$Id$")
// ***************************************************************************
// Valuetype visitor for generating Any operator declarations.
@@ -69,7 +65,7 @@ be_visitor_valuetype_any_op_ch::visit_valuetype (be_valuetype *node)
*os << be_global->stub_export_macro () << " CORBA::Boolean"
<< " operator>>= (const CORBA::Any &, "
- << node->name () << " *&);\n";
+ << node->name () << " *&);" << be_nl;
node->cli_hdr_any_op_gen (1);
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/any_op_cs.cpp
index 1c685d835a4..74232a8ed5a 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/any_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/any_op_cs.cpp
@@ -18,13 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-#include "be_visitor_valuetype.h"
-
-ACE_RCSID(be_visitor_valuetype, any_op_cs, "$Id$")
-
+ACE_RCSID (be_visitor_valuetype,
+ any_op_cs,
+ "$Id$")
// ***************************************************************************
// Valuetype visitor for generating Any operator declarations in the client
@@ -45,37 +41,47 @@ be_visitor_valuetype_any_op_cs::~be_visitor_valuetype_any_op_cs (void)
int
be_visitor_valuetype_any_op_cs::visit_valuetype (be_valuetype *node)
{
- if (node->cli_stub_any_op_gen () || node->imported ())
+ if (node->cli_stub_any_op_gen ()
+ || node->imported ()
+ || node->is_local ())
{
return 0;
}
TAO_OutStream *os = this->ctx_->stream ();
- os->indent ();
+ // Generate the Any <<= and >>= operator declarations
- // Generate the Any <<= and >>= operator declarations.
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
- *os << be_global->stub_export_macro () << " void" << be_nl
- << "operator<<= (CORBA::Any &any, " << node->name ()
- << " *value) // copying" << be_nl
+ *os << "// Copying." << be_nl
+ << "void" << be_nl
+ << "operator<<= (" << be_idt << be_idt_nl
+ << "CORBA::Any &any," << be_nl
+ << node->name () << " *value" << be_uidt_nl
+ << ")" << be_uidt_nl
<< "{" << be_idt_nl
- << "TAO_OutputCDR stream;" << be_nl
- << "if (stream << value)" << be_nl
+ << "TAO_OutputCDR stream;" << be_nl << be_nl
+ << "if (stream << value)" << be_idt_nl
<< "{" << be_idt_nl
<< "any._tao_replace (" << be_idt << be_idt_nl
<< node->tc_name () << ", " << be_nl
<< "TAO_ENCAP_BYTE_ORDER," << be_nl
- << "stream.begin ());" << be_uidt << be_uidt << be_uidt_nl
- << "}" << be_uidt_nl
+ << "stream.begin ()" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
<< "}" << be_nl << be_nl;
- *os << be_global->stub_export_macro () << " void" << be_nl
- << "operator<<= (CORBA::Any &any, " << node->name ()
- << " **value) // non-copying" << be_nl
+ *os << "// Non-copying." << be_nl
+ << "void" << be_nl
+ << "operator<<= (" << be_idt << be_idt_nl
+ << "CORBA::Any &any," << be_nl
+ << node->name ()<< " **value" << be_uidt_nl
+ << ")" << be_uidt_nl
<< "{" << be_idt_nl
- << "TAO_OutputCDR stream;" << be_nl
- << "if (stream << *value)" << be_nl
+ << "TAO_OutputCDR stream;" << be_nl << be_nl
+ << "if (stream << *value)" << be_idt_nl
<< "{" << be_idt_nl
<< "any._tao_replace (" << be_idt << be_idt_nl
<< node->tc_name () << ", " << be_nl
@@ -83,56 +89,65 @@ be_visitor_valuetype_any_op_cs::visit_valuetype (be_valuetype *node)
<< "stream.begin ()," << be_nl
<< "1," << be_nl
<< "*value," << be_nl
- << node->name () << "::_tao_any_destructor);"
- << be_uidt << be_uidt << be_uidt_nl
- << "}" << be_uidt_nl
+ << node->name () << "::_tao_any_destructor" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
<< "}" << be_nl << be_nl;
- *os << be_global->stub_export_macro () << " CORBA::Boolean" << be_nl
- << "operator>>= (const CORBA::Any &any, "
- << node->name () << " *&value)" << be_nl
+ *os << "CORBA::Boolean" << be_nl
+ << "operator>>= (" << be_idt << be_idt_nl
+ << "const CORBA::Any &any," << be_nl
+ << node->name () << " *&value" << be_uidt_nl
+ << ")" << be_uidt_nl
<< "{" << be_idt_nl
<< "ACE_TRY_NEW_ENV" << be_nl
<< "{" << be_idt_nl
<< "value = 0;" << be_nl
- << "CORBA::TypeCode_var type = any.type ();" << be_nl << be_nl
- << "CORBA::Boolean result = type->equivalent (" << node->tc_name ()
- << " ACE_ENV_ARG_PARAMETER);" << be_nl
+ << "CORBA::TypeCode_var type = any.type ();" << be_nl
+ << "CORBA::Boolean result =" << be_idt_nl
+ << "type->equivalent (" << be_idt << be_idt_nl
+ << node->tc_name () << be_nl
+ << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
<< "ACE_TRY_CHECK;" << be_nl << be_nl
- << "if (!result)" << be_nl
+ << "if (!result)" << be_idt_nl
<< "{" << be_idt_nl
<< "return 0; // not equivalent" << be_uidt_nl
- << "}" << be_nl
- << "if (any.any_owns_data ())" << be_nl
+ << "}" << be_uidt_nl << be_nl
+ << "if (any.any_owns_data ())" << be_idt_nl
<< "{" << be_idt_nl
- << "const " << node->name () << " *const_holder = "
+ << "const " << node->name () << " *const_holder =" << be_idt_nl
<< "ACE_static_cast (" << be_idt << be_idt_nl
- << "const " << node->name () << "*," << be_nl
- << "any.value ());" << be_uidt << be_uidt_nl
- << "value = ACE_const_cast (" << be_idt << be_idt_nl
- << node->name () << "*," << be_nl
- << "const_holder);" << be_uidt << be_uidt_nl
+ << "const " << node->name () << " *," << be_nl
+ << "any.value ()" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "value =" << be_idt_nl
+ << "ACE_const_cast (" << be_idt << be_idt_nl
+ << node->name () << " *," << be_nl
+ << "const_holder" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
<< "return 1;" << be_uidt_nl
- << "}" << be_nl
- << "else" << be_nl // else any does not own the data
+ << "}" << be_uidt_nl
+ << "else" << be_idt_nl // else any does not own the data
<< "{" << be_idt_nl
<< node->name () << " *tmp;" << be_nl
<< "TAO_InputCDR stream (" << be_idt << be_idt_nl
<< "any._tao_get_cdr ()," << be_nl
- << "any._tao_byte_order ());" << be_uidt << be_uidt_nl
- << "if (stream >> tmp)" << be_nl
+ << "any._tao_byte_order ()" << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl
+ << "if (stream >> tmp)" << be_idt_nl
<< "{" << be_idt_nl
<< "((CORBA::Any *)&any)->_tao_replace (" << be_idt << be_idt_nl
<< node->tc_name () << "," << be_nl
<< "1," << be_nl
<< "ACE_static_cast (void *, tmp)," << be_nl
- << node->name () << "::_tao_any_destructor);" << be_uidt << be_uidt_nl
+ << node->name () << "::_tao_any_destructor" << be_uidt_nl
+ << ");" << be_uidt_nl
<< "value = tmp;" << be_nl
<< "return 1;" << be_uidt_nl
- << "}" << be_nl
- << be_uidt_nl
- << "}" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
<< "}" << be_nl
<< "ACE_CATCHANY" << be_nl
<< "{" << be_nl
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp
index b3a255b16cb..bb183c26b31 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp
@@ -20,23 +20,19 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_operation.h"
-
-ACE_RCSID(be_visitor_valuetype, arglist, "$Id$")
-
+ACE_RCSID (be_visitor_valuetype,
+ arglist,
+ "$Id$")
// ************************************************************
-// operation visitor to generate the argument list.
+// 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
+// visitors to avoid code duplication and tight coupling.
// ************************************************************
-be_visitor_obv_operation_arglist::be_visitor_obv_operation_arglist (be_visitor_context
- *ctx)
+be_visitor_obv_operation_arglist::be_visitor_obv_operation_arglist (
+ be_visitor_context *ctx
+ )
: be_visitor_scope (ctx)
{
}
@@ -52,6 +48,7 @@ be_visitor_obv_operation_arglist::is_amh_exception_holder (be_operation *node)
be_interface *iface = be_interface::narrow_from_scope (scope);
int is_an_amh_exception_holder = 0;
+
if (iface != 0)
{
const char *amh_underbar = "AMH_";
@@ -63,16 +60,16 @@ be_visitor_obv_operation_arglist::is_amh_exception_holder (be_operation *node)
amh_underbar[3] == node_name[3]
) // node name starts with "AMH_"
{
- //ACE_DEBUG ((LM_DEBUG, "Passed first test of amh_excepholder \n"));
const char *last_E = ACE_OS::strrchr (iface->full_name (), 'E');
+
if (last_E != 0
&& ACE_OS::strcmp (last_E, "ExceptionHolder") == 0)
{
- //ACE_DEBUG ((LM_DEBUG, "obv_operation: Passed second test of amh_excepholder \n"));
is_an_amh_exception_holder = 1;
}
}
}
+
return is_an_amh_exception_holder;
}
@@ -100,26 +97,9 @@ be_visitor_obv_operation_arglist::visit_operation (be_operation *node)
{
// Use ACE_ENV_SINGLE_ARG_DECL or ACE_ENV_ARG_DECL depending on
// whether the operation node has parameters.
- const char *env_decl;
- /********************************************************************/
- // If it is an AMH raise operation, we do not need the Environment
- // variable.
- if (amh_valuetype)
- {
- if (node->argument_count () > 0)
- env_decl = " ACE_ENV_ARG_DECL_NOT_USED";
- else
- env_decl = " ACE_ENV_SINGLE_ARG_DECL_NOT_USED";
- }
- /********************************************************************/
- else
- {
- if (node->argument_count () > 0)
- env_decl = " ACE_ENV_ARG_DECL";
- else
- env_decl = " ACE_ENV_SINGLE_ARG_DECL";
- }
- *os << env_decl;
+ const char *env_decl = (node->argument_count () > 0
+ ? " ACE_ENV_ARG_DECL"
+ : "ACE_ENV_SINGLE_ARG_DECL");
if (!amh_valuetype)
{
@@ -146,7 +126,7 @@ be_visitor_obv_operation_arglist::visit_operation (be_operation *node)
*os << be_uidt_nl;
}
- *os << ")" << be_uidt;
+ *os << ")";
be_visitor_context ctx = *this->ctx_;
be_visitor_operation operation_visitor (&ctx);
@@ -164,12 +144,10 @@ be_visitor_obv_operation_arglist::visit_operation (be_operation *node)
// Each method is pure virtual in the Valuetype class.
// BUT, not if it is an AMH ExceptionHolder!
/***********************************************************/
- if (amh_valuetype)
+ if (is_amh_exception_holder (node))
{
- *os << be_uidt_nl
- << "{ this->exception->_raise (); }"
- << be_uidt_nl
- << be_nl;
+ *os << "{ this->exception->_raise (); }"
+ << be_uidt_nl;
}
/***********************************************************/
else
@@ -182,11 +160,11 @@ be_visitor_obv_operation_arglist::visit_operation (be_operation *node)
case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IS:
break;
case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IMPL_CH:
- *os << ";" << be_uidt_nl;
+ *os << ";" << be_nl;
break;
case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IMPL_CS:
default:
- *os << be_uidt_nl;
+ *os << be_nl;
}
return 0;
@@ -195,17 +173,14 @@ be_visitor_obv_operation_arglist::visit_operation (be_operation *node)
int
be_visitor_obv_operation_arglist::visit_argument (be_argument *node)
{
- // TAO_OutStream *os = this->ctx_->stream ();
-
- // 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
+ // 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,
@@ -217,10 +192,9 @@ be_visitor_obv_operation_arglist::visit_argument (be_argument *node)
// 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
+ // information from the context.
// %! use AST_Interface
- be_valuetype *intf;
- intf = this->ctx_->attribute ()
+ be_valuetype *intf = this->ctx_->attribute ()
? be_valuetype::narrow_from_scope (this->ctx_->attribute ()->defined_in ())
: be_valuetype::narrow_from_scope (op->defined_in ());
@@ -232,14 +206,13 @@ be_visitor_obv_operation_arglist::visit_argument (be_argument *node)
"Bad interface\n"),
-1);
}
- ctx.scope (intf); // set new scope
- // snipped from
- // be_visitor_args_arglist::visit_argument (be_argument *node)
+ ctx.scope (intf);
ctx.node (node); // save the argument node
- // retrieve the type
+ // Retrieve the type.
be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -249,24 +222,27 @@ be_visitor_obv_operation_arglist::visit_argument (be_argument *node)
-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
-
- // end of be_visitor_args_arglist::visit_argument ()
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_CH:
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_ARGLIST_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARGUMENT_ARGLIST_CH);
+ be_visitor_args_arglist visitor (&ctx);
+ status = bt->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_OTHERS:
case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_SH:
case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IH:
case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IS:
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_ARGLIST_OTHERS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARGUMENT_ARGLIST_OTHERS);
+ be_visitor_args_arglist visitor (&ctx);
+ status = bt->accept (&visitor);
+ break;
+ }
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -277,26 +253,15 @@ be_visitor_obv_operation_arglist::visit_argument (be_argument *node)
}
}
- // grab a visitor
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_arglist::"
"visit_argument - "
- "Bad visitor\n"),
- -1);
- }
- if (bt->accept (visitor) == -1)
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_arglist::"
- "visit_argument - "
"codegen for argument failed\n"),
-1);
}
- delete visitor;
+
return 0;
}
@@ -306,21 +271,26 @@ be_visitor_obv_operation_arglist::post_process (be_decl *bd)
{
TAO_OutStream *os = this->ctx_->stream ();
- switch (this->ctx_->state ())
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_CH:
+ case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_OTHERS:
+ case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_SH:
+ case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IH:
+ case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IS:
+ if (!this->last_node (bd))
+ {
+ *os << ", ";
+ }
+ else
{
- case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_CH:
- case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_OTHERS:
- case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_SH:
- case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IH:
- case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IS:
- if (!this->last_node (bd))
- *os << ", "; // "\n";
- else
- *os << ""; // "\n";
- break;
- default:
- break;
+ *os << "";
}
+
+ break;
+ default:
+ break;
+ }
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp
index 51c3b5aa54a..2b8790ce4fc 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp
@@ -20,17 +20,13 @@
//
// ============================================================================
+ACE_RCSID (be_visitor_valuetype,
+ cdr_op_ch,
+ "$Id$")
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_valuetype.h"
-
-ACE_RCSID(be_visitor_valuetype, cdr_op_ch, "$Id$")
-
-be_visitor_valuetype_cdr_op_ch::be_visitor_valuetype_cdr_op_ch
-(be_visitor_context *ctx)
+be_visitor_valuetype_cdr_op_ch::be_visitor_valuetype_cdr_op_ch (
+ be_visitor_context *ctx
+ )
: be_visitor_valuetype (ctx)
{
}
@@ -48,10 +44,6 @@ be_visitor_valuetype_cdr_op_ch::visit_valuetype (be_valuetype *node)
}
TAO_OutStream *os = this->ctx_->stream ();
- os->indent (); //start with whatever indentation level we are at now
-
-
-
if (!node->cli_hdr_cdr_op_gen ())
{
// Generate helper functions declaration.
@@ -60,12 +52,12 @@ be_visitor_valuetype_cdr_op_ch::visit_valuetype (be_valuetype *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_cdr_op_ch::"
"visit_valuetype - "
- "codegen for helper functions failed\n"), -1);
+ "codegen for helper functions failed\n"),
+ -1);
}
- // generate the CDR << and >> operator declarations (prototypes)
-
- os->indent (); //start with whatever indentation level we are at now
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
*os << be_global->stub_export_macro () << " "
<< "CORBA::Boolean operator<< (TAO_OutputCDR &, const "
@@ -78,29 +70,25 @@ be_visitor_valuetype_cdr_op_ch::visit_valuetype (be_valuetype *node)
node->cli_hdr_cdr_op_gen (1);
}
-
- // set the substate as generating code for the types defined in our scope
+ // Set the substate as generating code for the types defined in our scope.
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
- // 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_valuetype_cdr_op_ch::"
"visit_valuetype - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
- //@@ Boris: that's suck!
- if (!node->is_abstract_valuetype ())
+ if (!node->is_abstract ())
{
- // functions that marshal state
- be_visitor_context* new_ctx =
- new be_visitor_context (*this->ctx_);
- be_visitor_valuetype_marshal_ch visitor (new_ctx);
+ // Functions that marshal state.
+ be_visitor_context new_ctx (*this->ctx_);
+ be_visitor_valuetype_marshal_ch visitor (&new_ctx);
visitor.visit_valuetype (node);
}
-
-
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ci.cpp
index ad77ab00e28..7ef0373f2b7 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ci.cpp
@@ -20,18 +20,13 @@
//
// ============================================================================
+ACE_RCSID (be_visitor_valuetype,
+ cdr_op_ci,
+ "$Id$")
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_valuetype.h"
-// #include "be_visitor_field.h"
-
-ACE_RCSID(be_visitor_valuetype, cdr_op_ci, "$Id$")
-
-be_visitor_valuetype_cdr_op_ci::be_visitor_valuetype_cdr_op_ci
-(be_visitor_context *ctx)
+be_visitor_valuetype_cdr_op_ci::be_visitor_valuetype_cdr_op_ci (
+ be_visitor_context *ctx
+ )
: be_visitor_valuetype (ctx)
{
}
@@ -43,9 +38,11 @@ be_visitor_valuetype_cdr_op_ci::~be_visitor_valuetype_cdr_op_ci (void)
int
be_visitor_valuetype_cdr_op_ci::visit_valuetype (be_valuetype *node)
{
- // already generated and/or we are imported. Don't do anything.
+ // Already generated and/or we are imported. Don't do anything.
if (node->cli_inline_cdr_op_gen () || node->imported ())
- return 0;
+ {
+ return 0;
+ }
// Generate helper functions implementation.
if (node->gen_helper_inline () == -1)
@@ -53,45 +50,31 @@ be_visitor_valuetype_cdr_op_ci::visit_valuetype (be_valuetype *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_cdr_op_ci::"
"visit_valuetype - "
- "codegen for helper functions failed\n"), -1);
+ "codegen for helper functions failed\n"),
+ -1);
}
TAO_OutStream *os = this->ctx_->stream ();
- os->indent (); //start with whatever indentation level we are at now
-
- // Generate CDR << and >> operator signatures
- //@@ Boris: Can I move this to be_valuetype? (as with _var, _out, etc?)
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
- //This is just declaration so no ACE_INLINE
+ // This is just declaration so no ACE_INLINE
*os << be_global->stub_export_macro () << " "
<< "CORBA::Boolean operator<< (TAO_OutputCDR &, const "
<< node->full_name () << " *);" << be_nl;
*os << be_global->stub_export_macro () << " "
<< "CORBA::Boolean operator>> (TAO_InputCDR &, "
- << node->full_name () << " *&);" << be_nl;
-
-
-
- // Generate marshaling code if any
-
- // @@ Boris: the next statement is patrue anymore since I moved code
- // to stubs.
-
- // First generate code for our children. The reason we do this first is
- // because the inlined code for our children must be available before we use
- // it in our parent
+ << node->full_name () << " *&);" << be_nl << be_nl;
- // set the substate as generating code for the types defined in our scope
- //this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
- // 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_valuetype_cdr_op_ci"
"::visit_valuetype - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
node->cli_inline_cdr_op_gen (I_TRUE);
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_cs.cpp
index 574b3cd3131..597784321ae 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_cs.cpp
@@ -21,17 +21,13 @@
//
// ============================================================================
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_cdr_op_cs,
+ "$Id$")
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_valuetype.h"
-
-ACE_RCSID(be_visitor_valuetype, valuetype_cdr_op_cs, "$Id$")
-
-be_visitor_valuetype_cdr_op_cs::be_visitor_valuetype_cdr_op_cs
-(be_visitor_context *ctx)
+be_visitor_valuetype_cdr_op_cs::be_visitor_valuetype_cdr_op_cs (
+ be_visitor_context *ctx
+ )
: be_visitor_valuetype (ctx)
{
}
@@ -43,9 +39,11 @@ be_visitor_valuetype_cdr_op_cs::~be_visitor_valuetype_cdr_op_cs (void)
int
be_visitor_valuetype_cdr_op_cs::visit_valuetype (be_valuetype *node)
{
- // already generated and/or we are imported. Don't do anything.
+ // Already generated and/or we are imported. Don't do anything.
if (node->cli_stub_cdr_op_gen () || node->imported ())
- return 0;
+ {
+ return 0;
+ }
// Generate helper functions implementation.
if (node->gen_helper_stubs () == -1)
@@ -53,79 +51,65 @@ be_visitor_valuetype_cdr_op_cs::visit_valuetype (be_valuetype *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_cdr_op_cs::"
"visit_valuetype - "
- "codegen for helper functions failed\n"), -1);
+ "codegen for helper functions failed\n"),
+ -1);
}
- // Generate marshaling code
-
-
TAO_OutStream *os = this->ctx_->stream ();
- // @@ Boris: Do I need to let our children a chance to generate anything?
- // Sounds fair ;-)
-
- // @@ Boris: the next statement is not true anymore since this is a CS
-
- // First generate code for our children. The reason we do this first is
- // because the inlined code for our children must be available before we use
- // it in our parent
-
- // set the substate as generating code for the types defined in our scope
- // this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
- // 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_valuetype_cdr_op_ci"
"::visit_valuetype - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
- // set the sub state as generating code for the output operator
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Set the sub state as generating code for the output operator.
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_OUTPUT);
*os << "CORBA::Boolean" << be_nl
- << "operator<< (TAO_OutputCDR &strm, const "
- << node->full_name ()
- << " *_tao_valuetype)" << be_nl
+ << "operator<< (" << be_idt << be_idt_nl
+ << "TAO_OutputCDR &strm," << be_nl
+ << "const " << node->full_name ()
+ << " *_tao_valuetype" << be_uidt_nl
+ << ")" << be_uidt_nl
<< "{" << be_idt_nl;
- *os << "return CORBA_ValueBase::_tao_marshal (strm," << be_idt_nl
- << "ACE_const_cast (" << node->full_name () << "*, _tao_valuetype)," << be_nl
- << "(ptr_arith_t) &" << node->full_name() <<"::_downcast);"
- << be_uidt<< be_uidt_nl
- << "}\n\n";
+ *os << "return" << be_idt_nl
+ << "CORBA_ValueBase::_tao_marshal (" << be_idt << be_idt_nl
+ << "strm," << be_nl
+ << "ACE_const_cast (" << be_idt << be_idt_nl
+ << node->full_name () << " *," << be_nl
+ << "_tao_valuetype" << be_uidt_nl
+ << ")," << be_uidt_nl
+ << "(ptr_arith_t) &" << node->full_name () <<"::_downcast"
+ << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
- // set the substate as generating code for the input operator
- //this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_INPUT);
*os << "CORBA::Boolean" << be_nl
- << "operator>> (TAO_InputCDR &strm, "
+ << "operator>> (" << be_idt << be_idt_nl
+ << "TAO_InputCDR &strm," << be_nl
<< node->full_name ()
- << " *&_tao_valuetype)" << be_nl
+ << " *&_tao_valuetype" << be_uidt_nl
+ << ")" << be_uidt_nl
<< "{" << be_idt_nl;
- *os << "return " << node->full_name() << "::_tao_unmarshal (strm, _tao_valuetype);"
-#ifdef obv_marshal_old_version
- *os << "CORBA::ValueBase *ptr;" << be_nl
- << "int retval = CORBA_ValueBase::_tao_unmarshal (strm,"
- << be_idt_nl << "ptr, (ptr_arith_t) &" << node->full_name() <<"::_downcast);"
+ *os << "return " << node->full_name ()
+ << "::_tao_unmarshal (strm, _tao_valuetype);"
<< be_uidt_nl
- << "if (retval) {" << be_idt_nl
- << "_tao_valuetype = " << node->full_name() << "::_downcast (ptr);"
- << be_nl << "if (_tao_valuetype) retval = 1;"
- << be_uidt_nl << "}" << be_idt_nl
- << "return retval;"
-#endif /* obv_marshal_old_version */
- << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
- //@@ Boris: ment to be refactored
- if (!node->is_abstract_valuetype ())
- {
- // functions that marshal state
- be_visitor_context* new_ctx = new be_visitor_context (*this->ctx_);
- be_visitor_valuetype_marshal_cs visitor (new_ctx);
- visitor.visit_valuetype (node);
- }
+ if (!node->is_abstract ())
+ {
+ // Functions that marshal state.
+ be_visitor_context new_ctx (*this->ctx_);
+ be_visitor_valuetype_marshal_cs visitor (&new_ctx);
+ visitor.visit_valuetype (node);
+ }
node->cli_stub_cdr_op_gen (I_TRUE);
-
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_ch.cpp
index 494b8378eb1..0d4a7238d01 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_ch.cpp
@@ -18,277 +18,202 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_field.h"
-
-ACE_RCSID(be_visitor_valuetype, field_cdr_op_ch, "$Id$")
-
+ACE_RCSID (be_visitor_valuetype,
+ field_cdr_op_ch,
+ "$Id$")
// **********************************************
-// visitor for field in the client header file
+// Visitor for field in the client header file.
// **********************************************
-// constructor
-be_visitor_valuetype_field_cdr_ch::be_visitor_valuetype_field_cdr_ch (be_visitor_context *ctx)
+be_visitor_valuetype_field_cdr_ch::be_visitor_valuetype_field_cdr_ch (
+ be_visitor_context *ctx
+ )
: be_visitor_decl (ctx),
- pre_ (""), post_ ("")
+ pre_ (""),
+ post_ ("")
{
}
-// destructor
be_visitor_valuetype_field_cdr_ch::~be_visitor_valuetype_field_cdr_ch (void)
{
}
-// visit the field node
int
be_visitor_valuetype_field_cdr_ch::visit_field (be_field *node)
{
be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ch::"
"visit_field - "
- "Bad field type\n"
- ), -1);
+ "Bad field type\n"),
+ -1);
}
- this->ctx_->node (node); // save the node
+ this->ctx_->node (node);
+
if (bt->accept (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ch::"
"visit_field - "
- "codegen for field type failed\n"
- ), -1);
+ "codegen for field type failed\n"),
+ -1);
}
return 0;
}
-// =visit operations on all possible data types that a field can be
+// Visit operations on all possible data types that a field can be
-// visit array type
int
be_visitor_valuetype_field_cdr_ch::visit_array (be_array *node)
{
- // if not a typedef and we are defined in the use scope, we must be defined
-
- if (!this->ctx_->alias () // not a typedef
+ // If not a typedef and we are defined in the use scope, we must be defined.
+ if (!this->ctx_->alias ()
&& node->is_child (this->ctx_->scope ()))
{
- // this is the case for anonymous arrays.
-
- // instantiate a visitor context with a copy of our context. This info
- // will be modified based on what type of node we are visiting
+ // This is the case for anonymous arrays.
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.node (node);
ctx.state (TAO_CodeGen::TAO_ARRAY_CDR_OP_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_field_cdr_ch::"
- "visit_array - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_array_cdr_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ch::"
"visit_array - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
return 0;
}
-// visit enum type
int
be_visitor_valuetype_field_cdr_ch::visit_enum (be_enum *node)
{
- // if not a typedef and we are defined in the use scope, we must be defined
- if (!this->ctx_->alias () // not a typedef
+ // If not a typedef and we are defined in the use scope, we must be defined.
+ if (!this->ctx_->alias ()
&& 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.node (node);
ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_field_cdr_ch::"
- "visit_enum - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_enum_cdr_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ch::"
"visit_enum - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
return 0;
}
-// visit sequence type
int
be_visitor_valuetype_field_cdr_ch::visit_sequence (be_sequence *node)
{
- // if not a typedef and we are defined in the use scope, we must be defined
+ // 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.node (node);
ctx.state (TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_field_cdr_ch::"
- "visit_sequence - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_sequence_cdr_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ch::"
"visit_sequence - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
return 0;
}
-// visit structure type
int
be_visitor_valuetype_field_cdr_ch::visit_structure (be_structure *node)
{
- // if not a typedef and we are defined in the use scope, we must be defined
-
- if (!this->ctx_->alias () // not a typedef
+ // If not a typedef and we are defined in the use scope, we must be defined.
+ if (!this->ctx_->alias ()
&& 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.node (node);
ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_field_cdr_ch::"
- "visit_struct - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_structure_cdr_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ch::"
"visit_struct - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
return 0;
}
-// visit typedefed type
int
be_visitor_valuetype_field_cdr_ch::visit_typedef (be_typedef *node)
{
- // save the node for use in code generation and
+ // Save the node for use in code generation and
// indicate that the field of the field node
- // is a typedefed quantity
+ // is a typedefed quantity.
this->ctx_->alias (node);
- // make a decision based on the primitive base type
+ // 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_valuetype_field_cdr_ch::"
"visit_typedef - "
- "Bad primitive type\n"
- ), -1);
+ "Bad primitive type\n"),
+ -1);
}
+
this->ctx_->alias (0);
return 0;
}
-// visit union type
int
be_visitor_valuetype_field_cdr_ch::visit_union (be_union *node)
{
- // if not a typedef and we are defined in the use scope, we must be defined
- if (!this->ctx_->alias () // not a typedef
+ // If not a typedef and we are defined in the use scope, we must be defined.
+ if (!this->ctx_->alias ()
&& 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.node (node);
ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_field_cdr_ch::"
- "visit_enum - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_union_cdr_op_ch visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ch::"
"visit_enum - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_ci.cpp
index bb9549c5b1c..d77e0de7886 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_ci.cpp
@@ -19,109 +19,112 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_field.h"
-
-ACE_RCSID(be_visitor_valuetype, field_cdr_op_ci, "$Id$")
-
+ACE_RCSID (be_visitor_valuetype,
+ field_cdr_op_ci,
+ "$Id$")
// **********************************************
-// visitor for field in the client stubs file
+// Visitor for field in the client inline file.
// **********************************************
-// constructor
-be_visitor_valuetype_field_cdr_ci::be_visitor_valuetype_field_cdr_ci (be_visitor_context *ctx)
+be_visitor_valuetype_field_cdr_ci::be_visitor_valuetype_field_cdr_ci (
+ be_visitor_context *ctx
+ )
: be_visitor_decl (ctx),
- pre_ (""), post_ ("")
+ pre_ (""),
+ post_ ("")
{
}
-// destructor
be_visitor_valuetype_field_cdr_ci::~be_visitor_valuetype_field_cdr_ci (void)
{
}
-// visit the field node
int
be_visitor_valuetype_field_cdr_ci::visit_field (be_field *node)
{
be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_field - "
- "Bad field type\n"
- ), -1);
+ "Bad field type\n"),
+ -1);
}
- this->ctx_->node (node); // save the node
+ this->ctx_->node (node);
+
if (bt->accept (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_field - "
- "codegen for field type failed\n"
- ), -1);
+ "codegen for field type failed\n"),
+ -1);
}
+
return 0;
}
-// visit array
int
be_visitor_valuetype_field_cdr_ci::visit_array (be_array *node)
{
- TAO_OutStream *os; // output stream
- os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream ();
- // retrieve the field node
+ // Retrieve the field node.
be_field *f = this->ctx_->be_node_as_field ();
+
if (!f)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_array - "
- "cannot retrieve field node\n"
- ), -1);
+ "cannot retrieve field node\n"),
+ -1);
}
- // for anonymous arrays, the type name has a _ prepended. We compute
+ // For anonymous arrays, the type name has a _ prepended. We compute
// the full_name with or without the underscore and use it later on.
- char fname [NAMEBUFSIZE]; // to hold the full and
+ char fname [NAMEBUFSIZE];
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
- // save the node's local name and full name in a buffer for quick
- // use later on
- ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
- if (!this->ctx_->alias () // not a typedef
+ if (!this->ctx_->alias ()
&& node->is_child (this->ctx_->scope ()))
{
- // for anonymous arrays ...
- // we have to generate a name for us that has an underscore
+ // For anonymous arrays ...
+ // We have to generate a name for us that has an underscore
// prepended to our local name. This needs to be inserted after
- // the parents's name
+ // the parents's name.
if (node->is_nested ())
{
be_decl *parent =
be_scope::narrow_from_scope (node->defined_in ())->decl ();
- ACE_OS::sprintf (fname, "%s::_%s", parent->full_name (),
+ ACE_OS::sprintf (fname,
+ "%s::_%s",
+ parent->full_name (),
node->local_name ()->get_string ());
}
else
{
- ACE_OS::sprintf (fname, "_%s", node->full_name ());
+ ACE_OS::sprintf (fname,
+ "_%s",
+ node->full_name ());
}
}
else
{
- // typedefed node
- ACE_OS::sprintf (fname, "%s", node->full_name ());
+ // Typedefed node.
+ ACE_OS::sprintf (fname,
+ "%s",
+ node->full_name ());
}
- // check what is the code generation substate. Are we generating
+ // Check what is the code generation substate. Are we generating
// code for the in/out operators for our parent or for us?
switch (this->ctx_->sub_state ())
{
@@ -134,74 +137,58 @@ be_visitor_valuetype_field_cdr_ci::visit_array (be_array *node)
<< "_tao_" << pre_ << f->local_name () << post_ << ")";
return 0;
case TAO_CodeGen::TAO_CDR_SCOPE:
- // proceed further
+ // Proceed further.
break;
default:
- // error
+ // Error.
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_array - "
- "bad sub state\n"
- ), -1);
+ "bad sub state\n"),
+ -1);
}
- // if not a typedef and we are defined in the use scope, we must be defined
-
+ // 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 ()))
{
- // this is the case for anonymous arrays. Generate the <<, >> operators
- // for the type defined by the anonymous array
-
- // instantiate a visitor context with a copy of our context. This info
- // will be modified based on what type of node we are visiting
+ // This is the case for anonymous arrays.
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 declaration
+ ctx.node (node);
ctx.state (TAO_CodeGen::TAO_ARRAY_CDR_OP_CI);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_field_cdr_ci::"
- "visit_array - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_array_cdr_op_ci visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_array - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
+
return 0;
}
-// visit enum type
int
be_visitor_valuetype_field_cdr_ci::visit_enum (be_enum *node)
{
- TAO_OutStream *os; // output stream
- os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream ();
- // retrieve the field node
+ // Retrieve the field node.
be_field *f = this->ctx_->be_node_as_field ();
+
if (!f)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_array - "
- "cannot retrieve field node\n"
- ), -1);
+ "cannot retrieve field node\n"),
+ -1);
}
- // check what is the code generations substate. Are we generating code for
+ // Check what is the code generation substate. Are we generating code for
// the in/out operators for our parent or for us?
switch (this->ctx_->sub_state ())
{
@@ -212,70 +199,56 @@ be_visitor_valuetype_field_cdr_ci::visit_enum (be_enum *node)
*os << "(strm << " << pre_ << f->local_name () << post_ << ")";
return 0;
case TAO_CodeGen::TAO_CDR_SCOPE:
- // proceed further
+ // Proceed further.
break;
default:
- // error
+ // Error.
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_enum - "
- "bad sub state\n"
- ), -1);
+ "bad sub state\n"),
+ -1);
}
- if (node->node_type () != AST_Decl::NT_typedef // not a typedef
- && node->is_child (this->ctx_->scope ())) // node is defined inside the
- // structure
+ if (node->node_type () != AST_Decl::NT_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
-
- // generate the typcode for enums
+ ctx.node (node);
ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CI);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_field_cdr_ci::"
- "visit_enum - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_enum_cdr_op_ci visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_enum - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
+
return 0;
}
-// visit interface type
int
be_visitor_valuetype_field_cdr_ci::visit_interface (be_interface *)
{
- TAO_OutStream *os; // output stream
- os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream ();
- // retrieve the field node
+ // Retrieve the field node.
be_field *f = this->ctx_->be_node_as_field ();
+
if (!f)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_interface - "
- "cannot retrieve field node\n"
- ), -1);
+ "cannot retrieve field node\n"),
+ -1);
}
- // check what is the code generations substate. Are we generating code for
+ // Check what is the code generations substate. Are we generating code for
// the in/out operators for our parent or for us?
switch (this->ctx_->sub_state ())
{
@@ -286,39 +259,39 @@ be_visitor_valuetype_field_cdr_ci::visit_interface (be_interface *)
*os << "(strm << " << pre_ << f->local_name () << post_ << ".in ())";
break;
case TAO_CodeGen::TAO_CDR_SCOPE:
- // nothing to be done because an interface cannit be declared inside a
- // structure
+ // Nothing to be done because an interface cannit be declared inside a
+ // structure.
break;
default:
- // error
+ // Error.
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_interface - "
- "bad sub state\n"
- ), -1);
+ "bad sub state\n"),
+ -1);
}
+
return 0;
}
-// visit interface forward type
int
be_visitor_valuetype_field_cdr_ci::visit_interface_fwd (be_interface_fwd *)
{
- TAO_OutStream *os; // output stream
- os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream ();
- // retrieve the field node
+ // Retrieve the field node.
be_field *f = this->ctx_->be_node_as_field ();
+
if (!f)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_interface_fwd - "
- "cannot retrieve field node\n"
- ), -1);
+ "cannot retrieve field node\n"),
+ -1);
}
- // check what is the code generations substate. Are we generating code for
+ // Check what is the code generations substate. Are we generating code for
// the in/out operators for our parent or for us?
switch (this->ctx_->sub_state ())
{
@@ -329,39 +302,39 @@ be_visitor_valuetype_field_cdr_ci::visit_interface_fwd (be_interface_fwd *)
*os << "(strm << " << pre_ << f->local_name () << post_ << ").in ()";
break;
case TAO_CodeGen::TAO_CDR_SCOPE:
- // nothing to be done because an interface cannit be declared inside a
- // structure
+ // Nothing to be done because an interface cannit be declared inside a
+ // structure.
break;
default:
- // error
+ // Error.
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_interface_fwd - "
- "bad sub state\n"
- ), -1);
+ "bad sub state\n"),
+ -1);
}
+
return 0;
}
-// visit valuetype type
int
be_visitor_valuetype_field_cdr_ci::visit_valuetype (be_valuetype *)
{
- TAO_OutStream *os; // output stream
- os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream ();
- // retrieve the field node
+ // Retrieve the field node.
be_field *f = this->ctx_->be_node_as_field ();
+
if (!f)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_valuetype - "
- "cannot retrieve field node\n"
- ), -1);
+ "cannot retrieve field node\n"),
+ -1);
}
- // check what is the code generations substate. Are we generating code for
+ // Check what is the code generations substate. Are we generating code for
// the in/out operators for our parent or for us?
switch (this->ctx_->sub_state ())
{
@@ -372,39 +345,39 @@ be_visitor_valuetype_field_cdr_ci::visit_valuetype (be_valuetype *)
*os << "(strm << " << pre_ << f->local_name () << post_ << ".in ())";
break;
case TAO_CodeGen::TAO_CDR_SCOPE:
- // nothing to be done because an valuetype cannit be declared inside a
- // structure
+ // Nothing to be done because a valuetype cannit be declared inside a
+ // structure.
break;
default:
- // error
+ // Error.
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_valuetype - "
- "bad sub state\n"
- ), -1);
+ "bad sub state\n"),
+ -1);
}
+
return 0;
}
-// visit valuetype forward type
int
be_visitor_valuetype_field_cdr_ci::visit_valuetype_fwd (be_valuetype_fwd *)
{
- TAO_OutStream *os; // output stream
- os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream ();
- // retrieve the field node
+ // Retrieve the field node.
be_field *f = this->ctx_->be_node_as_field ();
+
if (!f)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_valuetype_fwd - "
- "cannot retrieve field node\n"
- ), -1);
+ "cannot retrieve field node\n"),
+ -1);
}
- // check what is the code generations substate. Are we generating code for
+ // Check what is the code generations substate. Are we generating code for
// the in/out operators for our parent or for us?
switch (this->ctx_->sub_state ())
{
@@ -415,91 +388,118 @@ be_visitor_valuetype_field_cdr_ci::visit_valuetype_fwd (be_valuetype_fwd *)
*os << "(strm << " << pre_ << f->local_name () << post_ << ").in ()";
break;
case TAO_CodeGen::TAO_CDR_SCOPE:
- // nothing to be done because an valuetype cannot be declared inside a
- // structure
+ // Nothing to be done because a valuetype cannot be declared inside a
+ // structure.
break;
default:
- // error
+ // Error.
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_valuetype_fwd - "
- "bad sub state\n"
- ), -1);
+ "bad sub state\n"),
+ -1);
}
+
return 0;
}
-// visit predefined type
int
be_visitor_valuetype_field_cdr_ci::visit_predefined_type (be_predefined_type *node)
{
- TAO_OutStream *os; // output stream
- os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream ();
- // retrieve the field node
+ // Retrieve the field node.
be_field *f = this->ctx_->be_node_as_field ();
+
if (!f)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_predefined_type - "
- "cannot retrieve field node\n"
- ), -1);
+ "cannot retrieve field node\n"),
+ -1);
}
- // check what is the code generations substate. Are we generating code for
+ AST_PredefinedType::PredefinedType pt = node->pt ();
+
+ // Check what is the code generations substate. Are we generating code for
// the in/out operators for our parent or for us?
switch (this->ctx_->sub_state ())
{
case TAO_CodeGen::TAO_CDR_INPUT:
- // is a psuedo obj
- if (node->pt () == AST_PredefinedType::PT_pseudo)
- *os << "(strm >> " << pre_ << f->local_name () << post_
- << ".out ())";
- else if (node->pt () == AST_PredefinedType::PT_char)
- *os << "(strm >> CORBA::Any::to_char (" << pre_
- << f->local_name () << post_ << "))";
- else if (node->pt () == AST_PredefinedType::PT_wchar)
- *os << "(strm >> CORBA::Any::to_wchar (" << pre_
- << f->local_name () << post_ << "))";
- else if (node->pt () == AST_PredefinedType::PT_octet)
- *os << "(strm >> CORBA::Any::to_octet (" << pre_
- << f->local_name () << post_ << "))";
- else if (node->pt () == AST_PredefinedType::PT_boolean)
- *os << "(strm >> CORBA::Any::to_boolean (" << pre_
- << f->local_name () << post_ << "))";
+ if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ *os << "(strm >> " << pre_ << f->local_name () << post_
+ << ".out ())";
+ }
+ else if (pt == AST_PredefinedType::PT_char)
+ {
+ *os << "(strm >> CORBA::Any::to_char (" << pre_
+ << f->local_name () << post_ << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_wchar)
+ {
+ *os << "(strm >> CORBA::Any::to_wchar (" << pre_
+ << f->local_name () << post_ << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_octet)
+ {
+ *os << "(strm >> CORBA::Any::to_octet (" << pre_
+ << f->local_name () << post_ << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_boolean)
+ {
+ *os << "(strm >> CORBA::Any::to_boolean (" << pre_
+ << f->local_name () << post_ << "))";
+ }
else
- *os << "(strm >> " << pre_ << f->local_name () << post_ << ")";
+ {
+ *os << "(strm >> " << pre_ << f->local_name () << post_ << ")";
+ }
break;
case TAO_CodeGen::TAO_CDR_OUTPUT:
- // is a psuedo obj
- if (node->pt () == AST_PredefinedType::PT_pseudo)
- *os << "(strm << " << pre_ << f->local_name () << post_ << ".in ())";
- else if (node->pt () == AST_PredefinedType::PT_char)
- *os << "(strm << CORBA::Any::from_char (" << pre_
- << f->local_name () << post_ << "))";
- else if (node->pt () == AST_PredefinedType::PT_wchar)
- *os << "(strm << CORBA::Any::from_wchar (" << pre_
- << f->local_name () << post_ << "))";
- else if (node->pt () == AST_PredefinedType::PT_octet)
- *os << "(strm << CORBA::Any::from_octet (" << pre_
- << f->local_name () << post_ << "))";
- else if (node->pt () == AST_PredefinedType::PT_boolean)
- *os << "(strm << CORBA::Any::from_boolean (" << pre_
- << f->local_name () << post_ << "))";
+ if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ *os << "(strm << " << pre_ << f->local_name ()
+ << post_ << ".in ())";
+ }
+ else if (pt == AST_PredefinedType::PT_char)
+ {
+ *os << "(strm << CORBA::Any::from_char (" << pre_
+ << f->local_name () << post_ << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_wchar)
+ {
+ *os << "(strm << CORBA::Any::from_wchar (" << pre_
+ << f->local_name () << post_ << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_octet)
+ {
+ *os << "(strm << CORBA::Any::from_octet (" << pre_
+ << f->local_name () << post_ << "))";
+ }
+ else if (pt == AST_PredefinedType::PT_boolean)
+ {
+ *os << "(strm << CORBA::Any::from_boolean (" << pre_
+ << f->local_name () << post_ << "))";
+ }
else
- *os << "(strm << " << pre_ << f->local_name () << post_ << ")";
+ {
+ *os << "(strm << " << pre_ << f->local_name () << post_ << ")";
+ }
break;
case TAO_CodeGen::TAO_CDR_SCOPE:
- // nothing to be done
+ // Nothing to be done.
break;
default:
- // error
+ // Error.
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_array - "
- "bad sub state\n"
- ), -1);
+ "bad sub state\n"),
+ -1);
}
return 0;
@@ -508,21 +508,21 @@ be_visitor_valuetype_field_cdr_ci::visit_predefined_type (be_predefined_type *no
int
be_visitor_valuetype_field_cdr_ci::visit_sequence (be_sequence *node)
{
- TAO_OutStream *os; // output stream
- os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream ();
- // retrieve the field node
+ // Retrieve the field node.
be_field *f = this->ctx_->be_node_as_field ();
+
if (!f)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_sequence - "
- "cannot retrieve field node\n"
- ), -1);
+ "cannot retrieve field node\n" ),
+ -1);
}
- // check what is the code generations substate. Are we generating code for
+ // Check what is the code generations substate. Are we generating code for
// the in/out operators for our parent or for us?
switch (this->ctx_->sub_state ())
{
@@ -533,72 +533,59 @@ be_visitor_valuetype_field_cdr_ci::visit_sequence (be_sequence *node)
*os << "(strm << " << pre_ << f->local_name () << post_ << ")";
return 0;
case TAO_CodeGen::TAO_CDR_SCOPE:
- // proceed further
+ // Proceed further.
break;
default:
- // error
+ // Error.
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_sequence - "
- "bad sub state\n"
- ), -1);
+ "bad sub state\n"),
+ -1);
}
if (node->node_type () != AST_Decl::NT_typedef
&& node->is_child (this->ctx_->scope ()))
- // not a typedef AND
- // node is defined inside the structure
+ // Not a typedef AND
+ // node is defined inside the valuetype.
{
- // Anonymous sequence
- // instantiate a visitor context with a copy of our context. This info
- // will be modified based on what type of node we are visiting
+ // Anonymous sequence.
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.node (node);
ctx.state (TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CI);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_field_cdr_ci::"
- "visit_sequence - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_sequence_cdr_op_ci visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_sequence - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
+
return 0;
}
-// visit string type
int
be_visitor_valuetype_field_cdr_ci::visit_string (be_string *)
{
- TAO_OutStream *os; // output stream
- os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream ();
- // retrieve the field node
+ // Retrieve the field node.
be_field *f = this->ctx_->be_node_as_field ();
+
if (!f)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_string - "
- "cannot retrieve field node\n"
- ), -1);
+ "cannot retrieve field node\n"),
+ -1);
}
- // check what is the code generations substate. Are we generating code for
+ // Check what is the code generations substate. Are we generating code for
// the in/out operators for our parent or for us?
switch (this->ctx_->sub_state ())
{
@@ -609,39 +596,38 @@ be_visitor_valuetype_field_cdr_ci::visit_string (be_string *)
*os << "(strm << " << pre_ << f->local_name () << post_ << ".in ())";
break;
case TAO_CodeGen::TAO_CDR_SCOPE:
- // nothing to be done
+ // Nothing to be done.
break;
default:
- // error
+ // Error.
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_array - "
- "bad sub state\n"
- ), -1);
+ "bad sub state\n"),
+ -1);
}
return 0;
}
-// visit structure type
int
be_visitor_valuetype_field_cdr_ci::visit_structure (be_structure *node)
{
- TAO_OutStream *os; // output stream
- os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream ();
- // retrieve the field node
+ // Retrieve the field node.
be_field *f = this->ctx_->be_node_as_field ();
+
if (!f)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_structure - "
- "cannot retrieve field node\n"
- ), -1);
+ "cannot retrieve field node\n"),
+ -1);
}
- // check what is the code generations substate. Are we generating code for
+ // Check what is the code generations substate. Are we generating code for
// the in/out operators for our parent or for us?
switch (this->ctx_->sub_state ())
{
@@ -652,92 +638,77 @@ be_visitor_valuetype_field_cdr_ci::visit_structure (be_structure *node)
*os << "(strm << " << pre_ << f->local_name () << post_ << ")";
return 0;
case TAO_CodeGen::TAO_CDR_SCOPE:
- // proceed further
+ // Proceed further.
break;
default:
- // error
+ // Error.
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_structure - "
- "bad sub state\n"
- ), -1);
+ "bad sub state\n"),
+ -1);
}
- if (node->node_type () != AST_Decl::NT_typedef // not a typedef
- && node->is_child (this->ctx_->scope ())) // node is defined inside the
- // structure
+ if (node->node_type () != AST_Decl::NT_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
-
- // generate the inline code for structs
+ ctx.node (node);
ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CI);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_field_cdr_ci::"
- "visit_struct - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_structure_cdr_op_ci visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_struct - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
+
return 0;
}
-// visit typedef type
int
be_visitor_valuetype_field_cdr_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
+ this->ctx_->alias (node);
- // the node to be visited in the base primitve type that gets typedefed
+ // 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);
+ "Bad primitive type\n"),
+ -1);
}
this->ctx_->alias (0);
return 0;
}
-// visit union type
int
be_visitor_valuetype_field_cdr_ci::visit_union (be_union *node)
{
- TAO_OutStream *os; // output stream
- os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream ();
- // retrieve the field node
+ // Retrieve the field node.
be_field *f = this->ctx_->be_node_as_field ();
+
if (!f)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_union - "
- "cannot retrieve field node\n"
- ), -1);
+ "cannot retrieve field node\n"),
+ -1);
}
- // check what is the code generations substate. Are we generating code for
+ // Check what is the code generations substate. Are we generating code for
// the in/out operators for our parent or for us?
switch (this->ctx_->sub_state ())
{
@@ -748,56 +719,44 @@ be_visitor_valuetype_field_cdr_ci::visit_union (be_union *node)
*os << "(strm << " << pre_ << f->local_name () << post_ << ")";
return 0;
case TAO_CodeGen::TAO_CDR_SCOPE:
- // proceed further
+ // Proceed further.
break;
default:
- // error
+ // Error.
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_union - "
- "bad sub state\n"
- ), -1);
+ "bad sub state\n"),
+ -1);
}
- if (node->node_type () != AST_Decl::NT_typedef // not a typedef
- && node->is_child (this->ctx_->scope ())) // node is defined inside the
- // structure
+ if (node->node_type () != AST_Decl::NT_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
-
- // generate the inline code for union
+ ctx.node (node);
ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CI);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_field_cdr_ci::"
- "visit_union - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_union_cdr_op_ci visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_ci::"
"visit_union - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
+
return 0;
}
// ****************************************************************
-be_visitor_valuetype_field_cdr_decl::
- be_visitor_valuetype_field_cdr_decl (be_visitor_context *ctx)
+be_visitor_valuetype_field_cdr_decl::be_visitor_valuetype_field_cdr_decl (
+ be_visitor_context *ctx
+ )
: be_visitor_scope (ctx)
{
}
@@ -814,89 +773,101 @@ int
be_visitor_valuetype_field_cdr_decl::visit_field (be_field *node)
{
be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_decl::"
"visit_field - "
- "Bad field type\n"
- ), -1);
+ "Bad field type\n"),
+ -1);
}
// @@ Shouldn't this be saved in the visitor and not the context?!
- this->ctx_->node (node); // save the node
+ this->ctx_->node (node);
+
if (bt->accept (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_decl::"
"visit_field - "
- "codegen for field type failed\n"
- ), -1);
+ "codegen for field type failed\n"),
+ -1);
}
+
return 0;
}
-// visit array
int
be_visitor_valuetype_field_cdr_decl::visit_array (be_array *node)
{
- TAO_OutStream *os; // output stream
- os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream ();
- // retrieve the field node
+ // Retrieve the field node.
be_field *f = this->ctx_->be_node_as_field ();
+
if (!f)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_decl::"
"visit_array - "
- "cannot retrieve field node\n"
- ), -1);
+ "cannot retrieve field node\n"),
+ -1);
}
- // retrieve the valuetype scope in which the code is generated
+ // Retrieve the valuetype scope in which the code is generated.
be_decl *sc = this->ctx_->scope ();
be_valuetype *vt = be_valuetype::narrow_from_decl (sc);
+
if (!vt)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_decl::"
"visit_array - "
- "cannot retrieve valuetype node\n"
- ), -1);
+ "cannot retrieve valuetype node\n"),
+ -1);
}
- // for anonymous arrays, the type name has a _ prepended. We compute
+ // For anonymous arrays, the type name has a _ prepended. We compute
// the full_name with or without the underscore and use it later on.
- char fname [NAMEBUFSIZE]; // to hold the full and
+ char fname [NAMEBUFSIZE];
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
- ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
- if (!this->ctx_->alias () // not a typedef
+ if (!this->ctx_->alias ()
&& node->is_child (this->ctx_->scope ()))
{
- // for anonymous arrays ...
- // we have to generate a name for us that has an underscope
+ // For anonymous arrays ...
+ // We have to generate a name for us that has an underscope
// prepended to our local name. This needs to be inserted after
- // the parents's name
+ // the parent's name.
if (node->is_nested ())
{
- be_decl *parent = be_scope::narrow_from_scope (node->defined_in ())->decl ();
- ACE_OS::sprintf (fname, "%s::_%s", parent->full_name (),
+ be_decl *parent =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
+ ACE_OS::sprintf (fname,
+ "%s::_%s",
+ parent->full_name (),
node->local_name ()->get_string ());
}
else
{
- ACE_OS::sprintf (fname, "_%s", node->full_name ());
+ ACE_OS::sprintf (fname,
+ "_%s",
+ node->full_name ());
}
}
else
{
- // typedefed node
- ACE_OS::sprintf (fname, "%s", node->full_name ());
+ // Typedefed node.
+ ACE_OS::sprintf (fname,
+ "%s",
+ node->full_name ());
}
- // check what is the code generation substate. Are we generating code for
+ // Check what is the code generation substate. Are we generating code for
// the in/out operators for our parent or for us?
switch (this->ctx_->sub_state ())
{
@@ -914,32 +885,29 @@ be_visitor_valuetype_field_cdr_decl::visit_array (be_array *node)
return 0;
case TAO_CodeGen::TAO_CDR_SCOPE:
default:
- // error
+ // Error.
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cdr_decl::"
- "visit_array - "
- "bad sub state\n"
- ), -1);
+ "visit_array - "),
+ -1);
}
+
ACE_NOTREACHED (return 0);
}
-// visit typedef type
int
be_visitor_valuetype_field_cdr_decl::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
+ this->ctx_->alias (node);
be_type *bt = node->primitive_base_type ();
+
if (!bt || (bt->accept (this) == -1))
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_cdr_op_field_decl::"
"visit_typedef - "
- "Bad primitive type\n"
- ), -1);
+ "Bad primitive type\n"),
+ -1);
}
this->ctx_->alias (0);
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/field_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/field_ch.cpp
index 0cd37403575..f443ff1dd7a 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/field_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/field_ch.cpp
@@ -20,27 +20,22 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+ACE_RCSID (be_visitor_valuetype,
+ field_ch,
+ "$Id$")
-ACE_RCSID(be_visitor_valuetype, field_ch, "$Id$")
-
-
-// Constructor.
-be_visitor_valuetype_field_ch::be_visitor_valuetype_field_ch
- (be_visitor_context *ctx)
+be_visitor_valuetype_field_ch::be_visitor_valuetype_field_ch (
+ be_visitor_context *ctx
+ )
: be_visitor_decl (ctx)
{
- setenclosings ("",";");
+ setenclosings ("", ";");
}
-// Destructor.
be_visitor_valuetype_field_ch::~be_visitor_valuetype_field_ch (void)
{
}
-// Visit the field node.
int
be_visitor_valuetype_field_ch::visit_field (be_field *node)
{
@@ -69,9 +64,8 @@ be_visitor_valuetype_field_ch::visit_field (be_field *node)
return 0;
}
-// =Visit operations on all possible data types (valuetype state member).
+// Visit operations on all possible data types (valuetype state member).
-// visit array type
int
be_visitor_valuetype_field_ch::visit_array (be_array *node)
{
@@ -100,30 +94,19 @@ be_visitor_valuetype_field_ch::visit_array (be_array *node)
TAO_OutStream *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
- {
- // This is the case of an anonymous array inside a union.
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
- // Instantiate a visitor context with a copy of our context. This info
- // will be modified based on what type of node we are visiting.
+ if (bt->node_type () != AST_Decl::NT_typedef
+ && bt->is_child (bu))
+ {
+ // This is the case of an anonymous array inside a valuetype.
be_visitor_context ctx (*this->ctx_);
ctx.node (node);
-
- // First generate the array 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_valuetype_field_ch::"
- "visit_array - "
- "Bad visitor\n"),
- -1);
- }
+ be_visitor_array_ch visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_ch::"
@@ -132,12 +115,11 @@ be_visitor_valuetype_field_ch::visit_array (be_array *node)
-1);
}
- delete visitor;
// Now use this array as a "type" for the subsequent declarator
// the set method.
*os << pre_op () << "void " << ub->local_name () << " ("
<< "_" << bt->local_name () << ")"
- << post_op () << " // set" << be_nl;
+ << post_op () << be_nl;
// The get method.
*os << pre_op () << "const _" << bt->local_name ()
<< "_slice * " << ub->local_name ()
@@ -151,8 +133,7 @@ be_visitor_valuetype_field_ch::visit_array (be_array *node)
// Now use this array as a "type" for the subsequent declarator.
// The set method.
*os << pre_op () << "void " << ub->local_name () << " ("
- << bt->name () << ")" << post_op () << " // set"
- << be_nl;
+ << bt->name () << ")" << post_op () << be_nl;
// The get method.
*os << pre_op()
<< bt->name () << "_slice *" << ub->local_name ()
@@ -160,13 +141,12 @@ be_visitor_valuetype_field_ch::visit_array (be_array *node)
// The get (read/write) method.
*os << pre_op () << "const "
<< bt->name () << "_slice *" << ub->local_name ()
- << " (void) const" << post_op () << "\n\n";
+ << " (void) const" << post_op () << be_nl << be_nl;
}
return 0;
}
-// Visit enum type.
int
be_visitor_valuetype_field_ch::visit_enum (be_enum *node)
{
@@ -195,28 +175,18 @@ be_visitor_valuetype_field_ch::visit_enum (be_enum *node)
TAO_OutStream *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
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ if (bt->node_type () != AST_Decl::NT_typedef
+ && bt->is_child (bu))
{
- // 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);
-
- // First generate the enum declaration.
ctx.state (TAO_CodeGen::TAO_ENUM_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_enum_ch visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_field_ch::"
- "visit_enum - "
- "Bad visitor\n"),
- -1);
- }
-
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_ch::"
@@ -224,24 +194,19 @@ be_visitor_valuetype_field_ch::visit_enum (be_enum *node)
"codegen failed\n"),
-1);
}
-
- delete visitor;
}
// Now use this enum as a "type" for the subsequent declarator
// the set method.
*os << pre_op () << "void " << ub->local_name () << " ("
- << bt->name () << ")" << post_op () << " // set"
- << be_nl;
+ << bt->name () << ")" << post_op () << be_nl;
// The get method.
*os << pre_op () << bt->name () << " " << ub->local_name ()
- << " (void) const" << post_op () << " // get method"
- << be_nl << be_nl;
+ << " (void) const" << post_op () << be_nl << be_nl;
return 0;
}
-// Visit interface type.
int
be_visitor_valuetype_field_ch::visit_interface (be_interface *node)
{
@@ -270,20 +235,21 @@ be_visitor_valuetype_field_ch::visit_interface (be_interface *node)
TAO_OutStream *os = this->ctx_->stream ();
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Set method.
*os << pre_op() << "void " << ub->local_name () << " ("
<< bt->name () << "_ptr"
- << ")" << post_op() << " // set" << be_nl;
+ << ")" << post_op() << be_nl;
// Get method.
*os << pre_op()
<< bt->name () << "_ptr " << ub->local_name ()
- << " (void) const" << post_op() << " // get method"
- << be_nl << be_nl;
+ << " (void) const" << post_op() << be_nl << be_nl;
return 0;
}
-// Visit interface forward type.
int
be_visitor_valuetype_field_ch::visit_interface_fwd (be_interface_fwd *node)
{
@@ -312,20 +278,21 @@ be_visitor_valuetype_field_ch::visit_interface_fwd (be_interface_fwd *node)
TAO_OutStream *os = this->ctx_->stream ();
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Set method.
*os << pre_op () << "void " << ub->local_name () << " ("
<< bt->name () << "_ptr"
- << ")" << post_op () << " // set" << be_nl;
+ << ")" << post_op () << be_nl;
// Get method.
*os << pre_op ()
<< bt->name () << "_ptr " << ub->local_name ()
- << " (void) const" << post_op () << " // get method"
- << be_nl << be_nl;
+ << " (void) const" << post_op () << be_nl << be_nl;
return 0;
}
-// Visit valuetype type.
int
be_visitor_valuetype_field_ch::visit_valuetype (be_valuetype *node)
{
@@ -354,20 +321,21 @@ be_visitor_valuetype_field_ch::visit_valuetype (be_valuetype *node)
TAO_OutStream *os = this->ctx_->stream ();
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Set method.
*os << pre_op () << "void " << ub->local_name () << " ("
<< bt->name () << " *"
- << ")" << post_op () << " // set" << be_nl;
+ << ")" << post_op () << be_nl;
// Get method.
*os << pre_op ()
<< bt->name () << " *" << ub->local_name ()
- << " (void) const" << post_op () << " // get method"
- << be_nl << be_nl;
+ << " (void) const" << post_op () << be_nl << be_nl;
return 0;
}
-// Visit valuetype forward type.
int
be_visitor_valuetype_field_ch::visit_valuetype_fwd (be_valuetype_fwd *node)
{
@@ -396,20 +364,21 @@ be_visitor_valuetype_field_ch::visit_valuetype_fwd (be_valuetype_fwd *node)
TAO_OutStream *os = this->ctx_->stream ();
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Set method.
*os << pre_op () << "void " << ub->local_name () << " ("
<< bt->name () << " *"
- << ")" << post_op () << " // set" << be_nl;
+ << ")" << post_op () << be_nl;
// Get method.
*os << pre_op ()
<< bt->name () << " *" << ub->local_name ()
- << " (void) const" << post_op () << " // get method"
- << be_nl << be_nl;
+ << " (void) const" << post_op () << be_nl << be_nl;
return 0;
}
-// Visit predefined type.
int
be_visitor_valuetype_field_ch::visit_predefined_type (be_predefined_type *node)
{
@@ -438,34 +407,35 @@ be_visitor_valuetype_field_ch::visit_predefined_type (be_predefined_type *node)
TAO_OutStream *os = this->ctx_->stream ();
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
switch (node->pt ())
{
case AST_PredefinedType::PT_pseudo:
- // set method.
+ case AST_PredefinedType::PT_object:
+ // Set method.
*os << pre_op () << "void " << ub->local_name () << " ("
<< bt->name () << "_ptr)"
- << post_op () << " // set" << be_nl;
- // Get method.
+ << post_op () << be_nl;
+ // Get method.
*os << pre_op ()
<< bt->name () << "_ptr " << ub->local_name ()
- << " (void) const" << post_op () << " // get method"
- << be_nl << be_nl;
+ << " (void) const" << post_op () << be_nl << be_nl;
break;
case AST_PredefinedType::PT_any:
// Set method.
*os << pre_op () << "void " << ub->local_name () << " ("
- << bt->name () << ")"
- << post_op () << " // set" << be_nl;
+ << bt->name () << " &)"
+ << post_op () << be_nl;
// Get method (read-only).
- *os << pre_op () << "const " << bt->name () << " "
+ *os << pre_op () << "const " << bt->name () << " &"
<< ub->local_name () << " (void) const"
- << post_op () << " // get method"
- << be_nl << be_nl;
+ << post_op () << be_nl << be_nl;
// Get method (read/write).
- *os << pre_op () << bt->name () << " "
+ *os << pre_op () << bt->name () << " &"
<< ub->local_name () << " (void)"
- << post_op () << " // get method"
- << be_nl << be_nl;
+ << post_op () << be_nl << be_nl;
break;
case AST_PredefinedType::PT_void:
break;
@@ -473,16 +443,15 @@ be_visitor_valuetype_field_ch::visit_predefined_type (be_predefined_type *node)
// Set method.
*os << pre_op () << "void " << ub->local_name () << " ("
<< bt->name () << ")"
- << post_op () << " // set" << be_nl;
+ << post_op () << be_nl;
// Get method.
*os << pre_op () << bt->name () << " " << ub->local_name ()
- << " (void) const" << post_op () << " // get method"
- << be_nl << be_nl;
+ << " (void) const" << post_op () << be_nl << be_nl;
}
+
return 0;
}
-// Visit sequence type.
int
be_visitor_valuetype_field_ch::visit_sequence (be_sequence *node)
{
@@ -511,29 +480,19 @@ be_visitor_valuetype_field_ch::visit_sequence (be_sequence *node)
TAO_OutStream *os = this->ctx_->stream ();
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Not a typedef and bt is defined here.
if (bt->node_type () != AST_Decl::NT_typedef
&& bt->is_child (bu))
{
- // 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);
-
- // 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_valuetype_field_ch::"
- "visit_sequence - "
- "Bad visitor\n"),
- -1);
- }
+ be_visitor_sequence_ch visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_ch::"
@@ -542,18 +501,14 @@ be_visitor_valuetype_field_ch::visit_sequence (be_sequence *node)
-1);
}
- delete visitor;
-
- // Generate the anonymous sequence member typedef
- // but we must protect against certain versions of g++.
+ // Generate the anonymous sequence member typedef.
// This provides a consistent name to use instead of the
// implementation-specific name.
os->decr_indent (0);
- *os << "#if !defined (__GNUC__) || !defined (ACE_HAS_GNUG_PRE_2_8)"
- << be_idt_nl
- << "typedef " << bt->nested_type_name (bu)
- << " _" << ub->local_name () << "_seq;" << be_uidt_nl;
- *os << "#endif /* ! __GNUC__ || ACE_HAS_GNUG_PRE_2_8 */\n" << be_nl;
+
+ *os << "typedef " << bt->nested_type_name (bu)
+ << " _" << ub->local_name () << "_seq;" << be_nl;
+
os->incr_indent ();
}
@@ -561,21 +516,19 @@ be_visitor_valuetype_field_ch::visit_sequence (be_sequence *node)
// Set method.
*os << pre_op () << "void " << ub->local_name () << " (const "
<< bt->name () << " &)"
- << post_op () << " // set" << be_nl;
+ << post_op () << be_nl;
// Read-only.
*os << pre_op () << "const " << bt->name () << " &"
<< ub->local_name () << " (void) const"
- << post_op () << " // get method (read only)" << be_nl;
+ << post_op () << be_nl;
// Read/write.
*os << pre_op () << bt->name () << " &" << ub->local_name ()
<< " (void)"
- << post_op () << " // get method (read/write only)"
- << be_nl << be_nl;
+ << post_op () << be_nl << be_nl;
return 0;
}
-// Visit string type.
int
be_visitor_valuetype_field_ch::visit_string (be_string *node)
{
@@ -593,44 +546,44 @@ be_visitor_valuetype_field_ch::visit_string (be_string *node)
TAO_OutStream *os = this->ctx_->stream ();
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Three methods to set the string value.
if (node->width () == (long) sizeof (char))
{
*os << pre_op ()
<< "void " << ub->local_name () << " (char *)"
- << post_op () << " // set" << be_nl;
+ << post_op () << be_nl;
*os << pre_op ()
<< "void " << ub->local_name () << " (const char *)"
- << post_op () << " // set" << be_nl;
+ << post_op () << be_nl;
*os << pre_op ()
<< "void " << ub->local_name () << " (const CORBA::String_var&)"
- << post_op () << " // set" << be_nl;
+ << post_op () << be_nl;
// Get method.
*os << pre_op () << "const char *" << ub->local_name ()
- << " (void) const" << post_op () << " // get method"
- << be_nl << be_nl;
+ << " (void) const" << post_op () << be_nl << be_nl;
}
else
{
*os << pre_op ()
<< "void " << ub->local_name () << " (CORBA::WChar *)"
- << post_op () << " // set" << be_nl;
+ << post_op () << be_nl;
*os << pre_op ()
<< "void " << ub->local_name () << " (const CORBA::WChar *)"
- << post_op () << " // set" << be_nl;
+ << post_op () << be_nl;
*os << pre_op ()
<< "void " << ub->local_name () << " (const CORBA::WString_var&)"
- << post_op () << " // set" << be_nl;
+ << post_op () << be_nl;
// Get method.
*os << pre_op() << "const CORBA::WChar *" << ub->local_name ()
- << " (void) const" << post_op() << " // get method"
- << be_nl << be_nl;
+ << " (void) const" << post_op() << be_nl << be_nl;
}
return 0;
}
-// Visit structure type.
int
be_visitor_valuetype_field_ch::visit_structure (be_structure *node)
{
@@ -659,29 +612,19 @@ be_visitor_valuetype_field_ch::visit_structure (be_structure *node)
TAO_OutStream *os = this->ctx_->stream ();
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Not a typedef and bt is defined here.
if (bt->node_type () != AST_Decl::NT_typedef
&& bt->is_child (bu))
{
- // 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);
-
- // 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_valuetype_field_ch::"
- "visit_structure - "
- "Bad visitor\n"),
- -1);
- }
+ be_visitor_structure_ch visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_ch::"
@@ -689,27 +632,23 @@ be_visitor_valuetype_field_ch::visit_structure (be_structure *node)
"codegen failed\n"),
-1);
}
-
- delete visitor;
}
// Set method.
*os << pre_op () << "void " << ub->local_name () << " (const "
<< bt->name () << " &)"
- << post_op () << " // set" << be_nl;
+ << post_op () << be_nl;
// Read-only.
*os << pre_op () << "const " << bt->name () << " &";
*os << ub->local_name () << " (void) const"
- << post_op () << " // get method (read only)" << be_nl
+ << post_op () << be_nl
// Read/write.
<< pre_op () << bt->name () << " &" << ub->local_name ()
- << " (void)" << post_op () << " // get method (read/write only)"
- << be_nl << be_nl;
+ << " (void)" << post_op () << be_nl << be_nl;
return 0;
}
-// Visit typedefed type.
int
be_visitor_valuetype_field_ch::visit_typedef (be_typedef *node)
{
@@ -731,7 +670,6 @@ be_visitor_valuetype_field_ch::visit_typedef (be_typedef *node)
return 0;
}
-// Visit union type.
int
be_visitor_valuetype_field_ch::visit_union (be_union *node)
{
@@ -760,29 +698,19 @@ be_visitor_valuetype_field_ch::visit_union (be_union *node)
TAO_OutStream *os = this->ctx_->stream ();
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Not a typedef and bt is defined here.
if (bt->node_type () != AST_Decl::NT_typedef
&& bt->is_child (bu))
{
- // 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);
+ ctx.state (TAO_CodeGen::TAO_UNION_CH);
+ be_visitor_union_ch visitor (&ctx);
- // 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_valuetype_field_ch::"
- "visit_union - "
- "Bad visitor\n"),
- -1);
- }
-
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_ch::"
@@ -790,42 +718,39 @@ be_visitor_valuetype_field_ch::visit_union (be_union *node)
"codegen failed\n"),
-1);
}
-
- delete visitor;
}
// Set method.
*os << pre_op () << "void " << ub->local_name () << " (const "
<< bt->name () << " &)"
- << post_op () << " // set" << be_nl;
+ << post_op () << be_nl;
// Read-only.
*os << pre_op () << "const " << bt->name () << " &"
<< ub->local_name () << " (void) const"
- << post_op () << " // get method (read only)"
- << be_nl;
+ << post_op () << be_nl;
// Read/write.
*os << pre_op () << bt->name () << " &" << ub->local_name ()
- << " (void)" << post_op () << " // get method (read/write only)"
- << be_nl << be_nl;
+ << " (void)" << post_op () << be_nl << be_nl;
return 0;
}
void
-be_visitor_valuetype_field_ch::setenclosings (const char *pre, const char *post)
+be_visitor_valuetype_field_ch::setenclosings (const char *pre,
+ const char *post)
{
pre_op_ = pre;
post_op_ = post;
}
const char*
-be_visitor_valuetype_field_ch::pre_op ()
+be_visitor_valuetype_field_ch::pre_op (void)
{
return pre_op_;
}
const char*
-be_visitor_valuetype_field_ch::post_op ()
+be_visitor_valuetype_field_ch::post_op (void)
{
return post_op_;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/field_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/field_ci.cpp
index 25e78d69a86..4678af40c7d 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/field_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/field_ci.cpp
@@ -20,112 +20,95 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+ACE_RCSID (be_visitor_valuetype,
+ field_ci,
+ "$Id$")
-#include "be_visitor_valuetype.h"
-
-ACE_RCSID(be_visitor_valuetype, field_ci, "$Id$")
-
-
-// constructor
-be_visitor_valuetype_field_ci::
-be_visitor_valuetype_field_ci (be_visitor_context *ctx)
+be_visitor_valuetype_field_ci::be_visitor_valuetype_field_ci (
+ be_visitor_context *ctx
+ )
: be_visitor_decl (ctx),
in_obv_space_ (0)
{
setenclosings ("");
}
-// destructor
-be_visitor_valuetype_field_ci::
-~be_visitor_valuetype_field_ci (void)
+be_visitor_valuetype_field_ci::~be_visitor_valuetype_field_ci (void)
{
}
-// visit the field node
int
-be_visitor_valuetype_field_ci::
-visit_field (be_field *node)
+be_visitor_valuetype_field_ci::visit_field (be_field *node)
{
be_type *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);
+ "Bad field type\n"),
+ -1);
}
- this->ctx_->node (node); // save the node
+ this->ctx_->node (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);
+ "codegen for field type failed\n"),
+ -1);
}
+
return 0;
}
-// =visit operations on all possible data types that a field can be
+// Visit operations on all possible data types that a field can be.
int
be_visitor_valuetype_field_ci::visit_array (be_array *node)
{
- be_decl *ub =
- this->ctx_->node (); // get field node
- be_valuetype *bu =
- be_valuetype::narrow_from_decl (this->ctx_->scope ());
+ be_decl *ub = this->ctx_->node ();
+ be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ());
be_type *bt;
- // check if we are visiting this node via a visit to a typedef node
+ // Check if we are visiting this node via a visit to a typedef node.
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_ci::"
"visit_array - "
- "bad context information\n"
- ), -1);
+ "bad context information\n"),
+ -1);
}
- if (bt->node_type () != AST_Decl::NT_typedef // not a typedef
- && bt->is_child (bu)) // bt is defined inside the valuetype
+ if (bt->node_type () != AST_Decl::NT_typedef
+ && bt->is_child (bu))
{
- // 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 inline operations for this anonymous array type
+ ctx.node (node);
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_valuetype_field_ci::"
- "visit_array - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_array_ci visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_ci::"
"visit_array - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
return 0;
@@ -170,56 +153,45 @@ be_visitor_valuetype_field_ci::visit_predefined_type (be_predefined_type *)
int
be_visitor_valuetype_field_ci::visit_sequence (be_sequence *node)
{
- be_decl *ub =
- this->ctx_->node (); // get field node
- be_valuetype *bu =
- be_valuetype::narrow_from_decl (this->ctx_->scope ());
+ be_decl *ub = this->ctx_->node ();
+ be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ());
be_type *bt;
- // check if we are visiting this node via a visit to a typedef node
+ // Check if we are visiting this node via a visit to a typedef node.
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_ci::"
"visit_sequence - "
- "bad context information\n"
- ), -1);
+ "bad context information\n"),
+ -1);
}
- if (bt->node_type () != AST_Decl::NT_typedef // not a typedef
- && bt->is_child (bu)) // bt is defined inside the union
+ if (bt->node_type () != AST_Decl::NT_typedef
+ && bt->is_child (bu))
{
- // 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 inline operations for this anonymous sequence type
+ ctx.node (node);
ctx.state (TAO_CodeGen::TAO_SEQUENCE_CI);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_field_ci::"
- "visit_sequence - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_sequence_ci visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_ci::"
"visit_sequence - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
return 0;
@@ -234,56 +206,45 @@ be_visitor_valuetype_field_ci::visit_string (be_string *)
int
be_visitor_valuetype_field_ci::visit_structure (be_structure *node)
{
- be_decl *ub =
- this->ctx_->node (); // get field node
- be_valuetype *bu =
- be_valuetype::narrow_from_decl (this->ctx_->scope ());
+ be_decl *ub = this->ctx_->node ();
+ be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ());
be_type *bt;
- // check if we are visiting this node via a visit to a typedef node
+ // Check if we are visiting this node via a visit to a typedef node.
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_ci::"
"visit_structure - "
- "bad context information\n"
- ), -1);
+ "bad context information\n"),
+ -1);
}
- if (bt->node_type () != AST_Decl::NT_typedef // not a typedef
- && bt->is_child (bu)) // bt is defined inside the union
+ if (bt->node_type () != AST_Decl::NT_typedef
+ && bt->is_child (bu))
{
- // 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.node (node);
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_valuetype_field_ci::"
- "visit_structure - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_structure_ci visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_ci::"
"visit_structure - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
return 0;
@@ -298,56 +259,45 @@ be_visitor_valuetype_field_ci::visit_typedef (be_typedef *)
int
be_visitor_valuetype_field_ci::visit_union (be_union *node)
{
- be_decl *ub =
- this->ctx_->node (); // get field node
- be_valuetype *bu =
- be_valuetype::narrow_from_decl (this->ctx_->scope ());
+ be_decl *ub = this->ctx_->node ();
+ be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ());
be_type *bt;
- // check if we are visiting this node via a visit to a typedef node
+ // Check if we are visiting this node via a visit to a typedef node.
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_ci::"
"visit_union - "
- "bad context information\n"
- ), -1);
+ "bad context information\n"),
+ -1);
}
- if (bt->node_type () != AST_Decl::NT_typedef // not a typedef
- && bt->is_child (bu)) // bt is defined inside the union
+ if (bt->node_type () != AST_Decl::NT_typedef
+ && bt->is_child (bu))
{
- // 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.node (node);
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_valuetype_field_ci::"
- "visit_union - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_union_ci visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_ci::"
"visit_union - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
return 0;
@@ -356,22 +306,26 @@ be_visitor_valuetype_field_ci::visit_union (be_union *node)
void
be_visitor_valuetype_field_ci::setenclosings (const char *pre)
{
- pre_op_ = pre;
+ this->pre_op_ = pre;
}
const char*
be_visitor_valuetype_field_ci::pre_op ()
{
- return pre_op_;
+ return this->pre_op_;
}
-// retrieve the fully scoped skeleton name
+// Retrieve the fully scoped skeleton name.
void
be_visitor_valuetype_field_ci::op_name (be_valuetype *node,
TAO_OutStream *os)
{
if (this->in_obv_space_)
- *os << node->full_obv_skel_name ();
+ {
+ *os << node->full_obv_skel_name ();
+ }
else
- *os << node->name ();
+ {
+ *os << node->name ();
+ }
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp
index 3a80831f824..bbc42c3e500 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp
@@ -20,686 +20,774 @@
// derived from be_visitor_union_branch/public_ci.cpp
//
// ============================================================================
+ACE_RCSID (be_visitor_valuetype,
+ field_cs,
+ "$Id$")
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_valuetype.h"
-
-ACE_RCSID(be_visitor_valuetype, field_cs, "$Id$")
-
-
-// constructor
-be_visitor_valuetype_field_cs::
-be_visitor_valuetype_field_cs (be_visitor_context *ctx)
+be_visitor_valuetype_field_cs::be_visitor_valuetype_field_cs (
+ be_visitor_context *ctx
+ )
: be_visitor_decl (ctx),
in_obv_space_ (0)
{
setenclosings ("");
}
-// destructor
-be_visitor_valuetype_field_cs::
-~be_visitor_valuetype_field_cs (void)
+be_visitor_valuetype_field_cs::~be_visitor_valuetype_field_cs (void)
{
}
-// visit the field node
int
-be_visitor_valuetype_field_cs::
-visit_field (be_field *node)
+be_visitor_valuetype_field_cs::visit_field (be_field *node)
{
be_type *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);
+ "Bad field type\n"),
+ -1);
}
- this->ctx_->node (node); // save the node
+ this->ctx_->node (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);
+ "codegen for field type failed\n"),
+ -1);
}
+
return 0;
}
-// =visit operations on all possible data types that a field can be
+// Visit operations on all possible data types that a field can be
int
be_visitor_valuetype_field_cs::visit_array (be_array *node)
{
- TAO_OutStream *os; // output stream
- be_decl *ub =
- this->ctx_->node (); // get field node
- be_valuetype *bu =
- be_valuetype::narrow_from_decl (this->ctx_->scope ());
+ be_decl *ub = this->ctx_->node ();
+ be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ());
be_type *bt;
- // check if we are visiting this node via a visit to a typedef node
+ // Check if we are visiting this node via a visit to a typedef node.
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cs::"
"visit_array - "
- "bad context information\n"
- ), -1);
+ "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 valuetype
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (bt->node_type () != AST_Decl::NT_typedef
+ && bt->is_child (bu))
{
- // 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 inline operations for this anonymous array type
+ ctx.node (node);
ctx.state (TAO_CodeGen::TAO_ARRAY_CS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_field_cs::"
- "visit_array - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_array_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cs::"
"visit_array - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
- // for anonymous arrays, the type name has a _ prepended. We compute the
+ // For anonymous arrays, the type name has a _ prepended. We compute the
// full_name with or without the underscore and use it later on.
- char fname [NAMEBUFSIZE]; // to hold the full and
+ char fname [NAMEBUFSIZE];
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
- // save the node's local name and full name in a buffer for quick use later
- // on
- ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
- if (bt->node_type () != AST_Decl::NT_typedef // not a typedef
- && bt->is_child (bu)) // bt is defined inside the union
+ if (bt->node_type () != AST_Decl::NT_typedef
+ && bt->is_child (bu))
{
- // for anonymous arrays ...
- // we have to generate a name for us that has an underscope prepended to
- // our local name. This needs to be inserted after the parents's name
-
+ // For anonymous arrays ...
+ // We have to generate a name for us that has an underscope prepended to
+ // our local name. This needs to be inserted after the parent's name.
if (bt->is_nested ())
{
be_decl *parent =
be_scope::narrow_from_scope (bt->defined_in ())->decl ();
- ACE_OS::sprintf (fname, "%s::_%s", parent->full_name (),
+ ACE_OS::sprintf (fname,
+ "%s::_%s",
+ parent->full_name (),
bt->local_name ()->get_string ());
}
else
{
- ACE_OS::sprintf (fname, "_%s", bt->full_name ());
+ ACE_OS::sprintf (fname,
+ "_%s",
+ bt->full_name ());
}
}
else
{
- // typedefed node
- ACE_OS::sprintf (fname, "%s", bt->full_name ());
+ // Typedefed node.
+ ACE_OS::sprintf (fname,
+ "%s",
+ bt->full_name ());
}
- // set method
- os->indent (); // start from current indentation
- *os << "// accessor to set the member" << be_nl
- << this->pre_op() << "void" << be_nl;
- this->op_name(bu,os); *os << "::" << ub->local_name () << " (" << fname
- << " val)// set" << be_nl
- << "{" << be_idt_nl;
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ *os << "// Accessor to set the member." << be_nl
+ << this->pre_op () << "void" << be_nl;
+
+ this->op_name (bu,
+ os);
+
+ *os << "::" << ub->local_name () << " (" << fname
+ << " val)" << be_nl
+ << "{" << be_idt_nl;
*os << fname << "_copy ("
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
<< ", val);" << be_uidt_nl;
-
*os << "}" << be_nl;
- // get method
- *os << "// retrieve the member" << be_nl
- << this->pre_op() << "const " << fname << "_slice *" << be_nl;
- this->op_name(bu,os);
+ *os << "// Retrieve the member." << be_nl
+ << this->pre_op () << "const " << fname << "_slice *" << be_nl;
+
+ this->op_name (bu,
+ os);
+
*os << "::" << ub->local_name () << " (void) const" << be_nl
<< "{" << be_idt_nl;
*os << "return this->"
- << bu->field_pd_prefix() << ub->local_name ()
- << bu->field_pd_postfix() << ";" << be_uidt_nl
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix () << ";" << be_uidt_nl
<< "}\n" << be_nl;
- // get method
- *os << "// retrieve the member" << be_nl
- << this->pre_op() << fname << "_slice *" << be_nl;
- this->op_name(bu,os);
- *os << "::" << ub->local_name () << " (void)" << be_nl
+ *os << "// Retrieve the member." << be_nl
+ << this->pre_op () << fname << "_slice *" << be_nl;
+
+ this->op_name (bu,
+ os);
+
+ *os << "::" << ub->local_name () << " (void)" << be_nl
<< "{" << be_idt_nl;
- *os << "return this->"
- << bu->field_pd_prefix() << ub->local_name ()
- << bu->field_pd_postfix() << ";" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "return this->"
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix () << ";" << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
+
return 0;
}
int
be_visitor_valuetype_field_cs::visit_enum (be_enum *node)
{
- TAO_OutStream *os; // output stream
- be_decl *ub =
- this->ctx_->node (); // get field node
- be_valuetype *bu =
- be_valuetype::narrow_from_decl (this->ctx_->scope ());
+ be_decl *ub = this->ctx_->node ();
+ be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ());
be_type *bt;
- // check if we are visiting this node via a visit to a typedef node
+ // Check if we are visiting this node via a visit to a typedef node.
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cs::"
"visit_enum - "
- "bad context information\n"
- ), -1);
+ "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
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "// Accessor to set the member." << be_nl
<< this->pre_op() << "void" << be_nl;
- this->op_name(bu,os);
- *os << "::" << ub->local_name () << " (" << bt->name ()
- << " val)// set" << be_nl
- << "{\n";
- os->incr_indent ();
+
+ this->op_name (bu,
+ os);
+
+ *os << "::" << ub->local_name () << " (" << bt->name ()
+ << " val)/" << be_nl
+ << "{" << be_idt_nl;
+
*os << "this->"
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
- << " = val;\n";
- os->decr_indent ();
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
+ << " = val;" << be_uidt_nl;
+
*os << "}" << be_nl;
- // get method
- *os << "// retrieve the member" << be_nl
- << this->pre_op() << bt->name () << be_nl;
- this->op_name(bu,os);
- *os << "::" << ub->local_name () << " () const"
+ *os << "// Retrieve the member." << be_nl
+ << this->pre_op () << bt->name () << be_nl;
+
+ this->op_name (bu,
+ os);
+
+ *os << "::" << ub->local_name () << " () const"
<< be_nl
- << "{\n";
- os->incr_indent ();
+ << "{" << be_idt_nl;
+
*os << "return this->"
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
- << ";\n";
- os->decr_indent ();
- *os << "}\n\n";
+ << bu->field_pd_prefix() << ub->local_name ()
+ << bu->field_pd_postfix ()
+ << ";" << be_uidt_nl;
+
+ *os << "}" << be_nl << be_nl;
+
return 0;
}
int
be_visitor_valuetype_field_cs::visit_interface (be_interface *node)
{
- TAO_OutStream *os; // output stream
- be_decl *ub =
- this->ctx_->node (); // get field node
- be_valuetype *bu =
- be_valuetype::narrow_from_decl (this->ctx_->scope ());
+ be_decl *ub = this->ctx_->node ();
+ be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ());
be_type *bt;
- // check if we are visiting this node via a visit to a typedef node
+ // Check if we are visiting this node via a visit to a typedef node.
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cs::"
"visit_interface - "
- "bad context information\n"
- ), -1);
+ "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
- << this->pre_op() << "void" << be_nl;
- this->op_name(bu,os);
- *os << "::" << ub->local_name () << " (" << bt->name ()
- << "_ptr val)// set" << be_nl
- << "{\n";
- os->incr_indent ();
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "// Accessor to set the member." << be_nl
+ << this->pre_op () << "void" << be_nl;
+
+ this->op_name (bu,
+ os);
+
+ *os << "::" << ub->local_name () << " (" << bt->name ()
+ << "_ptr val)" << be_nl
+ << "{" << be_idt_nl;
+
*os << "this->"
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
<< " = " << bt->name () << "::_duplicate (val);" << be_uidt_nl;
- *os << "}" << be_nl;
+ *os << "}" << be_nl << be_nl;
- // get method
- *os << "// retrieve the member" << be_nl
- << this->pre_op() << bt->name () << "_ptr " << be_nl;
- this->op_name(bu,os);
- *os << "::" << ub->local_name () << " () const"
+ *os << "// Retrieve the member." << be_nl
+ << this->pre_op () << bt->name () << "_ptr " << be_nl;
+
+ this->op_name (bu,
+ os);
+
+ *os << "::" << ub->local_name () << " () const"
<< be_nl
- << "{\n";
- os->incr_indent ();
+ << "{" << be_idt_nl;
+
*os << "return this->"
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
- << ".ptr ();\n";
- os->decr_indent ();
- *os << "}\n\n";
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
+ << ".ptr ();" << be_uidt_nl;
+
+ *os << "}" << be_nl << be_nl;
+
return 0;
}
int
be_visitor_valuetype_field_cs::visit_interface_fwd (be_interface_fwd *node)
{
- TAO_OutStream *os; // output stream
- be_decl *ub =
- this->ctx_->node (); // get field node
- be_valuetype *bu =
- be_valuetype::narrow_from_decl (this->ctx_->scope ());
+ be_decl *ub = this->ctx_->node ();
+ be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ());
be_type *bt;
- // check if we are visiting this node via a visit to a typedef node
+ // Check if we are visiting this node via a visit to a typedef node.
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cs::"
"visit_interface - "
- "bad context information\n"
- ), -1);
+ "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
- << this->pre_op() << "void" << be_nl;
- this->op_name(bu,os);
- *os << "::" << ub->local_name () << " (" << bt->name ()
- << "_ptr val)// set" << be_nl
- << "{\n";
- os->incr_indent ();
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "// Accessor to set the member." << be_nl
+ << this->pre_op () << "void" << be_nl;
+
+ this->op_name (bu,
+ os);
+
+ *os << "::" << ub->local_name () << " (" << bt->name ()
+ << "_ptr val)" << be_nl
+ << "{" << be_idt_nl;
+
*os << "this->"
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
<< " = " << bt->name () << "::_duplicate (val);" << be_uidt_nl;
- *os << "}" << be_nl;
+ *os << "}" << be_nl << be_nl;
+
+ *os << "// Retrieve the member" << be_nl
+ << this->pre_op () << bt->name () << "_ptr " << be_nl;
+
+ this->op_name (bu,
+ os);
- // get method
- *os << "// retrieve the member" << be_nl
- << this->pre_op() << bt->name () << "_ptr " << be_nl;
- this->op_name(bu,os);
- *os << "::" << ub->local_name () << " () const"
+ *os << "::" << ub->local_name () << " () const"
<< be_nl
- << "{\n";
- os->incr_indent ();
+ << "{" << be_idt_nl;
+
*os << "return this->"
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
- << ".ptr ();\n";
- os->decr_indent ();
- *os << "}\n\n";
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
+ << ".ptr ();" << be_uidt_nl;
+
+ *os << "}" << be_nl << be_nl;
+
return 0;
}
int
be_visitor_valuetype_field_cs::visit_valuetype (be_valuetype *node)
{
- TAO_OutStream *os; // output stream
- be_decl *ub =
- this->ctx_->node (); // get field node
- be_valuetype *bu =
- be_valuetype::narrow_from_decl (this->ctx_->scope ());
+ be_decl *ub = this->ctx_->node ();
+ be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ());
be_type *bt;
- // check if we are visiting this node via a visit to a typedef node
+ // Check if we are visiting this node via a visit to a typedef node.
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cs::"
"visit_interface - "
- "bad context information\n"
- ), -1);
+ "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
- << this->pre_op() << "void" << be_nl;
- this->op_name(bu,os);
- *os << "::" << ub->local_name () << " (" << bt->name ()
- << "* val)// set" << be_nl
- << "{\n";
- os->incr_indent ();
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "// Accessor to set the member." << be_nl
+ << this->pre_op () << "void" << be_nl;
+
+ this->op_name (bu,
+ os);
+
+ *os << "::" << ub->local_name () << " (" << bt->name ()
+ << "* val)" << be_nl
+ << "{" << be_idt_nl;
+
*os << "CORBA::add_ref (val);" << be_nl
<< "this->"
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
<< " = val;" << be_uidt_nl;
- *os << "}" << be_nl;
+ *os << "}" << be_nl << be_nl;
- // get method
- *os << "// retrieve the member" << be_nl
- << this->pre_op() << bt->name () << "* " << be_nl;
- this->op_name(bu,os);
- *os << "::" << ub->local_name () << " () const"
+ *os << "// Retrieve the member" << be_nl
+ << this->pre_op () << bt->name () << " *" << be_nl;
+
+ this->op_name (bu,
+ os);
+
+ *os << "::" << ub->local_name () << " () const"
<< be_nl
- << "{\n";
- os->incr_indent ();
+ << "{" << be_idt_nl;
+
*os << "return this->"
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
- << ".ptr ();\n";
- os->decr_indent ();
- *os << "}\n\n";
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
+ << ".ptr ();" << be_uidt_nl;
+
+ *os << "}" << be_nl << be_nl;
+
return 0;
}
int
be_visitor_valuetype_field_cs::visit_valuetype_fwd (be_valuetype_fwd *node)
{
- TAO_OutStream *os; // output stream
- be_decl *ub =
- this->ctx_->node (); // get field node
- be_valuetype *bu =
- be_valuetype::narrow_from_decl (this->ctx_->scope ());
+ be_decl *ub = this->ctx_->node ();
+ be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ());
be_type *bt;
- // check if we are visiting this node via a visit to a typedef node
+ // Check if we are visiting this node via a visit to a typedef node.
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cs::"
"visit_interface - "
- "bad context information\n"
- ), -1);
+ "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
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "// Accessor to set the member." << be_nl
<< this->pre_op () << "void" << be_nl;
- this->op_name (bu, os);
- *os << "::" << ub->local_name () << " (" << bt->name ()
- << "* val)// set" << be_nl
- << "{\n";
- os->incr_indent ();
+
+ this->op_name (bu,
+ os);
+
+ *os << "::" << ub->local_name () << " (" << bt->name ()
+ << "* val)" << be_nl
+ << "{" << be_idt_nl;
+
*os << "CORBA::add_ref (val);" << be_nl
<< "this->"
- << bu->field_pd_prefix () << ub->local_name () << bu->field_pd_postfix()
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
<< " = val;" << be_uidt_nl;
- *os << "}" << be_nl;
+ *os << "}" << be_nl << be_nl;
+
+ *os << "// Retrieve the member." << be_nl
+ << this->pre_op () << bt->name () << " *" << be_nl;
- // get method
- *os << "// retrieve the member" << be_nl
- << this->pre_op () << bt->name () << "* " << be_nl;
- this->op_name (bu, os);
- *os << "::" << ub->local_name () << " () const"
+ this->op_name (bu,
+ os);
+
+ *os << "::" << ub->local_name () << " () const"
<< be_nl
- << "{\n";
- os->incr_indent ();
+ << "{" << be_idt_nl;
+
*os << "return this->"
- << bu->field_pd_prefix () << ub->local_name () << bu->field_pd_postfix()
- << ".ptr ();\n";
- os->decr_indent ();
- *os << "}\n\n";
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix
+ ()
+ << ".ptr ();" << be_uidt_nl;
+
+ *os << "}" << be_nl << be_nl;
+
return 0;
}
int
be_visitor_valuetype_field_cs::visit_predefined_type (be_predefined_type *node)
{
- TAO_OutStream *os; // output stream
-
- be_decl *ub =
- this->ctx_->node (); // get field node
- be_valuetype *bu =
- be_valuetype::narrow_from_decl (this->ctx_->scope ());
+ be_decl *ub = this->ctx_->node ();
+ be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ());
be_type *bt;
- // check if we are visiting this node via a visit to a typedef node
+
+ // Check if we are visiting this node via a visit to a typedef node.
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cs::"
"visit_predef... - "
- "bad context information\n"
- ), -1);
+ "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
- << this->pre_op() << "void" << be_nl;
- this->op_name(bu,os);
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "// Accessor to set the member." << be_nl
+ << this->pre_op () << "void" << be_nl;
+
+ this->op_name (bu,
+ os);
+
*os << "::" << ub->local_name ()
<< " (" << bt->name ();
- if (node->pt () == AST_PredefinedType::PT_pseudo)
- *os << "_ptr";
- *os << " val) // set" << be_nl
+
+ AST_PredefinedType::PredefinedType pt = node->pt ();
+
+ if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
+ {
+ *os << "_ptr";
+ }
+ else if (pt == AST_PredefinedType::PT_any)
+ {
+ *os << " &";
+ }
+
+ *os << " val)" << be_nl
<< "{" << be_idt_nl;
- switch (node->pt ())
- {
- case AST_PredefinedType::PT_pseudo:
- *os << "this->" << bu->field_pd_prefix() << ub->local_name ()
- << bu->field_pd_postfix() << " = "
- << bt->name () << "::_duplicate (val);" << be_uidt_nl;
- break;
-
- case AST_PredefinedType::PT_any:
- *os << "ACE_NEW (" << be_idt << be_idt_nl
- << "this->" << bu->field_pd_prefix() << ub->local_name ()
- << bu->field_pd_postfix() << "," << be_nl
- << bt->name () << " (val)" << be_uidt_nl
- << ");" << be_uidt << be_uidt_nl;
- break;
-
- case AST_PredefinedType::PT_void:
- break;
-
- default:
- *os << "// set the value" << be_nl
- << "this->" << bu->field_pd_prefix () << ub->local_name ()
- << bu->field_pd_postfix ()
- << " = val;" << be_uidt_nl;
- }
- *os << "}" << be_nl;
+ switch (pt)
+ {
+ case AST_PredefinedType::PT_pseudo:
+ case AST_PredefinedType::PT_object:
+ *os << "this->" << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix () << " = "
+ << bt->name () << "::_duplicate (val);" << be_uidt_nl;
+
+ break;
+ case AST_PredefinedType::PT_any:
+ *os << "this->" << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix () << " = val;" << be_uidt_nl;
+
+ break;
+ case AST_PredefinedType::PT_void:
+ break;
+ default:
+ *os << "// Set the value." << be_nl
+ << "this->" << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
+ << " = val;" << be_uidt_nl;
+
+ break;
+ }
+
+ *os << "}" << be_nl << be_nl;
switch (node->pt ())
- {
+ {
case AST_PredefinedType::PT_pseudo:
- // get method
- *os << "// retrieve the member" << be_nl
- << this->pre_op() << bt->name () << "_ptr" << be_nl;
- this->op_name(bu,os);
+ case AST_PredefinedType::PT_object:
+ *os << "// Retrieve the member" << be_nl
+ << this->pre_op () << bt->name () << "_ptr" << be_nl;
+
+ this->op_name (bu,
+ os);
+
*os << "::" << ub->local_name ()
<< " (void) const" << be_nl
<< "{" << be_idt_nl
<< "return this->"
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
<< ";" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
+
break;
case AST_PredefinedType::PT_any:
- // get method with read-only access
- *os << "// retrieve the member" << be_nl
- << this->pre_op() << "const " << bt->name () << be_nl;
- this->op_name(bu,os);
+ *os << "// Retrieve the member." << be_nl
+ << this->pre_op () << "const " << bt->name () << " &" << be_nl;
+
+ this->op_name (bu,
+ os);
+
*os << "::" << ub->local_name ()
<< " (void) const" << be_nl
<< "{" << be_idt_nl
- << "return *this->"
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
+ << "return this->"
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
<< ";" << be_uidt_nl
- << "}" << be_nl;
+ << "}" << be_nl << be_nl;
+
+ *os << "// Retrieve the member" << be_nl
+ << this->pre_op () << bt->name () << " &" << be_nl;
+
+ this->op_name (bu,
+ os);
- // get method with read/write access
- *os << "// retrieve the member" << be_nl
- << this->pre_op() << bt->name () << be_nl;
- this->op_name(bu,os);
*os << "::" << ub->local_name ()
<< " (void)" << be_nl
<< "{" << be_idt_nl
- << "return *this->"
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
+ << "return this->"
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
<< ";" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
+
break;
case AST_PredefinedType::PT_void:
break;
default:
- // get method
- *os << "// retrieve the member" << be_nl
- << this->pre_op() << bt->name () << be_nl;
- this->op_name(bu,os);
+ *os << "// Retrieve the member" << be_nl
+ << this->pre_op () << bt->name () << be_nl;
+
+ this->op_name (bu,
+ os);
+
*os << "::" << ub->local_name ()
<< " (void) const" << be_nl
<< "{" << be_idt_nl
<< "return this->"
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
<< ";" << be_uidt_nl
- << "}\n\n";
- }
+ << "}" << be_nl << be_nl;
+
+ break;
+ }
+
return 0;
}
int
be_visitor_valuetype_field_cs::visit_sequence (be_sequence *node)
{
- TAO_OutStream *os; // output stream
- be_decl *ub =
- this->ctx_->node (); // get field node
- be_valuetype *bu =
- be_valuetype::narrow_from_decl (this->ctx_->scope ());
+ be_decl *ub = this->ctx_->node ();
+ be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ());
be_type *bt;
- // check if we are visiting this node via a visit to a typedef node
+ // Check if we are visiting this node via a visit to a typedef node.
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cs::"
"visit_sequence - "
- "bad context information\n"
- ), -1);
+ "bad context information\n"),
+ -1);
}
- os = this->ctx_->stream ();
+
+ TAO_OutStream *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 inline operations for this anonymous sequence type
+ ctx.node (node);
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_valuetype_field_cs::"
- "visit_sequence - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_sequence_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cs::"
"visit_sequence - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// (1) set from a const
- *os << "// accessor to set the member" << be_nl
- << this->pre_op() << "void" << be_nl;
- this->op_name(bu,os);
+ *os << "// Accessor to set the member." << be_nl
+ << this->pre_op () << "void" << be_nl;
+
+ this->op_name (bu,
+ os);
+
*os << "::" << ub->local_name ()
<< " (const " << bt->name () << " &val)" << be_nl
<< "{" << be_idt_nl;
*os << "this->"
- << bu->field_pd_prefix() << ub->local_name ()
- << bu->field_pd_postfix()
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
<< " = val;" << be_uidt_nl;
-
*os << "}" << be_nl << be_nl;
- // readonly get method
- *os << "// readonly get method " << be_nl
- << this->pre_op() << "const " << bt->name () << " &" << be_nl;
- this->op_name(bu,os);
+ *os << "// Readonly get method." << be_nl
+ << this->pre_op () << "const " << bt->name () << " &" << be_nl;
+
+ this->op_name (bu,
+ os);
+
*os << "::" << ub->local_name ()
<< " (void) const" << be_nl
<< "{" << be_idt_nl
- << "return this->" // %! *this (seq_var, not seq member)
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
+ << "return this->"
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
<< ";" << be_uidt_nl
<< "}" << be_nl << be_nl;
- // read/write get method
- *os << "// read/write get method " << be_nl
- << this->pre_op() << bt->name () << " &" << be_nl;
- this->op_name(bu,os);
+ *os << "// Read/write get method." << be_nl
+ << this->pre_op () << bt->name () << " &" << be_nl;
+
+ this->op_name (bu,
+ os);
+
*os << "::" << ub->local_name () << " (void)" << be_nl
<< "{" << be_idt_nl
<< "return this->"
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix()
<< ";" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
return 0;
}
@@ -707,27 +795,31 @@ be_visitor_valuetype_field_cs::visit_sequence (be_sequence *node)
int
be_visitor_valuetype_field_cs::visit_string (be_string *node)
{
- be_decl *ub =
- this->ctx_->node (); // get field node
- be_valuetype *bu =
- be_valuetype::narrow_from_decl (this->ctx_->scope ());
+ be_decl *ub = this->ctx_->node ();
+ be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ());
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cs::"
"visit_string - "
- "bad context information\n"
- ), -1);
+ "bad context information\n"),
+ -1);
}
+
TAO_OutStream *os = this->ctx_->stream ();
- // three methods to set the string value
+ // Three methods to set the string value.
+
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
- // (1) set method from char* or wchar*
- os->indent (); // start from current indentation
- *os << "// accessor to set the member" << be_nl
+ // (1) Set method from char* or wchar*.
+ os->indent ();
+
+ *os << "// Accessor to set the member." << be_nl
<< this->pre_op () << "void" << be_nl;
+
this->op_name (bu,
os);
@@ -742,16 +834,17 @@ be_visitor_valuetype_field_cs::visit_string (be_string *node)
*os << be_nl
<< "{" << be_idt_nl;
+ *os << "// set the value" << be_nl
+ << "this->"
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
+ << " = val;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
- *os << "// set the value" << be_nl
- << "this->"
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
- << " = val;" << be_uidt_nl
- << "}" << be_nl;
-
- // (2) set method from const char * or const wchar*
- *os << "// accessor to set the member" << be_nl
+ // (2) Set method from const char * or const wchar*.
+ *os << "// Accessor to set the member." << be_nl
<< this->pre_op () << "void" << be_nl;
+
this->op_name (bu,
os);
*os << "::" << ub->local_name ();
@@ -765,12 +858,12 @@ be_visitor_valuetype_field_cs::visit_string (be_string *node)
*os << " (const CORBA::WChar *val)" << be_nl;
}
- *os << "{\n";
- os->incr_indent ();
+ *os << "{" << be_idt_nl;
- *os << "// set the value" << be_nl
+ *os << "// Set the value." << be_nl
<< "this->"
- << bu->field_pd_prefix () << ub->local_name () << bu->field_pd_postfix ()
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
<< " = ";
if (node->width () == (long) sizeof (char))
@@ -782,13 +875,15 @@ be_visitor_valuetype_field_cs::visit_string (be_string *node)
*os << "CORBA::wstring_dup (val);" << be_uidt_nl;
}
- *os << "}" << be_nl;
+ *os << "}" << be_nl << be_nl;
- // (3) set from const String_var&
- *os << "// accessor to set the member" << be_nl
+ // (3) Set from const String_var&.
+ *os << "// Accessor to set the member." << be_nl
<< this->pre_op () << "void" << be_nl;
+
this->op_name (bu,
os);
+
*os << "::" << ub->local_name ();
if (node->width () == (long) sizeof (char))
@@ -801,8 +896,6 @@ be_visitor_valuetype_field_cs::visit_string (be_string *node)
}
*os << "{" << be_idt_nl;
- *os << ";" << be_nl;
-
*os << "// set the value" << be_nl;
if (node->width () == (long) sizeof (char))
@@ -816,13 +909,12 @@ be_visitor_valuetype_field_cs::visit_string (be_string *node)
*os << "_var = val;" << be_nl
<< "this->"
- << bu->field_pd_prefix () << ub->local_name () << bu->field_pd_postfix ()
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
<< " = "
<< ub->local_name () << "_var._retn ();" << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
- *os << "}" << be_nl;
-
- // get method
if (node->width () == (long) sizeof (char))
{
*os << this->pre_op () << "const char *" << be_nl;
@@ -834,140 +926,113 @@ be_visitor_valuetype_field_cs::visit_string (be_string *node)
this->op_name (bu,
os);
+
*os << "::" << ub->local_name ()
<< " (void) const // get method" << be_nl
<< "{" << be_idt_nl
<< "return this->"
- << bu->field_pd_prefix () << ub->local_name () << bu->field_pd_postfix ()
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
<< ";" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
+
return 0;
}
int
be_visitor_valuetype_field_cs::visit_structure (be_structure *node)
{
- TAO_OutStream *os; // output stream
- be_decl *ub =
- this->ctx_->node (); // get field node
- be_valuetype *bu =
- be_valuetype::narrow_from_decl (this->ctx_->scope ());
+ be_decl *ub = this->ctx_->node ();
+ be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ());
be_type *bt;
- // check if we are visiting this node via a visit to a typedef node
+ // Check if we are visiting this node via a visit to a typedef node.
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cs::"
"visit_structure - "
- "bad context information\n"
- ), -1);
+ "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
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (bt->node_type () != AST_Decl::NT_typedef
+ && bt->is_child (bu))
{
- // 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.node (node);
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_valuetype_field_cs::"
- "visit_structure - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_structure_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cs::"
"visit_structure - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
- // (1) set from a const
- *os << "// accessor to set the member" << be_nl
- << this->pre_op() << "void" << be_nl;
- this->op_name(bu,os);
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // (1) Set from a const.
+ *os << "// Accessor to set the member." << be_nl
+ << this->pre_op () << "void" << be_nl;
+
+ this->op_name (bu,
+ os);
+
*os << "::" << ub->local_name ()
<< " (const " << bt->name () << " &val)" << be_nl
<< "{" << be_idt_nl;
- if (0) // %! (bt->size_type () == be_type::VARIABLE)
- { cerr <<"!t VARIABLE struct in field_cs\n";
- *os << "delete this->"
- << bu->field_pd_prefix() << ub->local_name ()
- << bu->field_pd_postfix()
- << ";" << be_nl;
-
- *os << "ACE_NEW (" << be_idt << be_idt_nl
- << "this->" << bu->field_pd_prefix() << ub->local_name ()
- << bu->field_pd_postfix() << "," << be_nl
- << bt->name () << " (val)" << be_uidt_nl
- << ");" << be_uidt << be_uidt_nl;
-
-// This was replaced by the above output statement, but this doesn't work
-// *os << "this->"
-// << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
-// << " = new "
-// << bt->name () << " (val);" << be_uidt_nl;
- }
- else
- {
- *os << "this->"
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
- << " = val;" << be_uidt_nl;
- }
+ *os << "this->"
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
+ << " = val;" << be_uidt_nl;
*os << "}" << be_nl;
- // readonly get method
- *os << "// readonly get method " << be_nl
- << this->pre_op() << "const " << bt->name () << " &" << be_nl;
- this->op_name(bu,os);
+ *os << "// Readonly get method." << be_nl
+ << this->pre_op () << "const " << bt->name () << " &" << be_nl;
+
+ this->op_name (bu,
+ os);
+
*os << "::" << ub->local_name () << " (void) const" << be_nl
<< "{" << be_idt_nl;
- if (0) // %! (bt->size_type () == be_type::VARIABLE)
- *os << "return *this->"
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
- << ";" << be_uidt_nl;
- else
- *os << "return this->"
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
- << ";" << be_uidt_nl;
+ *os << "return this->"
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
+ << ";" << be_uidt_nl;
*os << "}" << be_nl;
- // read/write get method
- *os << "// read/write get method " << be_nl
- << this->pre_op() << bt->name () << " &" << be_nl;
- this->op_name(bu,os);
+ *os << "// Read/write get method." << be_nl
+ << this->pre_op () << bt->name () << " &" << be_nl;
+
+ this->op_name (bu,
+ os);
+
*os << "::" << ub->local_name () << " (void)" << be_nl
<< "{" << be_idt_nl;
- if (0) // %! (bt->size_type () == be_type::VARIABLE)
- *os << "return *this->"
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
- << ";" << be_uidt_nl;
- else
- *os << "return this->"
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
- << ";" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "return this->"
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
+ << ";" << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
return 0;
}
@@ -975,18 +1040,16 @@ be_visitor_valuetype_field_cs::visit_structure (be_structure *node)
int
be_visitor_valuetype_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
+ this->ctx_->alias (node);
be_type *bt = node->primitive_base_type ();
+
if (!bt || (bt->accept (this) == -1))
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cs::"
"visit_typedef - "
- "Bad primitive type\n"
- ), -1);
+ "Bad primitive type\n"),
+ -1);
}
this->ctx_->alias (0);
@@ -996,104 +1059,95 @@ be_visitor_valuetype_field_cs::visit_typedef (be_typedef *node)
int
be_visitor_valuetype_field_cs::visit_union (be_union *node)
{
- cerr << "!u be_visitor_valuetype_field_cs::visit_union unimp.\n";
- TAO_OutStream *os; // output stream
- be_decl *ub =
- this->ctx_->node (); // get field node
- be_valuetype *bu =
- be_valuetype::narrow_from_decl (this->ctx_->scope ());
+ be_decl *ub = this->ctx_->node ();
+ be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ());
be_type *bt;
- // check if we are visiting this node via a visit to a typedef node
+ // Check if we are visiting this node via a visit to a typedef node.
if (this->ctx_->alias ())
- bt = this->ctx_->alias ();
+ {
+ bt = this->ctx_->alias ();
+ }
else
- bt = node;
+ {
+ bt = node;
+ }
if (!ub || !bu)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cs::"
"visit_union - "
- "bad context information\n"
- ), -1);
+ "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
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (bt->node_type () != AST_Decl::NT_typedef
+ && bt->is_child (bu))
{
- // 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.node (node);
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_valuetype_field_cs::"
- "visit_union - "
- "Bad visitor\n"
- ), -1);
- }
- if (node->accept (visitor) == -1)
+ be_visitor_union_cs visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_field_cs::"
"visit_union - "
- "codegen failed\n"
- ), -1);
+ "codegen failed\n"),
+ -1);
}
- delete visitor;
}
- // (1) set from a const
- *os << "// accessor to set the member" << be_nl
- << this->pre_op() << "void" << be_nl;
- this->op_name(bu,os);
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "// Accessor to set the member" << be_nl
+ << this->pre_op () << "void" << be_nl;
+
+ this->op_name (bu,
+ os);
+
*os << "::" << ub->local_name ()
<< " (const " << bt->name () << " &val)" << be_nl
<< "{" << be_idt_nl;
-
*os << "ACE_NEW (" << be_idt << be_idt_nl
- << "this->" << bu->field_pd_prefix() << ub->local_name ()
- << bu->field_pd_postfix() << "_var," << be_nl
+ << "this->" << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix () << "_var," << be_nl
<< bt->name () << " (val)" << be_uidt_nl
<< ");" << be_uidt << be_uidt_nl;
+ *os << "}" << be_nl;
-// This was replaced by the above output statement, but this doesn't work
-// *os << "this->"
-// << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
-// << "_var = new " << bt->name ()
-// << " (val);" << be_uidt_nl;
+ *os << "// Readonly get method." << be_nl
+ << this->pre_op () << "const " << bt->name () << " &" << be_nl;
- *os << "}" << be_nl;
+ this->op_name (bu,
+ os);
- // readonly get method
- *os << "// readonly get method " << be_nl
- << this->pre_op() << "const " << bt->name () << " &" << be_nl;
- this->op_name(bu,os);
*os << "::" << ub->local_name () << " (void) const" << be_nl
<< "{" << be_idt_nl
<< "return *this->"
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
<< ";" << be_uidt_nl
<< "}" << be_nl;
- // read/write get method
- *os << "// read/write get method " << be_nl
- << this->pre_op() << bt->name () << " &" << be_nl;
- this->op_name(bu,os);
+ *os << "// Read/write get method." << be_nl
+ << this->pre_op () << bt->name () << " &" << be_nl;
+
+ this->op_name (bu,
+ os);
+
*os << "::" << ub->local_name () << " (void)" << be_nl
<< "{" << be_idt_nl
<< "return *this->"
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
+ << bu->field_pd_prefix () << ub->local_name ()
+ << bu->field_pd_postfix ()
<< ";" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
return 0;
}
@@ -1101,22 +1155,26 @@ be_visitor_valuetype_field_cs::visit_union (be_union *node)
void
be_visitor_valuetype_field_cs::setenclosings (const char *pre)
{
- pre_op_ = pre;
+ this->pre_op_ = pre;
}
const char*
be_visitor_valuetype_field_cs::pre_op ()
{
- return pre_op_;
+ return this->pre_op_;
}
-// retrieve the fully scoped skeleton name
+// Retrieve the fully scoped skeleton name.
void
be_visitor_valuetype_field_cs::op_name (be_valuetype *node,
TAO_OutStream *os)
{
if (this->in_obv_space_)
- *os << node->full_obv_skel_name ();
+ {
+ *os << node->full_obv_skel_name ();
+ }
else
- *os << node->name ();
+ {
+ *os << node->name ();
+ }
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_ch.cpp
index 4688584e439..a4fa8a2aeb6 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_ch.cpp
@@ -20,14 +20,9 @@
//
// ============================================================================
-
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_valuetype.h"
-
-ACE_RCSID(be_visitor_valuetype, marshal_ch, "$Id$")
+ACE_RCSID (be_visitor_valuetype,
+ marshal_ch,
+ "$Id$")
// ***************************************************************************
// Structure visitor for generating declarations
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp
index e2df4c9c46d..836c462aeb8 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp
@@ -19,15 +19,9 @@
//
// ============================================================================
-
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_valuetype.h"
-
-ACE_RCSID(be_visitor_valuetype, marshal_cs, "$Id$")
-
+ACE_RCSID (be_visitor_valuetype,
+ marshal_cs,
+ "$Id$")
be_visitor_valuetype_marshal_cs::be_visitor_valuetype_marshal_cs (
be_visitor_context *ctx
@@ -46,6 +40,9 @@ be_visitor_valuetype_marshal_cs::visit_valuetype (be_valuetype *node)
TAO_OutStream *os = this->ctx_->stream ();
this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_OUTPUT);
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
*os << "CORBA::Boolean" << be_nl;
this->class_name (node, os);
@@ -72,14 +69,20 @@ be_visitor_valuetype_marshal_cs::visit_valuetype (be_valuetype *node)
this->class_name (inh, os);
- *os << "::_tao_marshal_state (strm)) return 0;" << be_nl;
+ *os << "::_tao_marshal_state (strm))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
}
// Can access base class only via virtual function.
else
{
- *os << "if (!this->_tao_marshal__"
+ *os << "if (! this->_tao_marshal__"
<< inh->flat_name ()
- << " (strm)) return 0;" << be_nl;
+ << " (strm))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
}
}
@@ -93,12 +96,16 @@ be_visitor_valuetype_marshal_cs::visit_valuetype (be_valuetype *node)
this->gen_fields (node,
*this->ctx_);
- *os << be_uidt_nl << ")"
- << be_idt_nl
+ *os << be_uidt_nl
+ << " )" << be_idt_nl
+ << "{" << be_idt_nl
<< "return 1;" << be_uidt_nl
+ << "}" << be_uidt_nl
<< "else" << be_idt_nl
- << "return 0;" << be_uidt_nl << be_uidt_nl
- << "}\n\n";
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
// Set the substate as generating code for the input operator.
this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_INPUT);
@@ -127,13 +134,19 @@ be_visitor_valuetype_marshal_cs::visit_valuetype (be_valuetype *node)
this->class_name (inh, os);
- *os << "::_tao_unmarshal_state (strm)) return 0;" << be_nl;
+ *os << "::_tao_unmarshal_state (strm))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
}
else // only can access base class via virtual function
{
- *os << "if (!this->_tao_unmarshal__"
+ *os << "if (! this->_tao_unmarshal__"
<< inh->flat_name ()
- << " (strm)) return 0;" << be_nl;
+ << " (strm))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
}
}
@@ -146,12 +159,16 @@ be_visitor_valuetype_marshal_cs::visit_valuetype (be_valuetype *node)
this->gen_fields (node,
*this->ctx_);
- *os << be_uidt_nl << ")"
- << be_idt_nl
+ *os << be_uidt_nl
+ << " )" << be_idt_nl
+ << "{" << be_idt_nl
<< "return 1;" << be_uidt_nl
+ << "}" << be_uidt_nl
<< "else" << be_idt_nl
- << "return 0;" << be_uidt_nl << be_uidt_nl
- << "}\n\n";
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
return 0;
}
@@ -199,6 +216,7 @@ be_visitor_valuetype_marshal_cs::gen_fields (be_valuetype *node,
"bad node in this scope\n"),
-1);
}
+
be_field *field = be_field::narrow_from_decl (d);
if (field)
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/obv_module.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/obv_module.cpp
index e53d67fa7d2..0fea9926210 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/obv_module.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/obv_module.cpp
@@ -20,15 +20,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-ACE_RCSID(be_visitor_obv_module, obv_module, "$Id$")
-
+ACE_RCSID (be_visitor_obv_module,
+ obv_module,
+ "$Id$")
// ************************************************************
-// Module visitor for server header
+// OBV module visitor for server header.
// ************************************************************
be_visitor_obv_module::be_visitor_obv_module (be_visitor_context *ctx)
@@ -40,19 +37,10 @@ be_visitor_obv_module::~be_visitor_obv_module (void)
{
}
-
-
-// This states are processed:
-// TAO_MODULE_OBV_CH
-// TAO_MODULE_OBV_CI
-// TAO_MODULE_OBV_CH
-
-
int
be_visitor_obv_module::visit_module (be_module *node)
{
- TAO_OutStream *os; // output stream
- os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream ();
if (node->has_nested_valuetype ())
{
@@ -60,25 +48,30 @@ be_visitor_obv_module::visit_module (be_module *node)
{
os->indent ();
- *os << "TAO_NAMESPACE "; // << idl_global->skel_export_macro ()
+ *os << "TAO_NAMESPACE ";
if (!node->is_nested ())
- // we are outermost module, so prepend
+ {
+ // We are outermost module, so prepend.
*os << " OBV_" << node->local_name () << be_nl;
+ }
else
- // we are inside another module
+ {
+ // We are inside another module.
*os << " " << node->local_name () << be_nl;
+ }
*os << "{" << be_nl
<< be_idt;
- } // client header
+ }
if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_obv_module::"
"visit_module - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
if (this->ctx_->state () == TAO_CodeGen::TAO_MODULE_OBV_CH)
@@ -87,6 +80,7 @@ be_visitor_obv_module::visit_module (be_module *node)
*os << "}\nTAO_NAMESPACE_CLOSE\n\n";
}
}
+
return 0;
}
@@ -94,11 +88,9 @@ be_visitor_obv_module::visit_module (be_module *node)
int
be_visitor_obv_module::visit_valuetype (be_valuetype *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
+ ctx.node (node);
+ int status = 1;
switch (this->ctx_->state ())
{
@@ -106,8 +98,13 @@ be_visitor_obv_module::visit_valuetype (be_valuetype *node)
ctx.state (TAO_CodeGen::TAO_VALUETYPE_OBV_CH);
break;
case TAO_CodeGen::TAO_MODULE_OBV_CI:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_OBV_CI);
- break;
+ {
+ // This context state is not involved in any strategies.
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_OBV_CI);
+ be_visitor_valuetype_obv_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_MODULE_OBV_CS:
ctx.state (TAO_CodeGen::TAO_VALUETYPE_OBV_CS);
break;
@@ -117,60 +114,76 @@ be_visitor_obv_module::visit_valuetype (be_valuetype *node)
"(%N:%l) be_visitor_obv_module::"
"visit_valuetype - "
"Bad context state\n"
- ), -1);
+ ),
+ -1);
}
}
- // Change the state depending on the kind of node strategy
+ if (status == 0)
+ {
+ return 0;
+ }
+ else if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_obv_module::"
+ "visit_valuetype - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ // Change the state depending on the kind of node strategy.
ctx.state (node->next_state (ctx.state ()));
be_visitor *visitor = tao_cg->make_visitor (&ctx);
+
if (!visitor)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_obv_module::"
"visit_valuetype - "
- "NUL visitor\n"
- ), -1);
+ "NUL visitor\n"),
+ -1);
}
- // let the node accept this visitor
if (node->accept (visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_obv_module::"
"visit_valuetype - "
- "failed to accept visitor\n"
- ), -1);
+ "failed to accept visitor\n"),
+ -1);
}
+
delete visitor;
visitor = 0;
- // Do addtional "extra" code generation if necessary
+ // Do addtional "extra" code generation if necessary.
if (node->has_extra_code_generation (ctx.state ()))
{
- // Change the state depending on the kind of node strategy
+ // Change the state depending on the kind of node strategy.
ctx.state (node->next_state (ctx.state (), 1));
visitor = tao_cg->make_visitor (&ctx);
+
if (!visitor)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_obv_module::"
"visit_valuetype - "
- "NUL visitor\n"
- ), -1);
+ "NUL visitor\n"),
+ -1);
}
- // let the node accept this visitor
if (node->accept (visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_obv_module::"
"visit_valuetype - "
- "failed to accept visitor\n"
- ), -1);
+ "failed to accept visitor\n"),
+ -1);
}
+
delete visitor;
visitor = 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp
index 1866aebc56d..73193e5cdda 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp
@@ -19,10 +19,9 @@
//
// ============================================================================
-#include "be_visitor_valuetype.h"
-#include "be_visitor_field.h"
-
-ACE_RCSID(be_visitor_valuetype, valuetype, "$Id$")
+ACE_RCSID (be_visitor_valuetype,
+ valuetype,
+ "$Id$")
be_visitor_valuetype::be_visitor_valuetype (be_visitor_context *ctx)
: be_visitor_scope (ctx)
@@ -44,7 +43,6 @@ int
be_visitor_valuetype::visit_valuetype_scope (be_valuetype *node)
{
int n_processed = 0;
-
this->elem_number_ = 0;
for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
@@ -63,21 +61,20 @@ be_visitor_valuetype::visit_valuetype_scope (be_valuetype *node)
AST_Field *field = AST_Field::narrow_from_decl (d);
- if (field && field->visibility() == AST_Field::vis_PRIVATE)
+ if (field && field->visibility () == AST_Field::vis_PRIVATE)
{
- continue; // ignore private fields in this run
+ continue;
+ // Ignore private fields in this run
// AST_Attribute derives from AST_Field, so test for
// vis_PRIVATE is ok (the attribute has it set to vis_NA)
}
be_decl *bd = be_decl::narrow_from_decl (d);
- // set the scope node as "node" in which the code is being
+ // Set the scope node as "node" in which the code is being
// generated so that elements in the node's scope can use it
- // for code generation
+ // for code generation.
this->ctx_->scope (node->decl ());
-
- // set the node to be visited
this->ctx_->node (bd);
this->elem_number_++;
@@ -89,7 +86,7 @@ be_visitor_valuetype::visit_valuetype_scope (be_valuetype *node)
-1);
}
- } // end of for loop
+ }
this->elem_number_ = 0;
@@ -129,8 +126,6 @@ be_visitor_valuetype::visit_valuetype_scope (be_valuetype *node)
// for code generation.
this->ctx_->scope (node->decl ());
-
- // Set the node to be visited.
this->ctx_->node (bd);
this->elem_number_++;
@@ -167,21 +162,16 @@ be_visitor_valuetype::visit_attribute (be_attribute *node)
this->ctx_->node (node);
this->ctx_->attribute (node);
- be_operation *op = 0;
- ACE_NEW_RETURN (op,
- be_operation (node->field_type (),
- AST_Operation::OP_noflags,
- node->name (),
- 0,
- 0),
- -1);
+ be_operation get_op (node->field_type (),
+ AST_Operation::OP_noflags,
+ node->name (),
+ 0,
+ 0);
- op->set_name ((UTL_IdList *) node->name ()->copy ());
+ get_op.set_name ((UTL_IdList *) node->name ()->copy ());
- if (!op || this->visit_operation (op) == -1)
+ if (this->visit_operation (&get_op) == -1)
{
- delete op;
- op = 0;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_attribute::"
"visit_attribute - "
@@ -189,66 +179,39 @@ be_visitor_valuetype::visit_attribute (be_attribute *node)
-1);
}
- delete op;
- op = 0;
-
if (node->readonly ())
{
// Nothing else to do.
return 0;
}
- // The set method.
- // The return type is "void".
+ Identifier id ("void");
- Identifier *id = 0;
- UTL_ScopedName *sn = 0;
+ UTL_ScopedName sn (&id,
+ 0);
- ACE_NEW_RETURN (id,
- Identifier ("void"),
- -1);
-
- ACE_NEW_RETURN (sn,
- UTL_ScopedName (id,
- 0),
- -1);
-
- be_predefined_type *rt = 0;
- ACE_NEW_RETURN (rt,
- be_predefined_type (AST_PredefinedType::PT_void,
- sn),
- -1);
+ be_predefined_type rt (AST_PredefinedType::PT_void,
+ &sn);
// Argument type is the same as the attribute type.
- be_argument *arg = 0;
- ACE_NEW_RETURN (arg,
- be_argument (AST_Argument::dir_IN,
- node->field_type (),
- node->name ()),
- -1);
+ be_argument arg (AST_Argument::dir_IN,
+ node->field_type (),
+ node->name ());
- arg->set_name ((UTL_IdList *) node->name ()->copy ());
+ arg.set_name ((UTL_IdList *) node->name ()->copy ());
// Create the operation.
- ACE_NEW_RETURN (op,
- be_operation (rt,
- AST_Operation::OP_noflags,
- node->name (),
- 0,
- 0),
- -1);
-
- op->set_name ((UTL_IdList *) node->name ()->copy ());
- op->add_argument_to_scope (arg);
-
- if (!op || this->visit_operation (op) == -1)
+ be_operation set_op (&rt,
+ AST_Operation::OP_noflags,
+ node->name (),
+ 0,
+ 0);
+
+ set_op.set_name ((UTL_IdList *) node->name ()->copy ());
+ set_op.be_add_argument (&arg);
+
+ if (this->visit_operation (&set_op) == -1)
{
- delete op;
- op = 0;
- delete arg;
- arg = 0;
- delete rt;
- rt = 0;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_attribute::"
"visit_attribute - "
@@ -256,12 +219,6 @@ be_visitor_valuetype::visit_attribute (be_attribute *node)
-1);
}
- delete op;
- op = 0;
- delete rt;
- rt = 0;
- delete arg;
- arg = 0;
return 0;
}
@@ -269,22 +226,26 @@ be_visitor_valuetype::visit_attribute (be_attribute *node)
int
be_visitor_valuetype::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);
-
- // This switch is acceptable rather than having derived visitors overriding
- // this method and differing only in what state they set.
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_VALUETYPE_CH:
- ctx.state (TAO_CodeGen::TAO_CONSTANT_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_CONSTANT_CH);
+ be_visitor_constant_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CS:
- ctx.state (TAO_CodeGen::TAO_CONSTANT_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_CONSTANT_CS);
+ be_visitor_constant_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_OBV_CH:
case TAO_CodeGen::TAO_VALUETYPE_OBV_CI:
case TAO_CodeGen::TAO_VALUETYPE_OBV_CS:
@@ -310,18 +271,7 @@ be_visitor_valuetype::visit_constant (be_constant *node)
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
-
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype::"
- "visit_constant - "
- "NULL visitor\n"),
- -1);
- }
-
- if (node->accept (visitor) == -1)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype::"
@@ -330,44 +280,61 @@ be_visitor_valuetype::visit_constant (be_constant *node)
-1);
}
- delete visitor;
return 0;
}
int
be_visitor_valuetype::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);
-
- // This switch is acceptable rather than having derived visitors overriding
- // this method and differing only in what state they set.
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_VALUETYPE_CH:
- ctx.state (TAO_CodeGen::TAO_ENUM_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_CH);
+ be_visitor_enum_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CS:
- ctx.state (TAO_CodeGen::TAO_ENUM_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_CS);
+ be_visitor_enum_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CH);
+ be_visitor_enum_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CS);
+ be_visitor_enum_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CH);
- break;
- case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CH);
+ be_visitor_enum_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CI);
+ be_visitor_enum_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CS:
case TAO_CodeGen::TAO_VALUETYPE_OBV_CH:
case TAO_CodeGen::TAO_VALUETYPE_OBV_CI:
case TAO_CodeGen::TAO_VALUETYPE_OBV_CS:
@@ -388,18 +355,7 @@ be_visitor_valuetype::visit_enum (be_enum *node)
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
-
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype::"
- "visit_enum - "
- "NULL visitor\n"),
- -1);
- }
-
- if (node->accept (visitor) == -1)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype::"
@@ -408,56 +364,74 @@ be_visitor_valuetype::visit_enum (be_enum *node)
-1);
}
- delete visitor;
- return 0;
-}
-
-
-int
-be_visitor_valuetype::visit_operation (be_operation *)
-{
- // Is overridden in derived visitors.
return 0;
}
int
be_visitor_valuetype::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);
-
- // This switch is acceptable rather than having derived visitors overriding
- // this method and differing only in what state they set.
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_VALUETYPE_CH:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CH);
+ be_visitor_exception_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CI:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CI);
+ be_visitor_exception_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CS:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CS);
+ be_visitor_exception_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CH);
+ be_visitor_exception_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CS);
+ be_visitor_exception_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CH);
+ be_visitor_exception_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CI);
+ be_visitor_exception_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CS);
- break;
-
+ {
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CDR_OP_CS);
+ be_visitor_exception_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_SH:
case TAO_CodeGen::TAO_VALUETYPE_IH:
case TAO_CodeGen::TAO_VALUETYPE_SI:
@@ -485,18 +459,7 @@ be_visitor_valuetype::visit_exception (be_exception *node)
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
-
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_interface::"
- "visit_exception - "
- "NULL visitor\n"),
- -1);
- }
-
- if (node->accept (visitor) == -1)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interface::"
@@ -505,47 +468,74 @@ be_visitor_valuetype::visit_exception (be_exception *node)
-1);
}
- delete visitor;
return 0;
}
int
be_visitor_valuetype::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);
-
- // This switch is acceptable rather than having derived visitors overriding
- // this method and differing only in what state they set.
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_VALUETYPE_CH:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CH);
+ be_visitor_structure_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CI:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CI);
+ be_visitor_structure_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CS:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CS);
+ be_visitor_structure_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CH);
+ be_visitor_structure_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CS);
+ be_visitor_structure_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CH);
+ be_visitor_structure_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CI);
+ be_visitor_structure_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CS);
+ be_visitor_structure_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_OBV_CH:
case TAO_CodeGen::TAO_VALUETYPE_OBV_CI:
case TAO_CodeGen::TAO_VALUETYPE_OBV_CS:
@@ -565,67 +555,147 @@ be_visitor_valuetype::visit_structure (be_structure *node)
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
-
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype::"
"visit_structure - "
- "NULL visitor\n"),
+ "failed to accept visitor\n"),
-1);
}
- if (node->accept (visitor) == -1)
+ return 0;
+}
+
+int
+be_visitor_valuetype::visit_structure_fwd (be_structure_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);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_VALUETYPE_CH:
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_FWD_CH);
+ be_visitor_structure_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_VALUETYPE_CI:
+ case TAO_CodeGen::TAO_VALUETYPE_CS:
+ case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CH:
+ case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CS:
+ case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CH:
+ case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CI:
+ case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CS:
+ case TAO_CodeGen::TAO_VALUETYPE_SH:
+ case TAO_CodeGen::TAO_VALUETYPE_IH:
+ case TAO_CodeGen::TAO_VALUETYPE_SI:
+ case TAO_CodeGen::TAO_VALUETYPE_SS:
+ case TAO_CodeGen::TAO_VALUETYPE_IS:
+ case TAO_CodeGen::TAO_VALUETYPE_OBV_CH:
+ case TAO_CodeGen::TAO_VALUETYPE_OBV_CI:
+ case TAO_CodeGen::TAO_VALUETYPE_OBV_CS:
+ case TAO_CodeGen::TAO_VALUETYPE_COLLOCATED_SH:
+ case TAO_CodeGen::TAO_VALUETYPE_COLLOCATED_SS:
+ case TAO_CodeGen::TAO_VALUETYPE_MARSHAL_CH:
+ case TAO_CodeGen::TAO_VALUETYPE_MARSHAL_CS:
+ case TAO_CodeGen::TAO_VALUETYPE_INIT_CH:
+ case TAO_CodeGen::TAO_VALUETYPE_INIT_CI:
+ case TAO_CodeGen::TAO_VALUETYPE_INIT_CS:
+ case TAO_CodeGen::TAO_VALUETYPE_INIT_ARGLIST_CH:
+ return 0; // nothing to be done
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype::"
+ "visit_structure_fwd - "
+ "Bad context state\n"),
+ -1);
+ }
+ }
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype::"
- "visit_structure - "
+ "visit_structure_fwd - "
"failed to accept visitor\n"),
-1);
}
- delete visitor;
return 0;
}
int
be_visitor_valuetype::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);
-
- // This switch is acceptable rather than having derived visitors overriding
- // this method and differing only in what state they set.
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_VALUETYPE_CH:
- ctx.state (TAO_CodeGen::TAO_UNION_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CH);
+ be_visitor_union_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CI:
- ctx.state (TAO_CodeGen::TAO_UNION_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CI);
+ be_visitor_union_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CS:
- ctx.state (TAO_CodeGen::TAO_UNION_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CS);
+ be_visitor_union_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CH);
+ be_visitor_union_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CS);
+ be_visitor_union_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CH);
+ be_visitor_union_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CI);
+ be_visitor_union_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CS);
+ be_visitor_union_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_OBV_CH:
case TAO_CodeGen::TAO_VALUETYPE_OBV_CI:
case TAO_CodeGen::TAO_VALUETYPE_OBV_CS:
@@ -645,67 +715,147 @@ be_visitor_valuetype::visit_union (be_union *node)
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
-
- if (!visitor)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype::"
"visit_union - "
- "NULL visitor\n"),
+ "failed to accept visitor\n"),
-1);
}
- if (node->accept (visitor) == -1)
+ return 0;
+}
+
+int
+be_visitor_valuetype::visit_union_fwd (be_union_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);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_VALUETYPE_CH:
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_FWD_CH);
+ be_visitor_union_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_VALUETYPE_CI:
+ case TAO_CodeGen::TAO_VALUETYPE_CS:
+ case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CH:
+ case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CS:
+ case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CH:
+ case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CI:
+ case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CS:
+ case TAO_CodeGen::TAO_VALUETYPE_SH:
+ case TAO_CodeGen::TAO_VALUETYPE_IH:
+ case TAO_CodeGen::TAO_VALUETYPE_SI:
+ case TAO_CodeGen::TAO_VALUETYPE_SS:
+ case TAO_CodeGen::TAO_VALUETYPE_IS:
+ case TAO_CodeGen::TAO_VALUETYPE_OBV_CH:
+ case TAO_CodeGen::TAO_VALUETYPE_OBV_CI:
+ case TAO_CodeGen::TAO_VALUETYPE_OBV_CS:
+ case TAO_CodeGen::TAO_VALUETYPE_COLLOCATED_SH:
+ case TAO_CodeGen::TAO_VALUETYPE_COLLOCATED_SS:
+ case TAO_CodeGen::TAO_VALUETYPE_MARSHAL_CH:
+ case TAO_CodeGen::TAO_VALUETYPE_MARSHAL_CS:
+ case TAO_CodeGen::TAO_VALUETYPE_INIT_CH:
+ case TAO_CodeGen::TAO_VALUETYPE_INIT_CI:
+ case TAO_CodeGen::TAO_VALUETYPE_INIT_CS:
+ case TAO_CodeGen::TAO_VALUETYPE_INIT_ARGLIST_CH:
+ return 0; // nothing to be done
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype::"
+ "visit_union_fwd - "
+ "Bad context state\n"),
+ -1);
+ }
+ }
+
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype::"
- "visit_union - "
+ "visit_union_fwd - "
"failed to accept visitor\n"),
-1);
}
- delete visitor;
return 0;
}
int
be_visitor_valuetype::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);
-
- // This switch is acceptable rather than having derived visitors overriding
- // this method and differing only in what state they set.
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_VALUETYPE_CH:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CH);
+ be_visitor_typedef_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CI:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CI);
+ be_visitor_typedef_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CS:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CS);
+ be_visitor_typedef_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH);
+ be_visitor_typedef_any_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS);
+ be_visitor_typedef_any_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CH);
+ be_visitor_typedef_cdr_op_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CI:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CI);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CI);
+ be_visitor_typedef_cdr_op_ci visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CS);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CS);
+ be_visitor_typedef_cdr_op_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
case TAO_CodeGen::TAO_VALUETYPE_OBV_CH:
case TAO_CodeGen::TAO_VALUETYPE_OBV_CI:
case TAO_CodeGen::TAO_VALUETYPE_OBV_CS:
@@ -725,18 +875,7 @@ be_visitor_valuetype::visit_typedef (be_typedef *node)
}
}
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
-
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype::"
- "visit_typedef - "
- "NULL visitor\n"),
- -1);
- }
-
- if (node->accept (visitor) == -1)
+ if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype::"
@@ -745,7 +884,6 @@ be_visitor_valuetype::visit_typedef (be_typedef *node)
-1);
}
- delete visitor;
return 0;
}
@@ -762,7 +900,6 @@ int
be_visitor_valuetype::gen_pd (be_valuetype *node)
{
int n_processed = 0;
-
this->elem_number_ = 0;
for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
@@ -778,20 +915,22 @@ be_visitor_valuetype::gen_pd (be_valuetype *node)
"bad node in this scope\n"),
-1);
}
+
be_field *field = be_field::narrow_from_decl (d);
if (!field)
{
continue;
}
+
++n_processed;
+
// Set the scope node as "node" in which the code is being
// generated so that elements in the node's scope can use it
// for code generation.
-
this->ctx_->scope (node->decl ());
- // set the node to be visited
+ // Set the node to be visited.
this->ctx_->node (field);
this->elem_number_++;
@@ -812,13 +951,10 @@ int
be_visitor_valuetype::gen_field_pd (be_field *node)
{
TAO_OutStream *os = this->ctx_->stream ();
- be_type *bt;
- be_valuetype *vt;
- os = this->ctx_->stream ();
// First generate the type information.
- bt = be_type::narrow_from_decl (node->field_type ());
- vt = be_valuetype::narrow_from_scope (node->defined_in ());
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
+ be_valuetype *vt = be_valuetype::narrow_from_scope (node->defined_in ());
if (!bt || !vt)
{
@@ -833,12 +969,12 @@ be_visitor_valuetype::gen_field_pd (be_field *node)
// will be modified based on what type of node we are visiting.
be_visitor_context ctx (*this->ctx_);
ctx.node (node);
-
ctx.state (TAO_CodeGen::TAO_FIELD_CH);
-
be_visitor_field_ch visitor (&ctx);
- if (bt->accept(&visitor) == -1)
+ *os << be_nl;
+
+ if (bt->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_field_ch::"
@@ -849,8 +985,9 @@ be_visitor_valuetype::gen_field_pd (be_field *node)
// Now output the field name.
*os << " " << vt->field_pd_prefix ()
- << node->local_name ()
- << vt->field_pd_postfix() << ";" << be_nl;
+ << node->local_name ()
+ << vt->field_pd_postfix () << ";";
+
return 0;
}
@@ -859,7 +996,7 @@ be_visitor_valuetype::gen_field_pd (be_field *node)
int
be_visitor_valuetype::gen_init_defn (be_valuetype *node)
{
- if (node->is_abstract_valuetype ())
+ if (node->is_abstract ())
{
return 0;
}
@@ -885,7 +1022,7 @@ be_visitor_valuetype::gen_init_defn (be_valuetype *node)
int
be_visitor_valuetype::gen_init_impl (be_valuetype *node)
{
- if (node->is_abstract_valuetype ())
+ if (node->is_abstract ())
{
return 0;
}
@@ -973,11 +1110,11 @@ be_visitor_valuetype::determine_factory_style (be_valuetype* node)
} // end of for loop
} // end of if
- if(!have_operation && !have_factory)
+ if (!have_operation && !have_factory)
{
factory_style = FS_CONCRETE_FACTORY;
}
- else if(have_operation && !have_factory)
+ else if (have_operation && !have_factory)
{
factory_style = FS_NO_FACTORY;
}
@@ -990,7 +1127,7 @@ be_visitor_valuetype::determine_factory_style (be_valuetype* node)
}
idl_bool
-be_visitor_valuetype::have_operation(be_valuetype* node)
+be_visitor_valuetype::have_operation (be_valuetype* node)
{
// Check whatever scope we get for operations/attributes.
@@ -1030,24 +1167,24 @@ be_visitor_valuetype::have_operation(be_valuetype* node)
AST_Decl::NodeType node_type = d->node_type();
- if(node_type == AST_Decl::NT_op)
+ if (node_type == AST_Decl::NT_op)
{
have_operation = 1;
continue;
}
- if(node_type == AST_Decl::NT_attr)
+ if (node_type == AST_Decl::NT_attr)
{
have_operation = 1;
continue;
}
- if(node_type == AST_Decl::NT_factory)
+ if (node_type == AST_Decl::NT_factory)
{
continue;
}
- if(node_type == AST_Decl::NT_field)
+ if (node_type == AST_Decl::NT_field)
{
continue;
}
@@ -1055,35 +1192,26 @@ be_visitor_valuetype::have_operation(be_valuetype* node)
} // end of for loop
} // end of if
- //Now traverse inheritance tree.
- int i; // loop index
-
- AST_Interface *iface =
- AST_Interface::narrow_from_scope (node);
+ // Now traverse inheritance tree.
+ long i; // loop index
+ long n_inherits = node->n_inherits ();
+ AST_Interface **inherits = node->inherits ();
- for (i = 0; i < iface->n_inherits (); ++i)
+ for (i = 0; i < n_inherits; ++i)
{
- AST_Interface *inherited =
- AST_Interface::narrow_from_decl (iface->inherits ()[i]);
-
- if (!inherited || !inherited->is_valuetype())
- {
- continue;
- }
-
- be_valuetype *vt = be_valuetype::narrow_from_decl(node->inherits ()[i]);
+ be_valuetype *vt = be_valuetype::narrow_from_decl (inherits[i]);
if (vt != 0)
{
have_operation = have_operation ||
- be_visitor_valuetype::have_operation(vt);
+ be_visitor_valuetype::have_operation (vt);
- if(have_operation)
+ if (have_operation)
{
break;
}
}
- } // end of for loop
+ }
return have_operation;
}
@@ -1094,26 +1222,15 @@ be_visitor_valuetype::obv_need_ref_counter (be_valuetype* node)
// VT needs RefCounter if it has concrete factory and
// none of its base VT has ref_counter
- if (determine_factory_style(node) != FS_CONCRETE_FACTORY)
+ if (determine_factory_style (node) != FS_CONCRETE_FACTORY)
{
return 0;
}
// Now go thru our base VTs and see if one has already.
-
- int i; // loop index
-
- for (i = 0; i < node->n_inherits (); ++i)
+ for (int i = 0; i < node->n_inherits (); ++i)
{
- AST_Interface *inherited =
- AST_Interface::narrow_from_decl (node->inherits ()[i]);
-
- if (!inherited || !inherited->is_valuetype())
- {
- continue;
- }
-
- be_valuetype *vt = be_valuetype::narrow_from_decl(node->inherits ()[i]);
+ be_valuetype *vt = be_valuetype::narrow_from_decl (node->inherits ()[i]);
if (vt != 0)
{
@@ -1122,7 +1239,7 @@ be_visitor_valuetype::obv_need_ref_counter (be_valuetype* node)
return 0;
}
}
- } // end of for loop
+ }
return 1;
}
@@ -1132,7 +1249,7 @@ be_visitor_valuetype::obv_have_ref_counter (be_valuetype* node)
{
// Just try to find a VT with concrete factory in inheritance tree.
- if(node == 0)
+ if (node == 0)
{
return 0;
}
@@ -1143,19 +1260,8 @@ be_visitor_valuetype::obv_have_ref_counter (be_valuetype* node)
}
// Now go thru our base VTs.
-
- int i; // loop index
-
- for (i = 0; i < node->n_inherits (); ++i)
+ for (int i = 0; i < node->n_inherits (); ++i)
{
- AST_Interface *inherited =
- AST_Interface::narrow_from_decl (node->inherits ()[i]);
-
- if (!inherited || !inherited->is_valuetype())
- {
- continue;
- }
-
be_valuetype *vt = be_valuetype::narrow_from_decl (node->inherits ()[i]);
if (vt != 0)
@@ -1165,7 +1271,7 @@ be_visitor_valuetype::obv_have_ref_counter (be_valuetype* node)
return 1;
}
}
- } // end of for loop
+ }
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp
index 83079b6f2c5..d9e7dab2036 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp
@@ -20,14 +20,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_valuetype.h"
-
-ACE_RCSID(be_visitor_valuetype, valuetype_ch, "$Id$")
-
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_ch,
+ "$Id$")
// ******************************************************
// Valuetype visitor for client header
@@ -46,60 +41,61 @@ be_visitor_valuetype_ch::~be_visitor_valuetype_ch (void)
int
be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node)
{
- TAO_OutStream *os = this->ctx_->stream ();
-
- if (!node->cli_hdr_gen () && !node->imported ())
+ if (node->cli_hdr_gen () || node->imported ())
{
- *os << "// Valuetype class" << be_nl;
+ return 0;
+ }
- // == STEP 1: Generate the class name and class names we inherit ==
+ TAO_OutStream *os = this->ctx_->stream ();
+ int status = 0;
- // Forward declaration.
- *os << "class " << node->local_name () << ";" << be_nl;
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
- os->gen_ifdef_macro (node->flat_name (), "_ptr");
+ // == STEP 1: Generate the class name and class names we inherit ==
- *os << "typedef " << node->local_name ()
- << " *" << node->local_name () << "_ptr;" << be_nl;
+ // Forward declaration.
+ *os << "class " << node->local_name () << ";" << be_nl;
- os->gen_endif ();
+ os->gen_ifdef_macro (node->flat_name (), "_ptr");
- // Generate the ifdefined macro for the _var type.
- os->gen_ifdef_macro (node->flat_name (), "_var");
+ *os << "typedef " << node->local_name ()
+ << " *" << node->local_name () << "_ptr;" << be_nl;
- // Generate the _var declaration.
- if (node->gen_var_defn () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_ch::"
- "visit_valuetype - "
- "codegen for _var failed\n"),
- -1);
- }
+ os->gen_endif ();
- os->gen_endif ();
+ // Generate the ifdefined macro for the _var type.
+ os->gen_ifdef_macro (node->flat_name (), "_var");
- // Generate the ifdef macro for the _out class.
- os->gen_ifdef_macro (node->flat_name (), "_out");
+ // Generate the _var declaration.
+ if (node->gen_var_defn () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_ch::"
+ "visit_valuetype - "
+ "codegen for _var failed\n"),
+ -1);
+ }
- // Generate the _out declaration
- if (node->gen_out_defn () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_ch::"
- "visit_valuetype - "
- "codegen for _out failed\n"), -1);
- }
+ os->gen_endif ();
- // generate the endif macro.
- os->gen_endif ();
- }
+ // Generate the ifdef macro for the _out class.
+ os->gen_ifdef_macro (node->flat_name (),
+ "_out");
- if (node->imported ())
+ // Generate the _out declaration.
+ if (node->gen_out_defn () == -1)
{
- return 0;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_ch::"
+ "visit_valuetype - "
+ "codegen for _out failed\n"),
+ -1);
}
+ // Generate the endif macro.
+ os->gen_endif ();
+
// Now the valuetype definition itself.
os->gen_ifdef_macro (node->flat_name ());
@@ -111,33 +107,19 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node)
// (ordinary (not abstract) interfaces ignored).
*os << be_idt_nl <<": ";
- int i; // loop index
- int n_inherits_valuetypes = 0;
- idl_bool valuebase_inherited = 0;
- if (node->n_inherits () > 0)
+ long i; // loop index
+ be_valuetype *inherited = 0;
+ long n_inherits = node->n_inherits ();
+
+ if (n_inherits > 0)
{
- for (i = 0; i < node->n_inherits (); i++)
+ for (i = 0; i < n_inherits; ++i)
{
- // %! move is_nested() and nested_type_name() to
- // AST_Interface, then type AST_Interface can be used
- be_interface *inherited =
- be_interface::narrow_from_decl (node->inherits ()[i]);
+ inherited =
+ be_valuetype::narrow_from_decl (node->inherits ()[i]);
- if (!inherited->is_valuetype ()
- && !inherited->is_abstract ())
- {
- continue;
- }
-
- ++ n_inherits_valuetypes;
-
- if (inherited->is_valuetype())
- {
- valuebase_inherited = 1;
- }
-
- if (n_inherits_valuetypes > 1)
+ if (i > 0)
{
*os << ",";
@@ -164,37 +146,28 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node)
*os << "public virtual ";
*os << inherited->nested_type_name (scope);
} // end of for loop
+ }
- if (n_inherits_valuetypes > 0)
- {
- if (n_inherits_valuetypes > 1)
- {
- *os << be_uidt;
- }
-
- *os << be_uidt_nl;
- }
- }
-
- /**************************************************************************
+ /***********************************************************************
** This is where we diverge for an ExceptionHolder ValueType.
** This is how we proceed:
** 1) Identify it is an AMH_ExceptionHolder class.
** 2) Inherit from CORBA_DefaultValueBaseRef i.e. provide a CONCRETE
** implementation for this ValueType! This is because the alternative
** design of deriving a concrete-exception-holder class that the IDL
- ** compiler again has to generate is superflous, unnecessary, more code
- ** bloat and unnecessary information for the app-programmer. The
+ ** compiler again has to generate is superflous, unnecessary, more
+ ** coe bloat and unnecessary information for the app-programmer. The
** changes required for this (n the *C.h file) are:
- ** 2.1) Generate the raise_method as non-abstract and provide a definition
- ** in place
- ** 2.2) Generate a new constructor that takes in a CORBA::Exception*
+ ** 2.1) Generate the raise_method as non-abstract and provide a
+ ** definition in place
+ ** 2.2) Generate a new constructor that takes in a
+ CORBA::Exception*
** 2.3) Make the destructor public (instead of protected)
** 2.4) Generate a private CORBA::Exception* field.
** 2.5) Generate the tao_marshal and tao_unmarshal methods as
** non-abstarct.
** 2.6) Generate the right throw spec for the AMH ExceptionHolders
- ***************************************************************************/
+ ************************************************************************/
/****************************************************************/
// 1) Find out if the ValueType is an AMH_*ExceptionHolder, the
@@ -204,55 +177,67 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node)
int is_an_amh_exception_holder = 0;
const char *amh_underbar = "AMH_";
const char *node_name = node->local_name ();
+
if( amh_underbar[0] == node_name[0] &&
amh_underbar[1] == node_name[1] &&
amh_underbar[2] == node_name[2] &&
amh_underbar[3] == node_name[3]
) // node name starts with "AMH_"
{
- //ACE_DEBUG ((LM_DEBUG, "Passed first test of amh_excepholder \n"));
const char *last_E = ACE_OS::strrchr (node->full_name (), 'E');
+
if (last_E != 0
&& ACE_OS::strcmp (last_E, "ExceptionHolder") == 0)
{
- //ACE_DEBUG ((LM_DEBUG, "visit_valuetype: Passed second test of amh_excepholder \n"));
is_an_amh_exception_holder = 1;
}
}
/*******************************************************************/
- if (!valuebase_inherited)
+ // We do not inherit from any valuetype, hence we do so from the base
+ // CORBA::ValueBase class.
+ if (n_inherits > 0)
{
- // We do not inherit from any valuetype, hence we do so from the base
- // CORBA::ValueBase class.
- if (n_inherits_valuetypes > 1)
- {
- *os << ", ";
- }
+ *os << "," << be_nl;
+ }
- /*********************************************************************/
- // 2
- if (is_an_amh_exception_holder)
+ /*********************************************************************/
+ // 2
+ if (is_an_amh_exception_holder)
+ {
+ *os << "public virtual CORBA_DefaultValueRefCountBase"
+ << be_uidt_nl;
+ }
+ /*********************************************************************/
+ else
+ {
+ *os << "public virtual CORBA_ValueBase" << be_uidt_nl;
+ }
+
+ if (node->supports_abstract ())
+ {
+ status =
+ node->traverse_supports_list_graphs (
+ be_valuetype::abstract_supports_helper,
+ os,
+ I_TRUE
+ );
+
+ if (status == -1)
{
- *os << "public virtual CORBA_DefaultValueRefCountBase"
- << be_uidt_nl;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_ch::"
+ "visit_valuetype - "
+ "traversal of supported interfaces failed\n"),
+ -1);
}
- /*********************************************************************/
- else
- *os << "public virtual CORBA_ValueBase" << be_uidt_nl;
}
// Generate the body.
- *os << "{" << be_nl
+ *os << be_uidt << be_uidt_nl
+ << "{" << be_nl
<< "public:" << be_idt_nl
-
- // Generate the _ptr_type and _var_type typedef
- // but we must protect against certain versions of g++
- << "\n#if !defined(__GNUC__) || !defined (ACE_HAS_GNUG_PRE_2_8)"
- << be_nl
- << "typedef " << node->local_name () << "* _ptr_type;" << be_nl
- << "typedef " << node->local_name () << "_var _var_type;\n"
- << "#endif /* ! __GNUC__ || g++ >= 2.8 */" << be_nl << be_nl;
+ << "typedef " << node->local_name () << "_var _var_type;" << be_nl;
/***********************************************************************/
// 2.2, 2.3
@@ -262,7 +247,8 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node)
*os << node->local_name () << " (CORBA::Exception *ex)" << be_nl
<< "{ this->exception = ex; }" << be_nl << be_nl;
// and the destructor
- *os << "virtual ~" << node->local_name () << " ();\n" << be_nl;
+ *os << "virtual ~" << node->local_name () << " (void);"
+ << be_nl << be_nl;
}
/***********************************************************************/
@@ -278,12 +264,11 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node)
<< node->local_name () << " *&" << be_uidt_nl
<< ");" << be_uidt_nl
<< "virtual const char* "
- << "_tao_obv_repository_id () const;"
+ << "_tao_obv_repository_id (void) const;"
<< be_nl
<< "static const char* "
- << "_tao_obv_static_repository_id ();" << be_nl << be_nl;
+ << "_tao_obv_static_repository_id (void);" << be_nl << be_nl;
- // Ugly TAO any support routine
*os << "static void _tao_any_destructor (void *);"
<< be_nl << be_nl;
@@ -298,29 +283,56 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node)
-1);
}
- // Protected member:
+ // Generate pure virtual declarations of the operations in our
+ // supported interfaces.
+ status =
+ node->traverse_supports_list_graphs (
+ be_visitor_valuetype_ch::gen_supported_ops,
+ os
+ );
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_ch::"
+ "visit_valuetype - "
+ "traversal of supported interfaces failed\n"),
+ -1);
+ }
+
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // If we inherit from both CORBA::ValueBase and CORBA::AbstractBase,
+ // we have to add this to avoid ambiguity.
+ if (node->supports_abstract ())
+ {
+ *os << be_nl << be_nl << "virtual void _add_ref (void) = 0;" << be_nl;
+ *os << "virtual void _remove_ref (void) = 0;";
+ }
// Generate the "protected" constructor so that users cannot
// instantiate us.
- *os << be_uidt_nl << "protected:" << be_idt_nl
+ *os << be_uidt_nl << be_nl << "protected:" << be_idt_nl
<< node->local_name ()
- << " ();" << be_nl;
+ << " (void);" << be_nl;
if (!is_an_amh_exception_holder)
- *os << "virtual ~" << node->local_name () << " ();\n" << be_nl;
+ {
+ *os << "virtual ~" << node->local_name () << " (void);"
+ << be_nl << be_nl;
+ }
*os << "// TAO internals" << be_nl
<< "virtual void *_tao_obv_narrow (ptr_arith_t);" << be_nl;
// Support for marshalling.
- if (!node->is_abstract_valuetype ())
+ if (!node->is_abstract ())
{
*os << "virtual CORBA::Boolean "
<< "_tao_marshal_v (TAO_OutputCDR &);" << be_nl;
*os << "virtual CORBA::Boolean "
<< "_tao_unmarshal_v (TAO_InputCDR &);" << be_nl;
- // %! optimize _downcast away: extra parameter with type info
- // set (void *) in CDR Stream with the right derived pointer.
}
if (is_an_amh_exception_holder)
{
@@ -362,11 +374,12 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node)
<< "_tao_unmarshal_state (TAO_InputCDR &);"
<< be_uidt_nl << be_nl;
*os << "private:" << be_idt_nl;
+
this->gen_pd (node);
}
else // Need a way to access the state of derived OBV_ classes.
{
- if (!node->is_abstract_valuetype ())
+ if (!node->is_abstract ())
{
*os << be_uidt_nl << "protected:" << be_idt_nl;
/*********************************************************/
@@ -394,51 +407,39 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node)
}
*os << be_uidt_nl << "};" << be_nl;
- os->gen_endif ();
+ os->gen_endif ();
// Generate the _init -related declarations.
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_VALUETYPE_INIT_CH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_valuetype_init_ch visitor (&ctx);
- if (!visitor)
+ if (visitor.visit_valuetype (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_ch::"
"visit_valuetype - "
- "NULL visitor.\n"
- ), -1);
+ "failed to generate _init construct.\n"),
+ -1);
}
- if (visitor->visit_valuetype(node) == -1)
+ // Step last: generate typecode declaration.
+ if (be_global->tc_support ())
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_ch::"
- "visit_valuetype - "
- "failed to generate _init construct.\n"
- ), -1);
- }
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL);
+ be_visitor_typecode_decl visitor (&ctx);
- delete visitor;
-
- // Step last: generate typecode declaration
- {
- 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_valuetype_ch::"
- "visit_structure - "
- "TypeCode declaration failed\n"
- ),
- -1);
- }
- }
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_ch::"
+ "visit_structure - "
+ "TypeCode declaration failed\n"),
+ -1);
+ }
+ }
node->cli_hdr_gen (I_TRUE);
@@ -450,7 +451,6 @@ int
be_visitor_valuetype_ch::visit_operation (be_operation *node)
{
TAO_OutStream *os = this->ctx_->stream ();
- be_type *bt;
this->ctx_->node (node); // save the node
@@ -458,7 +458,7 @@ be_visitor_valuetype_ch::visit_operation (be_operation *node)
*os << "virtual ";
// STEP I: Generate the return type.
- bt = be_type::narrow_from_decl (node->return_type ());
+ be_type *bt = be_type::narrow_from_decl (node->return_type ());
if (!bt)
{
@@ -472,20 +472,10 @@ be_visitor_valuetype_ch::visit_operation (be_operation *node)
// 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_valuetype_ch::"
- "visit_operation - "
- "Bad visitor to return type\n"),
- -1);
- }
+ be_visitor_operation_rettype or_visitor (&ctx);
- if (bt->accept (visitor) == -1)
+ if (bt->accept (&or_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_ch::"
"visit_operation - "
@@ -493,8 +483,6 @@ be_visitor_valuetype_ch::visit_operation (be_operation *node)
-1);
}
- delete visitor;
-
// STEP 2: Generate the operation name.
*os << " " << node->local_name ();
@@ -502,20 +490,10 @@ be_visitor_valuetype_ch::visit_operation (be_operation *node)
// we grab a visitor that generates the parameter listing.
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_CH);
- visitor = tao_cg->make_visitor (&ctx);
-
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_valuetype_ch::"
- "visit_operation - "
- "Bad visitor to argument list\n"),
- -1);
- }
+ be_visitor_obv_operation_arglist ooa_visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&ooa_visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_ch::"
"visit_operation - "
@@ -523,8 +501,6 @@ be_visitor_valuetype_ch::visit_operation (be_operation *node)
-1);
}
- delete visitor;
-
return 0;
}
@@ -538,38 +514,27 @@ be_visitor_valuetype_ch::visit_field (be_field *node)
return -1;
}
- be_visitor_context* ctx = new be_visitor_context (*this->ctx_);
- ctx->state (TAO_CodeGen::TAO_FIELD_OBV_CH);
- be_visitor_valuetype_field_ch *visitor =
- new be_visitor_valuetype_field_ch (ctx);
-
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_valuetype_obv_ch::"
- "visit_field - bad visitor\n"),
- -1);
- }
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_FIELD_OBV_CH);
+ be_visitor_valuetype_field_ch visitor (&ctx);
if (vt->opt_accessor ())
{
- visitor->setenclosings ("",";");
+ visitor.setenclosings ("",";");
}
else
{
- visitor->setenclosings ("virtual "," = 0;");
+ visitor.setenclosings ("virtual "," = 0;");
}
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_obv_ch::"
- "visit_field - codegen failed\n"),
+ "visit_field - codegen failed\n"),
-1);
}
- delete visitor;
return 0;
}
@@ -578,6 +543,7 @@ void
be_visitor_valuetype_ch::begin_public (void)
{
TAO_OutStream *os = this->ctx_->stream ();
+
*os << "public:" << be_idt_nl;
}
@@ -585,5 +551,59 @@ void
be_visitor_valuetype_ch::begin_private (void)
{
TAO_OutStream *os = this->ctx_->stream ();
+
*os << be_uidt_nl << "protected:" << be_idt_nl;
}
+
+int
+be_visitor_valuetype_ch::gen_supported_ops (be_interface *,
+ be_interface *base,
+ TAO_OutStream *os)
+{
+ // We inherit from abstract supported interfaces, so no need
+ // to declare their pure virtual operations again in our scope.
+ if (base->is_abstract ())
+ {
+ return 0;
+ }
+
+ AST_Decl *d = 0;
+ be_visitor_context ctx;
+ ctx.stream (os);
+
+ for (UTL_ScopeActiveIterator si (base, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ d = si.item ();
+
+ if (d == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_ch::"
+ "gen_supported_ops - "
+ "bad node in this scope\n"),
+ -1);
+ }
+
+ AST_Decl::NodeType nt = d->node_type ();
+ be_visitor_valuetype_ch visitor (&ctx);
+
+ if (nt == AST_Decl::NT_op)
+ {
+ be_operation *op = be_operation::narrow_from_decl (d);
+
+ if (visitor.visit_operation (op) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_ch::"
+ "gen_supported_ops - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+ }
+ }
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp
index 6fa624a44fe..0717c18d30c 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp
@@ -19,18 +19,14 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_valuetype.h"
-
-ACE_RCSID(be_visitor_valuetype, valuetype_ci, "$Id$")
-
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_ci,
+ "$Id$")
// **************************************************
-// Valuetype visitor for client inline
+// Valuetype visitor for client inline.
// **************************************************
+
be_visitor_valuetype_ci::be_visitor_valuetype_ci (be_visitor_context *ctx)
: be_visitor_valuetype (ctx),
opt_accessor_ (0)
@@ -44,71 +40,86 @@ be_visitor_valuetype_ci::~be_visitor_valuetype_ci (void)
int
be_visitor_valuetype_ci::visit_valuetype (be_valuetype *node)
{
- TAO_OutStream *os; // output stream
-
if (node->cli_inline_gen () || node->imported ())
- return 0;
+ {
+ return 0;
+ }
- //@@ What is that?
- // need to access it in visit_field ()
if (node->opt_accessor ())
- this->opt_accessor_ = 1;
+ {
+ this->opt_accessor_ = 1;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
- os = this->ctx_->stream ();
+ os->indent ();
- os->indent (); // start from the current indentation level
+ *os << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
- // generate the constructors and destructor
*os << "ACE_INLINE" << be_nl;
- *os << node->name () << "::" << node->local_name () <<
- " () // default constructor" << be_nl;
- *os << "{}" << be_nl << be_nl;
+ *os << node->name () << "::" << node->local_name () << " (void)" << be_nl;
+
+ if (node->supports_abstract ())
+ {
+ *os << "{" << be_idt;
+
+ int status =
+ node->traverse_supports_list_graphs (
+ be_valuetype::gen_abstract_init_helper,
+ os,
+ I_TRUE
+ );
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_ci::"
+ "visit_valuetype - "
+ "traversal of supported interfaces failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl << "}" << be_nl << be_nl;
+ }
+ else
+ {
+ *os << "{}" << be_nl << be_nl;
+ }
*os << "ACE_INLINE" << be_nl;
- *os << node->name () << "::~" << node->local_name () <<
- " () // destructor" << be_nl;
+ *os << node->name () << "::~" << node->local_name () << " (void)" << be_nl;
*os << "{}\n" << be_nl;
*os << "ACE_INLINE const char* " << be_nl
- << node->name() << "::_tao_obv_static_repository_id ()" << be_nl
+ << node->name () << "::_tao_obv_static_repository_id ()" << be_nl
<< "{" << be_idt_nl
<< "return \"" << node->repoID () << "\";" << be_uidt_nl
<< "}\n\n";
- // generate inline methods for elements of our scope
if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_ci::"
"visit_valuetype - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
- // Generate the _init -related code.
+ // Generate the _init-related code.
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_VALUETYPE_INIT_CI);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ be_visitor_valuetype_init_ci visitor (&ctx);
- if (!visitor)
+ if (visitor.visit_valuetype (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_ci::"
"visit_valuetype - "
- "NULL visitor.\n"
- ), -1);
+ "failed to generate _init construct.\n"),
+ -1);
}
- if (visitor->visit_valuetype(node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_ci::"
- "visit_valuetype - "
- "failed to generate _init construct.\n"
- ), -1);
- }
-
- delete visitor;
-
return 0;
}
@@ -118,22 +129,19 @@ be_visitor_valuetype_ci::visit_field (be_field *node)
{
if (opt_accessor_)
{
- be_visitor_context *ctx = new be_visitor_context (*this->ctx_);
- be_visitor_valuetype_field_cs *visitor =
- new be_visitor_valuetype_field_cs (ctx);
- visitor->in_obv_space_ = 0;
- visitor->setenclosings ("ACE_INLINE ");
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_valuetype_field_cs visitor (&ctx);
+ visitor.in_obv_space_ = 0;
+ visitor.setenclosings ("ACE_INLINE ");
- if (visitor->visit_field (node) == -1)
+ if (visitor.visit_field (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_ci::"
"visit_field - "
- "visit_field failed\n"
- ), -1);
+ "visit_field failed\n"),
+ -1);
}
-
- delete visitor;
}
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp
index fa658ecdffb..529fd388412 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp
@@ -19,17 +19,12 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_valuetype.h"
-
-ACE_RCSID(be_visitor_valuetype, valuetype_cs, "$Id$")
-
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_cs,
+ "$Id$")
// ************************************************************
-// Valuetype visitor for client stubs
+// Valuetype visitor for client stubs.
// ************************************************************
be_visitor_valuetype_cs::be_visitor_valuetype_cs (be_visitor_context *ctx)
@@ -44,43 +39,61 @@ be_visitor_valuetype_cs::~be_visitor_valuetype_cs (void)
int
be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node)
{
- TAO_OutStream *os; // output stream
-
if (node->cli_stub_gen () || node->imported ())
{
return 0;
}
- // 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);
- ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_cs::"
- "visit_valuetype - "
- "TypeCode definition failed\n"
- ), -1);
- }
- }
+ if (be_global->tc_support ())
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN);
+ ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
+ be_visitor_typecode_defn tc_visitor (&ctx);
+
+ if (node->accept (&tc_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_cs::"
+ "visit_valuetype - "
+ "TypeCode definition failed\n"),
+ -1);
+ }
+ }
- os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream ();
- os->indent (); // start with whatever indentation level we are at
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Global functions to allow non-defined forward declared interfaces
+ // access to some methods in the full definition.
+ *os << "void" << be_nl
+ << "tao_" << node->flat_name ()
+ << "_add_ref (" << be_idt << be_idt_nl
+ << node->full_name () << " *p" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "CORBA::add_ref (p);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "void" << be_nl
+ << "tao_" << node->flat_name ()
+ << "_remove_ref (" << be_idt << be_idt_nl
+ << node->full_name () << " *p" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "CORBA::remove_ref (p);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
- // Generate methods for _var class
+ // Generate methods for _var class.
if (node->gen_var_impl () == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_cs::"
"visit_valuetype - "
- "codegen for _var failed\n"), -1);
+ "codegen for _var failed\n"),
+ -1);
}
// Generate methods for _out class
@@ -89,91 +102,151 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_cs::"
"visit_valuetype - "
- "codegen for _out failed\n"), -1);
+ "codegen for _out failed\n"),
+ -1);
}
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
// The _downcast method // %! use ACE_xxx_cast here ?
- *os << node->name() << "* " << node->name()
- << "::_downcast (CORBA::ValueBase* v)" << be_nl
- << "{" << be_idt_nl
- << "if (v == 0) return 0;" << be_nl
- << "return (" << node->local_name() << "* ) "
- << "v->_tao_obv_narrow ((ptr_arith_t) &_downcast);" << be_uidt_nl
- << "}\n" << be_nl
+ *os << node->name () << " *" << be_nl << node->name ()
+ << "::_downcast (CORBA::ValueBase *v)" << be_nl
+ << "{" << be_idt_nl
+ << "if (v == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "return (" << node->local_name () << " *) "
+ << "v->_tao_obv_narrow ((ptr_arith_t) &_downcast);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
// The _tao_obv_repository_id method
- << "const char* " << node->name()
- << "::_tao_obv_repository_id () const" << be_nl
- << "{" << be_idt_nl
- << "return this->_tao_obv_static_repository_id ();" << be_uidt_nl
- << "}\n" << be_nl
+ *os << "const char *" << be_nl
+ << node->name () << "::_tao_obv_repository_id (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "return this->_tao_obv_static_repository_id ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
// The _tao_obv_narrow method
- << "void* " << node->name()
+ *os << "void *" << be_nl << node->name ()
<< "::_tao_obv_narrow (ptr_arith_t type_id)" << be_nl
- << "{" << be_idt_nl
- << "if (type_id == (ptr_arith_t) &_downcast)" << be_idt_nl
- << "return this;" << be_uidt_nl
- << "void *rval = 0;" << be_nl;
+ << "{" << be_idt_nl
+ << "if (type_id == (ptr_arith_t) &_downcast)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return this;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "void *rval = 0;" << be_nl;
// Find the possible base classes.
int n_inherits_downcastable = 0;
+ AST_Interface *inherited = 0;
- for (int i = 0; i < node->n_inherits (); i++)
+ for (int i = 0; i < node->n_inherits (); ++i)
{
- AST_Interface *inherited =
- AST_Interface::narrow_from_decl (node->inherits ()[i]);
+ inherited = node->inherits ()[i];
+
+ ++n_inherits_downcastable;
- if (inherited->is_valuetype())
+ *os << be_nl
+ << "if (rval == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "rval = ";
+
+ AST_Decl::NodeType nt =
+ inherited->defined_in ()->scope_node_type ();
+
+ if (nt == AST_Decl::NT_module)
{
- ++n_inherits_downcastable;
- *os << "if (rval == 0)" << be_idt_nl
- << "rval = ";
+ be_scope *scope =
+ be_scope::narrow_from_scope (inherited->defined_in ());
+ be_decl *scope_decl = scope->decl ();
- if (inherited->defined_in ()->scope_node_type () == AST_Decl::NT_module)
- {
- be_decl *scope = be_scope::narrow_from_scope (inherited->defined_in ())->decl ();
- *os << "ACE_NESTED_CLASS ("
- << scope->name() << ","
- << inherited->local_name () << ")";
- }
- else
+ *os << "ACE_NESTED_CLASS ("
+ << scope_decl->name () << ","
+ << inherited->local_name () << ")";
+ }
+ else
+ {
+ *os << inherited->name ();
+ }
+
+ *os << "::_tao_obv_narrow (type_id);" << be_uidt_nl
+ << "}" << be_uidt_nl;
+ }
+
+ if (node->supports_abstract ())
+ {
+ long size = node->n_supports ();
+ AST_Interface *supported = 0;
+
+ for (long i = 0; i < size; ++i)
+ {
+ supported = node->supports ()[i];
+
+ if (supported->is_abstract ())
{
- *os << inherited->name ();
+ *os << be_nl
+ << "if (rval == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "rval = ";
+
+ AST_Decl::NodeType supported_nt =
+ supported->defined_in ()->scope_node_type ();
+
+ if (supported_nt == AST_Decl::NT_module)
+ {
+ be_scope *supported_scope =
+ be_scope::narrow_from_scope (supported->defined_in ());
+ be_decl *supported_scope_decl = supported_scope->decl ();
+
+ *os << "ACE_NESTED_CLASS ("
+ << supported_scope_decl->name () << ","
+ << supported->local_name () << ")";
+ }
+ else
+ {
+ *os << supported->name ();
+ }
+
+ *os << "::_tao_obv_narrow (type_id);" << be_uidt_nl
+ << "}" << be_uidt_nl;
}
-
- *os << "::_tao_obv_narrow (type_id);" << be_uidt_nl;
}
}
- *os << "return rval;" << be_uidt_nl
- << "}\n\n";
+ *os << be_nl << "return rval;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
- // Ugly TAO any support routine
*os << "void" << be_nl
<< node->name ()
<< "::_tao_any_destructor (void *_tao_void_pointer)" << be_nl
<< "{" << be_idt_nl
- << node->local_name () << " *tmp = ACE_static_cast ("
- << node->local_name () << "*, _tao_void_pointer);" << be_nl
+ << node->local_name () << " *tmp =" << be_idt_nl
+ << "ACE_static_cast (" << be_idt << be_idt_nl
+ << node->local_name () << " *," << be_nl
+ << "_tao_void_pointer" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
<< "delete tmp;" << be_uidt_nl
<< "}" << be_nl << be_nl;
// Nothing to marshal if abstract valuetype.
- if (!node->is_abstract_valuetype ())
+ if (!node->is_abstract ())
{
- // The virtual _tao_marshal_v method
+ // The virtual _tao_marshal_v method.
*os << "CORBA::Boolean " << node->name ()
- << "::_tao_marshal_v (TAO_OutputCDR & strm)"
+ << "::_tao_marshal_v (TAO_OutputCDR & strm)"
<< be_nl
- << "{" << be_idt_nl
- << "return ";
+ << "{" << be_idt_nl
+ << "return ";
+
if (node->opt_accessor ())
{
- be_decl *scope = be_scope::narrow_from_scope (node->defined_in ())->decl ();
+ be_decl *scope =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
+
*os << "ACE_NESTED_CLASS ("
<< scope->name () << ","
<< node->local_name () << ")"
@@ -187,15 +260,18 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node)
*os << "}\n" << be_nl;
- // The virtual _tao_unmarshal_v method
+ // The virtual _tao_unmarshal_v method.
*os << "CORBA::Boolean " << node->name ()
- << "::_tao_unmarshal_v (TAO_InputCDR & strm)"
+ << "::_tao_unmarshal_v (TAO_InputCDR & strm)"
<< be_nl
- << "{" << be_idt_nl
- << "return ";
+ << "{" << be_idt_nl
+ << "return ";
+
if (node->opt_accessor ())
{
- be_decl *scope = be_scope::narrow_from_scope (node->defined_in ())->decl ();
+ be_decl *scope =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
+
*os << "ACE_NESTED_CLASS ("
<< scope->name () << ","
<< node->local_name () << ")"
@@ -210,89 +286,78 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node)
*os << "}\n" << be_nl;
}
- // The static T::_tao_unmarshal method ----------------------------
+ // The static T::_tao_unmarshal method
*os << "CORBA::Boolean " << node->name()
- << "::_tao_unmarshal (TAO_InputCDR &strm, "
- << node->local_name () <<" *&new_object)" << be_nl
- << "{" << be_idt_nl
- << "CORBA::Boolean retval = 1;" << be_nl
- << "CORBA::ValueBase *base; // %! should be a _var"
- << be_nl
- << "CORBA::ValueFactory_ptr factory; // %! should be a _var"
- << be_nl
-
- << "if (!CORBA::ValueBase::_tao_unmarshal_pre (strm, factory, base," << be_idt_nl
- << " " << node->local_name ()
- << "::_tao_obv_static_repository_id ()) )" << be_nl
- << "{" << be_idt_nl
- << "return 0;" << be_uidt_nl
- << "}" << be_uidt_nl
- << "if (factory != 0)" << be_idt_nl
- << "{" << be_idt_nl
-
- << "base = factory->create_for_unmarshal ();" << be_nl
- << "factory->_remove_ref ();" << be_nl
- << "if (base == 0) return 0; // %! except.?" << be_nl
- << "//%! ACE_DEBUG ((LM_DEBUG, \"" << node->name()
- << "::_tao_unmarshal %s\\n\", "
- << "base->_tao_obv_repository_id () ));" << be_nl
- << "retval = base->_tao_unmarshal_v (strm);" << be_nl
- << "//%! ACE_DEBUG ((LM_DEBUG, \"" << node->name()
- << "::_tao_unmarshal retval unmarshal_v is %d\\n\", "
- << "retval));" << be_nl
- << "if (!retval) return 0;"
-
- << be_uidt_nl << "}" << be_uidt_nl
- << "// Now base must be null or point to the unmarshaled object."
- << be_nl
- << "// Align the pointer to the right subobject." << be_nl
- << "new_object = " << node->local_name () << "::_downcast (base);" << be_nl
- << "// %! unmarshal_post" << be_nl
- << "return 1;" << be_uidt_nl
- << "}\n" << be_nl;
-
- // The static T::_tao_unmarshal method ------------------------ end
-
- // generate code for the elements of the valuetype
+ << "::_tao_unmarshal (" << be_idt << be_idt_nl
+ << "TAO_InputCDR &strm," << be_nl
+ << node->local_name () << " *&new_object" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "CORBA::ValueBase *base = 0;" << be_nl
+ << "CORBA::ValueFactory_var factory;" << be_nl
+ << "CORBA::Boolean retval =" << be_idt_nl
+ << "CORBA::ValueBase::_tao_unmarshal_pre (" << be_idt << be_idt_nl
+ << "strm," << be_nl
+ << "factory," << be_nl
+ << "base," << be_nl
+ << node->local_name () << "::_tao_obv_static_repository_id ()" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl << be_nl
+ << "if (retval == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "if (factory.in () != 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "base = factory->create_for_unmarshal ();" << be_nl << be_nl
+ << "if (base == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return 0; // %! except.?" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "retval = base->_tao_unmarshal_v (strm);" << be_nl << be_nl
+ << "if (retval == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "// Now base must be null or point to the unmarshaled object." << be_nl
+ << "// Align the pointer to the right subobject." << be_nl
+ << "new_object = " << node->local_name () << "::_downcast (base);" << be_nl
+ << "return retval;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ if (node->supports_abstract ())
+ {
+ *os << "CORBA::ValueBase *" << be_nl
+ << node->name () << "::_tao_to_value (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return this;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
+
+ // Generate code for the elements of the valuetype.
if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_cs::"
"visit_valuetype - "
- "codegen for scope failed\n"), -1);
+ "codegen for scope failed\n"),
+ -1);
}
- // Generate the _init -related code.
+ // Generate the _init-related code.
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_VALUETYPE_INIT_CS);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
-
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_ch::"
- "visit_valuetype - "
- "NULL visitor.\n"
- ), -1);
- }
+ be_visitor_valuetype_init_cs vi_visitor (&ctx);
- if (visitor->visit_valuetype(node) == -1)
+ if (vi_visitor.visit_valuetype (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_ch::"
"visit_valuetype - "
- "failed to generate _init construct.\n"
- ), -1);
+ "failed to generate _init construct.\n"),
+ -1);
}
- delete visitor;
-
-
- // 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
- // (see interface code how to do this. not yet impl.)
-
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init.cpp
index 780004ba2d8..84a56777620 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init.cpp
@@ -20,13 +20,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_valuetype.h"
-
-ACE_RCSID(be_visitor_valuetype, valuetype_init, "$Id$")
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_init,
+ "$Id$")
be_visitor_valuetype_init::be_visitor_valuetype_init (
be_visitor_context *ctx
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp
index 5b621ca3272..ee8ef8cbdcb 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp
@@ -19,23 +19,20 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+ACE_RCSID (be_visitor_valuetype_init,
+ arglist_ch,
+ "$Id$")
-#include "be_visitor_valuetype.h"
-
-ACE_RCSID(be_visitor_valuetype_init, arglist_ch, "$Id$")
-
-
-be_visitor_valuetype_init_arglist_ch::
-be_visitor_valuetype_init_arglist_ch (be_visitor_context *ctx)
+be_visitor_valuetype_init_arglist_ch::be_visitor_valuetype_init_arglist_ch (
+ be_visitor_context *ctx
+ )
: be_visitor_scope (ctx)
{
}
-be_visitor_valuetype_init_arglist_ch::
-~be_visitor_valuetype_init_arglist_ch (void)
+be_visitor_valuetype_init_arglist_ch::~be_visitor_valuetype_init_arglist_ch (
+ void
+ )
{
}
@@ -43,10 +40,11 @@ int
be_visitor_valuetype_init_arglist_ch::visit_factory (be_factory *node)
{
TAO_OutStream& os = *(this->ctx_->stream ());
- os << " (" << be_idt // idt = 1
- << be_idt_nl; // idt = 2
- // all we do is hand over code generation to our scope
+ os << " (" << be_idt
+ << be_idt_nl;
+
+ // All we do is hand over code generation to our scope.
if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -56,8 +54,8 @@ be_visitor_valuetype_init_arglist_ch::visit_factory (be_factory *node)
-1);
}
- os << be_uidt_nl // idt = 1
- << ")" << be_uidt; // idt = 0
+ os << be_uidt_nl
+ << ")" << be_uidt;
return 0;
}
@@ -65,15 +63,20 @@ be_visitor_valuetype_init_arglist_ch::visit_factory (be_factory *node)
int
be_visitor_valuetype_init_arglist_ch::visit_argument (be_argument *node)
{
- // get the visitor that will dump the argument's mapping in the operation
+ // Get the visitor that will dump the argument's mapping in the operation
// signature.
be_visitor_context ctx (*this->ctx_);
+ int status = 0;
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_VALUETYPE_INIT_ARGLIST_CH:
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_ARGLIST_CH);
- break;
+ {
+ ctx.state (TAO_CodeGen::TAO_ARGUMENT_ARGLIST_CH);
+ be_visitor_args_arglist visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -84,20 +87,8 @@ be_visitor_valuetype_init_arglist_ch::visit_argument (be_argument *node)
}
}
- // grab a visitor
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_init_arglist_ch::"
- "visit_argument - "
- "Bad visitor\n"),
- -1);
- }
-
- if (node->accept (visitor) == -1)
+ if (status == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_init_arglist_ch::"
"visit_argument - "
@@ -105,7 +96,6 @@ be_visitor_valuetype_init_arglist_ch::visit_argument (be_argument *node)
-1);
}
- delete visitor;
return 0;
}
@@ -114,7 +104,7 @@ be_visitor_valuetype_init_arglist_ch::post_process (be_decl *bd)
{
TAO_OutStream *os = this->ctx_->stream ();
- // if we are not the last node in the list of arguments, generate a comma.
+ // If we are not the last node in the list of arguments, generate a comma.
if (!this->last_node (bd))
{
*os << "," << be_nl;
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp
index ffa84c7497c..cb507e4ca8b 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp
@@ -20,13 +20,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_valuetype.h"
-
-ACE_RCSID(be_visitor_valuetype, valuetype_init_ch, "$Id$")
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_init_ch,
+ "$Id$")
be_visitor_valuetype_init_ch::be_visitor_valuetype_init_ch (
be_visitor_context *ctx
@@ -42,11 +38,10 @@ be_visitor_valuetype_init_ch::~be_visitor_valuetype_init_ch (void)
int
be_visitor_valuetype_init_ch::visit_valuetype (be_valuetype *node)
{
-
- if (node->is_abstract_valuetype ())
- {
- return 0;
- }
+ if (node->is_abstract ())
+ {
+ return 0;
+ }
// There are three possible situations.
// (1) If there is no initializers but at least one operation.
@@ -61,9 +56,10 @@ be_visitor_valuetype_init_ch::visit_valuetype (be_valuetype *node)
FactoryStyle factory_style = determine_factory_style (node);
- if(factory_style == FS_NO_FACTORY) // nothing to do
+ if (factory_style == FS_NO_FACTORY)
{
- return 0; // bail out
+ // Nothing to do.
+ return 0;
}
TAO_OutStream& os = *(this->ctx_->stream ());
@@ -72,27 +68,24 @@ be_visitor_valuetype_init_ch::visit_valuetype (be_valuetype *node)
os.gen_ifdef_macro (node->flat_name (), "_init");
- //@@ If I'm generating concrete class I need a RefCounter
+ //@@ If I'm generating concrete class I need a RefCounter.
os << "class " << be_global->stub_export_macro ()
<< " " << node->local_name ()
<< "_init : public virtual CORBA_ValueFactoryBase" << be_nl;
- // generate the body
+ // Generate the body.
os << "{" << be_nl
<< "public:" << be_idt_nl;
- if(factory_style == FS_CONCRETE_FACTORY)
+ if (factory_style == FS_CONCRETE_FACTORY)
{
- // public ctor
- os << node->local_name () << "_init ();" << be_nl;
+ // Public constructor.
+ os << node->local_name () << "_init (void);" << be_nl;
}
- // virtual public dtor
- os << "virtual ~" << node->local_name () << "_init ();" << be_nl;
-
+ // Virtual destructor.
+ os << "virtual ~" << node->local_name () << "_init (void);";
- // custom methods
- os << be_nl;
if (this->visit_valuetype_scope (node) == -1)
{
@@ -103,42 +96,44 @@ be_visitor_valuetype_init_ch::visit_valuetype (be_valuetype *node)
-1);
}
- os << be_nl;
+ // Generate _downcast method.
+ os << be_nl << be_nl
+ << "static " << node->local_name () << "_init* "
+ << "_downcast (CORBA_ValueFactoryBase* );";
- // generate _downcast method
- os << "static " << node->local_name () << "_init* "
- << "_downcast (CORBA_ValueFactoryBase* );" << be_nl;
-
- if(factory_style == FS_CONCRETE_FACTORY)
+ if (factory_style == FS_CONCRETE_FACTORY)
{
//@@ Boris: create_for_unmarshal is still public...
// generate create_for_unmarshal
- os << be_nl
- << "virtual CORBA_ValueBase* "
- << "create_for_unmarshal" << " "
- << "(void);" << be_nl;
+ os << be_nl << be_nl
+ << "virtual CORBA::ValueBase *"
+ << "create_for_unmarshal (void);";
+
+ if (node->supports_abstract ())
+ {
+ os << be_nl << be_nl
+ << "virtual CORBA::AbstractBase_ptr "
+ << "create_for_unmarshal_abstract (void);";
+ }
}
- os << be_nl;
+ os << be_nl << be_nl;
- // propriate extensions
+ // Proprietary extensions.
os << "// TAO-specific extensions"
<< be_uidt_nl
<< "public:" << be_idt_nl;
+ os << "virtual const char* tao_repository_id (void);";
- os << "virtual const char* tao_repository_id (void);\n";
-
- if(factory_style == FS_ABSTRACT_FACTORY)
+ if (factory_style == FS_ABSTRACT_FACTORY)
{
- // protected ctor
- os << be_uidt_nl
+ // Protected constructor.
+ os << be_uidt_nl << be_nl
<< "protected:" << be_idt_nl;
-
os << node->local_name () << "_init ();";
-
}
- os << be_uidt_nl << "};" << be_nl;
+ os << be_uidt_nl << "};" << be_nl << be_nl;
// Generate the endif macro.
os.gen_endif ();
@@ -166,20 +161,10 @@ be_visitor_valuetype_init_ch::visit_factory (be_factory *node)
// we grab a visitor that generates the parameter listing.
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_VALUETYPE_INIT_ARGLIST_CH);
- be_visitor* visitor = tao_cg->make_visitor (&ctx);
-
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_valuetype_init_ch::"
- "visit_factory - "
- "Bad visitor to argument list\n"),
- -1);
- }
+ be_visitor_valuetype_init_arglist_ch visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_init_arglist__ch::"
"visit_operation - "
@@ -187,9 +172,7 @@ be_visitor_valuetype_init_ch::visit_factory (be_factory *node)
-1);
}
- delete visitor;
-
- // make pure virtual
+ // Make pure virtual.
os << " = 0;" << be_nl;
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ci.cpp
index 87ef979a821..670597cad6c 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ci.cpp
@@ -20,13 +20,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_valuetype.h"
-
-ACE_RCSID(be_visitor_valuetype, valuetype_init_ci, "$Id$")
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_init_ci,
+ "$Id$")
be_visitor_valuetype_init_ci::be_visitor_valuetype_init_ci (
be_visitor_context *ctx
@@ -40,7 +36,7 @@ be_visitor_valuetype_init_ci::~be_visitor_valuetype_init_ci (void)
}
int
-be_visitor_valuetype_init_ci::visit_valuetype (be_valuetype *)
+be_visitor_valuetype_init_ci::visit_valuetype (be_valuetype *node)
{
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_cs.cpp
index 5c4d7caf51c..bda1a103b02 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_cs.cpp
@@ -20,14 +20,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_valuetype.h"
-
-ACE_RCSID(be_visitor_valuetype, valuetype_init_cs, "$Id$")
-
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_init_cs,
+ "$Id$")
be_visitor_valuetype_init_cs::be_visitor_valuetype_init_cs (
be_visitor_context *ctx
@@ -43,7 +38,7 @@ be_visitor_valuetype_init_cs::~be_visitor_valuetype_init_cs (void)
int
be_visitor_valuetype_init_cs::visit_valuetype (be_valuetype *node)
{
- if (node->is_abstract_valuetype ())
+ if (node->is_abstract ())
{
return 0;
}
@@ -61,34 +56,40 @@ be_visitor_valuetype_init_cs::visit_valuetype (be_valuetype *node)
FactoryStyle factory_style = determine_factory_style (node);
- if(factory_style == FS_NO_FACTORY) // nothing to do
+ if (factory_style == FS_NO_FACTORY)
{
- return 0; // bail out
+ return 0;
}
-
- TAO_OutStream *os; // output stream
-
- os = this->ctx_->stream ();
-
- os->indent (); // start with whatever indentation level we are at
+ TAO_OutStream *os = this->ctx_->stream ();
char fname [NAMEBUFSIZE]; // to hold the full and
char lname [NAMEBUFSIZE]; // local _out names
- ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (fname, "%s_init", node->full_name ());
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
+ ACE_OS::sprintf (fname,
+ "%s_init",
+ node->full_name ());
- ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (lname, "%s_init", node->local_name ());
+ ACE_OS::memset (lname,
+ '\0',
+ NAMEBUFSIZE);
+ ACE_OS::sprintf (lname,
+ "%s_init",
+ node->local_name ());
+
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
// ctor
- *os << fname << "::" << lname << " ()" << be_nl
+ *os << fname << "::" << lname << " (void)" << be_nl
<< "{" << be_nl << "}\n";
// dtor
*os << be_nl
- << fname << "::~" << lname << " ()" << be_nl
+ << fname << "::~" << lname << " (void)" << be_nl
<< "{" << be_nl << "}\n";
//tao_repository_id
@@ -98,25 +99,45 @@ be_visitor_valuetype_init_cs::visit_valuetype (be_valuetype *node)
<< "{" << be_idt_nl
<< "return " << node->full_name ()
<< "::_tao_obv_static_repository_id ();"
- << be_uidt_nl << "}\n";
+ << be_uidt_nl << "}";
- if(factory_style == FS_CONCRETE_FACTORY)
+ if (factory_style == FS_CONCRETE_FACTORY)
{
// generate create_for_unmarshal()
- *os << be_nl
- << "CORBA_ValueBase* " << be_nl
+ *os << be_nl << be_nl
+ << "CORBA_ValueBase *" << be_nl
<< fname << "::create_for_unmarshal" << " "
<< "(void)" << be_nl
<< "{" << be_idt_nl
- << "CORBA_ValueBase* ret_val = 0;" << be_nl
- << "ACE_NEW_RETURN(ret_val, " << be_nl
- << " OBV_" << node->full_name () << ", " << be_nl
- << " 0);" << be_nl
+ << "CORBA_ValueBase *ret_val = 0;" << be_nl
+ << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
+ << "ret_val," << be_nl
+ << "OBV_" << node->full_name () << "," << be_nl
+ << "0" << be_uidt_nl
+ << ");" << be_uidt_nl
<< "return ret_val;"
- << be_uidt_nl << "}\n";
+ << be_uidt_nl << "}";
+
+ if (node->supports_abstract ())
+ {
+ *os << be_nl << be_nl
+ << "CORBA::AbstractBase_ptr" << be_nl
+ << fname << "::create_for_unmarshal_abstract (void)" << be_nl
+ << "{" << be_idt_nl
+ << "CORBA_AbstractBase *ret_val = 0;" << be_nl
+ << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
+ << "ret_val," << be_nl
+ << "OBV_" << node->full_name () << "," << be_nl
+ << "0" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << "return ret_val;"
+ << be_uidt_nl << "}";
+ }
}
+ *os << be_nl << be_nl;
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp
index 7ea87ebec20..45e70d1190b 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp
@@ -22,14 +22,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_valuetype.h"
-
-ACE_RCSID(be_visitor_valuetype_obv_ch, valuetype_obv_ch, "$Id$")
-
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_obv_ch,
+ "$Id$")
// ******************************************************
// Valuetype visitor for client header
@@ -50,7 +45,7 @@ int
be_visitor_valuetype_obv_ch::visit_valuetype (be_valuetype *node)
{
// Only visit non-abstract non-imported valuetype.
- if (node->is_abstract_valuetype () || node->imported ())
+ if (node->is_abstract () || node->imported ())
{
return 0;
}
@@ -104,14 +99,14 @@ be_visitor_valuetype_obv_ch::visit_valuetype (be_valuetype *node)
//
int i = 0;
+ AST_Interface *inherited = 0;
+
for (; i < node->n_inherits (); ++i)
{
- AST_Interface *inherited =
- AST_Interface::narrow_from_decl(node->inherits ()[i]);
+ inherited = node->inherits ()[i];
- // we need only concrete valuetypes
- if (!inherited->is_valuetype ()
- || inherited->is_abstract ())
+ // We need only concrete valuetypes.
+ if (inherited->is_abstract ())
{
continue;
}
@@ -151,10 +146,18 @@ be_visitor_valuetype_obv_ch::visit_valuetype (be_valuetype *node)
-1);
}
+ // If we inherit from both CORBA::ValueBase and CORBA::AbstractBase,
+ // we have to add this to avoid ambiguity.
+ if (node->supports_abstract ())
+ {
+ *os << "virtual void _add_ref (void);" << be_nl;
+ *os << "virtual void _remove_ref (void);";
+ }
+
// Map fields to private data.
if (!node->opt_accessor ())
{
- *os << be_uidt_nl << "protected:" << be_idt_nl;
+ *os << be_nl << be_uidt_nl << "protected:" << be_idt_nl;
*os << "virtual CORBA::Boolean _tao_marshal__"
<< node->flat_name () << " (TAO_OutputCDR &);" << be_nl;
*os << "virtual CORBA::Boolean _tao_unmarshal__"
@@ -164,7 +167,7 @@ be_visitor_valuetype_obv_ch::visit_valuetype (be_valuetype *node)
<< "CORBA::Boolean "
<< "_tao_unmarshal_state (TAO_InputCDR &);"
<< be_uidt_nl << be_nl;
- *os << "private:" << be_idt_nl;
+ *os << "private:" << be_idt;
this->gen_pd (node);
}
@@ -192,31 +195,19 @@ be_visitor_valuetype_obv_ch::visit_field (be_field *node)
// Only in OBV_ class, if we are not optimizing accessors (and modifiers).
if (!vt->opt_accessor ())
{
- be_visitor_context* ctx = new be_visitor_context (*this->ctx_);
- ctx->state (TAO_CodeGen::TAO_FIELD_OBV_CH);
- be_visitor_valuetype_field_ch *visitor =
- new be_visitor_valuetype_field_ch (ctx);
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_FIELD_OBV_CH);
+ be_visitor_valuetype_field_ch visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_valuetype_obv_ch::"
- "visit_field - bad visitor\n"),
- -1);
- }
-
- visitor->setenclosings ("virtual ",";");
+ visitor.setenclosings ("virtual ",";");
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_obv_ch::"
"visit_field - codegen failed\n"),
-1);
}
-
- delete visitor;
}
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ci.cpp
index c2bdf1529a5..40067e536c2 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ci.cpp
@@ -22,14 +22,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_valuetype.h"
-
-ACE_RCSID(be_visitor_valuetype_obv_ci, valuetype_obv_ci, "$Id$")
-
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_obv_ci,
+ "$Id$")
// ******************************************************
// Valuetype visitor for OBV_ class implementation
@@ -50,8 +45,10 @@ int
be_visitor_valuetype_obv_ci::visit_valuetype (be_valuetype *node)
{
// only visit non-abstract valuetype
- if (node->is_abstract_valuetype ())
- return 0;
+ if (node->is_abstract ())
+ {
+ return 0;
+ }
TAO_OutStream *os; // output stream
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp
index e3fc33230fb..f4d115dfd23 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp
@@ -22,14 +22,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_valuetype.h"
-
-ACE_RCSID(be_visitor_valuetype_obv_cs, valuetype_obv_cs, "$Id$")
-
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_obv_cs,
+ "$Id$")
// ******************************************************
// Valuetype visitor for OBV_ class implementation
@@ -50,41 +45,67 @@ int
be_visitor_valuetype_obv_cs::visit_valuetype (be_valuetype *node)
{
// only visit non-abstract non-imported valuetype
- if (node->is_abstract_valuetype () || node->imported ())
- return 0;
+ if (node->is_abstract () || node->imported ())
+ {
+ return 0;
+ }
TAO_OutStream *os = this->ctx_->stream ();
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// OBV_ class has no accessors or modifiers if we are optimizing
// or the valuetype is abstract.
- if (!(node->opt_accessor () || node->is_abstract_valuetype () ))
+ if (!node->opt_accessor ())
{
- os->indent ();
- *os << "CORBA::Boolean " << be_nl
+ *os << "CORBA::Boolean" << be_nl
<< node->full_obv_skel_name ()
<< "::_tao_marshal__" << node->flat_name ()
- << " (TAO_OutputCDR &strm)"
+ << " (TAO_OutputCDR &strm)" << be_nl
<< "{" << be_idt_nl
- << "return _tao_marshal_state (strm);" << be_nl
- << be_uidt_nl << "}\n";
+ << "return _tao_marshal_state (strm);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
- *os << "CORBA::Boolean "
+ *os << "CORBA::Boolean" << be_nl
<< node->full_obv_skel_name ()
<< "::_tao_unmarshal__" << node->flat_name ()
- << " (TAO_InputCDR &strm)"
+ << " (TAO_InputCDR &strm)" << be_nl
<< "{" << be_idt_nl
- << "return _tao_unmarshal_state (strm);" << be_nl
- << be_uidt_nl << "}\n";
+ << "return _tao_unmarshal_state (strm);" << be_uidt_nl
+ << "}" << be_nl;
if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_obv_cs::"
"visit_valuetype - "
- "visit_scope failed\n"
- ), -1);
+ "visit_scope failed\n"),
+ -1);
}
- }
+
+ // If we inherit from both CORBA::ValueBase and CORBA::AbstractBase,
+ // we have to add this to avoid ambiguity.
+ if (node->supports_abstract ())
+ {
+ *os << be_nl << "void" << be_nl
+ << node->full_obv_skel_name ()
+ << "::_add_ref (void)" << be_nl
+ << "{" << be_idt_nl
+ << "this->CORBA_DefaultValueRefCountBase::_add_ref ();"
+ << be_uidt_nl
+ << "}" << be_nl;
+
+ *os << be_nl << "void" << be_nl
+ << node->full_obv_skel_name ()
+ << "::_remove_ref (void)" << be_nl
+ << "{" << be_idt_nl
+ << "this->CORBA_DefaultValueRefCountBase::_remove_ref ();"
+ << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
+ }
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_sh.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_sh.cpp
new file mode 100644
index 00000000000..54d3bdb0bd5
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_sh.cpp
@@ -0,0 +1,135 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_sh.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for value types in the server header
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_sh,
+ "$Id$")
+
+
+// ************************************************************
+// Valuetype visitor for server header.
+// ************************************************************
+
+be_visitor_valuetype_sh::be_visitor_valuetype_sh (be_visitor_context *ctx)
+ : be_visitor_valuetype (ctx)
+{
+}
+
+be_visitor_valuetype_sh::~be_visitor_valuetype_sh (void)
+{
+}
+
+int
+be_visitor_valuetype_sh::visit_valuetype (be_valuetype *node)
+{
+ if (node->srv_hdr_gen () || node->imported () || node->is_abstract ())
+ {
+ return 0;
+ }
+
+ AST_Interface *concrete = node->supports_concrete ();
+
+ // We generate a skeleton class only if the valuetype supports a
+ // non-abstract interface.
+ if (concrete == 0)
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ os->indent ();
+ ACE_CString class_name;
+
+ // We shall have a POA_ prefix only if we are at the topmost level.
+ if (!node->is_nested ())
+ {
+ // We are outermost.
+ class_name += "POA_";
+ class_name += node->local_name ();
+ }
+ else
+ {
+ class_name += node->local_name ();
+ }
+
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Generate the skeleton class name.
+ *os << "class " << class_name.c_str () << ";" << be_nl;
+
+ // Generate the _ptr declaration.
+ *os << "typedef " << class_name.c_str () << " *" << class_name.c_str ()
+ << "_ptr;" << be_nl;
+
+ // Forward class declaration.
+ *os << "// Forward Classes Declaration" << be_nl;
+
+ if (be_global->gen_thru_poa_collocation ())
+ {
+ *os << "class " << node->thru_poa_proxy_impl_name () << ";" << be_nl;
+ }
+
+ if (be_global->gen_direct_collocation ())
+ {
+ *os << "class " << node->direct_proxy_impl_name () << ";" << be_nl;
+ }
+
+ if (be_global->gen_thru_poa_collocation ()
+ || be_global->gen_direct_collocation ())
+ {
+ *os << "class " << node->strategized_proxy_broker_name ()
+ << ";" << be_nl;
+ }
+
+ *os << be_nl;
+
+ // Now generate the class definition.
+ *os << "class " << be_global->skel_export_macro ()
+ << " " << class_name.c_str () << be_idt_nl << ": " << be_idt;
+
+ *os << "public virtual " << "POA_"
+ << concrete->name ();
+
+ *os << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "protected:" << be_idt_nl
+ << class_name.c_str () << " (void);\n" << be_uidt_nl
+ << "public:" << be_idt_nl;
+
+ // No copy constructor for locality constraint interface.
+ *os << class_name.c_str () << " (const " << class_name.c_str ()
+ << "& rhs);" << be_nl
+ << "virtual ~" << class_name.c_str () << " (void);" << be_nl << be_nl;
+
+ *os << "::" << node->full_name () << " *_this (" << be_idt << be_idt_nl
+ << "ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // The _interface_repository_id method.
+ *os << "virtual const char* _interface_repository_id "
+ << "(void) const;" << be_uidt_nl;
+
+ *os << "};\n\n";
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_si.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_si.cpp
new file mode 100644
index 00000000000..d878c4f3957
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_si.cpp
@@ -0,0 +1,44 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_si.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Interfaces in the server inline file
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_si,
+ "$Id$")
+
+
+// ************************************************************************
+// Valuetype visitor for server inline
+// ************************************************************************
+
+be_visitor_valuetype_si::be_visitor_valuetype_si (be_visitor_context *ctx)
+ : be_visitor_valuetype (ctx)
+{
+}
+
+be_visitor_valuetype_si::~be_visitor_valuetype_si (void)
+{
+}
+
+int
+be_visitor_valuetype_si::visit_valuetype (be_valuetype *node)
+{
+ // Nothing needed for now, but the visitor is here just in case.
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ss.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ss.cpp
new file mode 100644
index 00000000000..004da7bfd1b
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ss.cpp
@@ -0,0 +1,203 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_ss.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Interfaces in the server skeletons file.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "nr_extern.h"
+
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_ss,
+ "$Id$")
+
+
+// ************************************************************
+// Interface visitor for server skeletons.
+// ************************************************************
+
+be_visitor_valuetype_ss::be_visitor_valuetype_ss (be_visitor_context *ctx)
+ : be_visitor_valuetype (ctx)
+{
+}
+
+be_visitor_valuetype_ss::~be_visitor_valuetype_ss (void)
+{
+}
+
+int
+be_visitor_valuetype_ss::visit_valuetype (be_valuetype *node)
+{
+ if (node->srv_skel_gen () || node->imported () || node->is_abstract ())
+ {
+ return 0;
+ }
+
+ AST_Interface *concrete = node->supports_concrete ();
+
+ // We generate a skeleton class only if the valuetype supports a
+ // non-abstract interface.
+ if (concrete == 0)
+ {
+ return 0;
+ }
+
+ // Generate the normal skeleton as usual.
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ os->indent ();
+
+ ACE_CString full_skel_name_holder =
+ this->generate_full_skel_name (node);
+
+ const char *full_skel_name = full_skel_name_holder.c_str ();
+
+ ACE_CString flat_name_holder =
+ this->generate_flat_name (node);
+
+ const char *flat_name = flat_name_holder.c_str ();
+
+ *os << be_nl << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Find if we are at the top scope or inside some module,
+ // pre-compute the prefix that must be added to the local name in
+ // each case.
+ const char *local_name_prefix = "";
+
+ if (!node->is_nested ())
+ {
+ local_name_prefix = "POA_";
+ }
+
+ ACE_CString node_local_name_holder =
+ this->generate_local_name (node);
+
+ const char *node_local_name = node_local_name_holder.c_str ();
+
+ *os << full_skel_name << "::"
+ << local_name_prefix << node_local_name
+ << " (void)" << be_nl
+ << "{}" << be_nl << be_nl;
+
+ *os << full_skel_name << "::"
+ << local_name_prefix << node_local_name << " ("
+ << "const " << local_name_prefix << node_local_name << "& rhs)";
+
+ *os << be_idt_nl
+ << ": ";
+
+ if (concrete->is_nested ())
+ {
+ AST_Decl *scope = ScopeAsDecl (concrete->defined_in ());
+
+ *os << "ACE_NESTED_CLASS (POA_" << scope->name () << ", "
+ << concrete->local_name () << ") (rhs)";
+ }
+ else
+ {
+ be_interface *bd = be_interface::narrow_from_decl (concrete);
+ *os << bd->full_skel_name () << " (rhs)";
+ }
+
+ *os << be_uidt_nl << "{}" << be_nl << be_nl;
+
+ *os << full_skel_name << "::~"
+ << local_name_prefix << node_local_name
+ << " (void)" << be_nl
+ << "{}" << be_nl << be_nl;
+
+ // the _this () operation.
+ *os << node->full_name () << " *" << be_nl
+ << node->full_skel_name ()
+ << "::_this (ACE_ENV_SINGLE_ARG_DECL)" << be_nl
+ << "{" << be_idt_nl
+ << "TAO_Stub *stub = this->_create_stub (ACE_ENV_SINGLE_ARG_PARAMETER);"
+ << be_nl
+ << "ACE_CHECK_RETURN (0);" << be_nl << be_nl
+ << "TAO_Stub_Auto_Ptr safe_stub (stub);" << be_nl;
+
+ *os << "CORBA::Object_ptr tmp = CORBA::Object::_nil ();" << be_nl
+ << be_nl
+ << "if (stub->servant_orb_var ()->orb_core ()->"
+ << "optimize_collocation_objects ())" << be_idt_nl
+ << "{" << be_idt_nl
+ << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
+ << "tmp," << be_nl
+ << "CORBA::Object (" << be_idt << be_idt_nl
+ << "stub," << be_nl
+ << "1," << be_nl
+ << "this" << be_uidt_nl
+ << ")," << be_uidt_nl
+ << "0" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "else" << be_idt_nl
+ << "{" << be_idt_nl
+ << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
+ << "tmp," << be_nl
+ << "CORBA::Object (" << be_idt << be_idt_nl
+ << "stub," << be_nl
+ << "0," << be_nl
+ << "this" << be_uidt_nl
+ << ")," << be_uidt_nl
+ << "0" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+
+ *os << "CORBA::Object_var obj = tmp;" << be_nl
+ << "(void) safe_stub.release ();" << be_nl
+ << "return ";
+
+ if (concrete->is_nested ())
+ {
+ UTL_Scope *parent_scope = concrete->defined_in ();
+ AST_Decl *parent_decl = ScopeAsDecl (parent_scope);
+
+ *os << "ACE_NESTED_CLASS ("
+ << parent_decl->name () << ", "
+ << concrete->local_name ();
+ }
+ else
+ {
+ *os << concrete->name ();
+ }
+
+ *os << "::_unchecked_narrow (obj.in ());"
+ << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ return 0;
+}
+
+ACE_CString
+be_visitor_valuetype_ss::generate_flat_name (be_valuetype *node)
+{
+ return ACE_CString (node->flat_name ());
+}
+
+ACE_CString
+be_visitor_valuetype_ss::generate_local_name (be_valuetype *node)
+{
+ return ACE_CString (node->local_name ());
+}
+
+ACE_CString
+be_visitor_valuetype_ss::generate_full_skel_name (be_valuetype *node)
+{
+ return ACE_CString (node->full_skel_name ());
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd.cpp
index fc13b3c768c..bcc4a2200da 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd.cpp
@@ -18,20 +18,20 @@
//
// ============================================================================
-
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
+#include "be_extern.h"
+#include "be_helper.h"
#include "be_visitor_valuetype_fwd.h"
+#include "be_visitor_context.h"
-// include all the individual files
-
-// Not implemented yet.
#include "be_visitor_valuetype_fwd/valuetype_fwd_ch.cpp"
#include "be_visitor_valuetype_fwd/valuetype_fwd_ci.cpp"
#include "be_visitor_valuetype_fwd/cdr_op_ch.cpp"
#include "be_visitor_valuetype_fwd/cdr_op_ci.cpp"
-ACE_RCSID(be, be_visitor_valuetype_fwd, "$Id$")
+ACE_RCSID (be,
+ be_visitor_valuetype_fwd,
+ "$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ch.cpp
index 31ebdf15ef8..778efd94f32 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ch.cpp
@@ -21,14 +21,9 @@
//
// ================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_valuetype_fwd.h"
-
-ACE_RCSID(be_visitor_valuetype_fwd, valuetype_fwd_cdr_op_ch, "$Id$")
-
+ACE_RCSID (be_visitor_valuetype_fwd,
+ cdr_op_ch,
+ "$Id$")
be_visitor_valuetype_fwd_cdr_op_ch::be_visitor_valuetype_fwd_cdr_op_ch (
be_visitor_context *ctx
@@ -64,20 +59,12 @@ be_visitor_valuetype_fwd_cdr_op_ch::visit_valuetype_fwd (
return 0;
}
- // Generate helper functions declaration.
- if (bfd->gen_helper_header () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_cdr_op_ch::"
- "visit_valuetype - "
- "codegen for helper functions failed\n"), -1);
- }
-
TAO_OutStream *os = this->ctx_->stream ();
// generate the CDR << and >> operator declarations (prototypes)
- //@@ Boris: Can I move this to be_valuetype? (as with _var, _out, etc?)
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
*os << be_global->stub_export_macro ()
<< " CORBA::Boolean operator<< (TAO_OutputCDR &, const "
@@ -88,6 +75,7 @@ be_visitor_valuetype_fwd_cdr_op_ch::visit_valuetype_fwd (
<< node->full_name () << " *&);" << be_nl;
node->cli_hdr_cdr_op_gen (I_TRUE);
+ bfd->cli_hdr_cdr_op_gen (I_TRUE);
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ci.cpp
index 436fa441618..2a237f3d5a6 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ci.cpp
@@ -20,27 +20,25 @@
//
// ================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_valuetype_fwd.h"
-
-ACE_RCSID(be_visitor_valuetype_fwd, cdr_op_ci, "$Id$")
+ACE_RCSID (be_visitor_valuetype_fwd,
+ cdr_op_ci,
+ "$Id$")
// ****************************************************************
// Interface visitor for generating CDR operator declarations in the
// client header
// ****************************************************************
-be_visitor_valuetype_fwd_cdr_op_ci::
-be_visitor_valuetype_fwd_cdr_op_ci (be_visitor_context *ctx)
+be_visitor_valuetype_fwd_cdr_op_ci::be_visitor_valuetype_fwd_cdr_op_ci (
+ be_visitor_context *ctx
+ )
: be_visitor_decl (ctx)
{
}
-be_visitor_valuetype_fwd_cdr_op_ci::
-~be_visitor_valuetype_fwd_cdr_op_ci (void)
+be_visitor_valuetype_fwd_cdr_op_ci::~be_visitor_valuetype_fwd_cdr_op_ci (
+ void
+ )
{
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ch.cpp
index 01a7497e552..8126f1674ee 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ch.cpp
@@ -20,14 +20,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_valuetype_fwd.h"
-
-ACE_RCSID(be_visitor_valuetype_fwd, valuetype_fwd_ch, "$Id$")
-
+ACE_RCSID (be_visitor_valuetype_fwd,
+ valuetype_fwd_ch,
+ "$Id$")
be_visitor_valuetype_fwd_ch::be_visitor_valuetype_fwd_ch (be_visitor_context *ctx)
: be_visitor_decl (ctx)
@@ -104,7 +99,6 @@ be_visitor_valuetype_fwd_ch::visit_valuetype_fwd (be_valuetype_fwd *node)
os->gen_endif ();
node->cli_hdr_gen (I_TRUE);
- bfd->cli_hdr_gen (I_TRUE);
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ci.cpp
index ba6aa3972f0..b24a18a32b2 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ci.cpp
@@ -19,13 +19,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_valuetype_fwd.h"
-
-ACE_RCSID(be_visitor_valuetype_fwd, valuetype_fwd_ci, "$Id$")
+ACE_RCSID (be_visitor_valuetype_fwd,
+ valuetype_fwd_ci,
+ "$Id$")
be_visitor_valuetype_fwd_ci::be_visitor_valuetype_fwd_ci (
be_visitor_context *ctx
diff --git a/TAO/TAO_IDL/be_include/Makefile.am b/TAO/TAO_IDL/be_include/Makefile.am
index 86d6a401dbd..769844880bc 100644
--- a/TAO/TAO_IDL/be_include/Makefile.am
+++ b/TAO/TAO_IDL/be_include/Makefile.am
@@ -18,6 +18,8 @@ noinst_HEADERS = \
be_array.h \
be_attribute.h \
be_codegen.h \
+ be_component.h \
+ be_component_fwd.h \
be_constant.h \
be_decl.h \
be_enum.h \
@@ -27,6 +29,7 @@ noinst_HEADERS = \
be_field.h \
be_generator.h \
be_helper.h \
+ be_home.h \
be_interface.h \
be_interface_fwd.h \
be_interface_strategy.h \
@@ -41,10 +44,12 @@ noinst_HEADERS = \
be_stream_factory.h \
be_string.h \
be_structure.h \
+ be_structure_fwd.h \
be_sunsoft.h \
be_type.h \
be_typedef.h \
be_union.h \
+ be_union_fwd.h \
be_union_branch.h \
be_union_label.h \
be_valuetype.h \
@@ -54,6 +59,8 @@ noinst_HEADERS = \
be_visitor_argument.h \
be_visitor_array.h \
be_visitor_attribute.h \
+ be_visitor_component.h \
+ be_visitor_component_fwd.h \
be_visitor_constant.h \
be_visitor_context.h \
be_visitor_decl.h \
@@ -61,6 +68,7 @@ noinst_HEADERS = \
be_visitor_exception.h \
be_visitor_factory.h \
be_visitor_field.h \
+ be_visitor_home.h \
be_visitor_interface.h \
be_visitor_interface_fwd.h \
be_visitor_module.h \
diff --git a/TAO/TAO_IDL/be_include/be.h b/TAO/TAO_IDL/be_include/be.h
deleted file mode 100644
index 732cfa46729..00000000000
--- a/TAO/TAO_IDL/be_include/be.h
+++ /dev/null
@@ -1,148 +0,0 @@
-// $Id$
-
-/*
-
-COPYRIGHT
-
-Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
-States of America. All Rights Reserved.
-
-This product is protected by copyright and distributed under the following
-license restricting its use.
-
-The Interface Definition Language Compiler Front End (CFE) is made
-available for your use provided that you include this license and copyright
-notice on all media and documentation and the software program in which
-this product is incorporated in whole or part. You may copy and extend
-functionality (but may not remove functionality) of the Interface
-Definition Language CFE without charge, but you are not authorized to
-license or distribute it to anyone else except as part of a product or
-program developed by you or with the express written consent of Sun
-Microsystems, Inc. ("Sun").
-
-The names of Sun Microsystems, Inc. and any of its subsidiaries or
-affiliates may not be used in advertising or publicity pertaining to
-distribution of Interface Definition Language CFE as permitted herein.
-
-This license is effective until terminated by Sun for failure to comply
-with this license. Upon termination, you shall destroy or return all code
-and documentation for the Interface Definition Language CFE.
-
-INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
-ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
-FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
-DEALING, USAGE OR TRADE PRACTICE.
-
-INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
-ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
-TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
-
-SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
-RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
-INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
-
-IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
-ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
-DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-Use, duplication, or disclosure by the government is subject to
-restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
-Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
-52.227-19.
-
-Sun, Sun Microsystems and the Sun logo are trademarks or registered
-trademarks of Sun Microsystems, Inc.
-
-SunSoft, Inc.
-2550 Garcia Avenue
-Mountain View, California 94043
-
-NOTE:
-
-SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
-trademarks or registered trademarks of Sun Microsystems, Inc.
-
- */
-
-#ifndef _BE_BE_HH
-#define _BE_BE_HH
-
-// be.h
-
-#if defined (_MSC_VER)
-#if (_MSC_VER >= 1200)
-#pragma warning(push)
-#endif /* _MSC_VER >= 1200 */
-#pragma warning(disable:4250)
-#endif /* _MSC_VER */
-
-// ACE includes
-
-#include "ace/ACE.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-#include "ace/OS.h"
-#include "ace/Singleton.h"
-#include "ace/Synch.h"
-#include "ace/Log_Msg.h"
-#include "ace/Containers.h"
-#include "ace/Process.h"
-
-// BE includes
-
-#include "be_decl.h" // class BE_Decl
-#include "be_scope.h" // class BE_Scope
-#include "be_generator.h" // class BE_generator
-
-#include "be_global.h" // global data for back end
-#include "be_extern.h" // pointer to global BE
- // data object
-
-#include "be_type.h"
-#include "be_predefined_type.h" // class BE_PredefinedType
-#include "be_module.h" // class BE_Module
-#include "be_interface.h" // class BE_Interface
-#include "be_interface_fwd.h" // class BE_InterfaceFwd
-#include "be_valuetype.h" // class be_valuetype
-#include "be_valuetype_fwd.h" // class be_valuetype_fwd
-#include "be_structure.h" // class BE_Structure
-#include "be_exception.h" // class BE_Exception
-#include "be_expression.h" // class BE_Expr_val
-#include "be_enum.h" // class BE_Enum
-#include "be_operation.h" // class BE_Operation
-#include "be_field.h" // class BE_Field
-#include "be_argument.h" // class BE_Argument
-#include "be_attribute.h" // class BE_Attribute
-#include "be_union.h" // class BE_Union
-#include "be_union_branch.h" // class BE_UnionBranch
-#include "be_union_label.h" // class BE_UnionLabel
-#include "be_constant.h" // class BE_Constant
-#include "be_enum_val.h" // class BE_EnumVal
-#include "be_array.h" // class BE_Array
-#include "be_sequence.h" // class BE_Sequence
-#include "be_string.h" // class BE_String
-#include "be_typedef.h" // class BE_Typedef
-#include "be_root.h" // class BE_Root
-#include "be_native.h" // class BE_Native
-#include "be_factory.h" // class be_factory
-
-#include "be_helper.h" // helper functions
-#include "be_codegen.h" // code generator
-#include "be_stream_factory.h" // output stream factory
-
-#include "be_visitor.h" // abstract visitor
-#include "be_visitor_factory.h" // visitor factory
-#include "be_visitor_context.h" // visitor context
-#include "be_visitor_ami_pre_proc.h" // generate AMI implied IDL
-#include "be_visitor_amh_pre_proc.h" // generate AMH implied IDL
-
-#include "be_interface_strategy.h" // strategy for interface nodes
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-#pragma warning(pop)
-#endif /* _MSC_VER */
-
-#endif /* _BE_BE_HH */
diff --git a/TAO/TAO_IDL/be_include/be_array.h b/TAO/TAO_IDL/be_include/be_array.h
index a70776479fa..777daca8e56 100644
--- a/TAO/TAO_IDL/be_include/be_array.h
+++ b/TAO/TAO_IDL/be_include/be_array.h
@@ -45,8 +45,8 @@ public:
~be_array (void);
- virtual int gen_dimensions (TAO_OutStream *os,
- unsigned short slice = 0);
+ int gen_dimensions (TAO_OutStream *os,
+ unsigned short slice = 0);
// Generate dimensions. If slice == 1, generate dimensions for the slice
// definition.
@@ -58,18 +58,8 @@ public:
DEF_NARROW_FROM_DECL (be_array);
protected:
- virtual int compute_size_type (void);
- // Compute the size type if it is unknown.
-
virtual int create_name (void);
// Create a name for us.
-
- const char* tao_name (void);
-
-private:
- char* tao_name_;
- // We need a name to generate typecodes and other objects, but it
- // must be different from the typedef name.
};
#endif
diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h
index 4ff0abea830..9fe2850154a 100644
--- a/TAO/TAO_IDL/be_include/be_codegen.h
+++ b/TAO/TAO_IDL/be_include/be_codegen.h
@@ -3,7 +3,7 @@
// ================================================================
//
// = LIBRARY
-// TAO IDL
+// TAO_IDL_BE
//
// = FILENAME
// be_codegen.h
@@ -23,9 +23,6 @@
#include "ace/Synch.h"
#include "TAO_IDL_BE_Export.h"
-#define NAMEBUFSIZE 1024
-// Maximum length of static buffers used to store names.
-
class TAO_Visitor_Factory;
class TAO_OutStream;
class be_visitor_context;
@@ -108,7 +105,6 @@ public:
TAO_ATTRIBUTE_SMART_PROXY_CH, // in client header
TAO_ATTRIBUTE_SMART_PROXY_CS, // in client source
- TAO_ATTRIBUTE_INTERCEPTORS_CH, // in client header
TAO_ATTRIBUTE_INTERCEPTORS_CS, // in client source
TAO_ATTRIBUTE_INTERCEPTORS_SH, // in server header
TAO_ATTRIBUTE_INTERCEPTORS_SS, // in server source
@@ -180,7 +176,6 @@ public:
TAO_INTERFACE_TIE_SI,
TAO_INTERFACE_SMART_PROXY_CH,
TAO_INTERFACE_SMART_PROXY_CS,
- TAO_INTERFACE_INTERCEPTORS_CH,
TAO_INTERFACE_INTERCEPTORS_CS,
TAO_INTERFACE_INTERCEPTORS_SH,
TAO_INTERFACE_INTERCEPTORS_SS,
@@ -306,11 +301,6 @@ public:
TAO_OPERATION_RETTYPE_IS, // return type in client header op
TAO_OPERATION_RETTYPE_OTHERS, // ... in other cases
- TAO_OPERATION_INVOKE_ARG_LIST, // Generate the signature needed to invoke
- // the operation given. The signature generated
- // consists of the name of the arguments, without
- // any type
-
TAO_OPERATION_ARGLIST_CH, // parameter list in op signature
// ... for client header
TAO_OPERATION_ARGLIST_SH, // ... for server header
@@ -326,9 +316,6 @@ public:
TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SS, // arglist for request info obj instantiation
TAO_OPERATION_INTERCEPTORS_ARGLIST_SS, // private member list list for request info // ... for server source
- // TAO_OPERATION_ARGLIST_PROXY_IMPL_CH, // Proxy impl arg list generation
- // in client header
-
TAO_OPERATION_ARGLIST_PROXY_IMPL_XH, // Proxy impl arg list generation
// in client/server header
TAO_OPERATION_ARGLIST_PROXY_IMPL_XS,
@@ -445,6 +432,9 @@ public:
TAO_STRUCT_CDR_OP_CI,
TAO_STRUCT_CDR_OP_CS,
+ // Emitting code for a forward declared struct.
+ TAO_STRUCT_FWD_CH,
+
// Emitting code for typedefs.
TAO_TYPEDEF_CH,
TAO_TYPEDEF_CI,
@@ -465,6 +455,9 @@ public:
TAO_UNION_CDR_OP_CI,
TAO_UNION_CDR_OP_CS,
+ // Emitting code for a forward declared union.
+ TAO_UNION_FWD_CH,
+
// Emitting code for the discriminant.
TAO_UNION_DISCTYPEDEFN_CH,
TAO_UNION_DISCTYPEDEFN_CI,
@@ -476,7 +469,6 @@ public:
TAO_UNION_PUBLIC_CS,
TAO_UNION_PUBLIC_ASSIGN_CS,
TAO_UNION_PUBLIC_RESET_CS,
- TAO_UNION_PUBLIC_ACCESS_CS,
// Emitting code for private members of the union.
TAO_UNION_PRIVATE_CH,
diff --git a/TAO/TAO_IDL/be_include/be_component.h b/TAO/TAO_IDL/be_include/be_component.h
new file mode 100644
index 00000000000..c9a5f96891d
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_component.h
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_component.h
+//
+// = DESCRIPTION
+// Extension of class AST_Component that provides additional means for C++
+// mapping of an interface.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef TAO_BE_COMPONENT_H
+#define TAO_BE_COMPONENT_H
+
+#include "be_interface.h"
+#include "ast_component.h"
+
+class be_component : public virtual AST_Component,
+ public virtual be_interface
+{
+ // = TITLE
+ // The back end extension of the AST_Component class
+ //
+ // = DESCRIPTION
+ //
+public:
+ be_component (void);
+
+ be_component (UTL_ScopedName *n,
+ AST_Component *base_component,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface **supports_flat,
+ long n_supports_flat);
+
+ ~be_component (void);
+
+ virtual void destroy (void);
+ // Cleanup function.
+
+ // Visiting.
+ virtual int accept (be_visitor *visitor);
+
+ // Narrowing.
+ DEF_NARROW_METHODS2 (be_component, be_interface, AST_Component);
+ DEF_NARROW_FROM_DECL (be_component);
+ DEF_NARROW_FROM_SCOPE (be_component);
+};
+
+#endif // if !defined
diff --git a/TAO/TAO_IDL/be_include/be_component_fwd.h b/TAO/TAO_IDL/be_include/be_component_fwd.h
new file mode 100644
index 00000000000..8fedc996740
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_component_fwd.h
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_component_fwd.h
+//
+// = DESCRIPTION
+// Extension of class AST_ComponentFwd that provides additional
+// means for C++ mapping of a forward declared component.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef BE_COMPONENT_FWD_H
+#define BE_COMPONENT_FWD_H
+
+#include "be_interface_fwd.h"
+#include "ast_component_fwd.h"
+
+class be_component_fwd : public virtual AST_ComponentFwd,
+ public virtual be_interface_fwd
+{
+ // =TITLE
+ // be_component_fwd
+ //
+ // =DESCRIPTION
+ // Extensions to the AST_ComponentFwd class
+public:
+ be_component_fwd (void);
+
+ be_component_fwd (AST_Interface *dummy,
+ UTL_ScopedName *n);
+
+ virtual ~be_component_fwd (void);
+
+ // Cleanup function.
+ virtual void destroy (void);
+
+ // Visiting.
+ virtual int accept (be_visitor* visitor);
+
+ // Narrowing.
+ DEF_NARROW_METHODS2 (be_component_fwd, AST_ComponentFwd, be_interface_fwd);
+ DEF_NARROW_FROM_DECL (be_component_fwd);
+};
+
+#endif // if !defined
diff --git a/TAO/TAO_IDL/be_include/be_constant.h b/TAO/TAO_IDL/be_include/be_constant.h
index 64486bc999c..b23fbc2734c 100644
--- a/TAO/TAO_IDL/be_include/be_constant.h
+++ b/TAO/TAO_IDL/be_include/be_constant.h
@@ -25,7 +25,6 @@
#include "be_decl.h"
#include "ast_constant.h"
-#include "ast_expression.h"
class be_visitor;
@@ -41,12 +40,12 @@ public:
UTL_ScopedName *n);
// Constructor.
- const char *exprtype_to_string (void);
- // Returns the appropriate type.
-
// Visiting.
virtual int accept (be_visitor *visitor);
+ //Cleanup.
+ virtual void destroy (void);
+
// Narrowing.
DEF_NARROW_METHODS2 (be_constant, AST_Constant, be_decl);
DEF_NARROW_FROM_DECL (be_constant);
diff --git a/TAO/TAO_IDL/be_include/be_decl.h b/TAO/TAO_IDL/be_include/be_decl.h
index a5c5191097c..217226d0147 100644
--- a/TAO/TAO_IDL/be_include/be_decl.h
+++ b/TAO/TAO_IDL/be_include/be_decl.h
@@ -36,15 +36,6 @@ class be_decl : public virtual AST_Decl
// interface.
//
public:
- enum SIZE_TYPE
- {
- SIZE_UNKNOWN,
- FIXED,
- VARIABLE
- };
- // Undicates if we are fixed size or variable. Most useful for structs,
- // unions, and arrays.
-
be_decl (void);
// Default constructor.
@@ -55,15 +46,6 @@ public:
~be_decl (void);
// Destructor.
- virtual void size_type (SIZE_TYPE);
- // Set the size type.
-
- virtual SIZE_TYPE size_type (void);
- // Return our size type.
-
- const char *flat_name (void);
- // Return the flattened full scoped name.
-
// Methods used by the interface type strategy.
void compute_full_name (const char *prefix,
const char *suffix,
@@ -79,20 +61,14 @@ public:
// End of Methods use by the interface type strategy.
- virtual idl_bool is_nested (void);
- // Determines if we are inside of a nested scope or not.
-
virtual be_scope *scope (void);
// Return the scope created by this node (if one exists).
// Visiting
virtual int accept (be_visitor *visitor);
- idl_bool has_constructor (void);
- // Accessor for protected member.
-
- void has_constructor (idl_bool value);
- // Mutator for protected member.
+ virtual void destroy (void);
+ // Cleanup function.
// Boolean methods to test if code was already generated.
idl_bool cli_hdr_gen (void);
@@ -130,16 +106,7 @@ public:
DEF_NARROW_METHODS1 (be_decl, AST_Decl);
DEF_NARROW_FROM_DECL (be_decl);
-protected:
- virtual int compute_size_type (void);
- // Determine our size type and set it if it is unknown.
-
- virtual void compute_flat_name (void);
- // Compute the flattened fully scoped name.
-
- virtual void destroy (void);
- // Cleanup function.
-
+private:
// Variables that indicate if the code generation for that node is already
// been done. This way we avoid regenerating same code.
idl_bool cli_hdr_gen_;
@@ -157,15 +124,6 @@ protected:
idl_bool cli_inline_cdr_op_gen_;
idl_bool cli_inline_cdr_decl_gen_;
- char *flat_name_;
- // Flattened fully scoped name.
-
- SIZE_TYPE size_type_;
- // Whether we are fixed or variable size (by default fixed).
-
- idl_bool has_constructor_;
- // Attribute that helps a union determine whether a member
- // should be included by value or by reference.
};
#endif // if !defined
diff --git a/TAO/TAO_IDL/be_include/be_enum_val.h b/TAO/TAO_IDL/be_include/be_enum_val.h
index 36040c96752..50d10e42068 100644
--- a/TAO/TAO_IDL/be_include/be_enum_val.h
+++ b/TAO/TAO_IDL/be_include/be_enum_val.h
@@ -42,14 +42,12 @@ public:
// Visiting
virtual int accept (be_visitor *visitor);
+ //Cleanup.
+ virtual void destroy (void);
+
// Narrowing
DEF_NARROW_METHODS2 (be_enum_val, AST_EnumVal, be_decl);
DEF_NARROW_FROM_DECL (be_enum_val);
-
-protected:
- virtual int compute_size_type (void);
- // Trivial implementation, but it avoids a switch statement
- // in be_decl::size_type().
};
#endif
diff --git a/TAO/TAO_IDL/be_include/be_extern.h b/TAO/TAO_IDL/be_include/be_extern.h
index db5cf3a479a..2f04a741f9e 100644
--- a/TAO/TAO_IDL/be_include/be_extern.h
+++ b/TAO/TAO_IDL/be_include/be_extern.h
@@ -68,15 +68,8 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#define _BE_EXTERN_BE_EXTERN_HH
#include "TAO_IDL_BE_Export.h"
-
-// be_extern.h - Defines the BE part of the BE<->FE protocol
+#include "be_global.h"
extern TAO_IDL_BE_Export BE_GlobalData *be_global;
-extern TAO_IDL_BE_Export BE_GlobalData *set_be_global (BE_GlobalData *bg);
-
-// Functions:
-
-extern TAO_IDL_BE_Export void BE_produce (void);
-extern TAO_IDL_BE_Export void BE_abort (void);
#endif // _BE_EXTERN_BE_EXTERN_HH
diff --git a/TAO/TAO_IDL/be_include/be_field.h b/TAO/TAO_IDL/be_include/be_field.h
index 1c9a8dae93d..95147f7bd91 100644
--- a/TAO/TAO_IDL/be_include/be_field.h
+++ b/TAO/TAO_IDL/be_include/be_field.h
@@ -45,10 +45,6 @@ public:
// Narrowing.
DEF_NARROW_METHODS2 (be_field, AST_Field, be_decl);
DEF_NARROW_FROM_DECL (be_field);
-
-protected:
- virtual int compute_size_type (void);
- // Compute the size type if it is unknown.
};
#endif
diff --git a/TAO/TAO_IDL/be_include/be_generator.h b/TAO/TAO_IDL/be_include/be_generator.h
index 1ab9f79b753..73012b08b63 100644
--- a/TAO/TAO_IDL/be_include/be_generator.h
+++ b/TAO/TAO_IDL/be_include/be_generator.h
@@ -73,6 +73,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// is implemented to create nodes of AST classes subclassed in this BE
#include "TAO_IDL_BE_Export.h"
+#include "ast_generator.h"
class TAO_IDL_BE_Export be_generator : public AST_Generator
{
@@ -101,11 +102,38 @@ public:
idl_bool local,
idl_bool abstract);
- virtual AST_Interface *create_valuetype (UTL_ScopedName *n,
- AST_Interface **ih,
- long nih);
+ virtual AST_ValueType *create_valuetype (UTL_ScopedName *n,
+ AST_Interface **inherits,
+ long n_inherits,
+ AST_ValueType *inherits_concrete,
+ AST_Interface **inherits_flat,
+ long n_inherits_flat,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface *supports_concrete,
+ idl_bool abstract,
+ idl_bool truncatable);
+
+ virtual AST_ValueTypeFwd *create_valuetype_fwd (UTL_ScopedName *n,
+ idl_bool abstract);
+
+ virtual AST_Component *create_component (UTL_ScopedName *n,
+ AST_Component *base_component,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface **supports_flat,
+ long n_supports_flat);
+
+ virtual AST_ComponentFwd *create_component_fwd (UTL_ScopedName *n);
- virtual AST_InterfaceFwd *create_valuetype_fwd (UTL_ScopedName *n);
+ virtual AST_Home *create_home (UTL_ScopedName *n,
+ AST_Home *base_home,
+ AST_Component *managed_component,
+ AST_ValueType *primary_key,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface **supports_flat,
+ long n_supports_flat);
virtual AST_Exception *create_exception (UTL_ScopedName *n,
idl_bool local,
@@ -115,6 +143,8 @@ public:
idl_bool local,
idl_bool abstract);
+ virtual AST_StructureFwd *create_structure_fwd (UTL_ScopedName *n);
+
virtual AST_Enum *create_enum (UTL_ScopedName *n,
idl_bool local,
idl_bool abstract);
@@ -139,10 +169,12 @@ public:
idl_bool local,
idl_bool abstract);
- virtual AST_Union *create_union(AST_ConcreteType *dt,
- UTL_ScopedName *n,
- idl_bool local,
- idl_bool abstract);
+ virtual AST_Union *create_union (AST_ConcreteType *dt,
+ UTL_ScopedName *n,
+ idl_bool local,
+ idl_bool abstract);
+
+ virtual AST_UnionFwd *create_union_fwd (UTL_ScopedName *n);
virtual AST_UnionBranch *create_union_branch (UTL_LabelList *ll,
AST_Type *ft,
@@ -192,6 +224,7 @@ public:
virtual AST_Sequence *create_sequence (AST_Expression *v,
AST_Type *bt,
+ UTL_ScopedName *n,
idl_bool local,
idl_bool abstract);
diff --git a/TAO/TAO_IDL/be_include/be_global.h b/TAO/TAO_IDL/be_include/be_global.h
index a0a3b2e5398..fe4ff9a7219 100644
--- a/TAO/TAO_IDL/be_include/be_global.h
+++ b/TAO/TAO_IDL/be_include/be_global.h
@@ -20,8 +20,13 @@
#ifndef _BE_GLOBAL_H
#define _BE_GLOBAL_H
+#include "TAO_IDL_BE_Export.h"
+#include "idl_bool.h"
+#include "ace/Unbounded_Queue.h"
+
class be_interface;
class be_interface_fwd;
+class UTL_String;
// Defines a class containing all back end global data.
@@ -61,19 +66,36 @@ public:
// The parameter <base_name_only> set to 0 (no base name, but full
// name with output dir path, is useful, when I just want just the
// base name to use in #include's etc.
- static const char *be_get_client_hdr_fname (int base_name_only = 0);
- static const char *be_get_client_stub_fname (void);
- static const char *be_get_client_inline_fname (int base_name_only = 0);
- static const char *be_get_server_hdr_fname (int base_name_only = 0);
- static const char *be_get_implementation_hdr_fname (int base_name_only = 0);
- static const char *be_get_implementation_skel_fname (int base_name_only = 0);
- static const char *be_get_server_template_hdr_fname (int base_name_only = 0);
- static const char *be_get_server_skeleton_fname (void);
- static const char *be_get_implementation_skeleton_fname (void);
- // static const char *be_get_implementation_hdr_fname (void);
- static const char *be_get_server_template_skeleton_fname (int base_name_only = 0);
- static const char *be_get_server_inline_fname (int base_name_only = 0);
- static const char *be_get_server_template_inline_fname (int base_name_only = 0);
+ static const char *be_get_client_hdr_fname (
+ int base_name_only = 0
+ );
+ static const char *be_get_client_stub_fname (void);
+ static const char *be_get_client_inline_fname (
+ int base_name_only = 0
+ );
+ static const char *be_get_server_hdr_fname (
+ int base_name_only = 0
+ );
+ static const char *be_get_implementation_hdr_fname (
+ int base_name_only = 0
+ );
+ static const char *be_get_implementation_skel_fname (
+ int base_name_only = 0
+ );
+ static const char *be_get_server_template_hdr_fname (
+ int base_name_only = 0
+ );
+ static const char *be_get_server_skeleton_fname (void);
+ static const char *be_get_implementation_skeleton_fname (void);
+ static const char *be_get_server_template_skeleton_fname (
+ int base_name_only = 0
+ );
+ static const char *be_get_server_inline_fname (
+ int base_name_only = 0
+ );
+ static const char *be_get_server_template_inline_fname (
+ int base_name_only = 0
+ );
// Helper functions: obtain the names of each generated file given
// the IDL file name.
@@ -94,247 +116,255 @@ public:
static const char *be_get_server_template_hdr (UTL_String *idl_file_name,
int base_name_only = 0);
static const char *be_get_server_skeleton (UTL_String *idl_file_name);
- static const char *be_get_server_template_skeleton (UTL_String *idl_file_name,
- int base_name_only = 0);
+ static const char *be_get_server_template_skeleton (
+ UTL_String *idl_file_name,
+ int base_name_only = 0
+ );
static const char *be_get_server_inline (UTL_String *idl_file_name,
int base_name_only = 0);
static const char *be_get_server_template_inline (UTL_String *idl_file_name,
int base_name_only = 0);
- virtual const char* skel_export_macro (void) const;
+ const char* skel_export_macro (void) const;
// returns the macro name for exporting server side classes in Win32
// DLL.
- virtual void skel_export_macro (const char* s);
+ void skel_export_macro (const char* s);
// set the macro name for export server side classes in Win32 DLL.
- virtual const char* skel_export_include (void) const;
+ const char* skel_export_include (void) const;
// returns the name of the include file that contains the server
// side export macro definition.
- virtual void skel_export_include (const char* s);
+ void skel_export_include (const char* s);
// set the name of the include file that contains the server side
// export macro definition.
- virtual const char* stub_export_macro (void) const;
+ const char* stub_export_macro (void) const;
// returns the macro name for exporting client side classes in Win32
// DLL.
- virtual void stub_export_macro (const char* s);
+ void stub_export_macro (const char* s);
// set the macro name for export client side classes in Win32 DLL.
- virtual const char* stub_export_include (void) const;
+ const char* stub_export_include (void) const;
// returns the name of the include file that contains the client
// side export macro definition.
- virtual void stub_export_include (const char* s);
+ void stub_export_include (const char* s);
// set the name of the include file that contains the client side
// export macro definition.
- virtual const char* pch_include (void) const;
+ const char* pch_include (void) const;
// returns the name of the include file to be used for precompiled
// header support.
- virtual void pch_include (const char* s);
+ void pch_include (const char* s);
// set the name of the include file to be used for precompiled
// header support.
- virtual const char* pre_include (void) const;
+ const char* pre_include (void) const;
// returns the name of the include file to be put at the top of
// every header file.
- virtual void pre_include (const char* s);
+ void pre_include (const char* s);
// set the name of the include file to be put at the top of every
// header file.
- virtual const char* post_include (void) const;
+ const char* post_include (void) const;
// returns the name of the include file to be put at the bottom of
// every header file.
- virtual void post_include (const char* s);
+ void post_include (const char* s);
// set the name of the include file to be put at the bottom of every
// header file.
// = Set and get methods for different file name endings.
- virtual void client_hdr_ending (const char* s);
+ void client_hdr_ending (const char* s);
// Set the client_hdr_ending.
- virtual const char* client_hdr_ending (void) const;
+ const char* client_hdr_ending (void) const;
// Get the client_hdr_ending.
- virtual void client_inline_ending (const char* s);
+ void client_inline_ending (const char* s);
// Set the client_inline_ending.
- virtual const char* client_inline_ending (void) const;
+ const char* client_inline_ending (void) const;
// Get the client_inline_ending.
- virtual void client_stub_ending (const char* s);
+ void client_stub_ending (const char* s);
// Set the client_stub_ending.
- virtual const char* client_stub_ending (void) const;
+ const char* client_stub_ending (void) const;
// Get the client_stub_ending.
- virtual void server_hdr_ending (const char* s);
+ void server_hdr_ending (const char* s);
// Set the server_hdr_ending.
- virtual const char* server_hdr_ending (void) const;
+ const char* server_hdr_ending (void) const;
// Get the server_hdr_ending.
- virtual void implementation_hdr_ending (const char* s);
+ void implementation_hdr_ending (const char* s);
// Set the implementation_hdr_ending.
- virtual void impl_class_prefix (const char* s);
+ void impl_class_prefix (const char* s);
// Set the implementation class prefix.
- virtual void impl_class_suffix (const char* s);
+ void impl_class_suffix (const char* s);
// Set the implementation class suffix.
- virtual void implementation_skel_ending (const char* s);
+ void implementation_skel_ending (const char* s);
// Set the implementation_skel_ending.
- virtual const char* implementation_hdr_ending (void) const;
+ const char* implementation_hdr_ending (void) const;
// Get the implementation_hdr_ending.
- virtual const char* impl_class_prefix (void) const;
+ const char* impl_class_prefix (void) const;
//Get implementation class prefix
- virtual const char* impl_class_suffix (void) const;
+ const char* impl_class_suffix (void) const;
//Get implementation class suffix
- virtual const char* implementation_skel_ending (void) const;
+ const char* implementation_skel_ending (void) const;
// Get the implementation_skel_ending.
- virtual void server_template_hdr_ending (const char* s);
+ void server_template_hdr_ending (const char* s);
// Set the server_template_hdr_ending.
- virtual const char* server_template_hdr_ending (void) const;
+ const char* server_template_hdr_ending (void) const;
// Get the server_template_hdr_ending.
- virtual void server_skeleton_ending (const char* s);
+ void server_skeleton_ending (const char* s);
// Set the server_skeleton_ending.
- virtual const char* server_skeleton_ending (void) const;
+ const char* server_skeleton_ending (void) const;
// Get the server_skeleton_ending.
- virtual void server_template_skeleton_ending (const char* s);
+ void server_template_skeleton_ending (const char* s);
// Set the server_template_skeleton_ending.
- virtual const char* server_template_skeleton_ending (void) const;
+ const char* server_template_skeleton_ending (void) const;
// Get the server_template_skeleton_ending.
- virtual void server_inline_ending (const char* s);
+ void server_inline_ending (const char* s);
// Set the server_inline_ending.
- virtual const char* server_inline_ending (void) const;
+ const char* server_inline_ending (void) const;
// Get the server_inline_ending.
- virtual void server_template_inline_ending (const char* s);
+ void server_template_inline_ending (const char* s);
// Set the server_template_inline_ending.
- virtual const char* server_template_inline_ending (void) const;
+ const char* server_template_inline_ending (void) const;
// Get the server_template_inline_ending.
- virtual void output_dir (const char* s);
+ void output_dir (const char* s);
// Set the directory where all the IDL-Compiler-Generated files are
// to be kept. Default is current directory from which the
// <tao_idl> is called.
- virtual const char* output_dir (void) const;
+ const char* output_dir (void) const;
// Get the directory where all the IDL-Compiler-Generated files are
// to be kept. Default is current directory from which the
// <tao_idl> is called.
- virtual void any_support (idl_bool);
+ void any_support (idl_bool);
// Set any support.
- virtual idl_bool any_support (void);
+ idl_bool any_support (void) const;
// Check Any support.
- virtual void tc_support (idl_bool);
+ void tc_support (idl_bool);
// Set TypeCode support.
- virtual idl_bool tc_support (void);
+ idl_bool tc_support (void) const;
// Check TypeCode support
- virtual void obv_opt_accessor (idl_bool);
+ void obv_opt_accessor (idl_bool);
// Set optimized valuetype member accessor generation.
- virtual idl_bool obv_opt_accessor (void);
+ idl_bool obv_opt_accessor (void) const;
// Check optimized valuetype member accessor generation.
- virtual void gen_impl_files (idl_bool);
+ void gen_impl_files (idl_bool);
// Set generation of implementation files.
- virtual idl_bool gen_impl_files (void);
+ idl_bool gen_impl_files (void) const;
// Check if we want to generate implementation files.
- virtual void gen_copy_ctor (idl_bool);
+ void gen_copy_ctor (idl_bool);
// Set generation of copy constructor.
- virtual idl_bool gen_copy_ctor (void);
+ idl_bool gen_copy_ctor (void) const;
// Check if we want to generate the copy constructor.
- virtual void gen_assign_op (idl_bool);
+ void gen_assign_op (idl_bool);
// Set the generation of the assignment operator.
- virtual idl_bool gen_assign_op (void);
+ idl_bool gen_assign_op (void) const;
// Check if we want to generate the assignment operator.
- virtual void gen_thru_poa_collocation (idl_bool);
+ void gen_thru_poa_collocation (idl_bool);
// Set whether we want to generate Thru_POA collocation stubs.
- virtual idl_bool gen_thru_poa_collocation (void);
+ idl_bool gen_thru_poa_collocation (void) const;
// Check if we want to generate Thru_POA collocation stubs.
- virtual void gen_direct_collocation (idl_bool);
+ void gen_direct_collocation (idl_bool);
// Set whether we want to generate Direct collocation stubs.
- virtual idl_bool gen_direct_collocation (void);
+ idl_bool gen_direct_collocation (void) const;
// Check if we want to generate Direct collocation stubs.
- virtual void exception_support (idl_bool);
+ void exception_support (idl_bool);
// Set real C++ exception support.
- virtual idl_bool exception_support (void);
+ idl_bool exception_support (void) const;
// Check if real C++ exception support is enabled.
- virtual void use_raw_throw (idl_bool);
+ void use_raw_throw (idl_bool);
// Set replacement of 'ACE_THROW_SPEC' with 'throw'.
- virtual idl_bool use_raw_throw (void);
+ idl_bool use_raw_throw (void) const;
// Check if raw 'throw' generation option is set.
- virtual void opt_tc (idl_bool);
+ void opt_tc (idl_bool);
// Set optimized typecodes.
- virtual idl_bool opt_tc (void);
+ idl_bool opt_tc (void) const;
// Check if TypeCodes are optimized.
- virtual void ami_call_back (idl_bool value);
+ void ami_call_back (idl_bool value);
// To enable or disable AMI call back feature of the Messaging
// specification in the generated code.
- virtual idl_bool ami_call_back (void);
+ idl_bool ami_call_back (void) const;
// Return the flag.
- virtual void gen_amh_classes (idl_bool value);
+ void gen_amh_classes (idl_bool value);
// To enable or disable AMH in the generated code.
- virtual idl_bool gen_amh_classes (void);
+ idl_bool gen_amh_classes (void) const;
// Return the flag.
- virtual void gen_tie_classes (idl_bool value);
+ void gen_tie_classes (idl_bool value);
// Set the generation of tie classes and files.
- virtual idl_bool gen_tie_classes (void);
+ idl_bool gen_tie_classes (void) const;
// Return the flag.
- virtual void gen_smart_proxies (idl_bool value);
+ void gen_smart_proxies (idl_bool value);
// To enable or disable AMI call back feature of the Messaging
// specification in the generated code.
- virtual idl_bool gen_smart_proxies (void);
+ idl_bool gen_smart_proxies (void) const;
+ // Return the flag.
+
+ void gen_inline_constants (idl_bool value);
+ // Set the flag.
+
+ idl_bool gen_inline_constants (void) const;
// Return the flag.
void lookup_strategy (LOOKUP_STRATEGY s);
@@ -344,7 +374,7 @@ public:
// Return the enumerated value for the lookup strategy. Default is
// perfect hashing.
- virtual void destroy (void);
+ void destroy (void);
// Cleanup function.
ACE_Unbounded_Queue<be_interface *> non_local_interfaces;
@@ -355,6 +385,11 @@ public:
// Used in the generation of extern function declarations so we
// can use non-defined interfaces as members and parameters.
+ ACE_Unbounded_Queue<be_interface *> mixed_parentage_interfaces;
+ // Used in the generation of overrides for CORBA::release and
+ // CORBA::is_nil, needed when the interface inherits versions from
+ // both CORBA::Object and CORBA::AbstractBase.
+
private:
size_t changing_standard_include_files_;
// To switch between changing or non-changing standard include
@@ -386,7 +421,7 @@ private:
// Implementation's hdr file name ending. Default is "I.h".
char* implementation_hdr_ending_;
- // Implementation's skeleton file name ending. Default is "I.cpp".
+ // Implementation's skeleton file name ending. Default is "I.cpp".
char* implementation_skel_ending_;
//Implementaion class prefix
@@ -465,6 +500,10 @@ private:
// Flag to indicate whether smart proxies classes will be generated
// or not.
+ idl_bool gen_inline_constants_;
+ // Flag to indicate whether we are using an inline form of constant
+ // generation that pleases the C++ compiler better on some platforms.
+
LOOKUP_STRATEGY lookup_strategy_;
// The enumerated value indicating the lookup strategy.
};
diff --git a/TAO/TAO_IDL/be_include/be_helper.h b/TAO/TAO_IDL/be_include/be_helper.h
index cb0a911e2f9..b2caf8864e6 100644
--- a/TAO/TAO_IDL/be_include/be_helper.h
+++ b/TAO/TAO_IDL/be_include/be_helper.h
@@ -23,6 +23,12 @@
#ifndef TAO_BE_OUTSTRM_H
#define TAO_BE_OUTSTRM_H
+#include "ace/CDR_Base.h"
+
+class Identifier;
+class UTL_IdList;
+class AST_Expression;
+
// a dummy structure to inform TAO_OutStream's << operator to put a newline
// and use the current indentation for the succeeding line
struct TAO_NL
@@ -102,7 +108,7 @@ public:
// destructor.
int open (const char *fname,
- TAO_OutStream::STREAM_TYPE st=TAO_OutStream::TAO_CLI_HDR);
+ TAO_OutStream::STREAM_TYPE st = TAO_OutStream::TAO_CLI_HDR);
// open the underlying low-level handle for output.
void stream_type (TAO_OutStream::STREAM_TYPE);
@@ -114,11 +120,11 @@ public:
FILE *file (void);
// Return the underlying lowlevel file pointer.
- int incr_indent (unsigned short flag=1);
+ int incr_indent (unsigned short flag = 1);
// increment the indentation level and by default actually indent the output
// accordingly
- int decr_indent (unsigned short flag=1);
+ int decr_indent (unsigned short flag = 1);
// decrease the indentation level and by default actually indent the output
// accordingly
@@ -134,7 +140,8 @@ public:
int print (const char *format, ...);
// "printf" style variable argument print
- int gen_ifdef_macro (const char *flat_name, const char *suffix=0);
+ int gen_ifdef_macro (const char *flat_name,
+ const char *suffix = 0);
// generate a #if !defined, #defined macro
int gen_endif (void);
@@ -205,7 +212,6 @@ protected:
int indent_level_;
// indentation level
-
};
#endif // if !defined
diff --git a/TAO/TAO_IDL/be_include/be_home.h b/TAO/TAO_IDL/be_include/be_home.h
new file mode 100644
index 00000000000..3e0f8e6b356
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_home.h
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_home.h
+//
+// = DESCRIPTION
+// Extension of class AST_Home that provides additional
+// means for C++ mapping of a component home.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef TAO_BE_HOME_H
+#define TAO_BE_HOME_H
+
+#include "be_interface.h"
+#include "ast_home.h"
+
+class be_home : public virtual AST_Home,
+ public virtual be_interface
+{
+ // =TITLE
+ // be_home
+ //
+ // =DESCRIPTION
+ // Extensions to the AST_Home class
+public:
+ be_home (void);
+
+ be_home (UTL_ScopedName *n,
+ AST_Home *base_home,
+ AST_Component *managed_component,
+ AST_ValueType *primary_key,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface **supports_flat,
+ long n_supports_flat);
+
+ virtual ~be_home (void);
+
+ // Cleanup function.
+ virtual void destroy (void);
+
+ // Visiting.
+ virtual int accept (be_visitor* visitor);
+
+ // Narrowing.
+ DEF_NARROW_METHODS2 (be_home, be_interface, AST_Home);
+ DEF_NARROW_FROM_DECL (be_home);
+ DEF_NARROW_FROM_SCOPE (be_home);
+};
+
+#endif // if !defined
diff --git a/TAO/TAO_IDL/be_include/be_interface.h b/TAO/TAO_IDL/be_include/be_interface.h
index 0dff0bda4a5..c74d2c29742 100644
--- a/TAO/TAO_IDL/be_include/be_interface.h
+++ b/TAO/TAO_IDL/be_include/be_interface.h
@@ -31,6 +31,7 @@
class TAO_OutStream;
class TAO_IDL_Inheritance_Hierarchy_Worker;
+class be_visitor;
// Forward declaration of the strategy
class be_interface_strategy;
@@ -211,13 +212,19 @@ public:
/// Iterate over the inheritance hierarchy and call the
/// worker->emit() method for each interface on it.
- virtual int traverse_inheritance_graph (TAO_IDL_Inheritance_Hierarchy_Worker &worker,
- TAO_OutStream *os);
+ int traverse_inheritance_graph (
+ TAO_IDL_Inheritance_Hierarchy_Worker &worker,
+ TAO_OutStream *os,
+ idl_bool abstract_paths_only = I_FALSE
+ );
/// Wrap the @c gen parameter and call the generic version of
/// traverse_inheritance_graph()
- virtual int traverse_inheritance_graph (tao_code_emitter gen,
- TAO_OutStream *os);
+ int traverse_inheritance_graph (
+ tao_code_emitter gen,
+ TAO_OutStream *os,
+ idl_bool abstract_paths_only = I_FALSE
+ );
int in_mult_inheritance (void);
// Am I in some form of multiple inheritance
@@ -281,20 +288,25 @@ public:
// Helper method to determine if the interface node is involved in some kind
// of multiple inheritance or not. Required on the skeleton side.
- static int gen_def_ctors_helper (be_interface* node,
- be_interface* base,
+ static int gen_def_ctors_helper (be_interface *node,
+ be_interface *base,
TAO_OutStream *os);
// Helper method to generate a call to the default
// constructors of all the base classes.
- static int gen_copy_ctors_helper (be_interface* node,
- be_interface* base,
+ static int gen_copy_ctors_helper (be_interface *node,
+ be_interface *base,
TAO_OutStream *os);
// Helper method to generate a call to the copy
// constructors of all the base classes.
+ static int gen_abstract_init_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os);
+ // Helper method to initialize the obj_ member of each generated abstract
+ // base class.
int gen_operation_table (void);
// Generate the operation table including entries for inherited interfaces.
@@ -309,6 +321,11 @@ public:
TAO_OutStream *os);
// generate the operation table entries.
+ void analyze_parentage (AST_Interface **parents,
+ long n_parents);
+ // Compute whether or not we have both abstract and concrete parents,
+ // and make a list of the abstract parents, if any.
+
TAO_CodeGen::CG_STATE next_state (TAO_CodeGen::CG_STATE current_state,
int is_extra_state = 0);
// Find the next state, used to hide differences between variants of
@@ -330,6 +347,9 @@ public:
// Returns an interface, which can be used instead.
// Needs to get set by the strategy.
+ idl_bool has_mixed_parentage (void) const;
+ // Do we have both abstract and concrete parents?
+
private:
void gen_gperf_input_header (TAO_OutStream *ss);
// Output the header (type declaration and %%) to the gperf's input
@@ -365,6 +385,7 @@ private:
void gen_linear_search_instance (const char *flat_name);
// Create an instance of the linear search optable.
+private:
int skel_count_;
// Number of static skeletons in the operation table.
@@ -376,6 +397,11 @@ private:
// Member for holding the strategy for generating names.
be_interface *original_interface_;
+ // The original interface from which this one was created,
+ // applies only to implied IDL
+
+ idl_bool has_mixed_parentage_;
+ // Do we have both abstract and concrete parents?
};
/**
@@ -404,7 +430,7 @@ public:
/**
* This is a no-op, simply put here to keep compilers happy.
*/
- virtual ~TAO_IDL_Inheritance_Hierarchy_Worker ();
+ virtual ~TAO_IDL_Inheritance_Hierarchy_Worker (void);
/// Define the method invoked during the inheritance traversal
/**
@@ -426,4 +452,17 @@ public:
be_interface *base_interface) = 0;
};
+class be_code_emitter_wrapper : public TAO_IDL_Inheritance_Hierarchy_Worker
+{
+public:
+ be_code_emitter_wrapper (be_interface::tao_code_emitter emitter);
+
+ virtual int emit (be_interface *derived_interface,
+ TAO_OutStream *output_stream,
+ be_interface *base_interface);
+
+private:
+ be_interface::tao_code_emitter emitter_;
+};
+
#endif // if !defined
diff --git a/TAO/TAO_IDL/be_include/be_interface_fwd.h b/TAO/TAO_IDL/be_include/be_interface_fwd.h
index 58f8a357795..34822128d63 100644
--- a/TAO/TAO_IDL/be_include/be_interface_fwd.h
+++ b/TAO/TAO_IDL/be_include/be_interface_fwd.h
@@ -7,11 +7,11 @@
// TAO IDL
//
// = FILENAME
-// be_interface.h
+// be_interface_fwd.h
//
// = DESCRIPTION
-// Extension of class AST_Interface_Fwd that provides additional
-// means for C++ mapping of an interface.
+// Extension of class AST_InterfaceFwd that provides additional
+// means for C++ mapping of a forward declared interface.
//
// = AUTHOR
// Copyright 1994-1995 by Sun Microsystems, Inc.
@@ -36,7 +36,7 @@ class be_interface_fwd : public virtual AST_InterfaceFwd,
// be_interface_fwd
//
// =DESCRIPTION
- // Extensions to the AST_Interface_Fwd class
+ // Extensions to the AST_InterfaceFwd class
public:
be_interface_fwd (void);
// Default constructor.
diff --git a/TAO/TAO_IDL/be_include/be_interface_strategy.h b/TAO/TAO_IDL/be_include/be_interface_strategy.h
index 07484fdfa4a..22c96876104 100644
--- a/TAO/TAO_IDL/be_include/be_interface_strategy.h
+++ b/TAO/TAO_IDL/be_include/be_interface_strategy.h
@@ -172,7 +172,6 @@ public:
// e.g. the reply handler to the actual node.
protected:
-
char *local_name_;
char *full_name_;
@@ -197,12 +196,8 @@ protected:
Strategy_Kind strategy_type_;
// The type of strategy
-
-
};
-
-
class be_interface_default_strategy
: public be_interface_strategy
{
diff --git a/TAO/TAO_IDL/be_include/be_module.h b/TAO/TAO_IDL/be_include/be_module.h
index 77f71fc0df4..1c6801addef 100644
--- a/TAO/TAO_IDL/be_include/be_module.h
+++ b/TAO/TAO_IDL/be_include/be_module.h
@@ -50,10 +50,6 @@ public:
DEF_NARROW_METHODS3 (be_module, AST_Module, be_scope, be_decl);
DEF_NARROW_FROM_DECL (be_module);
DEF_NARROW_FROM_SCOPE (be_module);
-
-protected:
- virtual int compute_size_type (void);
- // Compute the size type if it is unknown.
};
#endif
diff --git a/TAO/TAO_IDL/be_include/be_native.h b/TAO/TAO_IDL/be_include/be_native.h
index 01b581413e7..a0ccb9818bd 100644
--- a/TAO/TAO_IDL/be_include/be_native.h
+++ b/TAO/TAO_IDL/be_include/be_native.h
@@ -27,7 +27,6 @@
class be_visitor;
// Representation of "native" IDL type added by the POA spec.
-
class be_native : public virtual AST_Native,
public virtual be_type
{
diff --git a/TAO/TAO_IDL/be_include/be_operation.h b/TAO/TAO_IDL/be_include/be_operation.h
index 1c87ed1eae0..0e004b3b682 100644
--- a/TAO/TAO_IDL/be_include/be_operation.h
+++ b/TAO/TAO_IDL/be_include/be_operation.h
@@ -24,12 +24,13 @@
#include "be_scope.h"
#include "be_decl.h"
+#include "be_codegen.h"
#include "ast_operation.h"
-#include "be_operation_strategy.h"
class AST_Type;
class be_visitor;
class be_argument;
+class be_operation_strategy;
class be_operation : public virtual AST_Operation,
public virtual be_scope,
@@ -49,12 +50,6 @@ public:
~be_operation (void);
// Destructor.
- int void_return_type (void);
- // Returns 1 if the operation has a void return type.
-
- be_argument *add_argument_to_scope (be_argument *arg);
- // Add an argument to the scope.
-
virtual void destroy (void);
// Cleanup method.
@@ -86,9 +81,6 @@ public:
DEF_NARROW_FROM_SCOPE (be_operation);
protected:
- int compute_size_type (void);
- // Compute the size type if it is unknown.
-
be_operation_strategy *strategy_;
// Member for holding the strategy for covering
// differences between various operations, e.g. sendc_, raise_
diff --git a/TAO/TAO_IDL/be_include/be_operation_strategy.h b/TAO/TAO_IDL/be_include/be_operation_strategy.h
index 5e04b45a5ed..310a3d4f1e7 100644
--- a/TAO/TAO_IDL/be_include/be_operation_strategy.h
+++ b/TAO/TAO_IDL/be_include/be_operation_strategy.h
@@ -25,12 +25,12 @@
class be_operation;
-// Base class for operation level strategeis
-
+// Base class for operation level strategies.
class be_operation_strategy
{
public:
- enum Strategy_Kind {
+ enum Strategy_Kind
+ {
DEFAULT = 0,
AMI_SENDC,
AMI_HANDLER_REPLY_STUB,
@@ -40,41 +40,42 @@ public:
be_operation_strategy (be_operation *node,
Strategy_Kind strategy_type);
- virtual ~be_operation_strategy ();
+ virtual ~be_operation_strategy (void);
int strategy_type ();
// Return the type of the strategy.
- virtual TAO_CodeGen::CG_STATE next_state (TAO_CodeGen::CG_STATE current_state,
- int is_extra_state = 0) = 0;
- // Change the sate if necessary
+ virtual TAO_CodeGen::CG_STATE next_state (
+ TAO_CodeGen::CG_STATE current_state,
+ int is_extra_state = 0
+ ) = 0;
+ // Change the state if necessary.
virtual int has_extra_code_generation (TAO_CodeGen::CG_STATE current_state);
- // returns true if we have to genrate extra code.
+ // Returns true if we have to genrate extra code.
- virtual be_operation *marshaling ();
- // returns the operation containing special marshaling information,
+ virtual be_operation *marshaling (void);
+ // Returns the operation containing special marshaling information,
// this makes sense if not all arguments get marshaled, e.g. AMI
- // sendc_ operations
+ // sendc_ operations.
- virtual be_operation *arguments ();
- // returns a customized arguments list, e.g. AMI sendc_ operations
+ virtual be_operation *arguments (void);
+ // Returns a customized arguments list, e.g. AMI sendc_ operations
// only use the in and inout arguments but not the out arguments,
// also the first argument is the reply handler.
protected:
be_operation *node_;
- // The node we strategize
+ // The node we strategize.
Strategy_Kind strategy_type_;
- // the type of strategy
+ // The type of strategy.
};
-// Default (do nothing) strategy for operations
-
+// Default (do nothing) strategy for operations.
class be_operation_default_strategy
: public be_operation_strategy
{
@@ -83,7 +84,7 @@ public:
virtual ~be_operation_default_strategy ();
- // overridden methods.
+ // Overridden methods.
TAO_CodeGen::CG_STATE next_state (TAO_CodeGen::CG_STATE current_state,
int is_extra_state = 0);
@@ -92,51 +93,48 @@ public:
// Strategy to mark normal reply handler operations
// in order to have them generate the reply stub
-// alias client skeleton for AMI
-
+// alias client skeleton for AMI.
class be_operation_ami_handler_reply_stub_strategy
: public be_operation_strategy
{
public:
be_operation_ami_handler_reply_stub_strategy (be_operation *node);
- virtual ~be_operation_ami_handler_reply_stub_strategy ();
+ virtual ~be_operation_ami_handler_reply_stub_strategy (void);
- // overridden methods.
+ // Overridden methods.
TAO_CodeGen::CG_STATE next_state (TAO_CodeGen::CG_STATE current_state,
int is_extra_state = 0);
virtual int has_extra_code_generation (TAO_CodeGen::CG_STATE current_state);
- // returns true if we have to genrate extra code.
+ // Returns true if we have to genrate extra code.
};
// Strategy to mark normal sendc_ operations
// in AMI mode.
-
-class be_operation_ami_sendc_strategy
- : public be_operation_strategy
+class be_operation_ami_sendc_strategy : public be_operation_strategy
{
public:
be_operation_ami_sendc_strategy (be_operation *node,
be_operation *marshaling,
be_operation *arguments);
- virtual ~be_operation_ami_sendc_strategy ();
+ virtual ~be_operation_ami_sendc_strategy (void);
- // overridden methods.
+ // Overridden methods.
TAO_CodeGen::CG_STATE next_state (TAO_CodeGen::CG_STATE current_state,
int is_extra_state = 0);
virtual int has_extra_code_generation (TAO_CodeGen::CG_STATE current_state);
- // returns true if we have to genrate extra code.
+ // Returns true if we have to genrate extra code.
- virtual be_operation *marshaling ();
- // returns the operation containing special marshaling information,
+ virtual be_operation *marshaling (void);
+ // Returns the operation containing special marshaling information,
// this makes sense if not all arguments get marshaled, e.g. AMI
// sendc_ operations
- virtual be_operation *arguments ();
+ virtual be_operation *arguments (void);
// returns a customized arguments list, e.g. AMI sendc_ operations
// only use the in and inout arguments but not the out arguments,
// also the first argument is the reply handler.
@@ -148,7 +146,6 @@ private:
// Strategy for raise operations in the AMI exception
// holder valuetype.
-
class be_operation_ami_exception_holder_raise_strategy
: public be_operation_strategy
{
@@ -157,14 +154,15 @@ public:
virtual ~be_operation_ami_exception_holder_raise_strategy ();
- // overridden methods.
- virtual TAO_CodeGen::CG_STATE next_state (TAO_CodeGen::CG_STATE current_state,
- int is_extra_state = 0);
+ // Overridden methods.
+ virtual TAO_CodeGen::CG_STATE next_state (
+ TAO_CodeGen::CG_STATE current_state,
+ int is_extra_state = 0
+ );
};
-// AMH strategy
-
+// AMH strategy.
class be_operation_amh_strategy
: public be_operation_strategy
{
@@ -173,13 +171,13 @@ public:
virtual ~be_operation_amh_strategy ();
- // overridden methods.
+ // Overridden methods.
TAO_CodeGen::CG_STATE next_state (TAO_CodeGen::CG_STATE current_state,
int is_extra_state = 0);
virtual int has_extra_code_generation (TAO_CodeGen::CG_STATE current_state);
- virtual be_operation *arguments ();
+ virtual be_operation *arguments (void);
private:
be_operation *arguments_;
diff --git a/TAO/TAO_IDL/be_include/be_predefined_type.h b/TAO/TAO_IDL/be_include/be_predefined_type.h
index 0860729e6f2..57ae1a7a62a 100644
--- a/TAO/TAO_IDL/be_include/be_predefined_type.h
+++ b/TAO/TAO_IDL/be_include/be_predefined_type.h
@@ -42,14 +42,14 @@ public:
// Visiting.
virtual int accept (be_visitor* visitor);
+ // Cleanup.
+ virtual void destroy (void);
+
// Narrowing.
DEF_NARROW_METHODS2 (be_predefined_type, AST_PredefinedType, be_type);
DEF_NARROW_FROM_DECL (be_predefined_type);
protected:
- virtual int compute_size_type (void);
- // Compute the size type if it is unknown.
-
virtual void compute_tc_name (void);
// Overridden method.
diff --git a/TAO/TAO_IDL/be_include/be_sequence.h b/TAO/TAO_IDL/be_include/be_sequence.h
index abf916c0b56..6d7ec629437 100644
--- a/TAO/TAO_IDL/be_include/be_sequence.h
+++ b/TAO/TAO_IDL/be_include/be_sequence.h
@@ -48,6 +48,7 @@ public:
MNG_STRING,
MNG_WSTRING,
MNG_OBJREF,
+ MNG_ABSTRACT,
MNG_VALUE,
MNG_PSEUDO
};
@@ -57,11 +58,12 @@ public:
be_sequence (AST_Expression *v,
AST_Type *bt,
+ UTL_ScopedName *n,
idl_bool local,
idl_bool abstract);
// Constructor.
- virtual int create_name (be_typedef *node=0);
+ virtual int create_name (be_typedef *node = 0);
// Create a name for ourselves. If we are typedefed, then we get the name of
// the typedef node, else we generate a name for ourselves.
diff --git a/TAO/TAO_IDL/be_include/be_string.h b/TAO/TAO_IDL/be_include/be_string.h
index 236cb1bc64c..b13c4218ded 100644
--- a/TAO/TAO_IDL/be_include/be_string.h
+++ b/TAO/TAO_IDL/be_include/be_string.h
@@ -35,16 +35,18 @@ public:
be_string (void);
// Default constructor.
- be_string (AST_Expression *v);
- // Constructor.
-
- be_string (AST_Expression *v,
- long wide);
+ be_string (AST_Decl::NodeType nt,
+ UTL_ScopedName *n,
+ AST_Expression *v,
+ long width);
// Constructor.
// Visiting.
virtual int accept (be_visitor *visitor);
+ // Cleanup.
+ virtual void destroy (void);
+
// Narrowing.
DEF_NARROW_METHODS2 (be_string, AST_String, be_type);
DEF_NARROW_FROM_DECL (be_string);
diff --git a/TAO/TAO_IDL/be_include/be_structure.h b/TAO/TAO_IDL/be_include/be_structure.h
index aa950558a31..8830f052572 100644
--- a/TAO/TAO_IDL/be_include/be_structure.h
+++ b/TAO/TAO_IDL/be_include/be_structure.h
@@ -66,10 +66,6 @@ public:
DEF_NARROW_METHODS3 (be_structure, AST_Structure, be_scope, be_type);
DEF_NARROW_FROM_DECL (be_structure);
DEF_NARROW_FROM_SCOPE (be_structure);
-
-protected:
- virtual int compute_size_type (void);
- // Compute the size type if it is unknown.
};
#endif
diff --git a/TAO/TAO_IDL/be_include/be_structure_fwd.h b/TAO/TAO_IDL/be_include/be_structure_fwd.h
new file mode 100644
index 00000000000..6627e9ade78
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_structure_fwd.h
@@ -0,0 +1,58 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_structure_fwd.h
+//
+// = DESCRIPTION
+// Extension of class AST_StructureFwd that provides additional
+// means for C++ mapping of a struct.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef BE_STRUCTURE_FWD_H
+#define BE_STRUCTURE_FWD_H
+
+#include "be_type.h"
+#include "ast_structure_fwd.h"
+
+class be_visitor;
+
+class be_structure_fwd : public virtual AST_StructureFwd,
+ public virtual be_type
+{
+ // =TITLE
+ // be_structure_fwd
+ //
+ // =DESCRIPTION
+ // Extensions to the AST_StructureFwd class
+public:
+ be_structure_fwd (void);
+ // Default constructor.
+
+ be_structure_fwd (UTL_ScopedName *n);
+ // Constructor.
+
+ virtual ~be_structure_fwd (void);
+ // Destructor.
+
+ virtual void destroy (void);
+ // Cleanup function.
+
+ // Visiting.
+ virtual int accept (be_visitor* visitor);
+
+ // Narrowing.
+ DEF_NARROW_METHODS2 (be_structure_fwd, AST_StructureFwd, be_type);
+ DEF_NARROW_FROM_DECL (be_structure_fwd);
+};
+
+#endif // if !defined
diff --git a/TAO/TAO_IDL/be_include/be_type.h b/TAO/TAO_IDL/be_include/be_type.h
index 53981f7c67a..760f53b9d0e 100644
--- a/TAO/TAO_IDL/be_include/be_type.h
+++ b/TAO/TAO_IDL/be_include/be_type.h
@@ -69,11 +69,6 @@ public:
// are non null, it computes and returns a tc name. Else, it also
// stores the result in a member variable.
- virtual const char *nested_type_name (be_decl *d,
- const char *suffix = 0,
- const char *prefix = 0);
- // Type name of a node used when generating declarations.
-
virtual const char *nested_sp_type_name (be_decl *use_scope,
const char *suffix = 0,
const char *prefix = 0);
@@ -100,18 +95,8 @@ protected:
virtual void compute_tc_name (void);
// Computes the fully scoped typecode name.
- virtual const char *nested_name (const char* local_name,
- const char* full_name,
- be_decl *use_scope,
- const char *suffix,
- const char *prefix);
- // Type name of a node used when generating declarations.
-
UTL_ScopedName *tc_name_;
// Typecode name.
-
- char *nested_type_name_;
- // For the corresponding method.
};
#endif // end of if !defined
diff --git a/TAO/TAO_IDL/be_include/be_typedef.h b/TAO/TAO_IDL/be_include/be_typedef.h
index 842d64ed3cd..dd9de21206e 100644
--- a/TAO/TAO_IDL/be_include/be_typedef.h
+++ b/TAO/TAO_IDL/be_include/be_typedef.h
@@ -57,11 +57,6 @@ public:
// Narrowing.
DEF_NARROW_METHODS2 (be_typedef, AST_Typedef, be_type);
DEF_NARROW_FROM_DECL (be_typedef);
-
-protected:
- virtual int compute_size_type (void);
- // Compute the size type if it is unknown.
-
};
#endif
diff --git a/TAO/TAO_IDL/be_include/be_union.h b/TAO/TAO_IDL/be_include/be_union.h
index 4463f06e849..2901fa1bf2f 100644
--- a/TAO/TAO_IDL/be_include/be_union.h
+++ b/TAO/TAO_IDL/be_include/be_union.h
@@ -37,10 +37,10 @@ public:
be_union (void);
// Default constructor.
- be_union(AST_ConcreteType *dt,
- UTL_ScopedName *n,
- idl_bool local,
- idl_bool abstract);
+ be_union (AST_ConcreteType *dt,
+ UTL_ScopedName *n,
+ idl_bool local,
+ idl_bool abstract);
// Constructor.
virtual int gen_var_defn (char *local_name = 0);
@@ -70,10 +70,6 @@ public:
DEF_NARROW_METHODS3 (be_union, AST_Union, be_scope, be_type);
DEF_NARROW_FROM_DECL(be_union);
DEF_NARROW_FROM_SCOPE(be_union);
-
-protected:
- virtual int compute_size_type (void);
- // Compute the size type if it is unknown.
};
#endif
diff --git a/TAO/TAO_IDL/be_include/be_union_branch.h b/TAO/TAO_IDL/be_include/be_union_branch.h
index d98f1519ec6..940fb93cdfe 100644
--- a/TAO/TAO_IDL/be_include/be_union_branch.h
+++ b/TAO/TAO_IDL/be_include/be_union_branch.h
@@ -26,8 +26,10 @@
#include "ast_union_branch.h"
class UTL_LabelList;
-class UTL_Type;
+class AST_Type;
class be_visitor;
+class TAO_OutStream;
+class be_union;
class be_union_branch : public virtual AST_UnionBranch,
public virtual be_decl
@@ -55,10 +57,6 @@ public:
// Narrowing.
DEF_NARROW_METHODS2 (be_union_branch, AST_UnionBranch, be_decl);
DEF_NARROW_FROM_DECL (be_union_branch);
-
-protected:
- virtual int compute_size_type (void);
- // Compute the size type if it is unknown.
};
#endif
diff --git a/TAO/TAO_IDL/be_include/be_union_fwd.h b/TAO/TAO_IDL/be_include/be_union_fwd.h
new file mode 100644
index 00000000000..c9d2132983a
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_union_fwd.h
@@ -0,0 +1,58 @@
+/* -*- c++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_union_fwd.h
+//
+// = DESCRIPTION
+// Extension of class AST_UnionFwd that provides additional
+// means for C++ mapping of a union.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef BE_UNION_FWD_H
+#define BE_UNION_FWD_H
+
+#include "be_type.h"
+#include "ast_union_fwd.h"
+
+class be_visitor;
+
+class be_union_fwd : public virtual AST_UnionFwd,
+ public virtual be_type
+{
+ // =TITLE
+ // be_union_fwd
+ //
+ // =DESCRIPTION
+ // Extensions to the AST_UnionFwd class
+public:
+ be_union_fwd (void);
+ // Default constructor.
+
+ be_union_fwd (UTL_ScopedName *n);
+ // Constructor.
+
+ virtual ~be_union_fwd (void);
+ // Destructor.
+
+ virtual void destroy (void);
+ // Cleanup function.
+
+ // Visiting.
+ virtual int accept (be_visitor* visitor);
+
+ // Narrowing.
+ DEF_NARROW_METHODS2 (be_union_fwd, AST_UnionFwd, be_type);
+ DEF_NARROW_FROM_DECL (be_union_fwd);
+};
+
+#endif // if !defined
diff --git a/TAO/TAO_IDL/be_include/be_valuetype.h b/TAO/TAO_IDL/be_include/be_valuetype.h
index 44af6358e4b..be9c0b63feb 100644
--- a/TAO/TAO_IDL/be_include/be_valuetype.h
+++ b/TAO/TAO_IDL/be_include/be_valuetype.h
@@ -19,10 +19,13 @@
#define TAO_BE_VALUETYPE_H
#include "be_interface.h"
+#include "ast_valuetype.h"
+#include "ast_field.h"
class TAO_OutStream;
-class be_valuetype : public virtual be_interface
+class be_valuetype : public virtual be_interface,
+ public virtual AST_ValueType
{
// = TITLE
// Backend-class for valuetypes
@@ -36,17 +39,23 @@ public:
// Default constructor.
be_valuetype (UTL_ScopedName *n,
- AST_Interface **ih,
- long nih,
- idl_bool set_abstract = 0);
+ AST_Interface **inherits,
+ long n_inherits,
+ AST_ValueType *inherits_concrete,
+ AST_Interface **inherits_flat,
+ long n_inherits_flat,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface *supports_concrete,
+ idl_bool abstract,
+ idl_bool truncatable);
// Constructor that sets its scoped name <n>, a list of inherited valuetypes
- // and supported interfaces <ih>, the number of inherited interfaces <nih>,
- // and any pragmas <p>.
+ // and supported interfaces <ih>, and the number of inherited interfaces <nih>
~be_valuetype (void);
// Destructor.
- virtual void redefine (AST_Interface *from);
+ virtual void redefine (AST_ValueType *from);
idl_bool opt_accessor (void);
// Should generate optimized form?
@@ -66,15 +75,15 @@ public:
// Generate the _out implementation.
virtual int gen_helper_header (char *local_name = 0,
- char *full_name = 0);
+ char *full_name = 0);
// Generate the helper functions definition.
virtual int gen_helper_inline (char *local_name = 0,
- char *full_name = 0);
+ char *full_name = 0);
// Generate the helper functions inline implementation.
virtual int gen_helper_stubs (char *local_name = 0,
- char *full_name = 0);
+ char *full_name = 0);
// Generate the helper functions implementation.
const char *full_obv_skel_name (void);
@@ -87,11 +96,32 @@ public:
// For building the name for private data fields.
be_valuetype *statefull_inherit (void);
+ /// Load the insert queue with all the interfaces we support, and
+ /// call the generic version of traverse_inheritance_graph().
+ int traverse_supports_list_graphs (
+ tao_code_emitter gen,
+ TAO_OutStream *os,
+ idl_bool abstract_paths_only = I_FALSE
+ );
+
+ /// Load the insert queue with the concrete interface we support, and
+ /// call the generic version of traverse_inheritance_graph().
+ int traverse_concrete_inheritance_graph (
+ tao_code_emitter gen,
+ TAO_OutStream *os
+ );
+
+ idl_bool supports_abstract (void) const;
+ // Do we support at least one abstract interface?
+
// Visiting.
virtual int accept (be_visitor *visitor);
+ // Cleanup.
+ virtual void destroy (void);
+
// Narrowing.
- DEF_NARROW_METHODS1 (be_valuetype, be_interface);
+ DEF_NARROW_METHODS2 (be_valuetype, be_interface, AST_ValueType);
DEF_NARROW_FROM_DECL (be_valuetype);
DEF_NARROW_FROM_SCOPE (be_valuetype);
@@ -106,8 +136,29 @@ public:
virtual idl_bool in_recursion (AST_Type *node = 0);
// Check if we are in recursion.
+ static int abstract_supports_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os);
+ // Helper method passed to the template method to generate code for
+ // adding abstract supported interfaces to the inheritance list.
+
+ static int gen_abstract_init_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os);
+ // Helper method to initialize the val_ member of the generated
+ // C++ class for each abstract interface that we support.
+
+ static int gen_skel_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os);
+ // Helper method to generate *_skel operations for the concrete
+ // interface that we support (if any) and those of its base classes.
+
private:
char *full_obv_skel_name_;
+
+ idl_bool supports_abstract_;
+ // Do we support at least one abstract interface?
};
#endif // if !defined
diff --git a/TAO/TAO_IDL/be_include/be_valuetype_fwd.h b/TAO/TAO_IDL/be_include/be_valuetype_fwd.h
index 61f483a8892..1de0fc25b44 100644
--- a/TAO/TAO_IDL/be_include/be_valuetype_fwd.h
+++ b/TAO/TAO_IDL/be_include/be_valuetype_fwd.h
@@ -25,8 +25,10 @@
#define BE_VALUETYPE_FWD_H
#include "be_interface_fwd.h"
+#include "ast_valuetype_fwd.h"
-class be_valuetype_fwd : public virtual be_interface_fwd
+class be_valuetype_fwd : public virtual be_interface_fwd,
+ public virtual AST_ValueTypeFwd
{
// =TITLE
// be_valuetype_fwd
@@ -44,13 +46,14 @@ public:
virtual ~be_valuetype_fwd (void);
// Destructor.
- virtual void set_abstract_valuetype (void);
-
// Visiting.
virtual int accept (be_visitor* visitor);
+ // Cleanup
+ virtual void destroy (void);
+
// Narrowing.
- DEF_NARROW_METHODS1 (be_valuetype_fwd, be_interface_fwd);
+ DEF_NARROW_METHODS2 (be_valuetype_fwd, be_interface_fwd, AST_ValueTypeFwd);
DEF_NARROW_FROM_DECL (be_valuetype_fwd);
};
diff --git a/TAO/TAO_IDL/be_include/be_visitor.h b/TAO/TAO_IDL/be_include/be_visitor.h
index 2434d5655b0..e326965ddc8 100644
--- a/TAO/TAO_IDL/be_include/be_visitor.h
+++ b/TAO/TAO_IDL/be_include/be_visitor.h
@@ -34,8 +34,12 @@ class be_interface;
class be_interface_fwd;
class be_valuetype;
class be_valuetype_fwd;
+class be_component;
+class be_component_fwd;
+class be_home;
class be_factory;
class be_structure;
+class be_structure_fwd;
class be_exception;
class be_expression;
class be_enum;
@@ -44,6 +48,7 @@ class be_field;
class be_argument;
class be_attribute;
class be_union;
+class be_union_fwd;
class be_union_branch;
class be_union_label;
class be_constant;
@@ -100,12 +105,24 @@ public:
virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
// visit valuetype_fwd
+ virtual int visit_component (be_component *node);
+ // visit component
+
+ virtual int visit_component_fwd (be_component_fwd *node);
+ // visit component_fwd
+
+ virtual int visit_home (be_home *node);
+ // visit component home
+
virtual int visit_factory (be_factory *node);
// Visit a OBV factory construct.
virtual int visit_structure (be_structure *node);
// visit a structure
+ virtual int visit_structure_fwd (be_structure_fwd *node);
+ // visit a structure
+
virtual int visit_exception (be_exception *node);
// visit exception
@@ -130,6 +147,9 @@ public:
virtual int visit_union (be_union *node);
// visit union
+ virtual int visit_union_fwd (be_union_fwd *node);
+ // visit union
+
virtual int visit_union_branch (be_union_branch *node);
// visit union branch
diff --git a/TAO/TAO_IDL/be_include/be_visitor_amh_pre_proc.h b/TAO/TAO_IDL/be_include/be_visitor_amh_pre_proc.h
index 8e3920eb026..700a1510d48 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_amh_pre_proc.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_amh_pre_proc.h
@@ -18,14 +18,8 @@
#ifndef TAO_BE_VISITOR_AMH_PRE_PROC_H
#define TAO_BE_VISITOR_AMH_PRE_PROC_H
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_root.h"
-#include "be_module.h"
-#include "be_interface.h"
#include "be_visitor_scope.h"
+#include "ace/SString.h"
/**
* @class be_visitor_amh_pre_proc
@@ -35,7 +29,8 @@
class be_visitor_amh_pre_proc : public be_visitor_scope
{
private:
- typedef enum {
+ typedef enum
+ {
NORMAL,
GET_OPERATION,
SET_OPERATION
diff --git a/TAO/TAO_IDL/be_include/be_visitor_ami_pre_proc.h b/TAO/TAO_IDL/be_include/be_visitor_ami_pre_proc.h
index 53d98fdf0ff..a4aba407390 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_ami_pre_proc.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_ami_pre_proc.h
@@ -25,15 +25,10 @@
#ifndef TAO_BE_VISITOR_AMI_PRE_PROC_H
#define TAO_BE_VISITOR_AMI_PRE_PROC_H
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_root.h"
-#include "be_module.h"
-#include "be_interface.h"
#include "be_visitor_scope.h"
+#include "ace/SString.h"
+class AST_Interface;
class be_visitor_ami_pre_proc : public be_visitor_scope
{
@@ -47,7 +42,8 @@ class be_visitor_ami_pre_proc : public be_visitor_scope
private:
typedef AST_Interface *AST_Interface_ptr;
- typedef enum {
+ typedef enum
+ {
NORMAL,
GET_OPERATION,
SET_OPERATION
@@ -119,7 +115,6 @@ private:
be_operation *generate_set_operation (be_attribute *node);
// generate a set operation out of the attribute.
-
};
diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument.h b/TAO/TAO_IDL/be_include/be_visitor_argument.h
index 2f0961a36d0..e9ce10fd640 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_argument.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_argument.h
@@ -22,7 +22,8 @@
#ifndef _BE_VISITOR_ARGUMENT_H
#define _BE_VISITOR_ARGUMENT_H
-#include "be_visitor_decl.h"
+#include "idl_defines.h"
+
#include "be_visitor_scope.h"
#include "be_visitor_argument/argument.h"
#include "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
index dec4beb6a0a..c5d61e09a04 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_argument/argument.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_argument/argument.h
@@ -21,6 +21,8 @@
#ifndef _BE_VISITOR_ARGUMENT_ARGUMENT_H_
#define _BE_VISITOR_ARGUMENT_ARGUMENT_H_
+#include "ast_argument.h"
+
class be_visitor_args : public be_visitor_decl
{
//
@@ -45,7 +47,8 @@ public:
// destructor
//= helper
- virtual const char *type_name (be_type *type, const char *suffix=0);
+ 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
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
index 6edd77f21b1..346fe3154f8 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_argument/marshal_ss.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_argument/marshal_ss.h
@@ -25,6 +25,7 @@
// ************************************************************
// class be_visitor_args_marshal_ss
// ************************************************************
+
class be_visitor_args_marshal_ss : public be_visitor_args
{
//
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
index 3b9aa9c8b63..2c9af16ce5d 100644
--- 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
@@ -44,35 +44,6 @@ public:
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
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
index c2eaac62162..0f0db659a35 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_argument/upcall_ss.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_argument/upcall_ss.h
@@ -25,6 +25,7 @@
// ************************************************************
// class be_visitor_args_upcall_ss
// ************************************************************
+
class be_visitor_args_upcall_ss : public be_visitor_args
{
//
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
index 9faa901fc69..374f1f1a2ee 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_argument/vardecl_ss.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_argument/vardecl_ss.h
@@ -25,6 +25,7 @@
// ************************************************************
// class be_visitor_args_vardecl_ss
// ************************************************************
+
class be_visitor_args_vardecl_ss : public be_visitor_args
{
//
diff --git a/TAO/TAO_IDL/be_include/be_visitor_array.h b/TAO/TAO_IDL/be_include/be_visitor_array.h
index 619792ff8b1..cd50794076b 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_array.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_array.h
@@ -21,10 +21,10 @@
#ifndef TAO_BE_VISITOR_ARRAY_H
#define TAO_BE_VISITOR_ARRAY_H
+#include "idl_defines.h"
+
#include "be_visitor_decl.h"
-// 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"
diff --git a/TAO/TAO_IDL/be_include/be_visitor_array/array.h b/TAO/TAO_IDL/be_include/be_visitor_array/array.h
index 5fa6a4aab4c..a6d9fd9832b 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_array/array.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_array/array.h
@@ -56,6 +56,12 @@ public:
virtual int visit_interface_fwd (be_interface_fwd *node);
// visit an interface forward node
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit a valuetype
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit a valuetype forward node
+
virtual int visit_predefined_type (be_predefined_type *node);
// visit a predefined type node
@@ -78,7 +84,6 @@ 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_cs.h b/TAO/TAO_IDL/be_include/be_visitor_array/array_cs.h
index 98c3e8f6c2c..1a6509e579b 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_array/array_cs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_array/array_cs.h
@@ -43,7 +43,6 @@ public:
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_array/cdr_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_ch.h
index a45af118541..2a0d889efe5 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_ch.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_ch.h
@@ -46,7 +46,6 @@ public:
virtual int visit_array (be_array *node);
// visit array
-
};
#endif /* _BE_VISITOR_ARRAY_CDR_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_ci.h b/TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_ci.h
index ef8caeabe43..437fbf15255 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_ci.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_ci.h
@@ -58,6 +58,12 @@ public:
virtual int visit_interface_fwd (be_interface_fwd *node);
// visit an interface forward node
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit a valuetype
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit a valuetype forward node
+
virtual int visit_predefined_type (be_predefined_type *node);
// visit a predefined type node
@@ -77,10 +83,8 @@ public:
// visit union
protected:
-
int visit_node (be_type *);
// helper that does the common job
-
};
#endif /* _BE_VISITOR_ARRAY_CDR_OP_CI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_cs.h
index dc79510ed78..1f57c759dfe 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_cs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_cs.h
@@ -50,7 +50,6 @@ public:
virtual int visit_array (be_array *node);
// visit array
-
};
#endif /* _BE_VISITOR_ARRAY_CDR_OP_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 9c5aa46988e..66ba0d3c30b 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_attribute.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_attribute.h
@@ -22,8 +22,7 @@
#ifndef TAO_BE_VISITOR_ATTRIBUTE_H
#define TAO_BE_VISITOR_ATTRIBUTE_H
-#include "be_visitor.h"
-#include "be_visitor_scope.h"
+#include "be_visitor_decl.h"
#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
index 1c2493722c0..39e0f8f08c8 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_attribute/attribute.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_attribute/attribute.h
@@ -46,7 +46,6 @@ public:
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_component.h b/TAO/TAO_IDL/be_include/be_visitor_component.h
new file mode 100644
index 00000000000..67e63e73cda
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component.h
@@ -0,0 +1,27 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_component.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component class
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_COMPONENT_H
+#define TAO_BE_VISITOR_COMPONENT_H
+
+#include "be_visitor_scope.h"
+
+#endif
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component_fwd.h b/TAO/TAO_IDL/be_include/be_visitor_component_fwd.h
new file mode 100644
index 00000000000..cf2c856aac2
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component_fwd.h
@@ -0,0 +1,27 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_component_fwd.h
+//
+// = DESCRIPTION
+// Concrete visitor for the forward declared component class.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_COMPONENT_FWD_H
+#define TAO_BE_VISITOR_COMPONENT_FWD_H
+
+#include "be_visitor_decl.h"
+
+#endif
diff --git a/TAO/TAO_IDL/be_include/be_visitor_constant.h b/TAO/TAO_IDL/be_include/be_visitor_constant.h
index acc6f65d31f..5b5d1e9f616 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_constant.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_constant.h
@@ -22,8 +22,7 @@
#ifndef TAO_BE_VISITOR_CONSTANT_H
#define TAO_BE_VISITOR_CONSTANT_H
-#include "be_visitor.h"
-#include "be_visitor_scope.h"
+#include "be_visitor_decl.h"
#include "be_visitor_constant/constant_ch.h"
#include "be_visitor_constant/constant_cs.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
index c0e53447176..f902c16864d 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_constant/constant_ch.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_constant/constant_ch.h
@@ -41,7 +41,6 @@ public:
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_context.h b/TAO/TAO_IDL/be_include/be_visitor_context.h
index 0487711615a..4316d420ca4 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_context.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_context.h
@@ -26,6 +26,34 @@
#ifndef TAO_BE_VISITOR_CONTEXT_H
#define TAO_BE_VISITOR_CONTEXT_H
+#include "be_codegen.h"
+#include "idl_bool.h"
+
+class TAO_OutStream;
+class be_decl;
+class be_typedef;
+class be_attribute;
+class be_interface;
+class be_interface_fwd;
+class be_argument;
+class be_array;
+class be_constant;
+class be_enum;
+class be_enum_val;
+class be_exceptionl;
+class be_field;
+class be_module;
+class be_operation;
+class be_exception;
+class be_predefined_type;
+class be_root;
+class be_sequence;
+class be_string;
+class be_structure;
+class be_typedef;
+class be_union;
+class be_union_branch;
+
class be_visitor_context
{
public:
@@ -106,7 +134,7 @@ public:
idl_bool comma (void);
// are we supposed to generate a comma?
- be_interface* interface (void) const;
+ be_interface *interface (void) const;
void interface (be_interface*);
// In some cases we need to generate the objects of one interface as
// members of a derived visitor (the TIE classes are a good
diff --git a/TAO/TAO_IDL/be_include/be_visitor_enum.h b/TAO/TAO_IDL/be_include/be_visitor_enum.h
index d8deaff8f47..4aaffbd4825 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_enum.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_enum.h
@@ -22,7 +22,6 @@
#ifndef TAO_BE_VISITOR_ENUM_H
#define TAO_BE_VISITOR_ENUM_H
-#include "be_visitor.h"
#include "be_visitor_scope.h"
#include "be_visitor_enum/enum_ch.h"
#include "be_visitor_enum/enum_cs.h"
diff --git a/TAO/TAO_IDL/be_include/be_visitor_enum/cdr_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_enum/cdr_op_ch.h
index c8ba0e49f81..70880813b57 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_enum/cdr_op_ch.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_enum/cdr_op_ch.h
@@ -22,7 +22,7 @@
#ifndef _BE_VISITOR_ENUM_CDR_OP_CH_H_
#define _BE_VISITOR_ENUM_CDR_OP_CH_H_
-class be_visitor_enum_cdr_op_ch : public be_visitor_scope
+class be_visitor_enum_cdr_op_ch : public be_visitor_decl
{
//
// = TITLE
diff --git a/TAO/TAO_IDL/be_include/be_visitor_enum/cdr_op_ci.h b/TAO/TAO_IDL/be_include/be_visitor_enum/cdr_op_ci.h
index 59ea94f3486..71cbfe57906 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_enum/cdr_op_ci.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_enum/cdr_op_ci.h
@@ -22,7 +22,7 @@
#ifndef _BE_VISITOR_ENUM_CDR_OP_CI_H_
#define _BE_VISITOR_ENUM_CDR_OP_CI_H_
-class be_visitor_enum_cdr_op_ci : public be_visitor_scope
+class be_visitor_enum_cdr_op_ci : public be_visitor_decl
{
//
// = TITLE
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
index a40455f2190..412842ed536 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_enum/enum_cs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_enum/enum_cs.h
@@ -41,7 +41,6 @@ public:
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 8de0ab1aea0..28558f21d21 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_exception.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_exception.h
@@ -22,7 +22,6 @@
#ifndef TAO_BE_VISITOR_EXCEPTION_H
#define TAO_BE_VISITOR_EXCEPTION_H
-#include "be_visitor.h"
#include "be_visitor_scope.h"
#include "be_visitor_enum.h"
#include "be_visitor_structure.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
index 80529d2a203..ce696bb600a 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_exception/ctor.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_exception/ctor.h
@@ -60,6 +60,12 @@ public:
virtual int visit_interface_fwd (be_interface_fwd *node);
// visit interface forward
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit valuetype
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit valuetype forward
+
virtual int visit_predefined_type (be_predefined_type *node);
// visit predefined type
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
index 52b6ab67dd7..e5f215fc179 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_exception/ctor_assign.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_exception/ctor_assign.h
@@ -58,6 +58,12 @@ public:
virtual int visit_interface_fwd (be_interface_fwd *node);
// visit interface forward
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit valuetype
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit valuetype forward
+
virtual int visit_predefined_type (be_predefined_type *node);
// visit predefined type
diff --git a/TAO/TAO_IDL/be_include/be_visitor_factory.h b/TAO/TAO_IDL/be_include/be_visitor_factory.h
index 4eb8b631457..984bc673db2 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_factory.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_factory.h
@@ -10,8 +10,7 @@
// be_visitor_factory.h
//
// = DESCRIPTION
-// Define an abstract visitor Factory and a bunch of concrete visitor
-// factories (whcih are singletons).
+// Define a visitor Factory which is a singleton.
//
// = AUTHOR
// Aniruddha Gokhale
@@ -21,70 +20,32 @@
#ifndef TAO_BE_VISITOR_FACTORY_H
#define TAO_BE_VISITOR_FACTORY_H
+#include "ace/Singleton.h"
+#include "ace/Synch.h"
+
+class be_visitor;
+class be_visitor_context;
+
class TAO_Visitor_Factory
{
// =TITLE
// TAO_Visitor_Factory
//
// =DESCRIPTION
- // An abstract visitor factory class
+ // Visitor factory class
public:
TAO_Visitor_Factory (void);
- // constructor
-
- virtual ~TAO_Visitor_Factory (void);
- // destructor
-
- virtual be_visitor *make_visitor (be_visitor_context *) = 0;
- // make a visitor
-};
-
-class TAO_Common_Visitor_Factory : public TAO_Visitor_Factory
-{
- // =TITLE
- // TAO_Common_Visitor_Factory
- //
- // =DESCRIPTION
- // A concrete visitor factory for generating the visitors irrsepective of
- // whether we use compiled or interpretive marshaling
-
-public:
-
- TAO_Common_Visitor_Factory (void);
- // constructor
-
- virtual ~TAO_Common_Visitor_Factory (void);
- // destructor
-
- virtual be_visitor *make_visitor (be_visitor_context *);
- // make the right visitor based on the context and code generation state
-};
-
-class TAO_Compiled_Visitor_Factory : public TAO_Visitor_Factory
-{
- // =TITLE
- // TAO_Compiled_Visitor_Factory
- //
- // =DESCRIPTION
- // A concrete visitor factory for generating the visitors for stubs and
- // skeletons using compiled marshaling.
-
-public:
-
- TAO_Compiled_Visitor_Factory (void);
- // constructor
- virtual ~TAO_Compiled_Visitor_Factory (void);
- // destructor
+ ~TAO_Visitor_Factory (void);
- virtual be_visitor *make_visitor (be_visitor_context *);
- // make the right visitor based on the context and code generation state
+ be_visitor *make_visitor (be_visitor_context *);
+ // Make a visitor.
};
-// Singleton instance of the BE Visitor Factory
-typedef ACE_Singleton<TAO_Common_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX> TAO_COMMON_VISITOR_FACTORY;
-typedef ACE_Singleton<TAO_Compiled_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX> TAO_COMPILED_VISITOR_FACTORY;
+// Singleton instance of the BE Visitor Factory.
+typedef ACE_Singleton<TAO_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX>
+ TAO_VISITOR_FACTORY;
#endif /* if !defined _TAO_BE_VISITOR_FACTORY_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_field.h b/TAO/TAO_IDL/be_include/be_visitor_field.h
index 47913a1c9c4..a788e759bea 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_field.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_field.h
@@ -21,8 +21,9 @@
#ifndef TAO_BE_VISITOR_FIELD_H
#define TAO_BE_VISITOR_FIELD_H
-#include "be_visitor_decl.h"
+#include "idl_defines.h"
+#include "be_visitor_scope.h"
#include "be_visitor_field/field_ch.h"
#include "be_visitor_field/field_ci.h"
#include "be_visitor_field/field_cs.h"
diff --git a/TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_ch.h
index 0e3a9555fd6..16cad59d193 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_ch.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_ch.h
@@ -60,7 +60,6 @@ public:
virtual int visit_union (be_union *node);
// visit union type
-
};
#endif /* _BE_VISITOR_FIELD_CDR_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_ci.h b/TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_ci.h
index 7f00116e9aa..7692e8625e8 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_ci.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_ci.h
@@ -22,8 +22,6 @@
#ifndef _BE_VISITOR_FIELD_CDR_OP_CI_H_
#define _BE_VISITOR_FIELD_CDR_OP_CI_H_
-#include "be_visitor_scope.h"
-
class be_visitor_field_cdr_op_ci : public be_visitor_decl
{
//
@@ -57,6 +55,12 @@ public:
virtual int visit_interface_fwd (be_interface_fwd *node);
// visit interface forward type
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit interface type
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit interface forward type
+
virtual int visit_predefined_type (be_predefined_type *node);
// visit predefined type
@@ -74,10 +78,6 @@ public:
virtual int visit_union (be_union *node);
// visit union type
-
- virtual int visit_valuetype (be_valuetype *node);
- // visit valuetype
-
};
class be_visitor_cdr_op_field_decl : public be_visitor_scope
diff --git a/TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_cs.h
index dd5731bac68..5e8fe547b4d 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_cs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_cs.h
@@ -22,8 +22,6 @@
#ifndef _BE_VISITOR_FIELD_CDR_OP_CS_H_
#define _BE_VISITOR_FIELD_CDR_OP_CS_H_
-#include "be_visitor_scope.h"
-
class be_visitor_field_cdr_op_cs : public be_visitor_decl
{
//
@@ -51,7 +49,6 @@ public:
virtual int visit_structure (be_structure *node);
virtual int visit_typedef (be_typedef *node);
virtual int visit_union (be_union *node);
-
};
#endif /* _BE_VISITOR_FIELD_CDR_OP_CS_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
index 942d3f19e1b..61f417722ae 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_field/field_ch.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_field/field_ch.h
@@ -78,7 +78,6 @@ public:
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
index b2b71678b70..583a6fd92c9 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_field/field_ci.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_field/field_ci.h
@@ -59,7 +59,6 @@ public:
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
index c48a1fd5969..787babe68f9 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_field/field_cs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_field/field_cs.h
@@ -62,7 +62,6 @@ public:
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_home.h b/TAO/TAO_IDL/be_include/be_visitor_home.h
new file mode 100644
index 00000000000..195d0e95b3a
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_home.h
@@ -0,0 +1,27 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_home.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Home class
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_HOME_H
+#define TAO_BE_VISITOR_HOME_H
+
+#include "be_visitor_scope.h"
+
+#endif
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface.h b/TAO/TAO_IDL/be_include/be_visitor_interface.h
index 7ae796e096c..eaebb4299ea 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface.h
@@ -21,8 +21,10 @@
#ifndef TAO_BE_VISITOR_INTERFACE_H
#define TAO_BE_VISITOR_INTERFACE_H
-#include "be_visitor_scope.h"
+#include "idl_defines.h"
+#include "ace/SString.h"
+#include "be_visitor_scope.h"
#include "be_visitor_interface/interface.h"
#include "be_visitor_interface/interface_ch.h"
#include "be_visitor_interface/interface_ci.h"
@@ -32,10 +34,6 @@
#include "be_visitor_interface/interface_si.h"
#include "be_visitor_interface/interface_ss.h"
#include "be_visitor_interface/interface_is.h"
-// #include "be_visitor_interface/thru_poa_collocated_sh.h"
-// #include "be_visitor_interface/thru_poa_collocated_ss.h"
-// #include "be_visitor_interface/direct_collocated_sh.h"
-// #include "be_visitor_interface/direct_collocated_ss.h"
#include "be_visitor_interface/any_op_ch.h"
#include "be_visitor_interface/any_op_cs.h"
#include "be_visitor_interface/cdr_op_ch.h"
@@ -46,7 +44,6 @@
#include "be_visitor_interface/ami_interface_ch.h"
#include "be_visitor_interface/smart_proxy_ch.h"
#include "be_visitor_interface/smart_proxy_cs.h"
-#include "be_visitor_interface/interceptors_ch.h"
#include "be_visitor_interface/interceptors_cs.h"
#include "be_visitor_interface/interceptors_sh.h"
#include "be_visitor_interface/interceptors_ss.h"
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/base_proxy_impl_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface/base_proxy_impl_ch.h
index 1e00449cd4c..73b04dd8e16 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/base_proxy_impl_ch.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/base_proxy_impl_ch.h
@@ -36,6 +36,11 @@ public:
virtual int visit_interface (be_interface *node);
// visit an interface
+ static int gen_abstract_ops_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os);
+ // Helper to generate the declarations for the operations
+ // of any abstract parents we may have.
};
#endif /* BE_BASE_PROXY_IMPL_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/cdr_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface/cdr_op_ch.h
index 353659c3bcc..9d4a989f36d 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/cdr_op_ch.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/cdr_op_ch.h
@@ -44,7 +44,6 @@ public:
virtual int visit_interface (be_interface *node);
// visit interface
-
};
#endif /* _BE_VISITOR_INTERFACE_CDR_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/cdr_op_ci.h b/TAO/TAO_IDL/be_include/be_visitor_interface/cdr_op_ci.h
index 47639725412..f938fe193be 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/cdr_op_ci.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/cdr_op_ci.h
@@ -44,7 +44,6 @@ public:
virtual int visit_interface (be_interface *node);
// visit interface
-
};
#endif /* _BE_VISITOR_INTERFACE_CDR_OP_CI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/cdr_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_interface/cdr_op_cs.h
index 05a062d594f..9d684ff8e9d 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/cdr_op_cs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/cdr_op_cs.h
@@ -44,7 +44,6 @@ public:
virtual int visit_interface (be_interface *node);
// visit interface
-
};
#endif /* _BE_VISITOR_INTERFACE_CDR_OP_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/direct_proxy_impl_sh.h b/TAO/TAO_IDL/be_include/be_visitor_interface/direct_proxy_impl_sh.h
index 322c3ae3f09..0c16d1467ea 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/direct_proxy_impl_sh.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/direct_proxy_impl_sh.h
@@ -36,6 +36,11 @@ public:
virtual int visit_interface (be_interface *node);
// visit an interface
+ static int gen_abstract_ops_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os);
+ // Helper to generate the declarations for the operations
+ // of any abstract parents we may have.
};
#endif /* BE_DIRECT_PROXY_IMPL_SH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/direct_proxy_impl_ss.h b/TAO/TAO_IDL/be_include/be_visitor_interface/direct_proxy_impl_ss.h
index c278e4cfdb8..91586f0d42a 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/direct_proxy_impl_ss.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/direct_proxy_impl_ss.h
@@ -35,6 +35,11 @@ public:
virtual int visit_interface (be_interface *node);
// visit an interface
+ static int gen_abstract_ops_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os);
+ // Helper to generate the declarations for the operations
+ // of any abstract parents we may have.
};
#endif /* BE_DIRECT_PROXY_IMPL_SS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/interceptors_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface/interceptors_ch.h
deleted file mode 100644
index aefd8f0cbdf..00000000000
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/interceptors_ch.h
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// $Id$
-//
-/* -*- c++ -*- */
-// ============================================================================
-//
-// = LIBRARY
-// TAO IDL
-//
-// = FILENAME
-// interceptors_ch.h
-//
-// = DESCRIPTION
-// Concrete visitor for the Interface node.
-// This provides code generation for interceptor classes for an
-// interface in the client header.
-//
-// = AUTHOR
-// Kirthika Parameswaran
-//
-// ============================================================================
-
-#ifndef _BE_INTERFACE_INTERCEPTORS_CH_H_
-#define _BE_INTERFACE_INTERCEPTORS_CH_H_
-
-class be_visitor_interface_interceptors_ch : public be_visitor_interface
-{
- // = TITLE
- // Generate the "thru_poa collocated" class declaration.
-
-public:
- be_visitor_interface_interceptors_ch (be_visitor_context *ctx);
- // constructor
-
- virtual ~be_visitor_interface_interceptors_ch (void);
- // destructor
-
- virtual int visit_interface (be_interface *node);
- // visit an interface
-
-};
-
-#endif /* _BE_INTERFACE_INTERCEPTORS_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/interceptors_cs.h b/TAO/TAO_IDL/be_include/be_visitor_interface/interceptors_cs.h
index 697d3714e3e..26617298145 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/interceptors_cs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interceptors_cs.h
@@ -38,6 +38,11 @@ public:
virtual int visit_interface (be_interface *node);
// visit an interface
+ static int gen_abstract_ops_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os);
+ // Helper to generate the declarations for the operations
+ // of any abstract parents we may have.
};
#endif /* _BE_INTERFACE_INTERCEPTORS_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/interceptors_ss.h b/TAO/TAO_IDL/be_include/be_visitor_interface/interceptors_ss.h
index 5bcf269f7cc..936773ccdaa 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/interceptors_ss.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interceptors_ss.h
@@ -38,6 +38,11 @@ public:
virtual int visit_interface (be_interface *node);
// visit an interface
+ static int gen_abstract_ops_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os);
+ // Helper to generate the declarations for the operations
+ // of any abstract parents we may have.
};
#endif /* _BE_INTERFACE_INTERCEPTORS_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
index c887e0ca515..edbfcc86077 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/interface.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface.h
@@ -40,6 +40,8 @@
// methods.
//
+class AST_Operation;
+
class be_visitor_interface : public be_visitor_scope
{
//
@@ -49,7 +51,6 @@ class be_visitor_interface : public be_visitor_scope
// = DESCRIPTION
// This is a concrete visitor for interface that abstracts all common tasks
//
-
public:
be_visitor_interface (be_visitor_context *ctx);
// constructor
@@ -60,6 +61,10 @@ public:
virtual int visit_interface (be_interface *node);
// visit the interface node
+ virtual int visit_scope (be_scope *node);
+ // An override of the base class method so we can generate code for
+ // any abstract parents the interface may have.
+
// =visit methods on all elements syntactically valid in a Interface scope
virtual int visit_attribute (be_attribute *node);
@@ -80,14 +85,23 @@ public:
virtual int visit_structure (be_structure *node);
// visit a structure
+ virtual int visit_structure_fwd (be_structure_fwd *node);
+ // visit a forward declared structure
+
virtual int visit_union (be_union *node);
// visit a union
+ virtual int visit_union_fwd (be_union_fwd *node);
+ // visit a union
+
virtual int visit_typedef (be_typedef *node);
// visit the typedef node
protected:
int is_amh_rh_node (be_interface *node);
+
+ static void add_abstract_op_args (AST_Operation *old_op,
+ be_operation &new_op);
};
#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
index 0294553503b..f0a8e9b94b2 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ch.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ch.h
@@ -44,6 +44,12 @@ public:
virtual int visit_interface (be_interface *node);
// set the right context and make a visitor
+
+ static int gen_abstract_ops_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os);
+ // Helper to generate the declarations for the operations
+ // of any abstract parents we may have.
};
#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
index ad1a5b31063..c9791f74cac 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ci.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ci.h
@@ -41,7 +41,6 @@ public:
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
index 51e3f8a7a88..ea44c2e7d2d 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_cs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_cs.h
@@ -41,6 +41,20 @@ public:
virtual int visit_interface (be_interface *node);
// set the right context and make a visitor
+
+ static int gen_abstract_ops_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os);
+ // Helper to generate the definitions for the operations
+ // of any abstract parents we may have.
+
+protected:
+ void gen_concrete_unchecked_narrow (be_interface *node,
+ be_type *bt,
+ TAO_OutStream *os);
+ void gen_abstract_unchecked_narrow (be_interface *node,
+ be_type *bt,
+ TAO_OutStream *os);
};
#endif /* _BE_INTERFACE_INTERFACE_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ih.h b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ih.h
index f553c5581c1..1c540eb905f 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ih.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ih.h
@@ -1,6 +1,4 @@
-
/* -*- c++ -*- */
-
// $Id$
// ============================================================================
@@ -46,8 +44,6 @@ public:
static int method_helper (be_interface *derived,
be_interface *node,
TAO_OutStream *os);
-
-
};
#endif /* _BE_INTERFACE_INTERFACE_IH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_is.h b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_is.h
index 20279502967..7c59bf5d0ee 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_is.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_is.h
@@ -44,7 +44,6 @@ public:
static int method_helper (be_interface *derived,
be_interface *node,
TAO_OutStream *os);
-
};
#endif /* _BE_INTERFACE_INTERFACE_IS_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
index f62e1e28d5d..f7fb788769b 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_sh.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_sh.h
@@ -24,27 +24,33 @@
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
+ //
+ // = 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
- ~be_visitor_interface_sh (void);
- // destructor
-
- virtual int visit_interface (be_interface *node);
- // set the right context and make a visitor
-
- protected:
- virtual void this_method (be_interface *node);
- virtual int generate_amh_classes (be_interface *node);
+ static int gen_abstract_ops_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os);
+ // Helper to generate the declarations for the operations
+ // of any abstract parents we may have.
+
+protected:
+ virtual void this_method (be_interface *node);
+ virtual int generate_amh_classes (be_interface *node);
};
#endif /* _BE_INTERFACE_INTERFACE_SH_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
index 2f0b008520d..fee57ebfe38 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ss.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ss.h
@@ -42,6 +42,12 @@ public:
virtual int visit_interface (be_interface *node);
// set the right context and make a visitor
+ static int gen_abstract_ops_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os);
+ // Helper to generate the declarations for the operations
+ // of any abstract parents we may have.
+
protected:
virtual void this_method (be_interface *node);
virtual void dispatch_method (be_interface *node);
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_impl_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_impl_ch.h
index b02d729add6..0eb989aa593 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_impl_ch.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_impl_ch.h
@@ -36,6 +36,11 @@ public:
virtual int visit_interface (be_interface *node);
// visit an interface
+ static int gen_abstract_ops_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os);
+ // Helper to generate the declarations for the operations
+ // of any abstract parents we may have.
};
#endif /* BE_REMOTE_PROXY_IMPL_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_impl_cs.h b/TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_impl_cs.h
index 156ed3ba878..3588e6b1178 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_impl_cs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_impl_cs.h
@@ -36,6 +36,11 @@ public:
virtual int visit_interface (be_interface *node);
// visit an interface
+ static int gen_abstract_ops_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os);
+ // Helper to generate the declarations for the operations
+ // of any abstract parents we may have.
};
#endif /* BE_REMOTE_PROXY_IMPL_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/thru_poa_proxy_impl_sh.h b/TAO/TAO_IDL/be_include/be_visitor_interface/thru_poa_proxy_impl_sh.h
index 550b8b05268..2c9970a02b5 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/thru_poa_proxy_impl_sh.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/thru_poa_proxy_impl_sh.h
@@ -36,6 +36,11 @@ public:
virtual int visit_interface (be_interface *node);
// visit an interface
+ static int gen_abstract_ops_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os);
+ // Helper to generate the declarations for the operations
+ // of any abstract parents we may have.
};
#endif /* BE_THRU_POA_PROXY_IMPL_SH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/thru_poa_proxy_impl_ss.h b/TAO/TAO_IDL/be_include/be_visitor_interface/thru_poa_proxy_impl_ss.h
index 3ace820c52a..7595dceb14b 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/thru_poa_proxy_impl_ss.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/thru_poa_proxy_impl_ss.h
@@ -36,6 +36,11 @@ public:
virtual int visit_interface (be_interface *node);
// visit an interface
+ static int gen_abstract_ops_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os);
+ // Helper to generate the declarations for the operations
+ // of any abstract parents we may have.
};
#endif /* BE_THRU_POA_PROXY_IMPL_SS_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 00000706930..2168bfc80e8 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface_fwd.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface_fwd.h
@@ -22,12 +22,11 @@
#ifndef TAO_BE_VISITOR_INTERFACE_FWD_H
#define TAO_BE_VISITOR_INTERFACE_FWD_H
-#include "be_visitor.h"
-#include "be_visitor_scope.h"
-
+#include "be_visitor_decl.h"
#include "be_visitor_interface_fwd/interface_fwd_ch.h"
#include "be_visitor_interface_fwd/interface_fwd_ci.h"
#include "be_visitor_interface_fwd/cdr_op_ch.h"
#include "be_visitor_interface_fwd/cdr_op_ci.h"
#include "be_visitor_interface_fwd/any_op_ch.h"
+
#endif /* TAO_BE_VISITOR_INTERFACE_FWD_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface_fwd/cdr_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface_fwd/cdr_op_ch.h
index 4befc6aca9e..9a75dc8bdc6 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface_fwd/cdr_op_ch.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface_fwd/cdr_op_ch.h
@@ -44,7 +44,6 @@ public:
virtual int visit_interface_fwd (be_interface_fwd *node);
// visit forward declared interface
-
};
#endif /* _BE_VISITOR_INTERFACE_FWD_CDR_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface_fwd/cdr_op_ci.h b/TAO/TAO_IDL/be_include/be_visitor_interface_fwd/cdr_op_ci.h
index 4b1449eeae0..4c759442240 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface_fwd/cdr_op_ci.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface_fwd/cdr_op_ci.h
@@ -45,7 +45,6 @@ public:
virtual int visit_interface_fwd (be_interface_fwd *node);
// visit interface
-
};
#endif /* BE_VISITOR_INTERFACE_FWD_CDR_OP_CI_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
index 02c788c071b..71d37c0ee70 100644
--- 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
@@ -41,7 +41,6 @@ public:
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
index f8c765d986f..66d3d4e1924 100644
--- 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
@@ -41,7 +41,6 @@ public:
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 ea4f140fd6d..0d8a70a64ff 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_module.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_module.h
@@ -22,12 +22,8 @@
#ifndef TAO_BE_VISITOR_MODULE_H
#define TAO_BE_VISITOR_MODULE_H
-#include "be_visitor.h"
#include "be_visitor_scope.h"
-
#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
#include "be_visitor_module/module_ch.h"
#include "be_visitor_module/module_sh.h"
#include "be_visitor_module/module_ih.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
index 156212e0c8a..60fa15695d5 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_module/module.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_module/module.h
@@ -30,7 +30,7 @@ class be_visitor_module : public be_visitor_scope
// be_visitor_module
//
// = DESCRIPTION
- // This is a concrete visitor for module that abstracts all common tasks
+ // This is a concrete visitor for module that abstracts all common tasks.
//
public:
@@ -69,12 +69,17 @@ public:
virtual int visit_structure (be_structure *node);
// visit a structure
+ virtual int visit_structure_fwd (be_structure_fwd *node);
+ // visit a structure
+
virtual int visit_union (be_union *node);
// visit a union
+ virtual int visit_union_fwd (be_union_fwd *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
index 5de940fa34f..da55a641498 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_module/module_ch.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_module/module_ch.h
@@ -42,7 +42,6 @@ public:
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_ih.h b/TAO/TAO_IDL/be_include/be_visitor_module/module_ih.h
index f0039005391..40e1b9f351a 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_module/module_ih.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_module/module_ih.h
@@ -41,7 +41,6 @@ public:
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_module/module_sh.h b/TAO/TAO_IDL/be_include/be_visitor_module/module_sh.h
index c0b6dfc5b37..b70f41e6f86 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_module/module_sh.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_module/module_sh.h
@@ -42,7 +42,6 @@ public:
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 9e3d340e234..1af94470e3a 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_operation.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation.h
@@ -22,7 +22,8 @@
#ifndef TAO_BE_VISITOR_OPERATION_H
#define TAO_BE_VISITOR_OPERATION_H
-#include "be_visitor.h"
+#include "idl_defines.h"
+
#include "be_visitor_scope.h"
#include "be_visitor_operation/operation.h"
#include "be_visitor_operation/operation_ch.h"
@@ -65,7 +66,6 @@
#include "be_visitor_operation/interceptors_result.h"
#include "be_visitor_operation/base_proxy_impl_ch.h"
#include "be_visitor_operation/proxy_impl_xh.h"
-#include "be_visitor_operation/inv_arglist.h"
#include "be_visitor_operation/remote_proxy_impl_cs.h"
#include "be_visitor_operation/thru_poa_proxy_impl_ss.h"
#include "be_visitor_operation/direct_proxy_impl_ss.h"
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_cs.h
index dd581cf58f0..982b5cb9a0d 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_cs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_cs.h
@@ -49,10 +49,12 @@ public:
// visit argument to generate ParamData entries
// = template methods
- virtual int gen_pre_stub_info (be_operation *, be_type *) = 0;
+ virtual int gen_pre_stub_info (be_operation *node,
+ be_type *bt);
// generate any info before the actual code for the stub is generated
- virtual int gen_marshal_and_invoke (be_operation *, be_type *) = 0;
+ virtual int gen_marshal_and_invoke (be_operation *node,
+ be_type *bt);
// generate code that marshals the arguments and transmits them
// =helper
@@ -60,57 +62,4 @@ public:
// stuff to output after every member of the scope is handled
};
-// specialized visitors
-
-class be_interpretive_visitor_operation_ami_cs : public be_visitor_operation_ami_cs
-{
- //
- // = TITLE
- // be_interpretive_visitor_operation_ami_cs
- //
- // = DESCRIPTION
- // This is a concrete visitor to generate the client stubs for operation
- // using interpretive marshaling.
- //
- //
-public:
- be_interpretive_visitor_operation_ami_cs (be_visitor_context *);
- // ctor
-
- ~be_interpretive_visitor_operation_ami_cs (void);
- // dtor
-
- virtual int gen_pre_stub_info (be_operation *, be_type *);
- // generate any info before the actual code for the stub is generated
-
- virtual int gen_marshal_and_invoke (be_operation *, be_type *);
- // generate code that marshals the arguments and transmits them
-
-};
-
-class be_compiled_visitor_operation_ami_cs : public be_visitor_operation_ami_cs
-{
- //
- // = TITLE
- // be_compiled_visitor_operation_ami_cs
- //
- // = DESCRIPTION
- // This is a concrete visitor to generate the client stubs for operation
- // using compiled marshaling.
- //
- //
-public:
- be_compiled_visitor_operation_ami_cs (be_visitor_context *);
- // ctor
-
- ~be_compiled_visitor_operation_ami_cs (void);
- // dtor
-
- virtual int gen_pre_stub_info (be_operation *, be_type *);
- // generate any info before the actual code for the stub is generated
-
- virtual int gen_marshal_and_invoke (be_operation *, be_type *);
- // generate code that marshals the arguments and transmits them
-};
-
#endif /* _BE_VISITOR_OPERATION_AMI_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_reply_stub_operation_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_reply_stub_operation_cs.h
index e692c382502..7b38c0e57d7 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_reply_stub_operation_cs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_reply_stub_operation_cs.h
@@ -51,10 +51,12 @@ public:
// visit argument to generate ParamData entries
// = template methods
- virtual int gen_pre_stub_info (be_operation *, be_type *) = 0;
+ virtual int gen_pre_stub_info (be_operation *node,
+ be_type *bt);
// generate any info before the actual code for the stub is generated
- virtual int gen_marshal_and_invoke (be_operation *, be_type *) = 0;
+ virtual int gen_marshal_and_invoke (be_operation *node,
+ be_type *bt);
// generate code that marshals the arguments and transmits them
// =helper
@@ -62,59 +64,4 @@ public:
// stuff to output after every member of the scope is handled
};
-// specialized visitors
-
-class be_interpretive_visitor_operation_ami_handler_reply_stub_operation_cs : public be_visitor_operation_ami_handler_reply_stub_operation_cs
-{
- //
- // = TITLE
- // be_interpretive_visitor_operation_ami_skeleton_operation_cs
- //
- // = DESCRIPTION
- // This is a concrete visitor to generate the client skeletons
- // for AMI reply handlers of IDL operations using interpretive marshaling.
- //
- //
-public:
- be_interpretive_visitor_operation_ami_handler_reply_stub_operation_cs (be_visitor_context *);
- // ctor
-
- ~be_interpretive_visitor_operation_ami_handler_reply_stub_operation_cs (void);
- // dtor
-
- virtual int gen_pre_stub_info (be_operation *, be_type *);
- // generate any info before the actual code for the stub is generated
-
- virtual int gen_marshal_and_invoke (be_operation *, be_type *);
- // generate code that marshals the arguments and transmits them
-
-};
-
-class be_compiled_visitor_operation_ami_handler_reply_stub_operation_cs : public be_visitor_operation_ami_handler_reply_stub_operation_cs
-{
- //
- // = TITLE
- // be_compiled_visitor_operation_ami_handler_reply_stub_operation_cs
- //
- // = DESCRIPTION
- // This is a concrete visitor to generate the client skeletons
- // for AMI reply handlers of IDL operations using compiled marshaling.
- //
- //
-public:
- be_compiled_visitor_operation_ami_handler_reply_stub_operation_cs (be_visitor_context *);
- // ctor
-
- ~be_compiled_visitor_operation_ami_handler_reply_stub_operation_cs (void);
- // dtor
-
- virtual int gen_pre_stub_info (be_operation *, be_type *);
- // generate any info before the actual code for the stub is generated
-
- virtual int gen_marshal_and_invoke (be_operation *, be_type *);
- // generate code that marshals the arguments and transmits them
-
-};
-
-
#endif /* _BE_VISITOR_OPERATION_OPERATION_AMI_HANDLER_REPLY_STUB_OPERATION_CS_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
index a42834b2868..a37510cca05 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_operation/arglist.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/arglist.h
@@ -51,7 +51,6 @@ public:
virtual int post_process (be_decl *);
// stuff to o/p after each element of the scope is handled
-
};
#endif /* _BE_VISITOR_OPERATION_ARGLIST_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/argument_invoke.h b/TAO/TAO_IDL/be_include/be_visitor_operation/argument_invoke.h
index 06e47f6b16a..47ed79ccfaa 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_operation/argument_invoke.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/argument_invoke.h
@@ -27,7 +27,7 @@
// generic operation visitor for docall, upcall, pre/post
// ************************************************************
-class be_compiled_visitor_operation_argument_invoke
+class be_visitor_operation_argument_invoke
: public be_visitor_operation_argument
{
//
@@ -39,10 +39,10 @@ class be_compiled_visitor_operation_argument_invoke
// return type
//
public:
- be_compiled_visitor_operation_argument_invoke (be_visitor_context *ctx);
+ be_visitor_operation_argument_invoke (be_visitor_context *ctx);
// constructor
- ~be_compiled_visitor_operation_argument_invoke (void);
+ ~be_visitor_operation_argument_invoke (void);
// destructor
virtual int pre_process (be_decl *bd);
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/argument_marshal.h b/TAO/TAO_IDL/be_include/be_visitor_operation/argument_marshal.h
index 2a4802db351..183b1baa7b3 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_operation/argument_marshal.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/argument_marshal.h
@@ -27,7 +27,7 @@
// generic operation visitor for docall, upcall, pre/post
// ************************************************************
-class be_compiled_visitor_operation_argument_marshal
+class be_visitor_operation_argument_marshal
: public be_visitor_operation_argument
{
//
@@ -39,10 +39,10 @@ class be_compiled_visitor_operation_argument_marshal
// return type
//
public:
- be_compiled_visitor_operation_argument_marshal (be_visitor_context *ctx);
+ be_visitor_operation_argument_marshal (be_visitor_context *ctx);
// constructor
- ~be_compiled_visitor_operation_argument_marshal (void);
+ ~be_visitor_operation_argument_marshal (void);
// destructor
virtual int pre_process (be_decl *bd);
@@ -65,7 +65,7 @@ private:
// ****************************************************************
-class be_visitor_compiled_args_decl : public be_visitor_scope
+class be_visitor_args_decl : public be_visitor_scope
{
//
// = TITLE
@@ -76,7 +76,7 @@ class be_visitor_compiled_args_decl : public be_visitor_scope
// compiled marshaling stubs.
//
public:
- be_visitor_compiled_args_decl (be_visitor_context *ctx);
+ be_visitor_args_decl (be_visitor_context *ctx);
// constructor
int visit_array (be_array *node);
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/direct_proxy_impl_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/direct_proxy_impl_ss.h
index 3d8003ed5ee..3bbb72d9107 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_operation/direct_proxy_impl_ss.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/direct_proxy_impl_ss.h
@@ -20,7 +20,7 @@
#ifndef _BE_VISITOR_OPERATION_DIRECT_PROXY_IMPL_SS_H_
#define _BE_VISITOR_OPERATION_DIRECT_PROXY_IMPL_SS_H_
-class be_visitor_operation_direct_proxy_impl_ss : public be_visitor_scope
+class be_visitor_operation_direct_proxy_impl_ss : public be_visitor_operation
{
//
// = TITLE
@@ -43,9 +43,6 @@ public:
virtual int gen_invoke (be_visitor_context &ctx, be_operation *node);
// A helper method to generate operation invocation code.
-
- virtual int void_return_type (be_type *bt);
- // is my return type void?
};
#endif /* _BE_VISITOR_OPERATION_DIRECT_PROXY_IMPL_SS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/inv_arglist.h b/TAO/TAO_IDL/be_include/be_visitor_operation/inv_arglist.h
deleted file mode 100644
index 3b1cb7d4db3..00000000000
--- a/TAO/TAO_IDL/be_include/be_visitor_operation/inv_arglist.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// $Id$
-//
-// ============================================================================
-//
-// = LIBRARY
-// TAO IDL
-//
-// = FILENAME
-// inv_arglist.h
-//
-// = DESCRIPTION
-// Visitor for generating signature needed to invoke a given
-// operation.
-//
-// = AUTHOR
-// Angelo Corsaro
-//
-// ============================================================================
-
-#ifndef _BE_VISITOR_OPERATION_INV_ARGLIST_H_
-#define _BE_VISITOR_OPERATION_INV_ARGLIST_H_
-
-// ******************************************************************************
-// Operation visitor for argument list - generates parameters in the signature
-// ******************************************************************************
-
-class be_visitor_operation_inv_arglist : public be_visitor_operation
-{
- //
- // = TITLE
- // be_visitor_operaion_inv_arglist
- //
- // = DESCRIPTION
- // This visitor generates the argument list needed to
- // invoke a given operation. No parentesys are generated
- // to give the caller code the abity to stick in other
- // parameter that might be needed.
- //
- //
-public:
- be_visitor_operation_inv_arglist (be_visitor_context *ctx);
- // constructor
-
- ~be_visitor_operation_inv_arglist (void);
- // destructor
-
- virtual int visit_operation (be_operation *node);
- // visit the operation
-
- virtual int visit_argument (be_argument *node);
- // visit each argument
-
-};
-
-#endif /* _BE_VISITOR_OPERATION_INV_ARGLIST_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/operation.h b/TAO/TAO_IDL/be_include/be_visitor_operation/operation.h
index 13a376d282b..3e9de8828a6 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_operation/operation.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/operation.h
@@ -47,7 +47,8 @@ public:
virtual int void_return_type (be_type *);
// is my return type void?
- virtual int has_param_type (be_operation *, AST_Argument::Direction);
+ virtual int has_param_type (be_operation *,
+ AST_Argument::Direction);
// does any of the argument node have the specified direction
/// Count the number of "in" and "inout" parameters.
@@ -79,6 +80,37 @@ public:
virtual int gen_check_interceptor_exception (be_type *);
// helper that generates code for checking for an exception within
// an interceptor try block.
+
+ virtual int gen_stub_operation_body (be_operation *node,
+ be_type *return_type);
+ // Generates the code from opening brace to closing brace for
+ // stub operations. Also called (for now)
+ // from be_visitor_operation_cs, to generate operation stub
+ // bodies for abstract interfaces (unless and until abstract
+ // interfaces are made to interoperate with collocatino).
+
+ virtual int gen_pre_stub_info (be_operation *node);
+ // generate any info before the actual code for the stub is generated
+
+ virtual int gen_marshal_and_invoke (be_operation *node,
+ be_type *bt);
+ // generate code that marshals the arguments and transmits them
+
+ virtual int gen_raise_interceptor_exception (
+ be_type *return_type,
+ const char *exception_name,
+ const char *exception_arguments
+ );
+ // helper that generates code for raising an exception within
+ // interceptor's try block
+
+ virtual const char *compute_operation_name (be_operation *node);
+ // compute the operation_remote_proxy_impl name.
+ // Notice that this operation_remote_proxy_impl
+ // _does_ include the double quote.
+
+private:
+ char *operation_name_;
};
#endif /* _BE_VISITOR_OPERATION_OPERATION_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
index 2171d0ef62f..484a4d4dd34 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ch.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ch.h
@@ -44,7 +44,6 @@ public:
virtual int visit_operation (be_operation *node);
// visit operation.
-
};
#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
index d59fa55d7ec..2a8faa405bc 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_operation/operation_cs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_cs.h
@@ -51,7 +51,6 @@ public:
// =helper
virtual int post_process (be_decl *);
// 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_ih.h b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ih.h
index 01b80ead8d6..55a3c1fd955 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ih.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ih.h
@@ -42,7 +42,6 @@ public:
virtual int visit_operation (be_operation *node);
// visit operation. We provide code for this method in the derived class
-
};
#endif /* _BE_VISITOR_OPERATION_OPERATION_IH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/operation_is.h b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_is.h
index 31743cdbba4..aa5da748f19 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_operation/operation_is.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_is.h
@@ -42,7 +42,6 @@ public:
virtual int visit_operation (be_operation *node);
// visit operation. We provide code for this method in the derived class
-
};
#endif /* _BE_VISITOR_OPERATION_OPERATION_IS_CPP_ */
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
index d33d61533d8..2074b69417e 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_operation/operation_sh.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_sh.h
@@ -44,7 +44,6 @@ public:
virtual int visit_operation (be_operation *node);
// visit operation.
-
};
#endif /* _BE_VISITOR_OPERATION_OPERATION_SH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/remote_proxy_impl_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/remote_proxy_impl_cs.h
index e71f22a1aa0..51b2b2340e4 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_operation/remote_proxy_impl_cs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/remote_proxy_impl_cs.h
@@ -49,29 +49,10 @@ public:
// visit argument to generate ParamData entries
// = template methods
- virtual int gen_pre_stub_info (be_operation *node);
- // generate any info before the actual code for the stub is generated
-
- virtual int gen_marshal_and_invoke (be_operation *node,
- be_type *bt);
- // generate code that marshals the arguments and transmits them
// =helper
virtual int post_process (be_decl *);
// stuff to output after every member of the scope is handled
-
- virtual int gen_raise_interceptor_exception (be_type *return_type,
- const char *exception_name,
- const char *exception_arguments);
- // helper that generates code for raising an exception within
- // interceptor's try block
-
- virtual const char *compute_operation_name (be_operation *node);
- // compute the operation_remote_proxy_impl name. Notice that this operation_remote_proxy_impl
- // _does_ include the double quote.
-
-private:
- char *operation_name_;
};
#endif /* _BE_VISITOR_OPERATION_REMOTE_PROXY_IMPL_OPERATION_REMOTE_PROXY_IMPL_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/smart_proxy_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/smart_proxy_cs.h
index 5e63484c0c8..8bbba1ab4ee 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_operation/smart_proxy_cs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/smart_proxy_cs.h
@@ -23,7 +23,7 @@
// Operation visitor for client stubs
// ************************************************************
-class be_visitor_operation_smart_proxy_cs : public be_visitor_scope
+class be_visitor_operation_smart_proxy_cs : public be_visitor_operation
{
//
// = TITLE
@@ -45,9 +45,6 @@ public:
virtual int gen_invoke (be_visitor_context &ctx, be_operation *node);
// A helper method to generate operation invocation code.
-
- virtual int void_return_type (be_type *bt);
- // is my return type void?
};
#endif /* _BE_VISITOR_OPERATION_OPERATION_SMART_PROXY_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/thru_poa_proxy_impl_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/thru_poa_proxy_impl_ss.h
index 3c15fd5762a..f4db4ecf488 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_operation/thru_poa_proxy_impl_ss.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/thru_poa_proxy_impl_ss.h
@@ -48,9 +48,6 @@ public:
virtual int gen_invoke (be_visitor_context &ctx, be_operation *node);
// A helper method to generate operation invocation code.
-
- virtual int void_return_type (be_type *bt);
- // is my return type void?
};
#endif /* _BE_VISITOR_OPERATION_THRU_POA_PROXY_IMPL_OPERATION_THRU_POA_PROXY_IMPL_SS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_root.h b/TAO/TAO_IDL/be_include/be_visitor_root.h
index 3c304af0a9e..e9d6cfd3c68 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_root.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_root.h
@@ -22,9 +22,7 @@
#ifndef TAO_BE_VISITOR_ROOT_H
#define TAO_BE_VISITOR_ROOT_H
-#include "be_visitor.h"
#include "be_visitor_scope.h"
-
#include "be_visitor_root/root.h"
#include "be_visitor_root/root_ch.h"
#include "be_visitor_root/root_ci.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
index 7a720753fc4..cb95595d55b 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_root/root.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_root/root.h
@@ -72,9 +72,15 @@ public:
virtual int visit_structure (be_structure *node);
// visit a structure
+ virtual int visit_structure_fwd (be_structure_fwd *node);
+ // visit a forward declared structure
+
virtual int visit_union (be_union *node);
// visit a union
+ virtual int visit_union_fwd (be_union_fwd *node);
+ // visit a forward declared union
+
virtual int visit_typedef (be_typedef *node);
// visit the typedef node
diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_ih.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_ih.h
index fca8a7f32ab..004bc0f73d5 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_root/root_ih.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_ih.h
@@ -21,8 +21,6 @@
#ifndef _BE_VISITOR_ROOT_ROOT_IH_H_
#define _BE_VISITOR_ROOT_ROOT_IH_H_
-
-
class be_visitor_root_ih : public be_visitor_root
{
//
diff --git a/TAO/TAO_IDL/be_include/be_visitor_scope.h b/TAO/TAO_IDL/be_include/be_visitor_scope.h
index d7696f1e32b..6aa0a2be7b6 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_scope.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_scope.h
@@ -21,8 +21,8 @@
#ifndef TAO_BE_VISITOR_SCOPE_H
#define TAO_BE_VISITOR_SCOPE_H
-#include "idl_bool.h"
#include "be_visitor_decl.h"
+#include "idl_bool.h"
class be_visitor_scope : public be_visitor_decl
{
diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence.h b/TAO/TAO_IDL/be_include/be_visitor_sequence.h
index 07588e9428a..17713905c9e 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_sequence.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_sequence.h
@@ -6,16 +6,15 @@
#ifndef TAO_BE_VISITOR_SEQUENCE_H
#define TAO_BE_VISITOR_SEQUENCE_H
-#include "be_visitor_decl.h"
+#include "idl_defines.h"
+#include "be_visitor_decl.h"
#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
#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"
#include "be_visitor_sequence/cdr_op_ch.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
index 523f903bc98..0054c042c2d 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_sequence/buffer_type.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/buffer_type.h
@@ -48,9 +48,11 @@ public:
virtual int visit_valuetype (be_valuetype *node);
virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
virtual int visit_structure (be_structure *node);
+ virtual int visit_structure_fwd (be_structure_fwd *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_union_fwd (be_union_fwd *node);
virtual int visit_array (be_array *node);
virtual int visit_string (be_string *node);
virtual int visit_sequence (be_sequence *node);
diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence/cdr_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_sequence/cdr_op_ch.h
index ca3f1b85856..4e625f0656c 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_sequence/cdr_op_ch.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/cdr_op_ch.h
@@ -44,7 +44,6 @@ public:
virtual int visit_sequence (be_sequence *node);
// visit sequence
-
};
#endif /* _BE_VISITOR_SEQUENCE_CDR_OP_CH_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
index 993a9894fff..bc8e91ad47f 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_sequence/elemtype.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/elemtype.h
@@ -51,9 +51,11 @@ public:
virtual int visit_valuetype (be_valuetype *node);
virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
virtual int visit_structure (be_structure *node);
+ virtual int visit_structure_fwd (be_structure_fwd *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_union_fwd (be_union_fwd *node);
virtual int visit_array (be_array *node);
virtual int visit_sequence (be_sequence *node);
virtual int visit_typedef (be_typedef *node);
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
index 71bca6b32b2..aa27936a665 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_base.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_base.h
@@ -54,9 +54,11 @@ public:
virtual int visit_valuetype (be_valuetype *node);
virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
virtual int visit_structure (be_structure *node);
+ virtual int visit_structure_fwd (be_structure_fwd *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_union_fwd (be_union_fwd *node);
virtual int visit_array (be_array *node);
virtual int visit_string (be_string *node);
virtual int visit_sequence (be_sequence *node);
diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure.h b/TAO/TAO_IDL/be_include/be_visitor_structure.h
index 09753ea11a1..fea653c474a 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_structure.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_structure.h
@@ -22,14 +22,13 @@
#ifndef TAO_BE_VISITOR_STRUCTURE_H
#define TAO_BE_VISITOR_STRUCTURE_H
-#include "be_visitor.h"
+#include "be_union.h"
+#include "be_enum.h"
+
#include "be_visitor_scope.h"
-#include "be_visitor_union.h"
#include "be_visitor_enum.h"
-
-// generic visitor
+#include "be_visitor_union.h"
#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"
diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure/cdr_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_structure/cdr_op_ch.h
index 4c082357b19..5ab95eb05d4 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_structure/cdr_op_ch.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_structure/cdr_op_ch.h
@@ -44,7 +44,6 @@ public:
virtual int visit_structure (be_structure *node);
// visit structure
-
};
#endif /* _BE_VISITOR_STRUCTURE_CDR_OP_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure/cdr_op_ci.h b/TAO/TAO_IDL/be_include/be_visitor_structure/cdr_op_ci.h
index c321ed901e3..2ce7aff080c 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_structure/cdr_op_ci.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_structure/cdr_op_ci.h
@@ -47,7 +47,6 @@ public:
virtual int post_process (be_decl *);
// any post processing that needs to be done after a scope element is handled
-
};
#endif /* _BE_VISITOR_STRUCTURE_CDR_OP_CI_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
index 1ec6f9d6ccb..1b19214ecc9 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_structure/structure_ch.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_structure/structure_ch.h
@@ -42,7 +42,6 @@ public:
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
index 8665832e078..313657b6bac 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_structure/structure_ci.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_structure/structure_ci.h
@@ -42,7 +42,6 @@ public:
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
index bf4adfa0000..24ebf61be18 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_structure/structure_cs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_structure/structure_cs.h
@@ -42,7 +42,6 @@ public:
virtual int visit_structure (be_structure *node);
// visit structure.
-
};
#endif /* _BE_VISITOR_STRUCTURE_STRUCTURE_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure_fwd.h b/TAO/TAO_IDL/be_include/be_visitor_structure_fwd.h
new file mode 100644
index 00000000000..fc0a7c6613d
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_structure_fwd.h
@@ -0,0 +1,28 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_structure_fwd.h
+//
+// = DESCRIPTION
+// Concrete visitor for the be_structure_fwd class
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_STRUCTURE_FWD_H
+#define TAO_BE_VISITOR_STRUCTURE_FWD_H
+
+#include "be_visitor_decl.h"
+#include "be_visitor_structure_fwd/structure_fwd_ch.h"
+
+#endif /* TAO_BE_VISITOR_STRUCTURE_FWD_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure_fwd/structure_fwd_ch.h b/TAO/TAO_IDL/be_include/be_visitor_structure_fwd/structure_fwd_ch.h
new file mode 100644
index 00000000000..fd4f84e9448
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_structure_fwd/structure_fwd_ch.h
@@ -0,0 +1,42 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// structure_fwd_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the be_structure_fwd node.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_STRUCTURE_FWD_CH_H_
+#define _BE_INTERFACE_STRUCTURE_FWD_CH_H_
+
+class be_visitor_structure_fwd_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_structure_fwd_ch
+ //
+ // = DESCRIPTION
+ // This is the visitor for be_structure_fwd for the header file
+ //
+ //
+public:
+ be_visitor_structure_fwd_ch (be_visitor_context *ctx);
+
+ ~be_visitor_structure_fwd_ch (void);
+
+ virtual int visit_structure_fwd (be_structure_fwd *node);
+};
+
+#endif /* _BE_INTERFACE_STRUCTURE_FWD_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode.h b/TAO/TAO_IDL/be_include/be_visitor_typecode.h
index c6d623cf5a0..1942889a4c8 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_typecode.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_typecode.h
@@ -22,9 +22,9 @@
#ifndef TAO_BE_VISITOR_TYPECODE_H
#define TAO_BE_VISITOR_TYPECODE_H
-#include "be_visitor_decl.h"
-#include "be_visitor_scope.h"
+#include "idl_defines.h"
+#include "be_visitor_decl.h"
#include "be_visitor_typecode/typecode_decl.h"
#include "be_visitor_typecode/typecode_defn.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
index f35fe573144..911243fbb2f 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h
@@ -25,6 +25,7 @@
#include "ace/CDR_Base.h"
#include "ace/Containers_T.h"
+#include "be_visitor_decl.h"
#include "be_visitor_scope.h"
const int TAO_BE_VISITOR_TYPECODE_DEFN_MAX_STACK_SIZE = 1024;
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef.h b/TAO/TAO_IDL/be_include/be_visitor_typedef.h
index 05524ceecbe..26dd22be587 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_typedef.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_typedef.h
@@ -22,12 +22,8 @@
#ifndef TAO_BE_VISITOR_TYPEDEF_H
#define TAO_BE_VISITOR_TYPEDEF_H
-#include "be_visitor.h"
-#include "be_visitor_scope.h"
-
-// generic visitor
+#include "be_visitor_decl.h"
#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"
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef/cdr_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_typedef/cdr_op_ch.h
index 0cb82ce2ff0..f832928c425 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_typedef/cdr_op_ch.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_typedef/cdr_op_ch.h
@@ -62,7 +62,6 @@ public:
virtual int visit_union (be_union *node);
// visit a union
-
};
#endif /* _BE_VISITOR_TYPEDEF_CDR_OP_CH_H_*/
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef/cdr_op_ci.h b/TAO/TAO_IDL/be_include/be_visitor_typedef/cdr_op_ci.h
index 26d8f6ee546..4924fed4dd4 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_typedef/cdr_op_ci.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_typedef/cdr_op_ci.h
@@ -62,7 +62,6 @@ public:
virtual int visit_union (be_union *node);
// visit a union
-
};
#endif /* _BE_VISITOR_TYPEDEF_CDR_OP_CI_H_*/
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef/cdr_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_typedef/cdr_op_cs.h
index 742ce34fd08..03af2ece923 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_typedef/cdr_op_cs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_typedef/cdr_op_cs.h
@@ -51,9 +51,6 @@ public:
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
@@ -62,7 +59,6 @@ public:
virtual int visit_union (be_union *node);
// visit a union
-
};
#endif /* _BE_VISITOR_TYPEDEF_CDR_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
index d0d1b297ae2..8a4a586917c 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef.h
@@ -52,12 +52,6 @@ public:
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
@@ -66,7 +60,6 @@ public:
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
index eda0adf5441..9b1f8f7f00f 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_ch.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_ch.h
@@ -70,7 +70,6 @@ public:
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
index 9f308d33d52..818bf9e91cc 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_ci.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_ci.h
@@ -1,4 +1,3 @@
-
/* -*- c++ -*- */
//
// $Id$
@@ -59,7 +58,6 @@ public:
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
index a546de4c38d..6a48d19eaa1 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_cs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_typedef/typedef_cs.h
@@ -1,4 +1,3 @@
-
/* -*- c++ -*- */
//
// $Id$
@@ -44,7 +43,6 @@ public:
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 1b63d3eb44d..ae50d5cc9b1 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_union.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_union.h
@@ -22,14 +22,14 @@
#ifndef TAO_BE_VISITOR_UNION_H
#define TAO_BE_VISITOR_UNION_H
-#include "be_visitor.h"
+#include "be_enum.h"
+#include "be_structure.h"
+
#include "be_visitor_scope.h"
#include "be_visitor_enum.h"
#include "be_visitor_structure.h"
-// 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"
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 c284f47f97a..7a647bb2308 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_union_branch.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch.h
@@ -21,14 +21,14 @@
#ifndef TAO_BE_VISITOR_UNION_BRANCH_H
#define TAO_BE_VISITOR_UNION_BRANCH_H
-#include "be_visitor_decl.h"
+#include "idl_defines.h"
+#include "be_visitor_decl.h"
#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/public_reset_cs.h"
-#include "be_visitor_union_branch/public_access_cs.h"
#include "be_visitor_union_branch/private_ch.h"
#include "be_visitor_union_branch/cdr_op_ch.h"
#include "be_visitor_union_branch/cdr_op_ci.h"
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/cdr_op_ci.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/cdr_op_ci.h
index 1a4b582c641..e9df14268e3 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_union_branch/cdr_op_ci.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/cdr_op_ci.h
@@ -55,6 +55,12 @@ public:
virtual int visit_interface_fwd (be_interface_fwd *node);
// visit interface forward type
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit interface type
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit interface forward type
+
virtual int visit_predefined_type (be_predefined_type *node);
// visit predefined type
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
index fdc7e9f2070..4d83cabea7d 100644
--- 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
@@ -59,6 +59,12 @@ public:
virtual int visit_interface_fwd (be_interface_fwd *node);
// visit interface forward type
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit interface type
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit interface forward type
+
virtual int visit_predefined_type (be_predefined_type *node);
// visit predefined type
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_access_cs.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_access_cs.h
deleted file mode 100644
index b1d76206108..00000000000
--- a/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_access_cs.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- c++ -*- */
-//
-// $Id$
-//
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO IDL
-//
-// = FILENAME
-// public_access_cs.h
-//
-// = DESCRIPTION
-// Visitor for the Union class.
-// This one generates code for the access method of the union class
-// for the union members. This is primarily used by the marshaling engine.
-//
-// = AUTHOR
-// Aniruddha Gokhale
-//
-// ============================================================================
-
-#ifndef _BE_VISITOR_UNION_BRANCH_PUBLIC_ACCESS_CS_H_
-#define _BE_VISITOR_UNION_BRANCH_PUBLIC_ACCESS_CS_H_
-
-class be_visitor_union_branch_public_access_cs : public be_visitor_decl
-{
- //
- // = TITLE
- // be_visitor_union_branch_public_access_cs
- //
- // = DESCRIPTION
- // This is used to generate the body of the access method
- //
-public:
- be_visitor_union_branch_public_access_cs (be_visitor_context *ctx);
- // constructor
-
- ~be_visitor_union_branch_public_access_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_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_ACCESS_CS_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
index fe324e600d0..731ecad3b2d 100644
--- 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
@@ -58,6 +58,12 @@ public:
virtual int visit_interface_fwd (be_interface_fwd *node);
// visit interface forward type
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit interface type
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit interface forward type
+
virtual int visit_predefined_type (be_predefined_type *node);
// visit predefined type
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
index 13833d3c657..93506c700ec 100644
--- 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
@@ -82,7 +82,6 @@ public:
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
index 585d8f0453d..d492157bd99 100644
--- 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
@@ -58,6 +58,12 @@ public:
virtual int visit_interface_fwd (be_interface_fwd *node);
// visit interface forward type
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit value type
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit value forward type
+
virtual int visit_predefined_type (be_predefined_type *node);
// visit predefined type
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
index c66e142c280..f079aeef154 100644
--- 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
@@ -63,7 +63,6 @@ public:
virtual int visit_union (be_union *node);
// visit union type
-
};
#endif /* _BE_VISITOR_UNION_BRANCS_PUBLIC_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_reset_cs.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_reset_cs.h
index e7fa0b7733a..695604da6c2 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_reset_cs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_reset_cs.h
@@ -58,6 +58,12 @@ public:
virtual int visit_interface_fwd (be_interface_fwd *node);
// visit interface forward type
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit interface type
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit interface forward type
+
virtual int visit_predefined_type (be_predefined_type *node);
// visit predefined type
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_fwd.h b/TAO/TAO_IDL/be_include/be_visitor_union_fwd.h
new file mode 100644
index 00000000000..68640eb5cbe
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_fwd.h
@@ -0,0 +1,28 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_union_fwd.h
+//
+// = DESCRIPTION
+// Concrete visitor for the be_union_fwd class
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_UNION_FWD_H
+#define TAO_BE_VISITOR_UNION_FWD_H
+
+#include "be_visitor_decl.h"
+#include "be_visitor_union_fwd/union_fwd_ch.h"
+
+#endif /* TAO_BE_VISITOR_UNION_FWD_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_fwd/union_fwd_ch.h b/TAO/TAO_IDL/be_include/be_visitor_union_fwd/union_fwd_ch.h
new file mode 100644
index 00000000000..54b3875ddc0
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_fwd/union_fwd_ch.h
@@ -0,0 +1,42 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// union_fwd_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the be_union_fwd node.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_UNION_FWD_CH_H_
+#define _BE_INTERFACE_UNION_FWD_CH_H_
+
+class be_visitor_union_fwd_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_union_fwd_ch
+ //
+ // = DESCRIPTION
+ // This is the visitor for be_union_fwd for the header file
+ //
+ //
+public:
+ be_visitor_union_fwd_ch (be_visitor_context *ctx);
+
+ ~be_visitor_union_fwd_ch (void);
+
+ virtual int visit_union_fwd (be_union_fwd *node);
+};
+
+#endif /* _BE_INTERFACE_UNION_FWD_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype.h
index 873ab40c764..7dcaf198e15 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_valuetype.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype.h
@@ -18,8 +18,9 @@
#ifndef TAO_BE_VISITOR_VALUETYPE_H
#define TAO_BE_VISITOR_VALUETYPE_H
-#include "be_visitor_scope.h"
+#include "idl_defines.h"
+#include "be_visitor_scope.h"
#include "be_visitor_valuetype/valuetype.h"
#include "be_visitor_valuetype/valuetype_ch.h"
#include "be_visitor_valuetype/valuetype_obv_ch.h"
@@ -27,6 +28,9 @@
#include "be_visitor_valuetype/valuetype_obv_cs.h"
#include "be_visitor_valuetype/valuetype_ci.h"
#include "be_visitor_valuetype/valuetype_cs.h"
+#include "be_visitor_valuetype/valuetype_sh.h"
+#include "be_visitor_valuetype/valuetype_si.h"
+#include "be_visitor_valuetype/valuetype_ss.h"
#include "be_visitor_valuetype/any_op_ch.h"
#include "be_visitor_valuetype/any_op_cs.h"
#include "be_visitor_valuetype/cdr_op_ch.h"
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/arglist.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/arglist.h
index 9e8002f517a..2b8cf372e91 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_valuetype/arglist.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/arglist.h
@@ -52,7 +52,6 @@ public:
int post_process (be_decl *bd);
// set 'comma' only between arguments
-
};
#endif /* _BE_VISITOR_OBV_OPERATION_ARGLIST_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype.h
index fdb74a70d9f..0116761b97a 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype.h
@@ -66,18 +66,21 @@ public:
virtual int visit_enum (be_enum *node);
// visit an enum
- virtual int visit_operation (be_operation *node);
- // visit operation
-
virtual int visit_exception (be_exception *node);
// visit exception (not used)
virtual int visit_structure (be_structure *node);
// visit a structure
+ virtual int visit_structure_fwd (be_structure_fwd *node);
+ // visit a forward declared structure
+
virtual int visit_union (be_union *node);
// visit a union
+ virtual int visit_union_fwd (be_union_fwd *node);
+ // visit a forward declared union
+
virtual int visit_typedef (be_typedef *node);
// visit the typedef node
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_ch.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_ch.h
index 527262a2721..054f2ed38af 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_ch.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_ch.h
@@ -48,8 +48,14 @@ public:
virtual int visit_operation (be_operation *node);
virtual int visit_field (be_field *node);
- void begin_public ();
- void begin_private ();
+ void begin_public (void);
+ void begin_private (void);
+
+ static int gen_supported_ops (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os);
+ // Helper method passed to the template method to generate code for
+ // the operations of the parents of supported interfaces.
};
#endif /* _BE_VALUETYPE_VALUETYPE_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_sh.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_sh.h
new file mode 100644
index 00000000000..7bc105ebc18
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_sh.h
@@ -0,0 +1,46 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_sh.h
+//
+// = DESCRIPTION
+// Concrete visitor for the valuetype node.
+// This provides for code generation in the server header
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_VALUETYPE_VALUETYPE_SH_H_
+#define _BE_VALUETYPE_VALUETYPE_SH_H_
+
+class be_visitor_valuetype_sh : public be_visitor_valuetype
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_sh
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the server header for valuetype
+ //
+ //
+public:
+ be_visitor_valuetype_sh (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_sh (void);
+ // destructor
+
+ virtual int visit_valuetype (be_valuetype *node);
+ // set the right context and make a visitor
+};
+
+#endif /* _BE_VALUETYPE_VALUETYPE_SH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_si.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_si.h
new file mode 100644
index 00000000000..bbe594e1283
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_si.h
@@ -0,0 +1,46 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_si.h
+//
+// = DESCRIPTION
+// Concrete visitor for the valuetype node.
+// This provides for code generation in the server inline
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_VALUETYPE_VALUETYPE_SI_H_
+#define _BE_VALUETYPE_VALUETYPE_SI_H_
+
+class be_visitor_valuetype_si : public be_visitor_valuetype
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_si
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the server inline for valuetype
+ //
+ //
+public:
+ be_visitor_valuetype_si (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_si (void);
+ // destructor
+
+ virtual int visit_valuetype (be_valuetype *node);
+ // set the right context and make a visitor
+};
+
+#endif /* _BE_VALUETYPE_VALUETYPE_SI_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_ss.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_ss.h
new file mode 100644
index 00000000000..57dbef6bdcc
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_ss.h
@@ -0,0 +1,51 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_ss.h
+//
+// = DESCRIPTION
+// Concrete visitor for the valuetype node.
+// This provides for code generation in the server skeleton
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_VALUETYPE_VALUETYPE_SS_H_
+#define _BE_VALUETYPE_VALUETYPE_SS_H_
+
+class be_visitor_valuetype_ss : public be_visitor_valuetype
+{
+ //
+ // = TITLE
+ // be_visitor_valuetype_ss
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the server skeletons for
+ // interface
+ //
+public:
+ be_visitor_valuetype_ss (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_valuetype_ss (void);
+ // destructor
+
+ virtual int visit_valuetype (be_valuetype *node);
+ // set the right context and make a visitor
+
+protected:
+ ACE_CString generate_flat_name (be_valuetype *node);
+ ACE_CString generate_local_name (be_valuetype *node);
+ ACE_CString generate_full_skel_name (be_valuetype *node);
+};
+
+#endif /* _BE_VALUETYPE_VALUETYPE_SS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd.h
index ce88329fe5d..d867c2d31d9 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd.h
@@ -23,9 +23,7 @@
#ifndef TAO_BE_VISITOR_VALUETYPE_FWD_H
#define TAO_BE_VISITOR_VALUETYPE_FWD_H
-#include "be_visitor.h"
-#include "be_visitor_scope.h"
-
+#include "be_visitor_decl.h"
#include "be_visitor_valuetype_fwd/valuetype_fwd_ch.h"
#include "be_visitor_valuetype_fwd/valuetype_fwd_ci.h"
#include "be_visitor_valuetype_fwd/cdr_op_ch.h"
diff --git a/TAO/TAO_IDL/driver/Makefile.am b/TAO/TAO_IDL/driver/Makefile.am
index 0a03613982e..9dfb189c2ab 100644
--- a/TAO/TAO_IDL/driver/Makefile.am
+++ b/TAO/TAO_IDL/driver/Makefile.am
@@ -22,11 +22,8 @@ noinst_LTLIBRARIES = libdriver.la
libdriver_la_SOURCES = \
drv_args.cpp \
- drv_fork.cpp \
- drv_init.cpp \
- drv_link.cpp \
drv_preproc.cpp \
- drv_private.cpp
+ tao_idl.cpp
## Additional C++ preprocessor flags to define for the TAO IDL compiler.
AM_CPPFLAGS = \
diff --git a/TAO/TAO_IDL/driver/drv_args.cpp b/TAO/TAO_IDL/driver/drv_args.cpp
index 0d29064b20b..303de028dd9 100644
--- a/TAO/TAO_IDL/driver/drv_args.cpp
+++ b/TAO/TAO_IDL/driver/drv_args.cpp
@@ -66,14 +66,19 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// drv_args.c - Argument parsing for IDL compiler main driver
-#include "idl.h"
-#include "idl_extern.h"
-#include "drv_private.h"
-#include "drv_extern.h"
-#include "be.h"
-#include "ace/Process.h"
+#include "idl_defines.h"
+#include "global_extern.h"
+#include "drv_extern.h"
+#include "be_global.h"
+#include "be_extern.h"
+#include "ace/Process.h"
-ACE_RCSID(driver, drv_args, "$Id$")
+ACE_RCSID (driver,
+ drv_args,
+ "$Id$")
+
+extern long DRV_nfiles;
+extern const char *DRV_files[];
// Push a file into the list of files to be processed
static void
@@ -86,16 +91,19 @@ DRV_push_file (const char *s)
static void
DRV_prep_cpp_arg (char *s)
{
- char *newarg = new char[512];
+ char *newarg = 0;
+ ACE_NEW (newarg,
+ char[512]);
char *farg;
newarg[0] = '\0';
for (farg = ACE_OS::strtok (s, ",");
- farg != NULL;
+ farg != 0;
farg = ACE_OS::strtok (0, ","))
{
- ACE_OS::strcat (newarg, farg);
+ ACE_OS::strcat (newarg,
+ farg);
}
DRV_cpp_putarg (newarg);
@@ -241,19 +249,18 @@ DRV_usage (void)
));
ACE_DEBUG ((
LM_DEBUG,
- ACE_TEXT (" -Ge [0|1]\t\t\tDisable/Enable generation of")
- ACE_TEXT (" CORBA::Environment arguments (disabled by default")
- ACE_TEXT (" if ACE_HAS_EXCEPTIONS)\n")
+ ACE_TEXT (" -GC \t\tGenerate the code for using AMI Call back model\n")
));
ACE_DEBUG ((
LM_DEBUG,
- ACE_TEXT (" -Gt\t\t\tenable optimized TypeCode support")
- ACE_TEXT (" (unopt by default)\n")
+ ACE_TEXT (" -Gd \t\tGenerate the code for direct collocation. Default")
+ ACE_TEXT ("is thru-POA collocation\n")
));
ACE_DEBUG ((
LM_DEBUG,
- ACE_TEXT (" -Gv\t\t\tenable OBV (Valuetype) support")
- ACE_TEXT (" (disabled by default)\n")
+ ACE_TEXT (" -Ge [0|1]\t\t\tDisable/Enable generation of")
+ ACE_TEXT (" CORBA::Environment arguments (disabled by default")
+ ACE_TEXT (" if ACE_HAS_EXCEPTIONS)\n")
));
ACE_DEBUG ((
LM_DEBUG,
@@ -281,7 +288,13 @@ DRV_usage (void)
));
ACE_DEBUG ((
LM_DEBUG,
- ACE_TEXT (" -GC \t\tGenerate the code for using AMI Call back model\n")
+ ACE_TEXT (" -Gm \t\tEnable support for CORBA components\n")
+ ACE_TEXT (" (default)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Gp \t\tGenerate the code for thru-POA collocation")
+ ACE_TEXT (" (default)\n")
));
ACE_DEBUG ((
LM_DEBUG,
@@ -289,6 +302,16 @@ DRV_usage (void)
));
ACE_DEBUG ((
LM_DEBUG,
+ ACE_TEXT (" -Gt\t\t\tenable optimized TypeCode support")
+ ACE_TEXT (" (unopt by default)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -Gv\t\t\tenable OBV (Valuetype) support")
+ ACE_TEXT (" (disabled by default)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
ACE_TEXT (" -hc\t\t\tClient's header file name ending.")
ACE_TEXT (" Default is C.h\n")
));
@@ -430,6 +453,114 @@ DRV_usage (void)
));
}
+// Return 0 on success, -1 failure. The <errno> corresponding to the
+// error that caused the GPERF execution is also set.
+int
+DRV_check_gperf (void)
+{
+ // If absolute path is not specified yet, let us call just
+ // "gperf". Hopefully PATH is set up correctly to locate the gperf.
+ if (idl_global->gperf_path () == 0)
+ {
+ // If ACE_GPERF is defined then use that gperf program instead of "gperf."
+#if defined (ACE_GPERF)
+ idl_global->gperf_path (ACE_GPERF);
+#else
+ idl_global->gperf_path ("gperf");
+#endif /* ACE_GPERF */
+ }
+
+ // If we have absolute path for the <gperf> rather than just the
+ // executable name <gperf>, make sure the file exists
+ // firsts. Otherwise just call <gperf>. Probably PATH is set
+ // correctly to take care of this.
+
+ // If ACE_GPERF is defined then use that gperf program instead of "gperf."
+#if defined (ACE_GPERF)
+ if (ACE_OS::strcmp (idl_global->gperf_path (), ACE_GPERF) != 0)
+#else
+ if (ACE_OS::strcmp (idl_global->gperf_path (), "gperf") != 0)
+#endif /* ACE_GPERF */
+ {
+ // It is absolute path. Check the existance, permissions and
+ // the modes.
+ if (ACE_OS::access (idl_global->gperf_path (),
+ F_OK | X_OK) == -1)
+ {
+ // Problem with the file. No point in having the absolute
+ // path. Swith to "gperf".
+ // If ACE_GPERF is defined then use that gperf program
+ //instead of "gperf."
+#if defined (ACE_GPERF)
+ idl_global->gperf_path (ACE_GPERF);
+#else
+ idl_global->gperf_path ("gperf");
+#endif /* ACE_GPERF */
+ }
+ }
+
+ // Just call gperf in silent mode. It will come and immly exit.
+
+ // Using ACE_Process.
+ ACE_Process process;
+ ACE_Process_Options process_options;
+
+ // Set the command line for the gperf program.
+ process_options.command_line ("%s"
+ " "
+ "-V",
+ idl_global->gperf_path ());
+
+ // Spawn a process for gperf.
+ if (process.spawn (process_options) == -1)
+ {
+ return -1;
+ }
+
+#if defined (ACE_WIN32)
+ // No wait or anything in Win32.
+ return 0;
+#endif /* ACE_WIN32 */
+
+ // Wait for gperf to complete.
+ ACE_exitcode wait_status = 0;
+ if (process.wait (&wait_status) == -1)
+ {
+ return -1;
+ }
+ else
+ {
+ // Wait is sucessful, we will check the exit code from the
+ // spawned process.
+ if (WIFEXITED (wait_status))
+ {
+ // Normal exit.
+
+ // Check the exit value of the spawned process. ACE_Process
+ // exits with <errno> as exit code, if it is not able to
+ // exec gperf program, so get the exit code now and set that
+ // to <errno> again, so that it can be used to print error
+ // messages.
+ errno = WEXITSTATUS (wait_status);
+ if (errno)
+ {
+ // <exec> has failed.
+ return -1;
+ }
+ else
+ {
+ // Everything was alright.
+ return 0;
+ }
+ }
+ else
+ {
+ // Not a normal exit. No <errno> might be set.
+ return -1;
+ }
+ }
+}
+
// Parse arguments on command line
void
DRV_parse_args (long ac, char **av)
@@ -1012,6 +1143,7 @@ DRV_parse_args (long ac, char **av)
ACE_OS::exit (99);
}
+
break;
case 'G':
// Enable generation of ...
@@ -1042,9 +1174,44 @@ DRV_parse_args (long ac, char **av)
else if (av[i][2] == 's')
{
if (av[i][3] == 'p')
- // smart proxies
- be_global->gen_smart_proxies (I_TRUE);
+ {
+ // smart proxies
+ be_global->gen_smart_proxies (I_TRUE);
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand ")
+ ACE_TEXT ("the '%s' option\n"),
+ av[i]
+ ));
+
+ ACE_OS::exit (99);
+ }
+
+ break;
+ }
+ else if (av[i][2] == 'i')
+ {
+ if (av[i][3] == 'c')
+ {
+ // inline constants
+ be_global->gen_inline_constants (I_TRUE);
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand ")
+ ACE_TEXT ("the '%s' option\n"),
+ av[i]
+ ));
+
+ ACE_OS::exit (99);
+ }
+ break;
}
else if (av[i][2] == 't')
{
@@ -1066,6 +1233,11 @@ DRV_parse_args (long ac, char **av)
// enable OBV (Valuetype) support
idl_global->obv_support (1);
}
+ else if (av[i][2] == 'm')
+ {
+ // enable CORBA component support
+ idl_global->component_support (1);
+ }
else if (av[i][2] == 'I')
{
int options = ACE_OS::strlen(av[i]) - 3;
@@ -1261,110 +1433,3 @@ DRV_parse_args (long ac, char **av)
}
}
-// Return 0 on success, -1 failure. The <errno> corresponding to the
-// error that caused the GPERF execution is also set.
-int
-DRV_check_gperf (void)
-{
- // If absolute path is not specified yet, let us call just
- // "gperf". Hopefully PATH is set up correctly to locate the gperf.
- if (idl_global->gperf_path () == 0)
- {
- // If ACE_GPERF is defined then use that gperf program instead of "gperf."
-#if defined (ACE_GPERF)
- idl_global->gperf_path (ACE_GPERF);
-#else
- idl_global->gperf_path ("gperf");
-#endif /* ACE_GPERF */
- }
-
- // If we have absolute path for the <gperf> rather than just the
- // executable name <gperf>, make sure the file exists
- // firsts. Otherwise just call <gperf>. Probably PATH is set
- // correctly to take care of this.
-
- // If ACE_GPERF is defined then use that gperf program instead of "gperf."
-#if defined (ACE_GPERF)
- if (ACE_OS::strcmp (idl_global->gperf_path (), ACE_GPERF) != 0)
-#else
- if (ACE_OS::strcmp (idl_global->gperf_path (), "gperf") != 0)
-#endif /* ACE_GPERF */
- {
- // It is absolute path. Check the existance, permissions and
- // the modes.
- if (ACE_OS::access (idl_global->gperf_path (),
- F_OK | X_OK) == -1)
- {
- // Problem with the file. No point in having the absolute
- // path. Swith to "gperf".
- // If ACE_GPERF is defined then use that gperf program
- //instead of "gperf."
-#if defined (ACE_GPERF)
- idl_global->gperf_path (ACE_GPERF);
-#else
- idl_global->gperf_path ("gperf");
-#endif /* ACE_GPERF */
- }
- }
-
- // Just call gperf in silent mode. It will come and immly exit.
-
- // Using ACE_Process.
- ACE_Process process;
- ACE_Process_Options process_options;
-
- // Set the command line for the gperf program.
- process_options.command_line ("%s"
- " "
- "-V",
- idl_global->gperf_path ());
-
- // Spawn a process for gperf.
- if (process.spawn (process_options) == -1)
- {
- return -1;
- }
-
-#if defined (ACE_WIN32)
- // No wait or anything in Win32.
- return 0;
-#endif /* ACE_WIN32 */
-
- // Wait for gperf to complete.
- ACE_exitcode wait_status = 0;
- if (process.wait (&wait_status) == -1)
- {
- return -1;
- }
- else
- {
- // Wait is sucessful, we will check the exit code from the
- // spawned process.
- if (WIFEXITED (wait_status))
- {
- // Normal exit.
-
- // Check the exit value of the spawned process. ACE_Process
- // exits with <errno> as exit code, if it is not able to
- // exec gperf program, so get the exit code now and set that
- // to <errno> again, so that it can be used to print error
- // messages.
- errno = WEXITSTATUS (wait_status);
- if (errno)
- {
- // <exec> has failed.
- return -1;
- }
- else
- {
- // Everything was alright.
- return 0;
- }
- }
- else
- {
- // Not a normal exit. No <errno> might be set.
- return -1;
- }
- }
-}
diff --git a/TAO/TAO_IDL/driver/drv_preproc.cpp b/TAO/TAO_IDL/driver/drv_preproc.cpp
index ade91b18ac4..44d31aaf9c4 100644
--- a/TAO/TAO_IDL/driver/drv_preproc.cpp
+++ b/TAO/TAO_IDL/driver/drv_preproc.cpp
@@ -66,17 +66,21 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// Pass an IDL file through the C preprocessor
-#include "idl.h"
-#include "idl_extern.h"
-#include "drv_private.h"
+#include "idl_bool.h"
+#include "idl_defines.h"
+#include "global_extern.h"
+#include "fe_extern.h"
#include "drv_extern.h"
+#include "utl_string.h"
#include "ace/Version.h"
#include "ace/Process_Manager.h"
#include "ace/SString.h"
#include "ace/Env_Value_T.h"
#include "ace/ARGV.h"
-ACE_RCSID(driver, drv_preproc, "$Id$")
+ACE_RCSID (driver,
+ drv_preproc,
+ "$Id$")
static long argcount = 0;
static long max_argcount = 128;
@@ -84,14 +88,14 @@ static const char *arglist[128];
static const char *output_arg_format = 0;
static long output_arg_index = 0;
-// Push the new CPP location if we got a -Yp argument
+// Push the new CPP location if we got a -Yp argument.
void
DRV_cpp_new_location (const char *new_loc)
{
arglist[0] = new_loc;
}
-// Push an argument into the arglist
+// Push an argument into the arglist.
void
DRV_cpp_putarg (const char *str)
{
@@ -100,9 +104,9 @@ DRV_cpp_putarg (const char *str)
ACE_ERROR ((LM_ERROR,
"%s%s %d %s\n",
idl_global->prog_name (),
- ACE_TEXT (": More than"),
+ ": More than",
max_argcount,
- ACE_TEXT ("arguments to preprocessor")));
+ "arguments to preprocessor"));
ACE_OS::exit (99);
}
@@ -133,21 +137,56 @@ DRV_cpp_expand_output_arg (const char *filename)
}
}
-// Initialize the cpp argument list
+// Lines can be 1024 chars long.
+#define LINEBUF_SIZE 1024
+static char drv_line[LINEBUF_SIZE + 1];
+
+// Get a line from stdin.
+static long
+DRV_get_line (FILE *f)
+{
+ char *l = fgets (drv_line,
+ LINEBUF_SIZE,
+ f);
+ long i = 0;
+
+ if (l == 0)
+ {
+ return I_FALSE;
+ }
+
+ if (*l == '\0' && feof (f))
+ {
+ return I_FALSE;
+ }
+
+ if (*l == '\0')
+ {
+ return I_TRUE;
+ }
+
+ i = strlen(l) - 1;
+
+ if (l[i] == '\n')
+ {
+ l[i] = '\0';
+ }
+
+ return I_TRUE;
+}
+
+// Initialize the cpp argument list.
void
DRV_cpp_init (void)
{
- // @@ There are two "one time" memory leaks in this function.
- // They will not blow off the program but should be fixed at some point.
const char *cpp_loc, *cpp_args;
// See if TAO_IDL_PREPROCESSOR is defined.
-
- ACE_Env_Value<char*> preprocessor ("TAO_IDL_PREPROCESSOR", (char *) 0);
+ ACE_Env_Value<char*> preprocessor ("TAO_IDL_PREPROCESSOR",
+ (char *) 0);
// Set cpp_loc to the built in location, unless it has been overriden by
// environment variables.
-
if (preprocessor != 0)
{
cpp_loc = preprocessor;
@@ -161,10 +200,10 @@ DRV_cpp_init (void)
if (cpp_path != 0)
{
ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("Warning: The environment variable ")
- ACE_TEXT ("CPP_LOCATION has been deprecated.\n")
- ACE_TEXT (" Please use TAO_IDL_PREPROCESSOR ")
- ACE_TEXT ("instead.\n")));
+ "Warning: The environment variable "
+ "CPP_LOCATION has been deprecated.\n"
+ " Please use TAO_IDL_PREPROCESSOR "
+ "instead.\n"));
cpp_loc = cpp_path;
}
@@ -178,7 +217,7 @@ DRV_cpp_init (void)
// Add an option to the IDL compiler to make the TAO version
// available to the user. A XX.YY.ZZ release gets version 0xXXYYZZ,
- // for example, 5.1.14 gets 0x050114
+ // for example, 5.1.14 gets 0x050114.
char version_option[128];
ACE_OS::sprintf (version_option,
"-D__TAO_IDL=0x%2.2d%2.2d%2.2d",
@@ -190,7 +229,6 @@ DRV_cpp_init (void)
DRV_cpp_putarg ("-I.");
// Added some customizable preprocessor options
-
ACE_Env_Value<char*> args1 ("TAO_IDL_PREPROCESSOR_ARGS",
(char *) 0);
@@ -200,19 +238,19 @@ DRV_cpp_init (void)
}
else
{
- // Check for the deprecated TAO_IDL_DEFAULT_CPP_FLAGS environment variable
+ // Check for the deprecated TAO_IDL_DEFAULT_CPP_FLAGS environment
+ // variable.
ACE_Env_Value<char*> args2 ("TAO_IDL_DEFAULT_CPP_FLAGS",
(char *) 0);
if (args2 != 0)
{
ACE_ERROR ((LM_ERROR,
- "%s%s%s%s%s",
- ACE_TEXT ("Warning: The environment variable "),
- ACE_TEXT ("TAO_IDL_DEFAULT_CPP_FLAGS has been "),
- ACE_TEXT ("deprecated.\n"),
- ACE_TEXT (" Please use "),
- ACE_TEXT ("TAO_IDL_PREPROCESSOR_ARGS instead.\n")));
+ "Warning: The environment variable "
+ "TAO_IDL_DEFAULT_CPP_FLAGS has been "
+ "deprecated.\n"
+ " Please use "
+ "TAO_IDL_PREPROCESSOR_ARGS instead.\n"));
cpp_args = args2;
}
@@ -237,7 +275,8 @@ DRV_cpp_init (void)
// TAO_IDL_INCLUDE_DIR should be in quotes,
// e.g. "/usr/local/include/tao"
- ACE_OS::strcat (option, TAO_IDL_INCLUDE_DIR);
+ ACE_OS::strcat (option,
+ TAO_IDL_INCLUDE_DIR);
#else
const char* TAO_ROOT = ACE_OS::getenv ("TAO_ROOT");
@@ -259,11 +298,10 @@ DRV_cpp_init (void)
{
ACE_ERROR ((
LM_ERROR,
- "%s%s%s%s",
- ACE_TEXT ("Note: The environment variables "),
- ACE_TEXT ("TAO_ROOT and ACE_ROOT are not defined.\n"),
- ACE_TEXT (" TAO_IDL may not be able to "),
- ACE_TEXT ("locate orb.idl\n")
+ "Note: The environment variables "
+ "TAO_ROOT and ACE_ROOT are not defined.\n"
+ " TAO_IDL may not be able to "
+ "locate orb.idl\n"
));
ACE_OS::strcat (option, ".");
@@ -272,8 +310,8 @@ DRV_cpp_init (void)
#endif /* TAO_IDL_INCLUDE_DIR */
DRV_cpp_putarg (option);
- }
- }
+ }
+ }
// Add any flags in cpp_args to cpp's arglist.
ACE_ARGV arglist (cpp_args);
@@ -281,7 +319,8 @@ DRV_cpp_init (void)
for (size_t arg_cnt = 0; arg_cnt < arglist.argc (); ++arg_cnt)
{
// Check for an argument that specifies the preprocessor's output file.
- if (ACE_OS::strstr (arglist[arg_cnt], "%s") != 0 && output_arg_format == 0)
+ if (ACE_OS::strstr (arglist[arg_cnt], "%s") != 0
+ && output_arg_format == 0)
{
output_arg_format = ACE::strnew (arglist[arg_cnt]);
output_arg_index = argcount;
@@ -294,42 +333,126 @@ DRV_cpp_init (void)
}
}
-// Lines can be 1024 chars long.
-#define LINEBUF_SIZE 1024
-static char drv_line[LINEBUF_SIZE + 1];
-
-// Get a line from stdin
-static long
-DRV_get_line (FILE *f)
+// We really need to know whether this line is a "#include ...". If
+// so, we would like to separate the "file name" and keep that in the
+// idl_global. We need them to produce "#include's in the stubs and
+// skeletons.
+void
+DRV_check_for_include (const char* buf)
{
- char *l = fgets (drv_line,
- LINEBUF_SIZE,
- f);
- long i = 0;
+ const char* r = buf;
+ const char* h;
- if (l == NULL)
- {
- return I_FALSE;
- }
+ // Skip initial '#'.
+ if (*r != '#')
+ {
+ return;
+ }
+ else
+ {
+ r++;
+ }
- if (*l == '\0' && feof (f))
- {
- return I_FALSE;
- }
+ // Skip the tabs and spaces.
+ while (*r == ' ' || *r == '\t')
+ {
+ ++r;
+ }
- if (*l == '\0')
- {
- return I_TRUE;
- }
+ // Probably we are at the word `include`. If not return.
+ if (*r != 'i')
+ {
+ return;
+ }
- i = strlen(l) - 1;
+ // Check whether this word is `include` or no.
+ const char* include_str = "include";
- if (l[i] == '\n')
- {
- l[i] = '\0';
- }
+ for (size_t ii = 0;
+ ii < strlen ("include") && *r != '\0' && *r != ' ' && *r != '\t';
+ ++r, ++ii)
+ {
+ // Return if it doesn't match.
+ if (include_str [ii] != *r)
+ {
+ return;
+ }
+ }
- return I_TRUE;
+ // Next thing is finding the file that has been `#include'd. Skip
+ // all the blanks and tabs and reach the startng " or < character.
+ for (; (*r != '"') && (*r != '<'); ++r)
+ {
+ if (*r == '\n' || *r == '\0')
+ {
+ return;
+ }
+ }
+
+ // Decide on the end char.
+ char end_char = '"';
+
+ if (*r == '<')
+ {
+ end_char = '>';
+ }
+
+ // Skip this " or <.
+ ++r;
+
+ // Store this position.
+ h = r;
+
+ // Found this in idl.ll. Decides the file to be standard input.
+ if (*h == '\0')
+ {
+ return;
+ }
+
+ // Find the closing " or < character.
+ for (; *r != end_char; ++r)
+ {
+ continue;
+ }
+
+ // Make a new string for this file name.
+ char* file_name = 0;
+ ACE_NEW (file_name,
+ char [r - h + 1]);
+
+ // Copy the char's.
+ size_t fi = 0;
+
+ for (; h != r; ++fi, ++h)
+ {
+ file_name [fi] = *h;
+ }
+
+ // Terminate the string.
+ file_name [fi] = '\0';
+
+ // Put Microsoft-style pathnames into a canonical form.
+ size_t i = 0;
+
+ for (size_t j = 0; file_name [j] != '\0'; ++i, ++j)
+ {
+ if (file_name [j] == '\\' && file_name [j + 1] == '\\')
+ {
+ j++;
+ }
+
+ file_name [i] = file_name [j];
+ }
+
+ // Terminate this string.
+ file_name [i] = '\0';
+
+ // Store in the idl_global, unless it's "orb.idl" -
+ // we don't want to generate header includes for that.
+ if (ACE_OS::strcmp (file_name, "orb.idl"))
+ {
+ idl_global->add_to_included_idl_files (file_name);
+ }
}
// Copy from stdin to a file
@@ -340,24 +463,24 @@ DRV_copy_input (FILE *fin,
{
FILE *f = ACE_OS::fopen (fn, "w");
- if (f == NULL)
+ if (f == 0)
{
ACE_ERROR ((LM_ERROR,
"%s%s%s%s",
idl_global->prog_name (),
- ACE_TEXT (": cannot open temp file "),
+ ": cannot open temp file ",
fn,
- ACE_TEXT (" for writing\n")));
+ " for writing\n"));
ACE_OS::exit (99);
}
- if (fin == NULL)
+ if (fin == 0)
{
ACE_ERROR ((LM_ERROR,
"%s%s",
idl_global->prog_name (),
- ACE_TEXT (": cannot open input file\n")));
+ ": cannot open input file\n"));
ACE_OS::exit (99);
}
@@ -409,16 +532,16 @@ DRV_copy_input (FILE *fin,
}
// Strip down a name to the last component,
-// i.e. everything after the last '/' or '\' character
+// i.e. everything after the last '/' or '\' character.
static char *
DRV_stripped_name (char *fn)
{
- char *n = fn;
- long l;
+ char *n = fn;
+ long l;
- if (n == NULL)
+ if (n == 0)
{
- return NULL;
+ return 0;
}
l = strlen (n);
@@ -439,11 +562,11 @@ DRV_stripped_name (char *fn)
return n;
}
-// File names
+// File names.
static char tmp_file[128];
static char tmp_ifile[128];
-// Pass input through preprocessor
+// Pass input through preprocessor.
void
DRV_pre_proc (const char *myfile)
{
@@ -454,14 +577,22 @@ DRV_pre_proc (const char *myfile)
const char* tmpdir = idl_global->temp_dir ();
- ACE_OS::strcpy (tmp_file, tmpdir);
- ACE_OS::strcpy (tmp_ifile, tmpdir);
+ ACE_OS::strcpy (tmp_file,
+ tmpdir);
+ ACE_OS::strcpy (tmp_ifile,
+ tmpdir);
- ACE_OS::strcat (tmp_file, "idlf_XXXXXX");
- ACE_OS::strcat (tmp_ifile, "idli_XXXXXX");
+ ACE_OS::strcat (tmp_file,
+ "idlf_XXXXXX");
+ ACE_OS::strcat (tmp_ifile,
+ "idli_XXXXXX");
- (void) ACE_OS::mktemp (tmp_file); ACE_OS::strcat (tmp_file, ".cc");
- (void) ACE_OS::mktemp (tmp_ifile); ACE_OS::strcat (tmp_ifile, ".cc");
+ (void) ACE_OS::mktemp (tmp_file);
+ ACE_OS::strcat (tmp_file,
+ ".cc");
+ (void) ACE_OS::mktemp (tmp_ifile);
+ ACE_OS::strcat (tmp_ifile,
+ ".cc");
UTL_String *tmp = 0;
@@ -543,9 +674,9 @@ DRV_pre_proc (const char *myfile)
ACE_ERROR ((LM_ERROR,
"%s%s%s%s",
idl_global->prog_name (),
- ACE_TEXT (": cannot open temp file "),
+ ": cannot open temp file ",
tmp_file,
- ACE_TEXT (" for writing\n")));
+ " for writing\n"));
return;
}
@@ -558,9 +689,9 @@ DRV_pre_proc (const char *myfile)
ACE_ERROR ((LM_ERROR,
"%s%s%s%s",
idl_global->prog_name (),
- ACE_TEXT (": spawn of "),
+ ": spawn of ",
arglist[0],
- ACE_TEXT (" failed\n")));
+ " failed\n"));
return;
}
@@ -573,9 +704,9 @@ DRV_pre_proc (const char *myfile)
ACE_ERROR ((LM_ERROR,
"%s%s%s%s",
idl_global->prog_name (),
- ACE_TEXT (": cannot close temp file"),
+ ": cannot close temp file",
tmp_file,
- ACE_TEXT (" on parent\n")));
+ " on parent\n"));
return;
}
@@ -586,12 +717,13 @@ DRV_pre_proc (const char *myfile)
argcount -= 2;
ACE_exitcode status = 0;
+
if (process.wait (&status) == ACE_INVALID_PID)
{
ACE_ERROR ((LM_ERROR,
"%s%s",
idl_global->prog_name (),
- ACE_TEXT (": wait for child process failed\n")));
+ ": wait for child process failed\n"));
return;
}
@@ -606,9 +738,9 @@ DRV_pre_proc (const char *myfile)
ACE_ERROR ((LM_ERROR,
"%s%s%s%s",
idl_global->prog_name (),
- ACE_TEXT (": preprocessor "),
+ ": preprocessor ",
arglist[0],
- ACE_TEXT (" returned with an error\n")));
+ " returned with an error\n"));
ACE_OS::exit (1);
}
@@ -621,9 +753,9 @@ DRV_pre_proc (const char *myfile)
ACE_ERROR ((LM_ERROR,
"%s%s%s%s",
idl_global->prog_name (),
- ACE_TEXT (": preprocessor "),
+ ": preprocessor ",
arglist[0],
- ACE_TEXT (" appears to have been interrupted\n")));
+ " appears to have been interrupted\n"));
ACE_OS::exit (1);
}
@@ -638,7 +770,7 @@ DRV_pre_proc (const char *myfile)
ACE_ERROR ((LM_ERROR,
"%s%s %s\n",
idl_global->prog_name (),
- ACE_TEXT (": Could not open cpp output file"),
+ ": Could not open cpp output file",
tmp_file));
ACE_OS::exit (99);
@@ -646,7 +778,7 @@ DRV_pre_proc (const char *myfile)
FE_set_yyin (ACE_reinterpret_cast (File *, yyin));
- if (idl_global->compile_flags() & IDL_CF_ONLY_PREPROC)
+ if (idl_global->compile_flags () & IDL_CF_ONLY_PREPROC)
{
FILE *preproc = ACE_OS::fopen (tmp_file, "r");
char buffer[ACE_MAXLOGMSGLEN];
@@ -692,7 +824,7 @@ DRV_pre_proc (const char *myfile)
ACE_ERROR ((LM_ERROR,
"%s%s %s\n",
idl_global->prog_name (),
- ACE_TEXT (": Could not remove cpp input file"),
+ ": Could not remove cpp input file",
tmp_ifile));
ACE_OS::exit (99);
@@ -704,141 +836,19 @@ DRV_pre_proc (const char *myfile)
ACE_ERROR ((LM_ERROR,
"%s%s %s\n",
idl_global->prog_name (),
- ACE_TEXT (": Could not remove cpp output file"),
+ ": Could not remove cpp output file",
tmp_file));
ACE_OS::exit (99);
}
#endif /* ACE_HAS_WINNT4 && ACE_HAS_WINNT4 != 0 */
- if (idl_global->compile_flags() & IDL_CF_ONLY_PREPROC)
+ if (idl_global->compile_flags () & IDL_CF_ONLY_PREPROC)
{
ACE_OS::exit (0);
}
}
-// We really need to know whether this line is a "#include ...". If
-// so, we would like to separate the "file name" and keep that in the
-// idl_global. We need them to produce "#include's in the stubs and
-// skeletons.
-void
-DRV_check_for_include (const char* buf)
-{
- const char* r = buf;
- const char* h;
-
- // Skip initial '#'.
- if (*r != '#')
- {
- return;
- }
- else
- {
- r++;
- }
-
- // Skip the tabs and spaces.
- while (*r == ' ' || *r == '\t')
- {
- r++;
- }
-
- // Probably we are at the word `include`. If not return.
- if (*r != 'i')
- {
- return;
- }
-
- // Check whether this word is `include` or no.
- const char* include_str = "include";
-
- for (size_t ii = 0;
- ii < strlen ("include") && *r != '\0' && *r != ' ' && *r != '\t';
- r++, ii++)
- {
- // Return if it doesn't match.
- if (include_str [ii] != *r)
- {
- return;
- }
- }
-
- // Next thing is finding the file that has been `#include'd. Skip
- // all the blanks and tabs and reach the startng " or < character.
- for (; (*r != '"') && (*r != '<'); r++)
- {
- if (*r == '\n' || *r == '\0')
- {
- return;
- }
- }
-
- // Decide on the end char.
- char end_char = '"';
-
- if (*r == '<')
- {
- end_char = '>';
- }
-
- // Skip this " or <.
- r++;
-
- // Store this position.
- h = r;
-
- // Found this in idl.ll. Decides the file to be standard input.
- if (*h == '\0')
- {
- return;
- }
-
- // Find the closing " or < character.
- for (; *r != end_char; r++)
- {
- continue;
- }
-
- // Make a new string for this file name.
- char* file_name = 0;
- ACE_NEW (file_name,
- char [r - h + 1]);
-
- // Copy the char's.
- size_t fi = 0;
-
- for (; h != r; fi++, h++)
- {
- file_name [fi] = *h;
- }
-
- // Terminate the string.
- file_name [fi] = '\0';
-
- // Put Microsoft-style pathnames into a canonical form.
- size_t i = 0;
-
- for (size_t j = 0; file_name [j] != '\0'; i++, j++)
- {
- if (file_name [j] == '\\' && file_name [j + 1] == '\\')
- {
- j++;
- }
-
- file_name [i] = file_name [j];
- }
-
- // Terminate this string.
- file_name [i] = '\0';
-
- // Store in the idl_global, unless it's "orb.idl" -
- // we don't want to generate header includes for that.
- if (ACE_OS::strcmp (file_name, "orb.idl"))
- {
- idl_global->add_to_included_idl_files (file_name);
- }
-}
-
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Env_Value<char*>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
diff --git a/TAO/TAO_IDL/driver/drv_private.cpp b/TAO/TAO_IDL/driver/drv_private.cpp
deleted file mode 100644
index 3963074b185..00000000000
--- a/TAO/TAO_IDL/driver/drv_private.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-// $Id$
-
-/*
-
-COPYRIGHT
-
-Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
-States of America. All Rights Reserved.
-
-This product is protected by copyright and distributed under the following
-license restricting its use.
-
-The Interface Definition Language Compiler Front End (CFE) is made
-available for your use provided that you include this license and copyright
-notice on all media and documentation and the software program in which
-this product is incorporated in whole or part. You may copy and extend
-functionality (but may not remove functionality) of the Interface
-Definition Language CFE without charge, but you are not authorized to
-license or distribute it to anyone else except as part of a product or
-program developed by you or with the express written consent of Sun
-Microsystems, Inc. ("Sun").
-
-The names of Sun Microsystems, Inc. and any of its subsidiaries or
-affiliates may not be used in advertising or publicity pertaining to
-distribution of Interface Definition Language CFE as permitted herein.
-
-This license is effective until terminated by Sun for failure to comply
-with this license. Upon termination, you shall destroy or return all code
-and documentation for the Interface Definition Language CFE.
-
-INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
-ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
-FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
-DEALING, USAGE OR TRADE PRACTICE.
-
-INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
-ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
-TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
-
-SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
-RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
-INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
-
-IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
-ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
-DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-Use, duplication, or disclosure by the government is subject to
-restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
-Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
-52.227-19.
-
-Sun, Sun Microsystems and the Sun logo are trademarks or registered
-trademarks of Sun Microsystems, Inc.
-
-SunSoft, Inc.
-2550 Garcia Avenue
-Mountain View, California 94043
-
-NOTE:
-
-SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
-trademarks or registered trademarks of Sun Microsystems, Inc.
-
-*/
-
-// Global variables for IDL compiler driver program
-
-#include "idl.h"
-#include "idl_extern.h"
-#include "drv_private.h"
-
-ACE_RCSID(driver, drv_private, "$Id$")
-
-// Storage for file names
-
-#if !defined (NFILES)
-# define NFILES 1024
-#endif /* ! NFILES */
-
-const char *DRV_files[NFILES];
-long DRV_nfiles = 0;
-long DRV_file_index = -1;
diff --git a/TAO/TAO_IDL/fe/Makefile.am b/TAO/TAO_IDL/fe/Makefile.am
index f7074e41070..728634a90a1 100644
--- a/TAO/TAO_IDL/fe/Makefile.am
+++ b/TAO/TAO_IDL/fe/Makefile.am
@@ -20,6 +20,7 @@ noinst_LTLIBRARIES = libfe.la
libfe_la_SOURCES = \
fe_declarator.cpp \
fe_extern.cpp \
+ fe_global.cpp \
fe_init.cpp \
fe_interface_header.cpp \
fe_lookup.cpp \
diff --git a/TAO/TAO_IDL/fe/fe_declarator.cpp b/TAO/TAO_IDL/fe/fe_declarator.cpp
index 94b47b0b63a..91e152feb6f 100644
--- a/TAO/TAO_IDL/fe/fe_declarator.cpp
+++ b/TAO/TAO_IDL/fe/fe_declarator.cpp
@@ -64,48 +64,47 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
*/
-#include "idl.h"
-#include "idl_extern.h"
-#include "fe_private.h"
+#include "fe_declarator.h"
+#include "ast_array.h"
+#include "ast_type.h"
+#include "utl_err.h"
+#include "global_extern.h"
+#include "ace/config-all.h"
-ACE_RCSID(fe, fe_declarator, "$Id$")
-
-// Constructor(s) and destructor
+ACE_RCSID (fe,
+ fe_declarator,
+ "$Id$")
FE_Declarator::FE_Declarator (UTL_ScopedName *n,
DeclaratorType dt,
AST_Decl *cp)
: pd_complex_part (cp),
- pd_name (n),
pd_decl_type (dt)
{
+ this->pd_name = n;
}
-// Public operations.
-
// Compose the type of the complex declarator (if any) with the base
// type supplied in ct.
AST_Type *
FE_Declarator::compose (AST_Decl *d)
{
- AST_Array *arr = 0;
- AST_Type *ct = 0;
+ AST_Decl::NodeType nt = d->node_type ();
- ct = AST_Type::narrow_from_decl (d);
-
- if (ct == 0)
+ if (nt == AST_Decl::NT_struct_fwd || nt == AST_Decl::NT_union_fwd)
{
- idl_global->err ()->not_a_type (d);
- return 0;
- }
+ idl_global->err ()->error1 (UTL_Error::EIDL_ILLEGAL_ADD,
+ d);
- if (ct->node_type () == AST_Decl::NT_except)
- {
- idl_global->err ()->not_a_type (d);
return 0;
}
- // All uses of forward declared interfaces, structs and unions must
+ AST_Array *arr = 0;
+ AST_Type *ct = 0;
+
+ ct = AST_Type::narrow_from_decl (d);
+
+ // All uses of forward declared interfaces must
// not have a different prefix from the place of declaration.
if (!ct->is_defined ())
{
@@ -137,6 +136,14 @@ FE_Declarator::compose (AST_Decl *d)
return 0;
}
+void
+FE_Declarator::destroy (void)
+{
+ this->pd_name->destroy ();
+ delete this->pd_name;
+ this->pd_name = 0;
+}
+
// Data accessors.
AST_Decl *
diff --git a/TAO/TAO_IDL/fe/fe_extern.cpp b/TAO/TAO_IDL/fe/fe_extern.cpp
index 872b8a434e2..cf2d05b168d 100644
--- a/TAO/TAO_IDL/fe/fe_extern.cpp
+++ b/TAO/TAO_IDL/fe/fe_extern.cpp
@@ -69,18 +69,15 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
* fe_extern.cc - export FE interfaces to driver
*/
-#include "idl.h"
-#include "idl_extern.h"
+#include "fe_extern.h"
+#include "ast_root.h"
+#include "global_extern.h"
+#include "utl_err.h"
+#include "utl_indenter.h"
-#include "fe_private.h"
-
-#include "utl_err.h"
-#include "utl_indenter.h"
-#include "utl_string.h"
-
-ACE_RCSID(fe, fe_extern, "$Id$")
-
-// yacc parser interface
+ACE_RCSID (fe,
+ fe_extern,
+ "$Id$")
extern int tao_yyparse (void);
extern FILE *tao_yyin;
@@ -128,13 +125,3 @@ FE_new_UTL_Indenter (void)
return retval;
}
-UTL_String *
-FE_new_UTL_String (char *str)
-{
- UTL_String *retval = 0;
- ACE_NEW_RETURN (retval,
- UTL_String (str),
- 0);
-
- return retval;
-}
diff --git a/TAO/TAO_IDL/fe/fe_global.cpp b/TAO/TAO_IDL/fe/fe_global.cpp
index 014f6521169..7f1e0f66ddd 100644
--- a/TAO/TAO_IDL/fe/fe_global.cpp
+++ b/TAO/TAO_IDL/fe/fe_global.cpp
@@ -1,11 +1,12 @@
// $Id$
-#include "TAO_IDL_FE_Export.h"
+#include "TAO_IDL_FE_Export.h"
-ACE_RCSID(fe, fe_global, "$Id$")
+ACE_RCSID (fe,
+ fe_global,
+ "$Id$")
-class TAO_IDL_FE_Export IDL_GlobalData; // Global data is stored in an
- // instance of this
+class TAO_IDL_FE_Export IDL_GlobalData;
TAO_IDL_FE_Export IDL_GlobalData *idl_global = 0;
diff --git a/TAO/TAO_IDL/fe/fe_init.cpp b/TAO/TAO_IDL/fe/fe_init.cpp
index 18381123889..6c5014e1f86 100644
--- a/TAO/TAO_IDL/fe/fe_init.cpp
+++ b/TAO/TAO_IDL/fe/fe_init.cpp
@@ -62,28 +62,20 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
-/*
- * fe_init.cc - Initialize the FE
- *
- * The FE initialization is carried out in two stages, with the BE
- * initialization protocol sandwiched between the two stages.
- *
- * The first stage is responsible for creating the scopes stack.
- * The second stage is run after the BE initialization has created
- * and returned an instance of AST_Generator (or a subclass). This
- * instance is used to create the root node for the AST, and to
- * populate it with AST_PredefinedType nodes which represent the
- * predefined IDL types. This AST root is then pushed on the scopes
- * stack as the outermost scope.
- */
-
-#include "idl.h"
-#include "idl_extern.h"
-#include "fe_private.h"
-
-ACE_RCSID(fe, fe_init, "$Id$")
+#include "ast_module.h"
+#include "ast_predefined_type.h"
+#include "ast_generator.h"
+#include "ast_root.h"
+#include "utl_scoped_name.h"
+#include "utl_identifier.h"
+#include "global_extern.h"
+#include "fe_extern.h"
+
+ACE_RCSID (fe,
+ fe_init,
+ "$Id$")
// Create a scoped name
static UTL_ScopedName *
@@ -107,350 +99,423 @@ create_scoped_name (const char *s)
void
fe_populate_global_scope (AST_Module *m)
{
+ // No need to created a scoped name for the basic types, the
+ // AST_PredefinedType constructor will do that.
+
AST_PredefinedType *pdt = 0;
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_long,
- create_scoped_name ("long")
+ 0
);
m->fe_add_predefined_type (pdt);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_ulong,
- create_scoped_name ("unsigned long")
+ 0
);
m->fe_add_predefined_type (pdt);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_longlong,
- create_scoped_name ("long long")
+ 0
);
m->fe_add_predefined_type(pdt);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_ulonglong,
- create_scoped_name ("unsigned long long")
+ 0
);
m->fe_add_predefined_type (pdt);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_short,
- create_scoped_name ("short")
+ 0
);
m->fe_add_predefined_type (pdt);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_ushort,
- create_scoped_name ("unsigned short")
+ 0
);
m->fe_add_predefined_type (pdt);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_float,
- create_scoped_name ("float")
+ 0
);
m->fe_add_predefined_type (pdt);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_double,
- create_scoped_name("double")
+ 0
);
m->fe_add_predefined_type (pdt);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_longdouble,
- create_scoped_name ("long double")
+ 0
);
m->fe_add_predefined_type (pdt);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_char,
- create_scoped_name ("char")
+ 0
);
m->fe_add_predefined_type (pdt);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_wchar,
- create_scoped_name ("wchar")
+ 0
);
m->fe_add_predefined_type (pdt);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_octet,
- create_scoped_name ("octet")
+ 0
);
m->fe_add_predefined_type (pdt);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_any,
- create_scoped_name ("any")
+ 0
);
m->fe_add_predefined_type (pdt);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_boolean,
- create_scoped_name ("boolean")
+ 0
);
m->fe_add_predefined_type (pdt);
+ Identifier void_id ("void");
+ UTL_ScopedName void_name (&void_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_void,
- create_scoped_name ("void")
+ &void_name
);
m->fe_add_predefined_type (pdt);
+ Identifier Object_id ("Object");
+ UTL_ScopedName Object_name (&Object_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
- AST_PredefinedType::PT_pseudo,
- create_scoped_name("Object")
+ AST_PredefinedType::PT_object,
+ &Object_name
);
m->fe_add_predefined_type (pdt);
- // Add these to make all keywords protected even in different spellings
+// Add these to make all keywords protected even in different spellings
+ Identifier attribute_id ("attribute");
+ UTL_ScopedName attribute_name (&attribute_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("attribute")
+ &attribute_name
);
m->fe_add_predefined_type (pdt);
+ Identifier case_id ("case");
+ UTL_ScopedName case_name (&case_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("case")
+ &case_name
);
m->fe_add_predefined_type (pdt);
+ Identifier const_id ("const");
+ UTL_ScopedName const_name (&const_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("const")
+ &const_name
);
m->fe_add_predefined_type (pdt);
+ Identifier context_id ("context");
+ UTL_ScopedName context_name (&context_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("context")
+ &context_name
);
m->fe_add_predefined_type (pdt);
+ Identifier default_id ("default");
+ UTL_ScopedName default_name (&default_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("default")
+ &default_name
);
m->fe_add_predefined_type (pdt);
+ Identifier enum_id ("enum");
+ UTL_ScopedName enum_name (&enum_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("enum")
+ &enum_name
);
m->fe_add_predefined_type (pdt);
+ Identifier exception_id ("exception");
+ UTL_ScopedName exception_name (&exception_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("exception")
+ &exception_name
);
m->fe_add_predefined_type (pdt);
+ Identifier in_id ("in");
+ UTL_ScopedName in_name (&in_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("in")
+ &in_name
);
m->fe_add_predefined_type (pdt);
+ Identifier out_id ("out");
+ UTL_ScopedName out_name (&out_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("out")
+ &out_name
);
m->fe_add_predefined_type (pdt);
+ Identifier inout_id ("inout");
+ UTL_ScopedName inout_name (&inout_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("inout")
+ &inout_name
);
m->fe_add_predefined_type (pdt);
+ Identifier interface_id ("interface");
+ UTL_ScopedName interface_name (&interface_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("interface")
+ &interface_name
);
m->fe_add_predefined_type (pdt);
+ Identifier module_id ("module");
+ UTL_ScopedName module_name (&module_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("module")
+ &module_name
);
m->fe_add_predefined_type (pdt);
+ Identifier oneway_id ("oneway");
+ UTL_ScopedName oneway_name (&oneway_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("oneway")
+ &oneway_name
);
m->fe_add_predefined_type (pdt);
+ Identifier raises_id ("raises");
+ UTL_ScopedName raises_name (&raises_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("raises")
+ &raises_name
);
m->fe_add_predefined_type (pdt);
+ Identifier readonly_id ("readonly");
+ UTL_ScopedName readonly_name (&readonly_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("readonly")
+ &readonly_name
);
m->fe_add_predefined_type (pdt);
+ Identifier sequence_id ("sequence");
+ UTL_ScopedName sequence_name (&sequence_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("sequence")
+ &sequence_name
);
m->fe_add_predefined_type (pdt);
+ Identifier string_id ("string");
+ UTL_ScopedName string_name (&string_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("string")
+ &string_name
);
m->fe_add_predefined_type (pdt);
+ Identifier wstring_id ("wstring");
+ UTL_ScopedName wstring_name (&wstring_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("wstring")
+ &wstring_name
);
m->fe_add_predefined_type (pdt);
+ Identifier struct_id ("struct");
+ UTL_ScopedName struct_name (&struct_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("struct")
+ &struct_name
);
m->fe_add_predefined_type (pdt);
+ Identifier switch_id ("switch");
+ UTL_ScopedName switch_name (&switch_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("switch")
+ &switch_name
);
m->fe_add_predefined_type (pdt);
+ Identifier typedef_id ("typedef");
+ UTL_ScopedName typedef_name (&typedef_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("typedef")
+ &typedef_name
);
m->fe_add_predefined_type (pdt);
+ Identifier union_id ("union");
+ UTL_ScopedName union_name (&union_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("union")
+ &union_name
);
m->fe_add_predefined_type (pdt);
+ Identifier unsigned_id ("unsigned");
+ UTL_ScopedName unsigned_name (&unsigned_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("unsigned")
+ &unsigned_name
);
m->fe_add_predefined_type (pdt);
+ Identifier TRUE_id ("TRUE");
+ UTL_ScopedName TRUE_name (&TRUE_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("TRUE")
+ &TRUE_name
);
m->fe_add_predefined_type (pdt);
+ Identifier FALSE_id ("FALSE");
+ UTL_ScopedName FALSE_name (&FALSE_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("FALSE")
+ &FALSE_name
);
m->fe_add_predefined_type (pdt);
+ Identifier abstract_id ("abstract");
+ UTL_ScopedName abstract_name (&abstract_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("abstract")
+ &abstract_name
);
m->fe_add_predefined_type (pdt);
+ Identifier custom_id ("custom");
+ UTL_ScopedName custom_name (&custom_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("custom")
+ &custom_name
);
m->fe_add_predefined_type (pdt);
+ Identifier private_id ("private");
+ UTL_ScopedName private_name (&private_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("private")
+ &private_name
);
m->fe_add_predefined_type (pdt);
+ Identifier public_id ("public");
+ UTL_ScopedName public_name (&public_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("public")
+ &public_name
);
m->fe_add_predefined_type (pdt);
+ Identifier supports_id ("supports");
+ UTL_ScopedName supports_name (&supports_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("supports")
+ &supports_name
);
m->fe_add_predefined_type (pdt);
+ Identifier truncatable_id ("truncatable");
+ UTL_ScopedName truncatable_name (&truncatable_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("truncatable")
+ &truncatable_name
);
m->fe_add_predefined_type (pdt);
+ Identifier valuetype_id ("valuetype");
+ UTL_ScopedName valuetype_name (&valuetype_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("valuetype")
+ &valuetype_name
);
m->fe_add_predefined_type (pdt);
+ Identifier ValueBase_id ("ValueBase");
+ UTL_ScopedName ValueBase_name (&ValueBase_id, 0);
pdt =
idl_global->gen ()->create_predefined_type (
AST_PredefinedType::PT_pseudo,
- create_scoped_name ("ValueBase")
+ &ValueBase_name
);
m->fe_add_predefined_type (pdt);
}
@@ -468,33 +533,46 @@ fe_populate_idl_keywords (void)
"BOOLEAN",
"CASE",
"CHAR",
+ "COMPONENT",
"CONST",
+ "CONSUMES",
"CONTEXT",
"CUSTOM",
"DEFAULT",
"DOUBLE",
+ "EMITS",
"EXCEPTION",
"ENUM",
+ "EVENTTYPE",
"FACTORY",
"FALSE",
+ "FINDER",
"FIXED",
"FLOAT",
+ "GETRAISES",
+ "HOME",
+ "IMPORT",
"IN",
"INOUT",
"INTERFACE",
"LOCAL",
"LONG",
"MODULE",
+ "MULTIPLE",
"NATIVE",
"OBJECT",
"OCTET",
"ONEWAY",
"OUT",
+ "PRIMARYKEY",
"PRIVATE",
+ "PROVIDES",
"PUBLIC",
+ "PUBLISHES",
"RAISES",
"READONLY",
"SEQUENCE",
+ "SETRAISES",
"SHORT",
"STRING",
"STRUCT",
@@ -503,8 +581,11 @@ fe_populate_idl_keywords (void)
"TRUE",
"TRUNCATABLE",
"TYPEDEF",
+ "TYPEID",
+ "TYPEPREFIX",
"UNION",
"UNSIGNED",
+ "USES",
"VALUEBASE",
"VALUETYPE",
"VOID",
@@ -528,26 +609,9 @@ fe_populate_idl_keywords (void)
}
}
-// Initialization stage 1: create global scopes stack.
-void
-FE_init_stage1 (void)
-{
- idl_global->set_scopes (new UTL_ScopeStack ());
-
- if (idl_global->scopes () == NULL)
- {
- ACE_ERROR ((
- LM_ERROR,
- ACE_TEXT ("IDL: FE init failed to create scope stack, exiting\n")
- ));
-
- ACE_OS::exit (99);
- }
-}
-
-// Initialization stage 2: create global scope and populate it.
+// FE initialization: create global scope and populate it.
void
-FE_init_stage2 (void)
+FE_init (void)
{
AST_Root *r;
@@ -563,7 +627,9 @@ FE_init_stage2 (void)
}
// Create a global root for the AST. Note that the AST root has no name.
- r = idl_global->gen ()->create_root (create_scoped_name (""));
+ Identifier root_id ("");
+ UTL_ScopedName root_name (&root_id, 0);
+ r = idl_global->gen ()->create_root (&root_name);
idl_global->set_root (r);
if (r == 0)
@@ -577,7 +643,7 @@ FE_init_stage2 (void)
}
// Push it on the stack
- idl_global->scopes ()->push (idl_global->root ());
+ idl_global->scopes ().push (idl_global->root ());
// Populate it with nodes for predefined types.
fe_populate_global_scope (idl_global->root ());
diff --git a/TAO/TAO_IDL/fe/fe_interface_header.cpp b/TAO/TAO_IDL/fe/fe_interface_header.cpp
index 527e673f11b..9e0c59d79bd 100644
--- a/TAO/TAO_IDL/fe/fe_interface_header.cpp
+++ b/TAO/TAO_IDL/fe/fe_interface_header.cpp
@@ -64,36 +64,23 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
*/
-// FE_InterfaceHeader instances are used to store information about an
-// interface header as the interface is being parsed and before the
-// AST_Interface node used to represent this interface is created.
-
-#include "idl.h"
-#include "idl_extern.h"
-#include "fe_private.h"
-
-ACE_RCSID(fe, fe_interface_header, "$Id$")
-
-// Constructor(s) and destructor
-
-FE_InterfaceHeader::FE_InterfaceHeader (UTL_ScopedName *n,
- UTL_NameList *nl,
- UTL_NameList *supports,
- idl_bool compile_now)
- : pd_interface_name (n)
-{
- if (compile_now)
- {
- compile_inheritance (nl,
- supports);
- }
-}
-
-FE_InterfaceHeader::~FE_InterfaceHeader (void)
-{
-}
-
-// Compute flattened, non-repeating list of inherited interfaces
+// These utility classes are used to store information about a
+// node type as the node type is being parsed and before the
+// node itself is created.
+
+#include "fe_interface_header.h"
+#include "ast_valuetype.h"
+#include "ast_component.h"
+#include "ast_home.h"
+#include "ast_module.h"
+#include "utl_namelist.h"
+#include "utl_err.h"
+#include "global_extern.h"
+#include "nr_extern.h"
+
+ACE_RCSID (fe,
+ fe_interface_header,
+ "$Id$")
#undef INCREMENT
#define INCREMENT 512
@@ -134,7 +121,7 @@ add_inheritance (AST_Interface *i)
ACE_NEW (iseen,
AST_Interface *[iallocated]);
- for (long k = 0; k < iused; k++)
+ for (long k = 0; k < iused; ++k)
{
iseen[k] = oiseen[k];
}
@@ -188,7 +175,7 @@ add_inheritance_flat (AST_Interface *i)
static long
already_seen (AST_Interface *ip)
{
- for (long i = 0; i < iused; i++)
+ for (long i = 0; i < iused; ++i)
{
if (iseen[i] == ip)
{
@@ -203,7 +190,7 @@ already_seen (AST_Interface *ip)
static long
already_seen_flat (AST_Interface *ip)
{
- for (long i = 0; i < iused_flat; i++)
+ for (long i = 0; i < iused_flat; ++i)
{
if (iseen_flat[i] == ip)
{
@@ -214,16 +201,106 @@ already_seen_flat (AST_Interface *ip)
return I_FALSE;
}
+// @@@ (JP) Here are the rules for interface inheritance and
+// value type inheritance and supports, straight from Jonathan
+// Biggar <jon@floorboard.com> as of 3/28/02. The following was
+// resolved by the OMG, but is not yet part of an official spec.
+
+/*
+An interface can inherit from any number of other interfaces, abstract
+or not.
+
+An abstract interface can only inherit from other abstract interfaces.
+
+An abstract valuetype can inherit from any number of abstract
+valuetypes. It may support one interface, and in addition, any number
+of abstract interfaces.
+
+A concrete valuetype can inherit from only one concrete valuetype. It
+may inherit from any number of abstract valuetypes. It may support one
+interface, and any number of abstract interfaces.
+
+The single concrete inherited valuetype must be the first one in the
+inheritance list.
+
+The single supported interface (for valuetypes) must also be the first
+in the "supports" list.
+
+And one more important clarification, if a base valuetype supports an
+interface, a derived valuetype may also be declared to support an
+interface, as long as it is derived from all interfaces that are
+supported by any base valuetypes. Here is an example:
+
+interface I1 { };
+interface I2 { };
+interface I3: I1, I2 { };
+
+abstract valuetype V1 supports I1 { };
+abstract valuetype V2 supports I2 { };
+valuetype V3: V1, V2 supports I3 { }; // legal
+valuetype V4: V1 supports I2 { }; // illegal
+
+This last rule was made to guarantee that any given valuetype supported
+at most one most-derived interface. We didn't want valuetypes to extend
+the OMG model through the backdoor by providing multiple non-related
+interfaces.
+*/
+
+FE_InterfaceHeader::FE_InterfaceHeader (UTL_ScopedName *n,
+ UTL_NameList *inherits,
+ idl_bool is_local,
+ idl_bool is_abstract,
+ idl_bool compile_now)
+ : pd_interface_name (n),
+ pd_inherits (0),
+ pd_n_inherits (0),
+ pd_inherits_flat (0),
+ pd_n_inherits_flat (0),
+ pd_is_local (is_local),
+ pd_is_abstract (is_abstract)
+{
+ if (compile_now)
+ {
+ this->compile_inheritance (inherits,
+ I_FALSE);
+ }
+
+ int abstract_parent_seen = 0;
+
+ if (this->pd_n_inherits > 0)
+ {
+ AST_Interface *iface = 0;
+
+ for (long i = 0; i < this->pd_n_inherits; ++i)
+ {
+ iface = this->pd_inherits[i];
+
+ if (iface->is_abstract ())
+ {
+ abstract_parent_seen = 1;
+ }
+ else if (abstract_parent_seen == 1)
+ {
+ idl_global->err ()->abstract_expected (iface);
+ }
+ }
+ }
+}
+
+FE_InterfaceHeader::~FE_InterfaceHeader (void)
+{
+}
+
idl_bool
-FE_InterfaceHeader::is_local (void)
+FE_InterfaceHeader::is_local (void) const
{
- return 0;
+ return this->pd_is_local;
}
idl_bool
-FE_InterfaceHeader::is_abstract (void)
+FE_InterfaceHeader::is_abstract (void) const
{
- return 0;
+ return this->pd_is_abstract;
}
// Add this interface to the list of inherited if not already there.
@@ -231,7 +308,7 @@ void
FE_InterfaceHeader::compile_one_inheritance (AST_Interface *i)
{
// Check for badly formed interface.
- if (i == NULL)
+ if (i == 0)
{
return;
}
@@ -255,7 +332,7 @@ FE_InterfaceHeader::compile_one_inheritance (AST_Interface *i)
AST_Interface **parents = i->inherits ();
long num_parents = i->n_inherits ();
- for (long j = 0; j < num_parents; j++)
+ for (long j = 0; j < num_parents; ++j)
{
AST_Interface *tmp = parents[j];
@@ -271,16 +348,19 @@ FE_InterfaceHeader::compile_one_inheritance (AST_Interface *i)
// Compute the list of top-level interfaces this one inherits from.
void
FE_InterfaceHeader::compile_inheritance (UTL_NameList *ifaces,
- UTL_NameList *supports)
+ idl_bool for_valuetype)
{
+ if (ifaces == 0)
+ {
+ return;
+ }
+
AST_Decl *d = 0;
- UTL_ScopedName *item;
+ UTL_ScopedName *item = 0;;
AST_Interface *i = 0;
- long j, k;
- UTL_NameList *nl = ifaces;
- long ichecked = 0;
- idl_bool inh_err = 0;
- idl_bool in_supports = 0;
+ long j = 0;
+ long k = 0;
+ int inh_err = 0;
iused = 0;
iused_flat = 0;
@@ -288,153 +368,129 @@ FE_InterfaceHeader::compile_inheritance (UTL_NameList *ifaces,
// Compute expanded flattened non-repeating list of interfaces
// which this one inherits from.
- // Loop twice if nl and supports are nonempty.
- for (int loops = 0; loops < 2; ++loops)
+ for (UTL_NamelistActiveIterator l (ifaces); !l.is_done (); l.next ())
{
- if (nl != NULL)
- {
- for (UTL_NamelistActiveIterator l (nl); !l.is_done (); l.next ())
- {
- item = l.item ();
+ item = l.item ();
- // Check that scope stack is valid.
- if (idl_global->scopes ()->top () == 0)
- {
- idl_global->err ()->lookup_error (item);
- return;
- }
-
- // Look it up.
- UTL_Scope *s = idl_global->scopes ()->top ();
+ // Check that scope stack is valid.
+ if (idl_global->scopes ().top () == 0)
+ {
+ idl_global->err ()->lookup_error (item);
+ return;
+ }
- d = s->lookup_by_name (item,
- I_TRUE);
+ // Look it up.
+ UTL_Scope *s = idl_global->scopes ().top ();
- if (d == 0)
- {
- AST_Decl *sad = ScopeAsDecl (s);
+ d = s->lookup_by_name (item,
+ I_TRUE);
- if (sad->node_type () == AST_Decl::NT_module)
- {
- AST_Module *m = AST_Module::narrow_from_decl (sad);
+ if (d == 0)
+ {
+ AST_Decl *sad = ScopeAsDecl (s);
- d = m->look_in_previous (item->last_component ());
- }
- }
+ if (sad->node_type () == AST_Decl::NT_module)
+ {
+ AST_Module *m = AST_Module::narrow_from_decl (sad);
- // Not found?
- if (d == 0)
- {
- idl_global->err ()->lookup_error (item);
- return;
- }
+ d = m->look_in_previous (item->last_component ());
+ }
+ }
- // Not an appropriate interface?
- while (d->node_type () == AST_Decl::NT_typedef)
- {
- d = AST_Typedef::narrow_from_decl (d)->base_type ();
- }
+ // Not found?
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (item);
+ return;
+ }
- if (d->node_type () == AST_Decl::NT_interface)
- {
- i = AST_Interface::narrow_from_decl (d);
- }
- else
- {
- i = 0;
- }
+ // Not an appropriate interface?
+ while (d->node_type () == AST_Decl::NT_typedef)
+ {
+ d = AST_Typedef::narrow_from_decl (d)->base_type ();
+ }
- if (i != 0)
- {
- if (in_supports)
- {
- inh_err = !this->check_supports (i);
- }
- else
- {
- if (ichecked == 0)
- {
- inh_err = !this->check_first (i);
- }
- else
- {
- inh_err = !this->check_further (i);
- }
- }
- }
- else
- {
- inh_err = 1;
- }
+ i = AST_Interface::narrow_from_decl (d);
- if (inh_err)
- {
- idl_global->err ()->inheritance_error (pd_interface_name,
- d);
- return; // @@ really ? inh_err=0; and test the remaining...?
- }
+ if (i != 0)
+ {
+ inh_err = this->check_inherit (i,
+ for_valuetype);
+ }
+ else
+ {
+ inh_err = -1;
+ }
- // Forward declared interface?
- if (!i->is_defined ())
- {
- idl_global->err ()->inheritance_fwd_error (pd_interface_name,
- i);
- return;
- }
+ if (inh_err == -1)
+ {
+ idl_global->err ()->interface_expected (d);
+ break;
+ }
- // OK, see if we have to add this to the list of interfaces
- // inherited from.
- this->compile_one_inheritance (i);
+ // Forward declared interface?
+ if (!i->is_defined ())
+ {
+ idl_global->err ()->inheritance_fwd_error (this->pd_interface_name,
+ i);
+ break;
+ }
- // Next element in header list.
- ++ichecked;
- }
+ if (!for_valuetype && this->pd_is_abstract && !i->is_abstract ())
+ {
+ idl_global->err ()->abstract_inheritance_error (this->name (),
+ i->name ());
}
- in_supports = 1;
- nl = supports;
+ // OK, see if we have to add this to the list of interfaces
+ // inherited from.
+ this->compile_one_inheritance (i);
}
// OK, install in interface header.
// First the flat list (all ancestors).
- this->pd_inherits_flat = new AST_Interface *[iused_flat];
-
- for (j = 0; j < iused_flat; j++)
+ if (iused_flat > 0)
{
- this->pd_inherits_flat[j] = iseen_flat[j];
- }
+ ACE_NEW (this->pd_inherits_flat,
+ AST_Interface *[iused_flat]);
+
+ for (j = 0; j < iused_flat; ++j)
+ {
+ this->pd_inherits_flat[j] = iseen_flat[j];
+ }
- this->pd_n_inherits_flat = iused_flat;
+ this->pd_n_inherits_flat = iused_flat;
+ }
// Then the list of immediate ancestors.
- ACE_NEW (this->pd_inherits,
- AST_Interface *[iused]);
-
- for (k = 0; k < iused; k++)
+ if (iused > 0)
{
- this->pd_inherits[k] = iseen[k];
- }
+ ACE_NEW (this->pd_inherits,
+ AST_Interface *[iused]);
- this->pd_n_inherits = iused;
-}
+ for (k = 0; k < iused; ++k)
+ {
+ this->pd_inherits[k] = iseen[k];
+ }
-// check_ methods called from compile_inheritance()
-// overridden in derived classes.
-idl_bool
-FE_InterfaceHeader::check_first (AST_Interface *i)
-{
- // Nothing special for the first.
- return this->check_further (i);
+ this->pd_n_inherits = iused;
+ }
}
-idl_bool
-FE_InterfaceHeader::check_further (AST_Interface *i)
+int
+FE_InterfaceHeader::check_inherit (AST_Interface *i,
+ idl_bool for_valuetype)
{
- if (i != 0
- && !i->is_valuetype ()
- && (this->is_local () || !i->is_local ()))
+ idl_bool is_valuetype = (i->node_type () == AST_Decl::NT_valuetype);
+
+ if (
+ // Non-local interfaces may not inherit from local ones.
+ (! this->pd_is_local && i->is_local ())
+ // Both valuetype or both interface.
+ || (for_valuetype ^ is_valuetype)
+ )
{
- return 1;
+ return -1;
}
else
{
@@ -442,148 +498,485 @@ FE_InterfaceHeader::check_further (AST_Interface *i)
}
}
-idl_bool
-FE_InterfaceHeader::check_supports (AST_Interface *)
-{
- return 0;
-}
-
// Data accessors.
UTL_ScopedName *
-FE_InterfaceHeader::interface_name (void)
+FE_InterfaceHeader::name (void) const
{
return this->pd_interface_name;
}
AST_Interface **
-FE_InterfaceHeader::inherits (void)
+FE_InterfaceHeader::inherits (void) const
{
return this->pd_inherits;
}
long
-FE_InterfaceHeader::n_inherits (void)
+FE_InterfaceHeader::n_inherits (void) const
{
return this->pd_n_inherits;
}
AST_Interface **
-FE_InterfaceHeader::inherits_flat (void)
+FE_InterfaceHeader::inherits_flat (void) const
{
return this->pd_inherits_flat;
}
long
-FE_InterfaceHeader::n_inherits_flat (void)
+FE_InterfaceHeader::n_inherits_flat (void) const
{
return this->pd_n_inherits_flat;
}
-FE_Local_InterfaceHeader::FE_Local_InterfaceHeader (UTL_ScopedName *n,
- UTL_NameList *nl,
- UTL_NameList *supports)
+//************************************************************************
+
+FE_OBVHeader::FE_OBVHeader (UTL_ScopedName *n,
+ UTL_NameList *inherits,
+ UTL_NameList *supports,
+ idl_bool truncatable)
: FE_InterfaceHeader (n,
- nl,
- supports,
- 0)
+ inherits,
+ I_FALSE,
+ I_FALSE,
+ I_FALSE),
+ pd_supports (0),
+ pd_inherits_concrete (0),
+ pd_supports_concrete (0),
+ pd_truncatable (truncatable)
{
- compile_inheritance (nl,
- supports);
+ this->compile_inheritance (inherits,
+ I_TRUE);
+
+ if (this->pd_n_inherits > 0)
+ {
+ AST_Interface *iface = this->pd_inherits[0];
+
+ if (!iface->is_abstract ())
+ {
+ AST_ValueType *vt = AST_ValueType::narrow_from_decl (iface);
+
+ if (vt == 0)
+ {
+ idl_global->err ()->valuetype_expected (iface);
+ }
+
+ this->pd_inherits_concrete = vt;
+ }
+
+ for (long i = 1; i < this->pd_n_inherits; ++i)
+ {
+ iface = this->pd_inherits[i];
+
+ if (!iface->is_abstract ())
+ {
+ idl_global->err ()->abstract_expected (iface);
+ }
+ }
+ }
+
+ if (idl_global->err_count () == 0)
+ {
+ this->compile_supports (supports);
+ }
}
-idl_bool
-FE_Local_InterfaceHeader::is_local (void)
+FE_OBVHeader::~FE_OBVHeader (void)
{
- return 1;
}
-FE_Abstract_InterfaceHeader::FE_Abstract_InterfaceHeader (UTL_ScopedName *n,
- UTL_NameList *nl,
- UTL_NameList *supports)
-
- : FE_InterfaceHeader (n,
- nl,
- supports,
- 0)
+AST_Interface **
+FE_OBVHeader::supports (void) const
{
- compile_inheritance (nl,
- supports);
+ return this->pd_supports;
}
-idl_bool
-FE_Abstract_InterfaceHeader::is_abstract (void)
+long
+FE_OBVHeader::n_supports (void) const
{
- return 1;
+ return this->pd_n_supports;
}
-// FE_obv_header.
+AST_ValueType *
+FE_OBVHeader::inherits_concrete (void) const
+{
+ return this->pd_inherits_concrete;
+}
-FE_obv_header::FE_obv_header (UTL_ScopedName *n,
- UTL_NameList *nl,
- UTL_NameList *supports)
- : FE_InterfaceHeader (n,
- nl,
- supports,
- 0),
- truncatable_ (0),
- n_concrete_ (0)
+AST_Interface *
+FE_OBVHeader::supports_concrete (void) const
{
- compile_inheritance (nl,
- supports);
+ return this->pd_supports_concrete;
}
-// check_ methods called from compile_inheritance().
idl_bool
-FE_obv_header::check_first (AST_Interface *i)
+FE_OBVHeader::truncatable (void) const
+{
+ return this->pd_truncatable;
+}
+
+void
+FE_OBVHeader::compile_supports (UTL_NameList *supports)
{
- if (i != 0 && i->is_valuetype ())
+ if (supports == 0)
{
- if (!i->is_abstract_valuetype ())
+ this->pd_supports = 0;
+ this->pd_n_supports = 0;
+ return;
+ }
+
+ long length = supports->length ();
+ this->pd_n_supports = length;
+ ACE_NEW (this->pd_supports,
+ AST_Interface *[length]);
+
+ AST_Decl *d = 0;
+ UTL_ScopedName *item = 0;;
+ AST_Interface *iface = 0;
+ int i = 0;
+
+ for (UTL_NamelistActiveIterator l (supports); !l.is_done (); l.next ())
+ {
+ item = l.item ();
+
+ // Check that scope stack is valid.
+ if (idl_global->scopes ().top () == 0)
{
- ++this->n_concrete_;
+ idl_global->err ()->lookup_error (item);
+ return;
}
- return 1;
+ // Look it up.
+ UTL_Scope *s = idl_global->scopes ().top ();
+
+ d = s->lookup_by_name (item,
+ I_TRUE);
+
+ if (d == 0)
+ {
+ AST_Decl *sad = ScopeAsDecl (s);
+
+ if (sad->node_type () == AST_Decl::NT_module)
+ {
+ AST_Module *m = AST_Module::narrow_from_decl (sad);
+
+ d = m->look_in_previous (item->last_component ());
+ }
+ }
+
+ // Not found?
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (item);
+ return;
+ }
+
+ // Remove typedefs, if any.
+ if (d->node_type () == AST_Decl::NT_typedef)
+ {
+ d = AST_Typedef::narrow_from_decl (d)->primitive_base_type ();
+ }
+
+ if (d->node_type () == AST_Decl::NT_interface)
+ {
+ iface = AST_Interface::narrow_from_decl (d);
+ }
+ else
+ {
+ idl_global->err ()->supports_error (pd_interface_name,
+ d);
+ continue;
+ }
+
+ // Forward declared interface?
+ if (!iface->is_defined ())
+ {
+ idl_global->err ()->supports_fwd_error (pd_interface_name,
+ iface);
+ continue;
+ }
+
+ if (!iface->is_abstract ())
+ {
+ if (i == 0)
+ {
+ this->pd_supports_concrete = iface;
+
+ if (this->check_concrete_supported_inheritance (iface) != 0)
+ {
+ idl_global->err ()->concrete_supported_inheritance_error (
+ this->name (),
+ iface->name ()
+ );
+ }
+ }
+ else
+ {
+ idl_global->err ()->abstract_expected (iface);
+ continue;
+ }
+ }
+
+ this->pd_supports[i++] = iface;
}
- else
+}
+
+idl_bool
+FE_OBVHeader::check_concrete_supported_inheritance (AST_Interface *d)
+{
+ AST_ValueType *vt = 0;
+ AST_Interface *concrete = 0;
+ AST_Interface **ancestors = 0;
+ AST_Interface *ancestor = 0;
+ long n_ancestors = 0;
+
+ for (long i = 0; i < this->pd_n_inherits; ++i)
{
- return 0;
+ vt = AST_ValueType::narrow_from_decl (this->pd_inherits[i]);
+ concrete = vt->supports_concrete ();
+
+ if (concrete != 0)
+ {
+ ancestors = concrete->inherits_flat ();
+ n_ancestors = concrete->n_inherits_flat ();
+
+ for (long j = 0; j < n_ancestors; ++j)
+ {
+ ancestor = ancestors[j];
+
+ if (!d->is_child (ancestor))
+ {
+ return 1;
+ }
+ }
+ }
}
+
+ return 0;
}
-idl_bool
-FE_obv_header::check_further (AST_Interface *i)
+//************************************************************************
+
+FE_ComponentHeader::FE_ComponentHeader (UTL_ScopedName *n,
+ UTL_ScopedName *base_component,
+ UTL_NameList *supports,
+ idl_bool compile_now)
+ : FE_InterfaceHeader (n,
+ supports,
+ I_FALSE,
+ I_FALSE,
+ I_FALSE),
+ pd_base_component (0)
{
- if (i != 0
- && i->is_valuetype ()
- && i->is_abstract_valuetype ())
+ // If there is a base component, look up the decl and assign our member.
+ // We also inherit its supported interfaces.
+ if (base_component != 0)
{
- return 1;
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Decl *d = s->lookup_by_name (base_component,
+ I_TRUE);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (base_component);
+ }
+ else
+ {
+ this->pd_base_component = AST_Component::narrow_from_decl (d);
+
+ if (this->pd_base_component == 0)
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_ILLEGAL_USE,
+ d);
+ }
+ else if (!this->pd_base_component->is_defined ())
+ {
+ idl_global->err ()->inheritance_fwd_error (
+ this->name (),
+ this->pd_base_component
+ );
+ }
+ }
}
- else
+
+ if (compile_now)
{
- return 0;
+ this->compile_inheritance (supports,
+ I_FALSE);
}
}
-idl_bool
-FE_obv_header::check_supports (AST_Interface *i)
+void
+FE_ComponentHeader::compile_inheritance (UTL_NameList *supports,
+ idl_bool for_valuetype)
{
- if (i && !i->is_valuetype ())
+ if (this->pd_base_component != 0)
{
- return 1;
+ UTL_NameList *base_component_name = 0;
+ ACE_NEW (base_component_name,
+ UTL_NameList (this->pd_base_component->name (),
+ supports));
+ supports = base_component_name;
+
+ this->FE_InterfaceHeader::compile_inheritance (supports,
+ for_valuetype);
}
- else
+}
+
+FE_ComponentHeader::~FE_ComponentHeader (void)
+{
+}
+
+AST_Component *
+FE_ComponentHeader::base_component (void) const
+{
+ return this->pd_base_component;
+}
+
+AST_Interface **
+FE_ComponentHeader::supports (void) const
+{
+ return this->pd_inherits;
+}
+
+long
+FE_ComponentHeader::n_supports (void) const
+{
+ return this->pd_n_inherits;
+}
+
+AST_Interface **
+FE_ComponentHeader::supports_flat (void) const
+{
+ return this->pd_inherits_flat;
+}
+
+long
+FE_ComponentHeader::n_supports_flat (void) const
+{
+ return this->pd_n_inherits_flat;
+}
+
+//************************************************************************
+
+FE_HomeHeader::FE_HomeHeader (UTL_ScopedName *n,
+ UTL_ScopedName *base_home,
+ UTL_NameList *supports,
+ UTL_ScopedName *managed_component,
+ UTL_ScopedName *primary_key)
+ : FE_ComponentHeader (n,
+ managed_component,
+ supports,
+ I_FALSE),
+ pd_base_home (0),
+ pd_primary_key (0)
+{
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Decl *d = 0;
+
+ if (base_home != 0)
{
- return 0;
+ d = s->lookup_by_name (base_home,
+ I_TRUE);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (base_home);
+ }
+ else
+ {
+ this->pd_base_home = AST_Home::narrow_from_decl (d);
+
+ if (this->pd_base_home == 0)
+ {
+ idl_global->err ()->inheritance_error (this->name (),
+ d);
+ }
+ }
+ }
+
+ if (managed_component != 0)
+ {
+ d = s->lookup_by_name (managed_component,
+ I_TRUE);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (managed_component);
+ }
+ else
+ {
+ this->pd_base_component = AST_Component::narrow_from_decl (d);
+
+ if (this->pd_base_component == 0)
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_ILLEGAL_USE,
+ d);
+ }
+ }
+ }
+
+ if (primary_key != 0)
+ {
+ d = s->lookup_by_name (primary_key,
+ I_TRUE);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (primary_key);
+ }
+ else
+ {
+ this->pd_primary_key = AST_ValueType::narrow_from_decl (d);
+
+ if (this->pd_primary_key == 0)
+ {
+ idl_global->err ()->valuetype_expected (d);
+ }
+ }
+ }
+
+ this->compile_inheritance (supports,
+ I_FALSE);
+}
+
+void
+FE_HomeHeader::compile_inheritance (UTL_NameList *supports,
+ idl_bool for_valuetype)
+{
+ if (this->pd_base_home != 0)
+ {
+ UTL_NameList *base_home_name = 0;
+ ACE_NEW (base_home_name,
+ UTL_NameList (this->pd_base_home->name (),
+ supports));
+
+ supports = base_home_name;
+ this->FE_InterfaceHeader::compile_inheritance (supports,
+ for_valuetype);
}
}
+FE_HomeHeader::~FE_HomeHeader (void)
+{
+}
-long
-FE_obv_header::n_concrete (void)
+AST_Home *
+FE_HomeHeader::base_home (void) const
+{
+ return this->pd_base_home;
+}
+
+AST_Component *
+FE_HomeHeader::managed_component (void) const
+{
+ return this->pd_base_component;
+}
+
+AST_ValueType *
+FE_HomeHeader::primary_key (void) const
{
- return this->n_concrete_;
+ return this->pd_primary_key;
}
diff --git a/TAO/TAO_IDL/fe/fe_lookup.cpp b/TAO/TAO_IDL/fe/fe_lookup.cpp
index 1b449b99308..1e48e4cddd9 100644
--- a/TAO/TAO_IDL/fe/fe_lookup.cpp
+++ b/TAO/TAO_IDL/fe/fe_lookup.cpp
@@ -1,7 +1,7 @@
// $Id$
-#include "idl.h"
-#include "idl_extern.h"
-#include "fe_private.h"
+
+#include "fe_private.h"
+
/* starting time is 2:40:07 */
/* C++ code produced by gperf version 2.8 (ACE version) */
/* Command-line: /project/adaptive/ACE_wrappers/build/SunOS5.5/bin/gperf -M -J -c -C -D -E -T -f 0 -a -o -t -p -K keyword_ -L C++ -Z TAO_IDL_CPP_Keyword_Table -N lookup -k1,2,$ fe/keywords.dat */
@@ -41,7 +41,7 @@ TAO_IDL_CPP_Keyword_Table::lookup (const char *str, unsigned int len)
DUPLICATES = 0
};
- static const struct TAO_IDL_CPP_Keyword_Entry wordlist[] =
+ static const struct TAO_IDL_CPP_Keyword_Entry wordlist[] =
{
{"",0}, {"",0}, {"",0}, {"",0}, {"",0}, {"",0},
{"delete", "_cxx_delete"},
diff --git a/TAO/TAO_IDL/fe/fe_private.cpp b/TAO/TAO_IDL/fe/fe_private.cpp
index fa1bd77277a..2df2edca523 100644
--- a/TAO/TAO_IDL/fe/fe_private.cpp
+++ b/TAO/TAO_IDL/fe/fe_private.cpp
@@ -62,21 +62,13 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
-/*
- * fe_private.cc - Declare global data which are private to the FE
- * part
- */
-
-#include "idl.h"
-#include "idl_extern.h"
+#include "fe_private.h"
+#include "utl_strlist.h"
-#include "fe_private.h"
+ACE_RCSID (fe,
+ fe_private,
+ "$Id$")
-ACE_RCSID(fe, fe_private, "$Id$")
-
-/*
- * List of pragmas
- */
-UTL_StrList *DRV_global_pragmas = NULL;
+UTL_StrList *DRV_global_pragmas = 0;
diff --git a/TAO/TAO_IDL/fe/fe_tmplinst.cpp b/TAO/TAO_IDL/fe/fe_tmplinst.cpp
index 0db97489744..9192f7eda55 100644
--- a/TAO/TAO_IDL/fe/fe_tmplinst.cpp
+++ b/TAO/TAO_IDL/fe/fe_tmplinst.cpp
@@ -1,22 +1,45 @@
// $Id$
+#include "ast_component.h"
#include "ace/ACE.h"
#include "ace/Hash_Map_Manager_T.h"
#include "ace/Containers_T.h"
class AST_Decl;
class AST_Field;
+class AST_Interface;
+class AST_ValueType;
+class Identifier;
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-template class ACE_Hash_Map_Entry<ACE_CString, int>;
-template class ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Iterator_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Entry<ACE_CString,
+ int>;
+template class ACE_Hash_Map_Iterator_Base_Ex<ACE_CString,
+ int,
+ ACE_Hash<ACE_CString>,
+ ACE_Equal_To<ACE_CString>,
+ ACE_Null_Mutex>;
+template class ACE_Hash_Map_Iterator_Ex<ACE_CString,
+ int,
+ ACE_Hash<ACE_CString>,
+ ACE_Equal_To<ACE_CString>,
+ ACE_Null_Mutex>;
template class ACE_Equal_To<ACE_CString>;
-template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_CString,
+ int,
+ ACE_Hash<ACE_CString>,
+ ACE_Equal_To<ACE_CString>,
+ ACE_Null_Mutex>;
template class ACE_Hash<ACE_CString>;
-template class ACE_Hash_Map_Manager_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Manager_Ex<ACE_CString,
+ int,
+ ACE_Hash<ACE_CString>,
+ ACE_Equal_To<ACE_CString>,
+ ACE_Null_Mutex>;
+template class ACE_Hash_Map_Manager<ACE_CString,
+ int,
+ ACE_Null_Mutex>;
template class ACE_Node<AST_Decl *>;
template class ACE_Unbounded_Set<AST_Decl *>;
@@ -26,27 +49,74 @@ template class ACE_Node<AST_Field *>;
template class ACE_Unbounded_Queue<AST_Field *>;
template class ACE_Unbounded_Queue_Iterator<AST_Field *>;
+template class ACE_Node<AST_Interface *>;
+template class ACE_Unbounded_Queue<AST_Interface *>;
+template class ACE_Unbounded_Queue_Iterator<AST_Interface *>;
+
+template class ACE_Node<AST_Component::uses_description>;
+template class ACE_Unbounded_Queue<AST_Component::uses_description>;
+template class ACE_Unbounded_Queue_Iterator<AST_Component::uses_description>;
+
+template class ACE_Node<AST_Component::port_description>;
+template class ACE_Unbounded_Queue<AST_Component::port_description>;
+template class ACE_Unbounded_Queue_Iterator<AST_Component::port_description>;
+
+template class ACE_Node<Identifier *>;
+template class ACE_Unbounded_Queue<Identifier *>;
+template class ACE_UnboundedQueue_Iterator<Identifier *>;
+
template class ACE_Unbounded_Stack<char *>;
template class ACE_Unbounded_Stack_Iterator<char *>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-#pragma instantiate ACE_Hash_Map_Entry<ACE_CString, int>
-#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Iterator_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Entry<ACE_CString,
+ int>
+#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_CString,
+ int,
+ ACE_Hash<ACE_CString>,
+ ACE_Equal_To<ACE_CString>,
+ ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Iterator_Ex<ACE_CString,
+ int,
+ ACE_Hash<ACE_CString>,
+ ACE_Equal_To<ACE_CString>,
+ ACE_Null_Mutex>
#pragma instantiate ACE_Equal_To<ACE_CString>
-#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACE_CString,
+ int,
+ ACE_Hash<ACE_CString>,
+ ACE_Equal_To<ACE_CString>,
+ ACE_Null_Mutex>
#pragma instantiate ACE_Hash<ACE_CString>
-#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_CString,
+ int,
+ ACE_Hash<ACE_CString>,
+ ACE_Equal_To<ACE_CString>,
+ ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Manager<ACE_CString,
+ int,
+ ACE_Null_Mutex>
#pragma instantiate ACE_Node<AST_Decl *>
#pragma instantiate ACE_Unbounded_Set<AST_Decl *>
#pragma instantiate ACE_Unbounded_Set_Iterator<AST_Decl *>
-#pragma instantiate ACE_Node<AST_Decl *>
-#pragma instantiate ACE_Unbounded_Queue<AST_Decl *>
-#pragma instantiate ACE_Unbounded_Queue_Iterator<AST_Decl *>
+#pragma instantiate ACE_Node<AST_Field *>;
+#pragma instantiate ACE_Unbounded_Queue<AST_Field *>;
+#pragma instantiate ACE_Unbounded_Queue_Iterator<AST_Field *>;
+
+#pragma instantiate ACE_Node<AST_Component::uses_description>;
+#pragma instantiate ACE_Unbounded_Queue<AST_Component::uses_description>;
+#pragma instantiate ACE_Unbounded_Queue_Iterator<AST_Component::uses_description>;
+
+#pragma instantiate ACE_Node<AST_Component::port_description>;
+#pragma instantiate ACE_Unbounded_Queue<AST_Component::port_description>;
+#pragma instantiate ACE_Unbounded_Queue_Iterator<AST_Component::port_description>;
+
+#pragma instantiate ACE_Node<Identifier *>;
+#pragma instantiate ACE_Unbounded_Queue<Identifier *>;
+#pragma instantiate ACE_UnboundedQueue_Iterator<Identifier *>;
#pragma instantiate ACE_Unbounded_Stack<char *>
#pragma instantiate ACE_Unbounded_Stack_Iterator<char *>
diff --git a/TAO/TAO_IDL/fe/idl.ll b/TAO/TAO_IDL/fe/idl.ll
index dff932a5f04..e9a3283f175 100644
--- a/TAO/TAO_IDL/fe/idl.ll
+++ b/TAO/TAO_IDL/fe/idl.ll
@@ -67,8 +67,19 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
* idl.ll - Lexical scanner for IDL 1.1
*/
-#include "idl.h"
-#include "idl_extern.h"
+#include "utl_strlist.h"
+#include "utl_exprlist.h"
+#include "utl_labellist.h"
+#include "utl_decllist.h"
+#include "utl_string.h"
+#include "utl_err.h"
+#include "ast_union_label.h"
+#include "ast_field.h"
+#include "ast_expression.h"
+#include "ast_argument.h"
+#include "ast_operation.h"
+#include "fe_interface_header.h"
+#include "global_extern.h"
#include "fe_private.h"
#include "y.tab.h"
@@ -117,6 +128,19 @@ static int scan_obv_token (int token)
return IDENTIFIER;
}
+static int scan_ccm_token (int token)
+{
+ if (idl_global->component_support ())
+ {
+ return token;
+ }
+ else
+ {
+ yylval.strval = ACE_OS::strdup (ace_yytext);
+ return IDENTIFIER;
+ }
+}
+
%}
/* SO we don't choke on files that use \r\n */
@@ -128,6 +152,7 @@ NL [\r?\n]
%%
any return IDL_ANY;
+Object return IDL_OBJECT;
module return IDL_MODULE;
raises return IDL_RAISES;
readonly return IDL_READONLY;
@@ -167,6 +192,23 @@ public return scan_obv_token (IDL_PUBLIC);
supports return scan_obv_token (IDL_SUPPORTS);
truncatable return scan_obv_token (IDL_TRUNCATABLE);
valuetype return scan_obv_token (IDL_VALUETYPE);
+component return scan_ccm_token (IDL_COMPONENT);
+consumes return scan_ccm_token (IDL_CONSUMES);
+emits return scan_ccm_token (IDL_EMITS);
+eventtype return scan_ccm_token (IDL_EVENTTYPE);
+finder return scan_ccm_token (IDL_FINDER);
+getraises return scan_ccm_token (IDL_GETRAISES);
+home return scan_ccm_token (IDL_HOME);
+import return scan_ccm_token (IDL_IMPORT);
+multiple return scan_ccm_token (IDL_MULTIPLE);
+primarykey return scan_ccm_token (IDL_PRIMARYKEY);
+provides return scan_ccm_token (IDL_PROVIDES);
+publishes return scan_ccm_token (IDL_PUBLISHES);
+setraises return scan_ccm_token (IDL_SETRAISES);
+typeid return scan_ccm_token (IDL_TYPEID);
+typeprefix return scan_ccm_token (IDL_TYPEPREFIX);
+uses return scan_ccm_token (IDL_USES);
+manages return scan_ccm_token (IDL_MANAGES);
TRUE return IDL_TRUETOK;
FALSE return IDL_FALSETOK;
@@ -235,7 +277,7 @@ oneway return IDL_ONEWAY;
return IDL_UINTEGER_LITERAL;
}
-\"([^\\\"]*|\\[ntvbrfax\\\?\'\"])*\" {
+(\"([^\\\"]*|\\[ntvbrfax\\\?\'\"])*\"[ \t]*)+ {
/* Skip the quotes */
char *tmp = ace_yytext;
tmp[strlen(tmp)-1] = '\0';
@@ -277,32 +319,32 @@ L"'"\\u([0-9a-fA-F]{1,4})"'" {
yylval.wcval = idl_wchar_escape_reader(ace_yytext + 2);
return IDL_WCHAR_LITERAL;
}
-^#[ \t]*pragma[ \t].*{NL} |
+^[ \t]*#[ \t]*pragma[ \t].*{NL} |
^\?\?=[ \t]*pragma[ \t].*{NL} {/* remember pragma */
idl_global->set_lineno(idl_global->lineno() + 1);
idl_store_pragma(ace_yytext);
}
-^#[ \t]*file[ \t].*{NL} |
+^[ \t]*#file[ \t].*{NL} |
^\?\?=[ \t]*file[ \t].*{NL} {/* ignore file */
idl_global->set_lineno(idl_global->lineno() + 1);
}
-^#[ \t]*[0-9]*" ""\""[^\"]*"\""" "[0-9]*([ \t]*[0-9]*)?{NL} |
+^[ \t]*#[ \t]*[0-9]*" ""\""[^\"]*"\""" "[0-9]*([ \t]*[0-9]*)?{NL} |
^\?\?=[ \t]*[0-9]*" ""\""[^\"]*"\""" "[0-9]*([ \t]*[0-9]*)?{NL} {
idl_parse_line_and_file(ace_yytext);
}
-^#[ \t]*[0-9]*" ""\""[^\"]*"\""{NL} |
+^[ \t]*#[ \t]*[0-9]*" ""\""[^\"]*"\""{NL} |
^\?\?=[ \t]*[0-9]*" ""\""[^\"]*"\""{NL} {
idl_parse_line_and_file(ace_yytext);
}
-^#line[ \t]*[0-9]+[ \t]*("\""[^\"]*"\"")?{NL} |
+^[ \t]*#line[ \t]*[0-9]+[ \t]*("\""[^\"]*"\"")?{NL} |
^\?\?=line[ \t]*[0-9]*" ""\""[^\"]*"\""{NL} {
idl_parse_line_and_file(ace_yytext);
}
-^#[ \t]*[0-9]*{NL} |
+^[ \t]*#[ \t]*[0-9]*{NL} |
^\?\?=[ \t]*[0-9]*{NL} {
idl_parse_line_and_file(ace_yytext);
}
-^#[ \t]*ident[ \t].*{NL} |
+^[ \t]*#[ \t]*ident[ \t].*{NL} |
^\?\?=[ \t]*ident[ \t].*{NL} {
/* ignore cpp ident */
idl_global->set_lineno(idl_global->lineno() + 1);
@@ -535,7 +577,7 @@ idl_store_pragma (char *buf)
if (new_prefix != 0)
{
- unsigned long depth = idl_global->scopes ()->depth ();
+ unsigned long depth = idl_global->scopes ().depth ();
// At global scope, we always replace the prefix. For all
// other scopes, we replace only if there is a prefix already
@@ -611,6 +653,7 @@ idl_store_pragma (char *buf)
if (new_id != 0)
{
d->repoID (new_id);
+ d->typeid_set (1);
}
}
}
@@ -919,7 +962,7 @@ idl_find_node (char *s)
if (node != 0)
{
- d = idl_global->scopes ()->top_non_null ()->lookup_by_name (node,
+ d = idl_global->scopes ().top_non_null ()->lookup_by_name (node,
I_TRUE);
}
diff --git a/TAO/TAO_IDL/fe/idl.yy b/TAO/TAO_IDL/fe/idl.yy
index 73604a87d16..41f68cb326c 100644
--- a/TAO/TAO_IDL/fe/idl.yy
+++ b/TAO/TAO_IDL/fe/idl.yy
@@ -28,21 +28,21 @@ This license is effective until terminated by Sun for failure to comply
with this license. Upon termination, you shall destroy or return all code
and documentation for the Interface Definition Language CFE.
-IDL_INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
-IDL_ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
+ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
DEALING, USAGE OR TRADE PRACTICE.
-IDL_INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
-IDL_ANY OBLIGATION ON THE PART OF Sun OR IDL_ANY OF ITS SUBSIDIARIES OR AFFILIATES
-TO ASSIST IDL_IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
+ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
+TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
-SUN OR IDL_ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
-RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR IDL_ANY PATENTS BY
-IDL_INTERFACE DEFINITION LANGUAGE CFE OR IDL_ANY PART THEREOF.
+SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
+RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
+INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
-IDL_IN NO EVENT WILL SUN OR IDL_ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
-IDL_ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
+IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
+ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Use, duplication, or disclosure by the government is subject to
@@ -71,10 +71,41 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
/* Declarations */
%{
-#include "idl.h"
-#include "idl_extern.h"
-#include "fe_private.h"
-#include <stdio.h>
+#include "utl_strlist.h"
+#include "utl_namelist.h"
+#include "fe_interface_header.h"
+#include "utl_exprlist.h"
+#include "utl_labellist.h"
+#include "utl_decllist.h"
+#include "ast_field.h"
+#include "ast_expression.h"
+#include "ast_argument.h"
+#include "ast_operation.h"
+#include "global_extern.h"
+#include "utl_identifier.h"
+#include "utl_err.h"
+#include "ast_generator.h"
+#include "ast_module.h"
+#include "ast_valuetype.h"
+#include "ast_valuetype_fwd.h"
+#include "ast_component.h"
+#include "ast_component_fwd.h"
+#include "ast_home.h"
+#include "utl_string.h"
+#include "ast_constant.h"
+#include "fe_declarator.h"
+#include "ast_union.h"
+#include "ast_union_fwd.h"
+#include "ast_structure_fwd.h"
+#include "ast_extern.h"
+#include "ast_enum.h"
+#include "ast_root.h"
+#include "ast_sequence.h"
+#include "ast_string.h"
+#include "ast_factory.h"
+#include "ast_exception.h"
+#include "ast_array.h"
+#include "nr_extern.h"
#if (defined(apollo) || defined(hpux)) && defined(__cplusplus)
extern "C" int yywrap();
@@ -86,6 +117,7 @@ int yylex (void);
extern "C" int yywrap (void);
extern char yytext[];
extern int yyleng;
+AST_Decl *tao_enum_constant_decl = 0;
#define YYDEBUG_LEXER_TEXT (yytext[yyleng] = '\0', yytext)
// Force the pretty debugging code to compile.
#define YYDEBUG 1
@@ -103,7 +135,9 @@ extern int yyleng;
UTL_LabelList *llval; /* Label list */
UTL_DeclList *dlval; /* Declaration list */
FE_InterfaceHeader *ihval; /* Interface header */
- FE_obv_header *vhval; /* Valuetype header */
+ FE_OBVHeader *vhval; /* Valuetype header */
+ FE_ComponentHeader *chval; /* Component header */
+ FE_HomeHeader *hhval; /* Home header */
AST_Expression *exval; /* Expression value */
AST_UnionLabel *ulval; /* Union label */
AST_Field *ffval; /* Field value */
@@ -147,6 +181,7 @@ extern int yyleng;
%token IDL_BOOLEAN
%token IDL_FIXED
%token IDL_ANY
+%token IDL_OBJECT
%token IDL_STRUCT
%token IDL_UNION
%token IDL_SWITCH
@@ -169,7 +204,7 @@ extern int yyleng;
%token IDL_CONTEXT
%token IDL_NATIVE
%token IDL_LOCAL
- /* OBV tokens see OMG ptc/98-10-04 3.2.4 */
+ /* OBV tokens */
%token IDL_ABSTRACT
%token IDL_CUSTOM
%token IDL_FACTORY
@@ -178,6 +213,24 @@ extern int yyleng;
%token IDL_SUPPORTS
%token IDL_TRUNCATABLE
%token IDL_VALUETYPE
+ /* Component tokens */
+%token IDL_COMPONENT
+%token IDL_CONSUMES
+%token IDL_EMITS
+%token IDL_EVENTTYPE
+%token IDL_FINDER
+%token IDL_GETRAISES
+%token IDL_HOME
+%token IDL_IMPORT
+%token IDL_MULTIPLE
+%token IDL_PRIMARYKEY
+%token IDL_PROVIDES
+%token IDL_PUBLISHES
+%token IDL_SETRAISES
+%token IDL_TYPEID
+%token IDL_TYPEPREFIX
+%token IDL_USES
+%token IDL_MANAGES
%token <ival> IDL_INTEGER_LITERAL
%token <uival> IDL_UINTEGER_LITERAL
@@ -201,9 +254,11 @@ extern int yyleng;
%type <dcval> template_type_spec sequence_type_spec string_type_spec
%type <dcval> struct_type enum_type switch_type_spec union_type
%type <dcval> array_declarator op_type_spec seq_head wstring_type_spec
-%type <dcval> param_type_spec
+%type <dcval> param_type_spec
+
+%type <idlist> scoped_name interface_type component_inheritance_spec
+%type <idlist> home_inheritance_spec primary_key_spec
-%type <idlist> scoped_name
%type <slval> opt_context at_least_one_string_literal
%type <slval> string_literals
@@ -221,6 +276,10 @@ extern int yyleng;
%type <vhval> value_header
+%type <chval> component_header
+
+%type <hhval> home_header
+
%type <exval> expression const_expr or_expr xor_expr and_expr shift_expr
%type <exval> add_expr mult_expr unary_expr primary_expr literal
%type <exval> positive_int_expr array_dim
@@ -230,8 +289,8 @@ extern int yyleng;
%type <ffval> element_spec
%type <etval> const_type integer_type char_type boolean_type
-%type <etval> floating_pt_type any_type fixed_type signed_int
-%type <etval> unsigned_int base_type_spec octet_type
+%type <etval> floating_pt_type fixed_type any_type signed_int
+%type <etval> unsigned_int base_type_spec octet_type object_type
%type <dival> direction
@@ -239,15 +298,15 @@ extern int yyleng;
%type <deval> declarator simple_declarator complex_declarator
-%type <bval> opt_readonly, opt_truncatable
+%type <bval> opt_readonly opt_truncatable opt_multiple
-%type <idval> interface_decl value_decl id
+%type <idval> interface_decl value_decl union_decl struct_decl id
%type <ival> type_dcl
%%
/*
- * Production starts here
+ * Production starts here.
*/
start : definitions ;
@@ -259,58 +318,122 @@ definitions
definition
: type_dcl
{
+// definition : type_dcl
idl_global->set_parse_state (IDL_GlobalData::PS_TypeDeclSeen);
}
';'
{
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ | typeid_dcl
+ {
+// | typeid_dcl
+ idl_global->set_parse_state (IDL_GlobalData::PS_TypeIdDeclSeen);
+ }
+ ';'
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ | typeprefix_dcl
+ {
+// | typeprefix_dcl
+ idl_global->set_parse_state (IDL_GlobalData::PS_TypePrefixDeclSeen);
+ }
+ ';'
+ {
+// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
| const_dcl
{
+// | const_dcl
idl_global->set_parse_state (IDL_GlobalData::PS_ConstDeclSeen);
}
';'
{
+// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
| exception
{
+// | exception
idl_global->set_parse_state (IDL_GlobalData::PS_ExceptDeclSeen);
}
';'
{
- idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
| interface_def
{
+// | interface_def
idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceDeclSeen);
}
';'
{
+// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
| module
{
+// | module
idl_global->set_parse_state (IDL_GlobalData::PS_ModuleDeclSeen);
}
';'
{
+// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
| value_def
{
- idl_global->set_parse_state (IDL_GlobalData::PS_ValuetypeDeclSeen);
+// | value_def
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeDeclSeen);
+ }
+ ';'
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ | component
+ {
+// | component
+ idl_global->set_parse_state (IDL_GlobalData::PS_ComponentDeclSeen);
+ }
+ ';'
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ | home_decl
+ {
+// | home_decl
+ idl_global->set_parse_state (IDL_GlobalData::PS_HomeDeclSeen);
+ }
+ ';'
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ | event
+ {
+// | event
+ idl_global->set_parse_state (IDL_GlobalData::PS_EventDeclSeen);
}
';'
{
+// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
| error
{
+// | error
idl_global->err()->syntax_error (idl_global->parse_state());
}
';'
{
+// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
yyerrok;
}
@@ -318,106 +441,130 @@ definition
module : IDL_MODULE
{
+// module : IDL_MODULE
idl_global->set_parse_state (IDL_GlobalData::PS_ModuleSeen);
}
IDENTIFIER
{
- UTL_ScopedName *n =
- new UTL_ScopedName(new Identifier ($3), 0);
+// IDENTIFIER
+ Identifier id ($3);
+ UTL_ScopedName n (&id,
+ 0);
AST_Module *m = 0;
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
idl_global->set_parse_state (IDL_GlobalData::PS_ModuleIDSeen);
/*
* Make a new module and add it to the enclosing scope
*/
- if (s != 0) {
- m = idl_global->gen ()->create_module (s, n);
- (void) s->fe_add_module (m);
- }
+ if (s != 0)
+ {
+ m = idl_global->gen ()->create_module (s,
+ &n);
+ (void) s->fe_add_module (m);
+ }
/*
* Push it on the stack
*/
- idl_global->scopes ()->push (m);
+ idl_global->scopes ().push (m);
}
'{'
{
+// '{'
idl_global->set_parse_state (IDL_GlobalData::PS_ModuleSqSeen);
}
definitions
{
+// definitions
idl_global->set_parse_state (IDL_GlobalData::PS_ModuleBodySeen);
}
'}'
{
+// '}'
idl_global->set_parse_state (IDL_GlobalData::PS_ModuleQsSeen);
/*
- * Finished with this module - pop it from the scope stack
+ * Finished with this module - pop it from the scope stack.
*/
- idl_global->scopes ()->pop ();
+ idl_global->scopes ().pop ();
}
;
interface_def
: interface
- | forward
+ | interface_forward
;
interface :
interface_header
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+// interface : interface_header
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Interface *i = 0;
/*
- * Make a new interface node and add it to its enclosing scope
+ * Make a new interface node and add it to its enclosing scope.
*/
- if (s != 0 && $1 != 0) {
- i = idl_global->gen ()->create_interface (
- $1->interface_name (),
- $1->inherits (),
- $1->n_inherits (),
- $1->inherits_flat (),
- $1->n_inherits_flat (),
- $1->is_local (),
- $1->is_abstract ()
- );
- AST_Interface::fwd_redefinition_helper (i, s);
- /*
- * Add the interface to its definition scope
- */
- (void) s->fe_add_interface (i);
- }
+ if (s != 0 && $1 != 0)
+ {
+ i =
+ idl_global->gen ()->create_interface (
+ $1->name (),
+ $1->inherits (),
+ $1->n_inherits (),
+ $1->inherits_flat (),
+ $1->n_inherits_flat (),
+ $1->is_local (),
+ $1->is_abstract ()
+ );
+ AST_Interface::fwd_redefinition_helper (i,
+ s);
+ /*
+ * Add the interface to its definition scope.
+ */
+ (void) s->fe_add_interface (i);
+
+ // This FE_InterfaceHeader class isn't destroyed with the AST.
+ $1->name ()->destroy ();
+ delete $1;
+ $1 = 0;
+ }
+
/*
- * Push it on the scope stack
+ * Push it on the scope stack.
*/
- idl_global->scopes ()->push (i);
+ idl_global->scopes ().push (i);
}
'{'
{
+// '{'
idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSqSeen);
}
exports
{
+// exports
idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceBodySeen);
}
'}'
{
+// '}'
idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceQsSeen);
+
/*
* Done with this interface - pop it off the scopes stack
*/
- idl_global->scopes ()->pop ();
+ idl_global->scopes ().pop ();
}
;
interface_decl:
IDL_INTERFACE
{
+// interface_decl : IDL_INTERFACE
idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSeen);
}
id
{
+// id
idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceIDSeen);
$$ = $3;
}
@@ -426,51 +573,85 @@ interface_decl:
interface_header :
interface_decl inheritance_spec
{
+// interface_header : interface_decl inheritance_spec
idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
+
/*
* Create an AST representation of the information in the header
* part of an interface - this representation contains a computed
* list of all interfaces which this interface inherits from,
* recursively
*/
- $$ = new FE_InterfaceHeader (new UTL_ScopedName ($1, 0), $2);
+ UTL_ScopedName n ($1,
+ 0);
+ ACE_NEW_RETURN ($$,
+ FE_InterfaceHeader (&n,
+ $2,
+ I_FALSE,
+ I_FALSE,
+ I_TRUE),
+ 1);
}
|
IDL_LOCAL interface_decl inheritance_spec
{
+// | IDL_LOCAL interface_decl inheritance_spec
idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
+
/*
* Create an AST representation of the information in the header
* part of an interface - this representation contains a computed
* list of all interfaces which this interface inherits from,
* recursively
*/
- $$ = new FE_Local_InterfaceHeader (new UTL_ScopedName($2, 0), $3);
+ UTL_ScopedName n ($2,
+ 0);
+ ACE_NEW_RETURN ($$,
+ FE_InterfaceHeader (&n,
+ $3,
+ I_TRUE,
+ I_FALSE,
+ I_TRUE),
+ 1);
}
|
IDL_ABSTRACT interface_decl inheritance_spec
{
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("error in %s line %d\n"),
- idl_global->filename ()->get_string (),
- idl_global->lineno ()));
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("Sorry, I (TAO_IDL) can't handle abstract")
- ACE_TEXT (" interfaces yet\n")));
+// | IDL_ABSTRACT interface_decl inheritance_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
+
+ /*
+ * Create an AST representation of the information in the header
+ * part of an interface - this representation contains a computed
+ * list of all interfaces which this interface inherits from,
+ * recursively
+ */
+ UTL_ScopedName n ($2,
+ 0);
+ ACE_NEW_RETURN ($$,
+ FE_InterfaceHeader (&n,
+ $3,
+ I_FALSE,
+ I_TRUE,
+ I_TRUE),
+ 1);
}
;
inheritance_spec
: ':'
{
+// inheritance_spec : ':'
idl_global->set_parse_state (IDL_GlobalData::PS_InheritColonSeen);
}
at_least_one_scoped_name
{
+// at_least_one_scoped_name
$$ = $3;
}
| /* EMPTY */
{
+// | /* EMPTY */
$$ = 0;
}
;
@@ -485,6 +666,7 @@ value_def
valuetype
: IDL_CUSTOM value_concrete_decl
{
+// valuetype : IDL_CUSTOM value_concrete_decl
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("error in %s line %d\n"),
idl_global->filename ()->get_string (),
@@ -499,42 +681,61 @@ valuetype
value_concrete_decl :
value_header
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+// value_concrete_decl : value_header
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_ValueType *v = 0;
AST_Interface *i = 0;
- if (s != 0 && $1 != 0) {
- i = idl_global->gen ()->create_valuetype ($1->interface_name (),
- $1->inherits (),
- $1->n_inherits ());
- AST_Interface::fwd_redefinition_helper (i, s);
- /*
- * Add the valuetype to its definition scope
- */
- (void) s->fe_add_interface (i);
- }
+ if (s != 0 && $1 != 0)
+ {
+ v =
+ idl_global->gen ()->create_valuetype (
+ $1->name (),
+ $1->inherits (),
+ $1->n_inherits (),
+ $1->inherits_concrete (),
+ $1->inherits_flat (),
+ $1->n_inherits_flat (),
+ $1->supports (),
+ $1->n_supports (),
+ $1->supports_concrete (),
+ I_FALSE,
+ $1->truncatable ()
+ );
+ i = AST_Interface::narrow_from_decl (v);
+ AST_Interface::fwd_redefinition_helper (i,
+ s);
+ /*
+ * Add the valuetype to its definition scope
+ */
+ v = AST_ValueType::narrow_from_decl (i);
+ (void) s->fe_add_valuetype (v);
+ }
+
/*
* Push it on the scope stack
*/
- idl_global->scopes ()->push (i);
+ idl_global->scopes ().push (v);
}
'{'
{
- idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSqSeen);
+// '{'
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeSqSeen);
}
value_elements
{
- idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceBodySeen);
+// value_elements
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeBodySeen);
}
'}'
{
- idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceQsSeen);
+// '}'
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeQsSeen);
+
/*
- * Done with this interface - pop it off the scopes stack
+ * Done with this value type - pop it off the scopes stack
*/
- UTL_Scope* s = idl_global->scopes ()->top ();
- AST_Interface* m = AST_Interface::narrow_from_scope (s);
- m->inherited_name_clash ();
- idl_global->scopes ()->pop ();
+ idl_global->scopes ().pop ();
}
;
@@ -542,146 +743,188 @@ value_abs_decl :
IDL_ABSTRACT
value_header
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+// value_abs_decl : IDL_ABSTRACT value_header
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_ValueType *v = 0;
AST_Interface *i = 0;
- if (s != 0 && $2 != 0) {
-
- if ($2->n_concrete() > 0) {
- idl_global->err ()->abstract_inheritance_error ($2->interface_name ());
+ if (s != 0 && $2 != 0)
+ {
+ v =
+ idl_global->gen ()->create_valuetype (
+ $2->name (),
+ $2->inherits (),
+ $2->n_inherits (),
+ $2->inherits_concrete (),
+ $2->inherits_flat (),
+ $2->n_inherits_flat (),
+ $2->supports (),
+ $2->n_supports (),
+ $2->supports_concrete (),
+ I_TRUE,
+ I_FALSE
+ );
+ i = AST_Interface::narrow_from_decl (v);
+ AST_Interface::fwd_redefinition_helper (i,
+ s);
+ /*
+ * Add the valuetype to its definition scope
+ */
+ v = AST_ValueType::narrow_from_decl (i);
+ (void) s->fe_add_valuetype (v);
}
- i = idl_global->gen()->create_valuetype ($2->interface_name (),
- $2->inherits (),
- $2->n_inherits ());
- i->set_abstract_valuetype ();
- AST_Interface::fwd_redefinition_helper (i, s);
- /*
- * Add the valuetype to its definition scope
- */
- (void) s->fe_add_interface (i);
- }
/*
- * Push it on the scope stack
+ * Push it on the scope stack.
*/
- idl_global->scopes ()->push (i);
+ idl_global->scopes ().push (v);
}
'{'
{
- idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSqSeen);
+// '{'
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeSqSeen);
}
exports
{
- idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceBodySeen);
+// exports
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeBodySeen);
}
'}'
{
- idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceQsSeen);
+// '}'
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeQsSeen);
+
/*
- * Done with this interface - pop it off the scopes stack
+ * Done with this valuetype - pop it off the scopes stack.
*/
- UTL_Scope* s = idl_global->scopes ()->top ();
- AST_Interface* m = AST_Interface::narrow_from_scope (s);
- m->inherited_name_clash ();
- idl_global->scopes ()->pop ();
+ idl_global->scopes ().pop ();
}
-
;
value_header :
value_decl
opt_truncatable
inheritance_spec
+ {
+// value_header : value_decl opt_truncatable inheritance_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
+ }
supports_spec
{
- $$ = new FE_obv_header (new UTL_ScopedName ($1, 0), $3, $4);
+// supports_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
+
+ UTL_ScopedName *sn = 0;
+ ACE_NEW_RETURN (sn,
+ UTL_ScopedName ($1,
+ 0),
+ 1);
+ ACE_NEW_RETURN ($$,
+ FE_OBVHeader (sn,
+ $3,
+ $5,
+ $2),
+ 1);
}
;
value_decl
: IDL_VALUETYPE
{
- idl_global->set_parse_state (IDL_GlobalData::PS_ValuetypeSeen);
+// value_decl : IDL_VALUETYPE
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeSeen);
}
id
{
- idl_global->set_parse_state (IDL_GlobalData::PS_ValuetypeIDSeen);
- $$ = $3;
+// id
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeIDSeen);
+ $$ = $3;
}
;
opt_truncatable :
- IDL_TRUNCATABLE
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("warning in %s line %d\n"),
- idl_global->filename ()->get_string (),
- idl_global->lineno ()));
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("truncatable modifier not supported ")
- ACE_TEXT ("and is ignored\n")));
- $$ = I_FALSE;
- }
+ IDL_TRUNCATABLE
+ {
+// opt_truncatable : IDL_TRUNCATABLE
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("warning in %s line %d\n"),
+ idl_global->filename ()->get_string (),
+ idl_global->lineno ()));
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("truncatable modifier not supported ")
+ ACE_TEXT ("and is ignored\n")));
+ $$ = I_FALSE;
+ }
| /* EMPTY */
- {
- $$ = I_FALSE;
- }
+ {
+// | /* EMPTY */
+ $$ = I_FALSE;
+ }
;
supports_spec :
- IDL_SUPPORTS
- scoped_name
- {
- $$ = new UTL_NameList ($2, 0);
- }
- | /* empty */
- {
- $$ = 0;
- }
+ IDL_SUPPORTS
+ at_least_one_scoped_name
+ {
+// supports_spec : IDL_SUPPORTS at_least_one_scoped_name
+ $$ = $2;
+ }
+ | /* EMPTY */
+ {
+// | /* EMPTY */
+ $$ = 0;
+ }
;
value_forward_decl :
IDL_ABSTRACT
value_decl
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- UTL_ScopedName *n = new UTL_ScopedName ($2, 0);
- AST_InterfaceFwd *f = 0;
+// value_forward_decl : IDL_ABSTRACT value_decl
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n ($2,
+ 0);
+ AST_ValueTypeFwd *f = 0;
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeForwardSeen);
- idl_global->set_parse_state (IDL_GlobalData::PS_ForwardDeclSeen);
/*
* Create a node representing a forward declaration of an
* valuetype. Store it in the enclosing scope
*/
- if (s != 0) {
- f = idl_global->gen()->create_valuetype_fwd (n);
- f->set_abstract_valuetype ();
- (void) s->fe_add_interface_fwd (f);
- }
+ if (s != 0)
+ {
+ f = idl_global->gen ()->create_valuetype_fwd (&n,
+ I_TRUE);
+ (void) s->fe_add_valuetype_fwd (f);
+ }
}
- |
+ |
value_decl
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- UTL_ScopedName *n = new UTL_ScopedName ($1, 0);
- AST_InterfaceFwd *f = 0;
+// | value_decl
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n ($1,
+ 0);
+ AST_ValueTypeFwd *f = 0;
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeForwardSeen);
- idl_global->set_parse_state (IDL_GlobalData::PS_ForwardDeclSeen);
/*
* Create a node representing a forward declaration of an
* valuetype. Store it in the enclosing scope
*/
- if (s != 0) {
- f = idl_global->gen ()->create_valuetype_fwd (n);
- (void) s->fe_add_interface_fwd (f);
- }
+ if (s != 0)
+ {
+ f = idl_global->gen ()->create_valuetype_fwd (&n,
+ I_FALSE);
+ (void) s->fe_add_valuetype_fwd (f);
+ }
}
;
-
value_box_decl
: value_decl type_spec /* in this order %!?*/
{
+// value_box_decl : value_decl type_spec
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("error in %s line %d\n"),
idl_global->filename ()->get_string (),
@@ -706,17 +949,19 @@ value_element
state_member
: IDL_PUBLIC
- {
- /* is $0 to member_i */
- $<vival>$ = AST_Field::vis_PUBLIC;
- }
- member_i
+ {
+// state_member : IDL_PUBLIC
+ /* is $0 to member_i */
+ $<vival>$ = AST_Field::vis_PUBLIC;
+ }
+ member_i
| IDL_PRIVATE
- {
- /* is $0 to member_i */
- $<vival>$ = AST_Field::vis_PRIVATE;
- }
- member_i
+ {
+// IDL_PRIVATE
+ /* is $0 to member_i */
+ $<vival>$ = AST_Field::vis_PRIVATE;
+ }
+ member_i
;
exports
@@ -727,50 +972,82 @@ exports
export
: type_dcl
{
+// export : type_dcl
idl_global->set_parse_state (IDL_GlobalData::PS_TypeDeclSeen);
}
';'
{
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ | typeid_dcl
+ {
+// | typeid_dcl
+ idl_global->set_parse_state (IDL_GlobalData::PS_TypeIdDeclSeen);
+ }
+ ';'
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ | typeprefix_dcl
+ {
+// | typeprefix_dcl
+ idl_global->set_parse_state (IDL_GlobalData::PS_TypePrefixDeclSeen);
+ }
+ ';'
+ {
+// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
| const_dcl
{
+// | const_dcl
idl_global->set_parse_state (IDL_GlobalData::PS_ConstDeclSeen);
}
';'
{
+// ';'
idl_global->set_parse_state(IDL_GlobalData::PS_NoState);
}
| exception
{
+// | exception
idl_global->set_parse_state (IDL_GlobalData::PS_ExceptDeclSeen);
}
';'
{
+// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
| attribute
{
+// | attribute
idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclSeen);
}
';'
{
+// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
| operation
{
+// | operation
idl_global->set_parse_state (IDL_GlobalData::PS_OpDeclSeen);
}
';'
{
+// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
| error
{
+// | error
idl_global->err()->syntax_error (idl_global->parse_state());
}
';'
{
+// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
yyerrok;
}
@@ -779,7 +1056,11 @@ export
at_least_one_scoped_name :
scoped_name scoped_names
{
- $$ = new UTL_NameList ($1, $2);
+// at_least_one_scoped_name : scoped_name scoped_names
+ ACE_NEW_RETURN ($$,
+ UTL_NameList ($1,
+ $2),
+ 1);
}
;
@@ -787,21 +1068,35 @@ scoped_names
: scoped_names
','
{
+// scoped_names : scoped_names ','
idl_global->set_parse_state (IDL_GlobalData::PS_SNListCommaSeen);
}
- scoped_name
+ scoped_name
{
+// scoped_name
idl_global->set_parse_state (IDL_GlobalData::PS_ScopedNameSeen);
if ($1 == 0)
- $$ = new UTL_NameList ($4, 0);
- else {
- $1->nconc (new UTL_NameList ($4, 0));
- $$ = $1;
- }
+ {
+ ACE_NEW_RETURN ($$,
+ UTL_NameList ($4,
+ 0),
+ 1);
+ }
+ else
+ {
+ UTL_NameList *nl = 0;
+ ACE_NEW_RETURN (nl,
+ UTL_NameList ($4,
+ 0),
+ 1);
+ $1->nconc (nl);
+ $$ = $1;
+ }
}
| /* EMPTY */
{
+// | /* EMPTY */
$$ = 0;
}
;
@@ -809,131 +1104,203 @@ scoped_names
scoped_name
: id
{
+// scoped_name : id
idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen);
- $$ = new UTL_IdList($1, 0);
+ ACE_NEW_RETURN ($$,
+ UTL_IdList ($1,
+ 0),
+ 1);
}
| IDL_SCOPE_DELIMITOR
{
+// | IDL_SCOPE_DELIMITOR
idl_global->set_parse_state (IDL_GlobalData::PS_ScopeDelimSeen);
}
- id
+ id
{
+// id
idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen);
- $$ = new UTL_IdList (new Identifier ($1),
- new UTL_IdList ($3, 0));
+ Identifier *id = 0;
+ ACE_NEW_RETURN (id,
+ Identifier ($1),
+ 1);
+ UTL_IdList *sn = 0;
+ ACE_NEW_RETURN (sn,
+ UTL_IdList ($3,
+ 0),
+ 1);
+ ACE_NEW_RETURN ($$,
+ UTL_IdList (id,
+ sn),
+ 1);
}
| scoped_name
IDL_SCOPE_DELIMITOR
{
+// | scoped_name IDL_SCOPE_DELIMITOR
idl_global->set_parse_state (IDL_GlobalData::PS_ScopeDelimSeen);
}
- id
+ id
{
+// id
idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen);
- $1->nconc (new UTL_IdList ($4, 0));
+ UTL_IdList *sn = 0;
+ ACE_NEW_RETURN (sn,
+ UTL_IdList ($4,
+ 0),
+ 1);
+ $1->nconc (sn);
$$ = $1;
}
;
-id: IDENTIFIER
+id : IDENTIFIER
{
- $$ = new Identifier ($1);
+// id: IDENTIFIER
+ ACE_NEW_RETURN ($$,
+ Identifier ($1),
+ 1);
+ ACE_OS::free ($1);
}
;
-forward :
+interface_forward :
interface_decl
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- UTL_ScopedName *n = new UTL_ScopedName($1, 0);
+// interface_forward : interface_decl
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n ($1,
+ 0);
AST_InterfaceFwd *f = 0;
+ idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceForwardSeen);
- idl_global->set_parse_state (IDL_GlobalData::PS_ForwardDeclSeen);
/*
* Create a node representing a forward declaration of an
* interface. Store it in the enclosing scope
*/
- if (s != 0) {
- f = idl_global->gen ()->create_interface_fwd (n, 0, 0);
- (void) s->fe_add_interface_fwd (f);
- }
+ if (s != 0)
+ {
+ f = idl_global->gen ()->create_interface_fwd (&n,
+ 0,
+ 0);
+ (void) s->fe_add_interface_fwd (f);
+ }
}
|
IDL_LOCAL interface_decl
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- UTL_ScopedName *n = new UTL_ScopedName ($2, 0);
+// | IDL_LOCAL interface_decl
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n ($2,
+ 0);
AST_InterfaceFwd *f = 0;
+ idl_global->set_parse_state (
+ IDL_GlobalData::PS_InterfaceForwardSeen
+ );
- idl_global->set_parse_state (IDL_GlobalData::PS_ForwardDeclSeen);
/*
* Create a node representing a forward declaration of an
* interface. Store it in the enclosing scope
*/
- if (s != 0) {
- f = idl_global->gen ()->create_interface_fwd (n, 1, 0);
- (void) s->fe_add_interface_fwd (f);
- }
+ if (s != 0)
+ {
+ f = idl_global->gen ()->create_interface_fwd (&n,
+ 1,
+ 0);
+ (void) s->fe_add_interface_fwd (f);
+ }
}
|
IDL_ABSTRACT interface_decl
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- UTL_ScopedName *n = new UTL_ScopedName ($2, 0);
+// | IDL_ABSTRACT interface_decl
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n ($2,
+ 0);
AST_InterfaceFwd *f = 0;
+ idl_global->set_parse_state (
+ IDL_GlobalData::PS_InterfaceForwardSeen
+ );
- idl_global->set_parse_state (IDL_GlobalData::PS_ForwardDeclSeen);
/*
* Create a node representing a forward declaration of an
* interface. Store it in the enclosing scope
*/
- if (s != 0) {
- f = idl_global->gen ()->create_interface_fwd (n, 0, 1);
- (void) s->fe_add_interface_fwd (f);
- }
+ if (s != 0)
+ {
+ f = idl_global->gen ()->create_interface_fwd (&n,
+ 0,
+ 1);
+ (void) s->fe_add_interface_fwd (f);
+ }
}
;
const_dcl :
IDL_CONST
{
+// const_dcl : IDL_CONST
idl_global->set_parse_state (IDL_GlobalData::PS_ConstSeen);
}
const_type
{
+// const_type
idl_global->set_parse_state (IDL_GlobalData::PS_ConstTypeSeen);
}
id
{
+// id
idl_global->set_parse_state (IDL_GlobalData::PS_ConstIDSeen);
}
'='
{
+// '='
idl_global->set_parse_state (IDL_GlobalData::PS_ConstAssignSeen);
}
expression
{
- UTL_ScopedName *n = new UTL_ScopedName ($5, 0);
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+// expression
+ UTL_ScopedName n ($5,
+ 0);
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Constant *c = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_ConstExprSeen);
+
/*
* Create a node representing a constant declaration. Store
- * it in the enclosing scope
+ * it in the enclosing scope.
*/
- if ($9 != 0 && s != 0) {
- if ($9->coerce ($3) == 0)
- idl_global->err ()->coercion_error ($9, $3);
- else {
- c =
- idl_global->gen ()->create_constant ($3, $9, n);
- (void) s->fe_add_constant (c);
+ if ($9 != 0 && s != 0)
+ {
+ AST_Expression::AST_ExprValue *result =
+ $9->check_and_coerce ($3,
+ tao_enum_constant_decl);
+ tao_enum_constant_decl = 0;
+
+ if (result == 0)
+ {
+ idl_global->err ()->coercion_error ($9,
+ $3);
+ }
+ else
+ {
+ c =
+ idl_global->gen ()->create_constant (
+ $3,
+ $9,
+ &n
+ );
+ (void) s->fe_add_constant (c);
+ delete result;
+ }
+
+ $5->destroy ();
+ delete $5;
+ $5 = 0;
}
- }
}
;
@@ -946,16 +1313,25 @@ const_type
| fixed_type
| string_type_spec
{
+// const_type
+// : integer_type
+// | char_type
+// | octet_type
+// | boolean_type
+// | floating_pt_type
+// | fixed_type
+// | string_type_spec
$$ = AST_Expression::EV_string;
}
| wstring_type_spec
{
+// | wstring_type_spec
$$ = AST_Expression::EV_wstring;
}
| scoped_name
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- AST_Decl *d = 0;
+// | scoped_name
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_PredefinedType *c = 0;
AST_Typedef *t = 0;
@@ -963,33 +1339,63 @@ const_type
* If the constant's type is a scoped name, it must resolve
* to a scalar constant type
*/
- if (s != 0 && (d = s->lookup_by_name ($1, I_TRUE)) != 0) {
- /*
- * Look through typedefs
- */
- while (d->node_type () == AST_Decl::NT_typedef) {
- t = AST_Typedef::narrow_from_decl (d);
- if (t == 0)
- break;
- d = t->base_type ();
- }
- if (d == 0)
- $$ = AST_Expression::EV_any;
- else if (d->node_type () == AST_Decl::NT_pre_defined) {
- c = AST_PredefinedType::narrow_from_decl (d);
- if (c != 0) {
- $$ = idl_global->PredefinedTypeToExprType (c->pt ());
- } else {
- $$ = AST_Expression::EV_any;
- }
- } else if (d->node_type () == AST_Decl::NT_string) {
- $$ = AST_Expression::EV_string;
- } else if (d->node_type () == AST_Decl::NT_wstring) {
- $$ = AST_Expression::EV_wstring;
- } else
- $$ = AST_Expression::EV_any;
- } else
- $$ = AST_Expression::EV_any;
+ AST_Decl *d =
+ s->lookup_by_name ($1,
+ I_TRUE);
+
+ if (s != 0 && d != 0)
+ {
+ tao_enum_constant_decl = d;
+
+ /*
+ * Look through typedefs.
+ */
+ while (d->node_type () == AST_Decl::NT_typedef)
+ {
+ t = AST_Typedef::narrow_from_decl (d);
+
+ if (t == 0)
+ {
+ break;
+ }
+
+ d = t->base_type ();
+ }
+
+ if (d == 0)
+ {
+ $$ = AST_Expression::EV_enum;
+ }
+ else if (d->node_type () == AST_Decl::NT_pre_defined)
+ {
+ c = AST_PredefinedType::narrow_from_decl (d);
+
+ if (c != 0)
+ {
+ $$ = idl_global->PredefinedTypeToExprType (c->pt ());
+ }
+ else
+ {
+ $$ = AST_Expression::EV_enum;
+ }
+ }
+ else if (d->node_type () == AST_Decl::NT_string)
+ {
+ $$ = AST_Expression::EV_string;
+ }
+ else if (d->node_type () == AST_Decl::NT_wstring)
+ {
+ $$ = AST_Expression::EV_wstring;
+ }
+ else
+ {
+ $$ = AST_Expression::EV_enum;
+ }
+ }
+ else
+ {
+ $$ = AST_Expression::EV_enum;
+ }
}
;
@@ -1000,9 +1406,14 @@ const_expr : or_expr ;
or_expr : xor_expr
| or_expr '|' xor_expr
{
- $$ = idl_global->gen ()->create_expr (AST_Expression::EC_or,
- $1,
- $3);
+// or_expr : xor_expr
+// | or_expr '|' xor_expr
+ $$ =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_or,
+ $1,
+ $3
+ );
}
;
@@ -1010,9 +1421,14 @@ xor_expr
: and_expr
| xor_expr '^' and_expr
{
- $$ = idl_global->gen ()->create_expr (AST_Expression::EC_xor,
- $1,
- $3);
+// xor_expr : and_expr
+// | xor_expr '^' and_expr
+ $$ =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_xor,
+ $1,
+ $3
+ );
}
;
@@ -1020,9 +1436,13 @@ and_expr
: shift_expr
| and_expr '&' shift_expr
{
- $$ = idl_global->gen ()->create_expr (AST_Expression::EC_and,
- $1,
- $3);
+// and_expr : shift_expr | and_expr '&' shift_expr
+ $$ =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_and,
+ $1,
+ $3
+ );
}
;
@@ -1030,15 +1450,23 @@ shift_expr
: add_expr
| shift_expr IDL_LEFT_SHIFT add_expr
{
- $$ = idl_global->gen ()->create_expr (AST_Expression::EC_left,
- $1,
- $3);
+// shift_expr : add_expr | shift_expr IDL_LEFT_SHIFT add_expr
+ $$ =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_left,
+ $1,
+ $3
+ );
}
| shift_expr IDL_RIGHT_SHIFT add_expr
{
- $$ = idl_global->gen ()->create_expr (AST_Expression::EC_right,
- $1,
- $3);
+// | shift_expr IDL_RIGHT_SHIFT add_expr
+ $$ =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_right,
+ $1,
+ $3
+ );
}
;
@@ -1046,15 +1474,23 @@ add_expr
: mult_expr
| add_expr '+' mult_expr
{
- $$ = idl_global->gen ()->create_expr (AST_Expression::EC_add,
- $1,
- $3);
+// add_expr : mult_expr | add_expr '+' mult_expr
+ $$ =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_add,
+ $1,
+ $3
+ );
}
| add_expr '-' mult_expr
{
- $$ = idl_global->gen ()->create_expr (AST_Expression::EC_minus,
- $1,
- $3);
+// | add_expr '-' mult_expr
+ $$ =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_minus,
+ $1,
+ $3
+ );
}
;
@@ -1062,21 +1498,33 @@ mult_expr
: unary_expr
| mult_expr '*' unary_expr
{
- $$ = idl_global->gen ()->create_expr (AST_Expression::EC_mul,
- $1,
- $3);
+// mult_expr : unary_expr | mult_expr '*' unary_expr
+ $$ =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_mul,
+ $1,
+ $3
+ );
}
| mult_expr '/' unary_expr
{
- $$ = idl_global->gen ()->create_expr (AST_Expression::EC_div,
- $1,
- $3);
+// | mult_expr '/' unary_expr
+ $$ =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_div,
+ $1,
+ $3
+ );
}
| mult_expr '%' unary_expr
{
- $$ = idl_global->gen ()->create_expr (AST_Expression::EC_mod,
- $1,
- $3);
+// | mult_expr '%' unary_expr
+ $$ =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_mod,
+ $1,
+ $3
+ );
}
;
@@ -1084,36 +1532,48 @@ unary_expr
: primary_expr
| '+' primary_expr
{
- $$ = idl_global->gen ()->create_expr (AST_Expression::EC_u_plus,
- $2,
- 0);
+// unary_expr : primary_expr | '+' primary_expr
+ $$ =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_u_plus,
+ $2,
+ 0
+ );
}
| '-' primary_expr
{
- $$ = idl_global->gen()->create_expr (AST_Expression::EC_u_minus,
- $2,
- 0);
+// | '-' primary_expr
+ $$ =
+ idl_global->gen()->create_expr (
+ AST_Expression::EC_u_minus,
+ $2,
+ 0
+ );
}
| '~' primary_expr
{
- $$ = idl_global->gen()->create_expr (AST_Expression::EC_bit_neg,
- $2,
- 0);
+// | '~' primary_expr
+ $$ =
+ idl_global->gen()->create_expr (
+ AST_Expression::EC_bit_neg,
+ $2,
+ 0
+ );
}
;
primary_expr
: scoped_name
{
+// primary_expr : scoped_name
/*
* An expression which is a scoped name is not resolved now,
* but only when it is evaluated (such as when it is assigned
* as a constant value).
*/
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
-
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Decl *d = s->lookup_by_name ($1,
- 1);
+ I_TRUE);
/*
* If the scoped name is an IDL constant, it may be used in an
@@ -1136,6 +1596,8 @@ primary_expr
| literal
| '(' const_expr ')'
{
+// | literal
+// | '(' const_expr ')'
$$ = $2;
}
;
@@ -1143,40 +1605,49 @@ primary_expr
literal
: IDL_INTEGER_LITERAL
{
+// literal : IDL_INTEGER_LITERAL
$$ = idl_global->gen ()->create_expr ($1);
}
| IDL_UINTEGER_LITERAL
{
+// | IDL_UINTEGER_LITERAL
$$ = idl_global->gen ()->create_expr ($1);
}
| IDL_STRING_LITERAL
{
+// | IDL_STRING_LITERAL
$$ = idl_global->gen ()->create_expr ($1);
}
| IDL_WSTRING_LITERAL
{
+// | IDL_WSTRING_LITERAL
$$ = idl_global->gen ()->create_expr ($1);
}
| IDL_CHARACTER_LITERAL
{
+// | IDL_CHARACTER_LITERAL
$$ = idl_global->gen ()->create_expr ($1);
}
| IDL_WCHAR_LITERAL
{
+// | IDL_WCHAR_LITERAL
ACE_OutputCDR::from_wchar wc ($1);
$$ = idl_global->gen ()->create_expr (wc);
}
| IDL_FLOATING_PT_LITERAL
{
+// | IDL_FLOATING_PT_LITERAL
$$ = idl_global->gen ()->create_expr ($1);
}
| IDL_TRUETOK
{
+// | IDL_TRUETOK
$$ = idl_global->gen ()->create_expr ((idl_bool) I_TRUE,
AST_Expression::EV_bool);
}
| IDL_FALSETOK
{
+// | IDL_FALSETOK
$$ = idl_global->gen ()->create_expr ((idl_bool) I_FALSE,
AST_Expression::EV_bool);
}
@@ -1185,10 +1656,9 @@ literal
positive_int_expr :
const_expr
{
+// positive_int_expr : const_expr
int good_expression = 1;
-
$1->evaluate (AST_Expression::EK_positive_int);
-
AST_Expression::AST_ExprValue *ev = $1->ev ();
/*
@@ -1205,30 +1675,35 @@ positive_int_expr :
{
good_expression = 0;
}
+
break;
case AST_Expression::EV_ulong:
if (ev->u.ulval == 0)
{
good_expression = 0;
}
+
break;
case AST_Expression::EV_ulonglong:
if (ev->u.ullval == 0)
{
good_expression = 0;
}
+
break;
case AST_Expression::EV_octet:
if (ev->u.oval == 0)
{
good_expression = 0;
}
+
break;
case AST_Expression::EV_bool:
if (ev->u.bval == 0)
{
good_expression = 0;
}
+
break;
default:
good_expression = 0;
@@ -1251,64 +1726,110 @@ positive_int_expr :
type_dcl
: IDL_TYPEDEF
- {
- idl_global->set_parse_state (IDL_GlobalData::PS_TypedefSeen);
- }
- type_declarator {$$ = 0;}
- | struct_type { $$ = 0;}
- | union_type { $$ = 0;}
- | enum_type { $$ = 0;}
+ {
+// type_dcl : IDL_TYPEDEF
+ idl_global->set_parse_state (IDL_GlobalData::PS_TypedefSeen);
+ }
+ type_declarator
+ {
+// type_declarator
+ $$ = 0;
+ }
+ | struct_type
+ {
+// | struct_type
+ $$ = 0;
+ }
+ | union_type
+ {
+// | union_type
+ $$ = 0;
+ }
+ | enum_type
+ {
+// | enum_type
+ $$ = 0;
+ }
| IDL_NATIVE simple_declarator
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+// | IDL_NATIVE simple_declarator
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Native *node = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_NativeSeen);
+
/*
* Create a node representing a Native and add it to its
* enclosing scope
*/
- if (s != 0) {
- node = idl_global->gen ()->create_native ($2->name ());
- /*
- * Add it to its defining scope
- */
- (void) s->fe_add_native (node);
- }
+ if (s != 0)
+ {
+ node =
+ idl_global->gen ()->create_native (
+ $2->name ()
+ );
+ /*
+ * Add it to its defining scope
+ */
+ (void) s->fe_add_native (node);
+ }
+ }
+ | constructed_forward_type_spec
+ {
+// | constructed_forward_type_spec
+ $$ = 0;
}
;
type_declarator :
type_spec
{
+// type_declarator : type_spec
idl_global->set_parse_state (IDL_GlobalData::PS_TypeSpecSeen);
}
at_least_one_declarator
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+// at_least_one_declarator
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
FE_Declarator *d = 0;
AST_Typedef *t = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_DeclaratorsSeen);
+
/*
* Create a list of type renamings. Add them to the
* enclosing scope
*/
- if (s != 0 && $1 != 0 && $3 != 0) {
- for (UTL_DecllistActiveIterator l ($3); !l.is_done (); l.next ()) {
- d = l.item ();
- if (d == 0)
- continue;
- AST_Type * tp = d->compose ($1);
- if (tp == 0)
- continue;
- t = idl_global->gen ()->create_typedef (tp,
- d->name (),
- s->is_local (),
- s->is_abstract ());
- (void) s->fe_add_typedef (t);
+ if (s != 0 && $1 != 0 && $3 != 0)
+ {
+ for (UTL_DecllistActiveIterator l ($3);
+ !l.is_done ();
+ l.next ())
+ {
+ d = l.item ();
+
+ if (d == 0)
+ {
+ continue;
+ }
+
+ AST_Type * tp = d->compose ($1);
+
+ if (tp == 0)
+ {
+ continue;
+ }
+
+ t = idl_global->gen ()->create_typedef (tp,
+ d->name (),
+ s->is_local (),
+ s->is_abstract ());
+ (void) s->fe_add_typedef (t);
+ }
+
+ // This FE_Declarator class isn't destroyed with the AST.
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
}
- }
}
;
@@ -1320,18 +1841,36 @@ type_spec
simple_type_spec
: base_type_spec
{
- $$ = idl_global->scopes ()->bottom ()->lookup_primitive_type ($1);
+// simple_type_spec : base_type_spec
+ $$ =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ $1
+ );
}
| template_type_spec
| scoped_name
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+// | template_type_spec
+// | scoped_name
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Decl *d = 0;
if (s != 0)
- d = s->lookup_by_name ($1, I_TRUE);
+ {
+ d = s->lookup_by_name ($1,
+ I_TRUE);
+ }
+
if (d == 0)
- idl_global->err ()->lookup_error ($1);
+ {
+ idl_global->err ()->lookup_error ($1);
+ }
+ else
+ {
+ d->last_referenced_as ($1);
+ }
+
+
$$ = d;
}
;
@@ -1344,6 +1883,7 @@ base_type_spec
| octet_type
| fixed_type
| any_type
+ | object_type
;
template_type_spec
@@ -1358,10 +1898,19 @@ constructed_type_spec
| enum_type
;
+constructed_forward_type_spec
+ : struct_forward_type
+ | union_forward_type
+ ;
+
at_least_one_declarator :
declarator declarators
{
- $$ = new UTL_DeclList ($1, $2);
+// at_least_one_declarator : declarator declarators
+ ACE_NEW_RETURN ($$,
+ UTL_DeclList ($1,
+ $2),
+ 1);
}
;
@@ -1369,21 +1918,35 @@ declarators
: declarators
','
{
+// declarators : declarators ','
idl_global->set_parse_state (IDL_GlobalData::PS_DeclsCommaSeen);
}
- declarator
+ declarator
{
+// declarator
idl_global->set_parse_state (IDL_GlobalData::PS_DeclsDeclSeen);
if ($1 == 0)
- $$ = new UTL_DeclList ($4, 0);
- else {
- $1->nconc (new UTL_DeclList ($4, 0));
- $$ = $1;
- }
+ {
+ ACE_NEW_RETURN ($$,
+ UTL_DeclList ($4,
+ 0),
+ 1);
+ }
+ else
+ {
+ UTL_DeclList *dl = 0;
+ ACE_NEW_RETURN (dl,
+ UTL_DeclList ($4,
+ 0),
+ 1);
+ $1->nconc (dl);
+ $$ = $1;
+ }
}
| /* EMPTY */
{
+// | /* EMPTY */
$$ = 0;
}
;
@@ -1396,7 +1959,11 @@ declarator
at_least_one_simple_declarator :
simple_declarator simple_declarators
{
- $$ = new UTL_DeclList ($1, $2);
+// at_least_one_simple_declarator : simple_declarator simple_declarators
+ ACE_NEW_RETURN ($$,
+ UTL_DeclList ($1,
+ $2),
+ 1);
}
;
@@ -1404,21 +1971,35 @@ simple_declarators
: simple_declarators
','
{
+// simple_declarators : simple_declarators ','
idl_global->set_parse_state (IDL_GlobalData::PS_DeclsCommaSeen);
}
- simple_declarator
+ simple_declarator
{
+// simple_declarator
idl_global->set_parse_state (IDL_GlobalData::PS_DeclsDeclSeen);
if ($1 == 0)
- $$ = new UTL_DeclList ($4, 0);
- else {
- $1->nconc (new UTL_DeclList ($4, 0));
- $$ = $1;
- }
+ {
+ ACE_NEW_RETURN ($$,
+ UTL_DeclList ($4,
+ 0),
+ 1);
+ }
+ else
+ {
+ UTL_DeclList *dl = 0;
+ ACE_NEW_RETURN (dl,
+ UTL_DeclList ($4,
+ 0),
+ 1);
+ $1->nconc (dl);
+ $$ = $1;
+ }
}
| /* EMPTY */
{
+// | /* EMPTY */
$$ = 0;
}
;
@@ -1426,18 +2007,36 @@ simple_declarators
simple_declarator :
id
{
- $$ = new FE_Declarator (new UTL_ScopedName ($1, 0),
- FE_Declarator::FD_simple, 0);
+// simple_declarator : id
+ UTL_ScopedName *sn = 0;
+ ACE_NEW_RETURN (sn,
+ UTL_ScopedName ($1,
+ 0),
+ 1);
+ ACE_NEW_RETURN ($$,
+ FE_Declarator (sn,
+ FE_Declarator::FD_simple,
+ 0),
+ 1);
}
;
complex_declarator :
array_declarator
{
- $$ = new FE_Declarator (new UTL_ScopedName ($1->local_name (),
- 0),
- FE_Declarator::FD_complex,
- $1);
+// complex_declarator : array_declarator
+ UTL_ScopedName *sn = 0;
+ ACE_NEW_RETURN (sn,
+ UTL_ScopedName (
+ $1->local_name ()->copy (),
+ 0
+ ),
+ 1);
+ ACE_NEW_RETURN ($$,
+ FE_Declarator (sn,
+ FE_Declarator::FD_complex,
+ $1),
+ 1);
}
;
@@ -1449,14 +2048,17 @@ integer_type
signed_int
: IDL_LONG
{
+// signed_int : IDL_LONG
$$ = AST_Expression::EV_long;
}
| IDL_LONG IDL_LONG
{
+// | IDL_LONG IDL_LONG
$$ = AST_Expression::EV_longlong;
}
| IDL_SHORT
{
+// | IDL_SHORT
$$ = AST_Expression::EV_short;
}
;
@@ -1464,14 +2066,17 @@ signed_int
unsigned_int
: IDL_UNSIGNED IDL_LONG
{
+// unsigned_int : IDL_UNSIGNED IDL_LONG
$$ = AST_Expression::EV_ulong;
}
| IDL_UNSIGNED IDL_LONG IDL_LONG
{
+// | IDL_UNSIGNED IDL_LONG IDL_LONG
$$ = AST_Expression::EV_ulonglong;
}
| IDL_UNSIGNED IDL_SHORT
{
+// | IDL_UNSIGNED IDL_SHORT
$$ = AST_Expression::EV_ushort;
}
;
@@ -1479,14 +2084,17 @@ unsigned_int
floating_pt_type
: IDL_DOUBLE
{
+// floating_pt_type : IDL_DOUBLE
$$ = AST_Expression::EV_double;
}
| IDL_FLOAT
{
+// | IDL_FLOAT
$$ = AST_Expression::EV_float;
}
| IDL_LONG IDL_DOUBLE
{
+// | IDL_LONG IDL_DOUBLE
$$ = AST_Expression::EV_longdouble;
}
;
@@ -1494,6 +2102,7 @@ floating_pt_type
fixed_type
: IDL_FIXED
{
+// fixed_type : IDL_FIXED
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("error in %s line %d\n"),
idl_global->filename ()->get_string (),
@@ -1507,10 +2116,12 @@ fixed_type
char_type
: IDL_CHAR
{
+// char_type : IDL_CHAR
$$ = AST_Expression::EV_char;
}
| IDL_WCHAR
{
+// | IDL_WCHAR
$$ = AST_Expression::EV_wchar;
}
;
@@ -1518,6 +2129,7 @@ char_type
octet_type
: IDL_OCTET
{
+// octet_type : IDL_OCTET
$$ = AST_Expression::EV_octet;
}
;
@@ -1525,6 +2137,7 @@ octet_type
boolean_type
: IDL_BOOLEAN
{
+// boolean_type : IDL_BOOLEAN
$$ = AST_Expression::EV_bool;
}
;
@@ -1532,55 +2145,85 @@ boolean_type
any_type
: IDL_ANY
{
+// any_type : IDL_ANY
$$ = AST_Expression::EV_any;
}
;
-struct_type :
+object_type
+ : IDL_OBJECT
+ {
+// object_type : IDL_OBJECT
+ $$ = AST_Expression::EV_object;
+ }
+ ;
+
+struct_decl :
IDL_STRUCT
{
+// struct_decl : IDL_STRUCT
idl_global->set_parse_state (IDL_GlobalData::PS_StructSeen);
}
id
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- UTL_ScopedName *n = new UTL_ScopedName ($3, 0);
+// id
+ idl_global->set_parse_state (IDL_GlobalData::PS_StructIDSeen);
+ $$ = $3;
+ }
+ ;
+
+
+struct_type
+ : struct_decl
+ {
+// struct_type : struct_header
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n ($1,
+ 0);
AST_Structure *d = 0;
- idl_global->set_parse_state (IDL_GlobalData::PS_StructIDSeen);
/*
* Create a node representing a struct declaration. Add it
* to the enclosing scope
*/
- if (s != 0) {
- d = idl_global->gen ()->create_structure (n,
- s->is_local (),
- s->is_abstract ());
- (void) s->fe_add_structure (d);
- }
+ if (s != 0)
+ {
+ d =
+ idl_global->gen ()->create_structure (
+ &n,
+ s->is_local (),
+ s->is_abstract ()
+ );
+ (void) s->fe_add_structure (d);
+ }
+
/*
- * Push the scope of the struct on the scopes stack
+ * Push the scope of the struct on the scopes stack.
*/
- idl_global->scopes ()->push (d);
+ idl_global->scopes ().push (d);
}
'{'
{
+// '{'
idl_global->set_parse_state (IDL_GlobalData::PS_StructSqSeen);
}
at_least_one_member
{
+// at_least_one_member
idl_global->set_parse_state (IDL_GlobalData::PS_StructBodySeen);
}
'}'
{
+// '}'
idl_global->set_parse_state (IDL_GlobalData::PS_StructQsSeen);
+
/*
- * Done with this struct. Pop its scope off the scopes stack
+ * Done with this struct. Pop its scope off the scopes stack.
*/
$$ = AST_Structure::narrow_from_scope (
- idl_global->scopes ()->top_non_null ()
+ idl_global->scopes ().top_non_null ()
);
- idl_global->scopes ()->pop ();
+ idl_global->scopes ().pop ();
}
;
@@ -1593,134 +2236,185 @@ members
member :
{
+// member :
/* is $0 to member_i */
$<vival>$ = AST_Field::vis_NA;
}
member_i
;
-member_i:
+member_i :
type_spec
{
+// member_i : type_spec
idl_global->set_parse_state (IDL_GlobalData::PS_MemberTypeSeen);
}
at_least_one_declarator
{
+// at_least_one_declarator
idl_global->set_parse_state (IDL_GlobalData::PS_MemberDeclsSeen);
}
- ';'
+ ';'
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+// ';'
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
FE_Declarator *d = 0;
AST_Field *f = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_MemberDeclsCompleted);
+
/*
- * Check for illegal recursive use of type
+ * Check for illegal recursive use of type.
*/
- if ($1 != 0 && AST_illegal_recursive_type ($1))
- idl_global->err ()->error1 (UTL_Error::EIDL_RECURSIVE_TYPE,
- $1);
+ if ($1 != 0
+ && AST_illegal_recursive_type ($1))
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_RECURSIVE_TYPE,
+ $1);
+ }
/*
* Create a node representing a struct or exception member
- * Add it to the enclosing scope
+ * Add it to the enclosing scope.
*/
- else if (s != 0 && $1 != 0 && $3 != 0) {
- for (UTL_DecllistActiveIterator l ($3); !(l.is_done ()); l.next ()) {
- d = l.item ();
- if (d == 0)
- continue;
- AST_Type *tp = d->compose ($1);
- if (tp == 0)
- continue;
- /* $0 denotes Visibility, must be on yacc reduction stack */
- f = idl_global->gen ()->create_field (tp,
- d->name (),
- $<vival>0);
- (void) s->fe_add_field (f);
+ else if (s != 0
+ && $1 != 0
+ && $3 != 0)
+ {
+ for (UTL_DecllistActiveIterator l ($3);
+ !l.is_done ();
+ l.next ())
+ {
+ d = l.item ();
+
+ if (d == 0)
+ {
+ continue;
+ }
+
+ AST_Type *tp = d->compose ($1);
+
+ if (tp == 0)
+ {
+ continue;
+ }
+
+ /* $0 denotes Visibility, must be on yacc reduction stack. */
+ f =
+ idl_global->gen ()->create_field (
+ tp,
+ d->name (),
+ $<vival>0
+ );
+ (void) s->fe_add_field (f);
+ }
}
- }
}
| error
{
+// | error
idl_global->err()->syntax_error (idl_global->parse_state ());
}
- ';'
+ ';'
{
+// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
yyerrok;
}
;
-union_type :
+union_decl :
IDL_UNION
{
+// union_decl : IDL_UNION
idl_global->set_parse_state (IDL_GlobalData::PS_UnionSeen);
}
id
{
+// id
idl_global->set_parse_state (IDL_GlobalData::PS_UnionIDSeen);
+ $$ = $3;
}
- IDL_SWITCH
+ ;
+
+union_type
+ : union_decl IDL_SWITCH
{
+// union_type : union_decl IDL_SWITCH
idl_global->set_parse_state (IDL_GlobalData::PS_SwitchSeen);
}
'('
{
+// '('
idl_global->set_parse_state (IDL_GlobalData::PS_SwitchOpenParSeen);
}
switch_type_spec
{
+// switch_type_spec
idl_global->set_parse_state (IDL_GlobalData::PS_SwitchTypeSeen);
}
')'
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- UTL_ScopedName *n = new UTL_ScopedName ($3, 0);
+// ')'
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n ($1,
+ 0);
AST_Union *u = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_SwitchCloseParSeen);
+
/*
* Create a node representing a union. Add it to its enclosing
- * scope
- */
- if ($9 != 0 && s != 0) {
- AST_ConcreteType *tp = AST_ConcreteType::narrow_from_decl ($9);
- if (tp == 0) {
- idl_global->err ()->not_a_type ($9);
- } else {
- u = idl_global->gen ()->create_union (tp,
- n,
- s->is_local (),
- s->is_abstract ());
- (void) s->fe_add_union (u);
+ * scope.
+ */
+ if ($6 != 0
+ && s != 0)
+ {
+ AST_ConcreteType *tp =
+ AST_ConcreteType::narrow_from_decl ($6);
+
+ if (tp == 0)
+ {
+ idl_global->err ()->not_a_type ($6);
+ }
+ else
+ {
+ u = idl_global->gen ()->create_union (tp,
+ &n,
+ s->is_local (),
+ s->is_abstract ());
+ }
+
+ (void) s->fe_add_union (u);
}
- }
+
/*
* Push the scope of the union on the scopes stack
*/
- idl_global->scopes()->push (u);
+ idl_global->scopes ().push (u);
}
'{'
{
+// '{'
idl_global->set_parse_state (IDL_GlobalData::PS_UnionSqSeen);
}
at_least_one_case_branch
{
+// at_least_one_case_branch
idl_global->set_parse_state (IDL_GlobalData::PS_UnionBodySeen);
}
'}'
{
+// '}'
idl_global->set_parse_state (IDL_GlobalData::PS_UnionQsSeen);
+
/*
- * Done with this union. Pop its scope from the scopes stack
+ * Done with this union. Pop its scope from the scopes stack.
*/
$$ = AST_Union::narrow_from_scope (
- idl_global->scopes ()->top_non_null ()
+ idl_global->scopes ().top_non_null ()
);
+
if ($$ != 0)
{
- idl_global->scopes ()->pop ();
+ idl_global->scopes ().pop ();
}
}
;
@@ -1728,98 +2422,139 @@ union_type :
switch_type_spec :
integer_type
{
- $$ = idl_global->scopes ()->bottom ()->lookup_primitive_type ($1);
+// switch_type_spec : integer_type
+ $$ =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ $1
+ );
}
| char_type
{
- /* wchars are not allowed */
+// | char_type
+ /* wchars are not allowed. */
if ($1 == AST_Expression::EV_wchar)
{
idl_global->err ()->error0 (UTL_Error::EIDL_DISC_TYPE);
}
- $$ = idl_global->scopes ()->bottom ()->lookup_primitive_type ($1);
+ $$ =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ $1
+ );
}
| octet_type
{
- /* octets are not allowed */
+// | octet_type
+ /* octets are not allowed. */
idl_global->err ()->error0 (UTL_Error::EIDL_DISC_TYPE);
- $$ = idl_global->scopes ()->bottom ()->lookup_primitive_type ($1);
+ $$ =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ $1
+ );
}
| boolean_type
{
- $$ = idl_global->scopes ()->bottom ()->lookup_primitive_type ($1);
+// | boolean_type
+ $$ =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ $1
+ );
}
| enum_type
| scoped_name
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+// | enum_type
+// | scoped_name
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Decl *d = 0;
AST_PredefinedType *p = 0;
AST_Typedef *t = 0;
- long found = I_FALSE;
+ idl_bool found = I_FALSE;
/*
* The discriminator is a scoped name. Try to resolve to
* one of the scalar types or to an enum. Thread through
* typedef's to arrive at the base type at the end of the
- * chain
- */
- if (s != 0 && (d = s->lookup_by_name ($1, I_TRUE)) != 0) {
- while (!found) {
- switch (d->node_type ()) {
- case AST_Decl::NT_enum:
- $$ = d;
- found = I_TRUE;
- break;
- case AST_Decl::NT_pre_defined:
- p = AST_PredefinedType::narrow_from_decl (d);
- if (p != 0) {
- switch (p->pt ()) {
- case AST_PredefinedType::PT_long:
- case AST_PredefinedType::PT_ulong:
- case AST_PredefinedType::PT_longlong:
- case AST_PredefinedType::PT_ulonglong:
- case AST_PredefinedType::PT_short:
- case AST_PredefinedType::PT_ushort:
- case AST_PredefinedType::PT_char:
- case AST_PredefinedType::PT_boolean:
- $$ = p;
- found = I_TRUE;
- break;
- case AST_PredefinedType::PT_wchar:
- case AST_PredefinedType::PT_octet:
- /* octets and wchars are not allowed */
- idl_global->err ()->error0 (UTL_Error::EIDL_DISC_TYPE);
- $$ = 0;
- found = I_TRUE;
- break;
- default:
- $$ = 0;
- found = I_TRUE;
- break;
- }
- } else
+ * chain.
+ */
+ d = s->lookup_by_name ($1,
+ I_TRUE);
+
+ if (s != 0 && d != 0)
+ {
+ while (!found)
{
- $$ = 0;
- found = I_TRUE;
+ switch (d->node_type ())
+ {
+ case AST_Decl::NT_enum:
+ $$ = d;
+ found = I_TRUE;
+ break;
+ case AST_Decl::NT_pre_defined:
+ p = AST_PredefinedType::narrow_from_decl (d);
+
+ if (p != 0)
+ {
+ switch (p->pt ())
+ {
+ case AST_PredefinedType::PT_long:
+ case AST_PredefinedType::PT_ulong:
+ case AST_PredefinedType::PT_longlong:
+ case AST_PredefinedType::PT_ulonglong:
+ case AST_PredefinedType::PT_short:
+ case AST_PredefinedType::PT_ushort:
+ case AST_PredefinedType::PT_char:
+ case AST_PredefinedType::PT_boolean:
+ $$ = p;
+ found = I_TRUE;
+ break;
+ case AST_PredefinedType::PT_wchar:
+ case AST_PredefinedType::PT_octet:
+ /* octets and wchars are not allowed */
+ idl_global->err ()->error0 (
+ UTL_Error::EIDL_DISC_TYPE
+ );
+ $$ = 0;
+ found = I_TRUE;
+ break;
+ default:
+ $$ = 0;
+ found = I_TRUE;
+ break;
+ }
+ }
+ else
+ {
+ $$ = 0;
+ found = I_TRUE;
+ }
+
+ break;
+ case AST_Decl::NT_typedef:
+ t = AST_Typedef::narrow_from_decl (d);
+
+ if (t != 0)
+ {
+ d = t->base_type ();
+ }
+
+ break;
+ default:
+ $$ = 0;
+ found = I_TRUE;
+ break;
+ }
}
- break;
- case AST_Decl::NT_typedef:
- t = AST_Typedef::narrow_from_decl (d);
- if (t != 0) d = t->base_type ();
- break;
- default:
- $$ = 0;
- found = I_TRUE;
- break;
- }
+ }
+ else
+ {
+ $$ = 0;
}
- } else
- $$ = 0;
if ($$ == 0)
- idl_global->err ()->lookup_error ($1);
+ {
+ idl_global->err ()->lookup_error ($1);
+ }
}
;
@@ -1833,37 +2568,47 @@ case_branches
case_branch :
at_least_one_case_label
{
+// case_branch : at_least_one_case_label
idl_global->set_parse_state (IDL_GlobalData::PS_UnionLabelSeen);
}
element_spec
{
+// element_spec
idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemSeen);
}
- ';'
+ ';'
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+// ';'
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_UnionBranch *b = 0;
AST_Field *f = $3;
-
idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemCompleted);
+
/*
* Create several nodes representing branches of a union.
* Add them to the enclosing scope (the union scope)
*/
- if (s != 0 && $1 != 0 && $3 != 0) {
- b = idl_global->gen ()->create_union_branch ($1,
- f->field_type (),
- f->name ());
+ if (s != 0
+ && $1 != 0
+ && $3 != 0)
+ {
+ b =
+ idl_global->gen ()->create_union_branch (
+ $1,
+ f->field_type (),
+ f->name ()
+ );
(void) s->fe_add_union_branch (b);
- }
+ }
}
| error
{
+// | error
idl_global->err()->syntax_error (idl_global->parse_state());
}
- ';'
-
+ ';'
{
+// ';'
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
yyerrok;
}
@@ -1872,22 +2617,39 @@ case_branch :
at_least_one_case_label :
case_label case_labels
{
- $$ = new UTL_LabelList ($1, $2);
+// at_least_one_case_label : case_label case_labels
+ ACE_NEW_RETURN ($$,
+ UTL_LabelList ($1,
+ $2),
+ 1);
}
;
case_labels
: case_labels case_label
{
+// case_labels : case_labels case_label
if ($1 == 0)
- $$ = new UTL_LabelList ($2, 0);
- else {
- $1->nconc(new UTL_LabelList ($2, 0));
- $$ = $1;
- }
+ {
+ ACE_NEW_RETURN ($$,
+ UTL_LabelList ($2,
+ 0),
+ 1);
+ }
+ else
+ {
+ UTL_LabelList *ll = 0;
+ ACE_NEW_RETURN (ll,
+ UTL_LabelList ($2,
+ 0),
+ 1);
+ $1->nconc (ll);
+ $$ = $1;
+ }
}
| /* EMPTY */
{
+// | /* EMPTY */
$$ = 0;
}
;
@@ -1895,10 +2657,12 @@ case_labels
case_label
: IDL_DEFAULT
{
+// case_label : IDL_DEFAULT
idl_global->set_parse_state (IDL_GlobalData::PS_DefaultSeen);
}
':'
{
+// ':'
idl_global->set_parse_state (IDL_GlobalData::PS_LabelColonSeen);
$$ = idl_global->gen ()->create_union_label (
@@ -1908,14 +2672,16 @@ case_label
}
| IDL_CASE
{
+// | IDL_CASE
idl_global->set_parse_state (IDL_GlobalData::PS_CaseSeen);
}
const_expr
{
idl_global->set_parse_state (IDL_GlobalData::PS_LabelExprSeen);
}
- ':'
+ ':'
{
+// const_expr
idl_global->set_parse_state (IDL_GlobalData::PS_LabelColonSeen);
$$ = idl_global->gen()->create_union_label (
@@ -1928,84 +2694,154 @@ case_label
element_spec :
type_spec
{
+// element_spec : type_spec
idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemTypeSeen);
}
declarator
{
+// declarator
idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemDeclSeen);
+
/*
* Check for illegal recursive use of type
*/
- if ($1 != 0 && AST_illegal_recursive_type ($1))
- idl_global->err()->error1 (UTL_Error::EIDL_RECURSIVE_TYPE, $1);
+ if ($1 != 0
+ && AST_illegal_recursive_type ($1))
+ {
+ idl_global->err()->error1 (UTL_Error::EIDL_RECURSIVE_TYPE,
+ $1);
+ }
/*
* Create a field in a union branch
*/
- else if ($1 == 0 || $3 == 0)
- $$ = 0;
- else {
- AST_Type *tp = $3->compose ($1);
- if (tp == 0)
+ else if ($1 == 0
+ || $3 == 0)
+ {
$$ = 0;
- else
- $$ = idl_global->gen ()->create_field (tp,
- $3->name());
- }
+ }
+ else
+ {
+ AST_Type *tp = $3->compose ($1);
+
+ if (tp == 0)
+ {
+ $$ = 0;
+ }
+ else
+ {
+ $$ = idl_global->gen ()->create_field (
+ tp,
+ $3->name ()
+ );
+ }
+ }
+ }
+ ;
+
+struct_forward_type
+ : struct_decl
+ {
+// struct_forward_type : struct_decl
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n ($1,
+ 0);
+ AST_StructureFwd *d = 0;
+
+ /*
+ * Create a node representing a forward declaration of a struct.
+ */
+ if (s != 0)
+ {
+ d = idl_global->gen ()->create_structure_fwd (&n);
+ (void) s->fe_add_structure_fwd (d);
+ }
+ }
+ ;
+
+union_forward_type
+ : union_decl
+ {
+// union_forward_type : union_decl
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n ($1,
+ 0);
+ AST_UnionFwd *u = 0;
+
+ /*
+ * Create a node representing a forward declaration of a union.
+ */
+ if (s != 0)
+ {
+ u = idl_global->gen ()->create_union_fwd (&n);
+ (void) s->fe_add_union_fwd (u);
+ }
}
;
enum_type :
IDL_ENUM
{
+// enum_type : IDL_ENUM
idl_global->set_parse_state (IDL_GlobalData::PS_EnumSeen);
}
id
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- UTL_ScopedName *n = new UTL_ScopedName($3, 0);
+// id
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n ($3,
+ 0);
AST_Enum *e = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_EnumIDSeen);
+
/*
* Create a node representing an enum and add it to its
- * enclosing scope
+ * enclosing scope.
*/
- if (s != 0) {
- e = idl_global->gen ()->create_enum (n,
- s->is_local (),
- s->is_abstract ());
- /*
- * Add it to its defining scope
- */
- (void) s->fe_add_enum (e);
- }
+ if (s != 0)
+ {
+ e = idl_global->gen ()->create_enum (&n,
+ s->is_local (),
+ s->is_abstract ());
+ /*
+ * Add it to its defining scope
+ */
+ (void) s->fe_add_enum (e);
+ }
+
/*
- * Push the enum scope on the scopes stack
+ * Push the enum scope on the scopes stack.
*/
- idl_global->scopes ()->push (e);
+ idl_global->scopes ().push (e);
}
'{'
{
+// '{'
idl_global->set_parse_state (IDL_GlobalData::PS_EnumSqSeen);
}
at_least_one_enumerator
{
+// at_least_one_enumerator
idl_global->set_parse_state (IDL_GlobalData::PS_EnumBodySeen);
}
'}'
{
+// '}'
idl_global->set_parse_state (IDL_GlobalData::PS_EnumQsSeen);
+
/*
- * Done with this enum. Pop its scope from the scopes stack
+ * Done with this enum. Pop its scope from the scopes stack.
*/
- if (idl_global->scopes ()->top () == 0)
- $$ = 0;
- else {
- $$ = AST_Enum::narrow_from_scope (
- idl_global->scopes ()->top_non_null ()
- );
- idl_global->scopes ()->pop ();
- }
+ if (idl_global->scopes ().top () == 0)
+ {
+ $$ = 0;
+ }
+ else
+ {
+ $$ = AST_Enum::narrow_from_scope (
+ idl_global->scopes ().top_non_null ()
+ );
+ idl_global->scopes ().pop ();
+ }
}
;
@@ -2015,6 +2851,7 @@ enumerators
: enumerators
','
{
+// enumerators : enumerators ','
idl_global->set_parse_state (IDL_GlobalData::PS_EnumCommaSeen);
}
enumerator
@@ -2024,9 +2861,11 @@ enumerators
enumerator :
IDENTIFIER
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- UTL_ScopedName *n =
- new UTL_ScopedName (new Identifier ($1), 0);
+// enumerator : IDENTIFIER
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ Identifier id ($1);
+ UTL_ScopedName n (&id,
+ 0);
AST_EnumVal *e = 0;
AST_Enum *c = 0;
@@ -2034,13 +2873,21 @@ enumerator :
* Create a node representing one enumerator in an enum
* Add it to the enclosing scope (the enum scope)
*/
- if (s != 0 && s->scope_node_type () == AST_Decl::NT_enum) {
- c = AST_Enum::narrow_from_scope (s);
- if (c != 0)
- e = idl_global->gen ()->create_enum_val (c->next_enum_val (),
- n);
- (void) s->fe_add_enum_val (e);
- }
+ if (s != 0
+ && s->scope_node_type () == AST_Decl::NT_enum)
+ {
+ c = AST_Enum::narrow_from_scope (s);
+
+ if (c != 0)
+ {
+ e = idl_global->gen ()->create_enum_val (
+ c->next_enum_val (),
+ &n
+ );
+ }
+
+ (void) s->fe_add_enum_val (e);
+ }
}
;
@@ -2048,88 +2895,136 @@ sequence_type_spec
: seq_head
','
{
+// sequence_type_spec : seq_head ','
idl_global->set_parse_state (IDL_GlobalData::PS_SequenceCommaSeen);
}
positive_int_expr
{
+// positive_int_expr
idl_global->set_parse_state (IDL_GlobalData::PS_SequenceExprSeen);
}
'>'
{
+// '>'
idl_global->set_parse_state (IDL_GlobalData::PS_SequenceQsSeen);
+
/*
- * Remove sequence marker from scopes stack
+ * Remove sequence marker from scopes stack.
*/
- if (idl_global->scopes ()->top() == 0)
- idl_global->scopes ()->pop ();
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+ if (idl_global->scopes ().top() == 0)
+ {
+ idl_global->scopes ().pop ();
+ }
+
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+
/*
* Create a node representing a sequence
*/
- if ($4 == 0 || $4->coerce(AST_Expression::EV_ulong) == 0) {
- idl_global->err ()->coercion_error ($4, AST_Expression::EV_ulong);
- $$ = 0;
- } else if ($1 == 0) {
- $$ = 0;
- } else {
- AST_Type *tp = AST_Type::narrow_from_decl ($1);
- if (tp == 0)
- ; // Error will be caught in FE_Declarator.
- else {
- $$ = idl_global->gen ()->create_sequence ($4,
- tp,
- s->is_local (),
- s->is_abstract ());
+ if ($4 == 0 || $4->coerce (AST_Expression::EV_ulong) == 0)
+ {
+ idl_global->err ()->coercion_error ($4,
+ AST_Expression::EV_ulong);
+ $$ = 0;
+ }
+ else if ($1 == 0)
+ {
+ $$ = 0;
+ }
+ else
+ {
+ AST_Type *tp = AST_Type::narrow_from_decl ($1);
+
+ if (tp == 0)
+ {
+ ; // Error will be caught in FE_Declarator.
+ }
+ else
+ {
+ Identifier id ("sequence");
+ UTL_ScopedName sn (&id,
+ 0);
+
+ $$ =
+ idl_global->gen ()->create_sequence (
+ $4,
+ tp,
+ &sn,
+ s->is_local (),
+ s->is_abstract ()
+ );
+ }
}
- }
}
| seq_head
'>'
{
+// | seq_head '>'
idl_global->set_parse_state (IDL_GlobalData::PS_SequenceQsSeen);
+
/*
- * Remove sequence marker from scopes stack
+ * Remove sequence marker from scopes stack.
*/
- if (idl_global->scopes ()->top () == 0)
- idl_global->scopes ()->pop ();
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+ if (idl_global->scopes ().top () == 0)
+ {
+ idl_global->scopes ().pop ();
+ }
+
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+
/*
- * Create a node representing a sequence
+ * Create a node representing a sequence.
*/
if ($1 == 0)
- $$ = 0;
- else {
- AST_Type *tp = AST_Type::narrow_from_decl ($1);
- if (tp == 0)
- ; // Error will be caught in FE_Declarator.
- else {
- $$ =
- idl_global->gen ()->create_sequence (
- idl_global->gen ()->create_expr ((unsigned long) 0),
- tp,
- s->is_local (),
- s->is_abstract ()
- );
+ {
+ $$ = 0;
+ }
+ else
+ {
+ AST_Type *tp = AST_Type::narrow_from_decl ($1);
+
+ if (tp == 0)
+ {
+ ; // Error will be caught in FE_Declarator.
+ }
+ else
+ {
+ Identifier id ("sequence");
+ UTL_ScopedName sn (&id,
+ 0);
+
+ $$ =
+ idl_global->gen ()->create_sequence (
+ idl_global->gen ()->create_expr ((unsigned long) 0),
+ tp,
+ &sn,
+ s->is_local (),
+ s->is_abstract ()
+ );
+ }
}
- }
}
;
-seq_head:
+seq_head :
IDL_SEQUENCE
{
+// seq_head : IDL_SEQUENCE
idl_global->set_parse_state (IDL_GlobalData::PS_SequenceSeen);
+
/*
- * Push a sequence marker on scopes stack
+ * Push a sequence marker on scopes stack.
*/
- idl_global->scopes ()->push (0);
+ idl_global->scopes ().push (0);
}
'<'
{
+// '<'
idl_global->set_parse_state (IDL_GlobalData::PS_SequenceSqSeen);
}
simple_type_spec
{
+// simple_type_spec
idl_global->set_parse_state (IDL_GlobalData::PS_SequenceTypeSeen);
$$ = $5;
}
@@ -2139,53 +3034,68 @@ string_type_spec
: string_head
'<'
{
+// string_type_spec : string_head '<'
idl_global->set_parse_state (IDL_GlobalData::PS_StringSqSeen);
}
positive_int_expr
{
+// positive_int_expr
idl_global->set_parse_state (IDL_GlobalData::PS_StringExprSeen);
}
'>'
{
+// '>'
idl_global->set_parse_state (IDL_GlobalData::PS_StringQsSeen);
+
/*
- * Create a node representing a string
+ * Create a node representing a string.
*/
- if ($4 == 0 || $4->coerce (AST_Expression::EV_ulong) == 0) {
- idl_global->err ()->coercion_error ($4, AST_Expression::EV_ulong);
- $$ = 0;
- } else {
- $$ = idl_global->gen ()->create_string ($4);
- /*
- * Add this AST_String to the types defined in the global scope
- */
- (void) idl_global->root ()->fe_add_string (
- AST_String::narrow_from_decl ($$)
- );
- }
+ if ($4 == 0
+ || $4->coerce (AST_Expression::EV_ulong) == 0)
+ {
+ idl_global->err ()->coercion_error ($4,
+ AST_Expression::EV_ulong);
+ $$ = 0;
+ }
+ else
+ {
+ $$ = idl_global->gen ()->create_string ($4);
+ /*
+ * Add this AST_String to the types defined in the global scope.
+ */
+ (void) idl_global->root ()->fe_add_string (
+ AST_String::narrow_from_decl (
+ $$
+ )
+ );
+ }
}
| string_head
{
+// | string_head
idl_global->set_parse_state (IDL_GlobalData::PS_StringCompleted);
/*
- * Create a node representing a string
+ * Create a node representing a string.
*/
$$ =
idl_global->gen ()->create_string (
idl_global->gen ()->create_expr ((unsigned long) 0)
);
/*
- * Add this AST_String to the types defined in the global scope
+ * Add this AST_String to the types defined in the global scope.
*/
(void) idl_global->root ()->fe_add_string (
- AST_String::narrow_from_decl ($$)
+ AST_String::narrow_from_decl (
+ $$
+ )
);
}
;
-string_head:
+string_head :
IDL_STRING
{
+// string_head : IDL_STRING
idl_global->set_parse_state (IDL_GlobalData::PS_StringSeen);
}
;
@@ -2194,43 +3104,54 @@ wstring_type_spec
: wstring_head
'<'
{
+// wstring_type_spec : wstring_head '<'
idl_global->set_parse_state (IDL_GlobalData::PS_StringSqSeen);
}
positive_int_expr
{
+// positive_int_expr
idl_global->set_parse_state (IDL_GlobalData::PS_StringExprSeen);
}
'>'
{
+// '>'
idl_global->set_parse_state (IDL_GlobalData::PS_StringQsSeen);
+
/*
- * Create a node representing a string
+ * Create a node representing a string.
*/
- if ($4 == 0 || $4->coerce(AST_Expression::EV_ulong) == 0) {
- idl_global->err ()->coercion_error ($4, AST_Expression::EV_ulong);
- $$ = 0;
- } else {
- $$ = idl_global->gen ()->create_wstring ($4);
- /*
- * Add this AST_String to the types defined in the global scope
- */
- (void) idl_global->root ()->fe_add_string (
- AST_String::narrow_from_decl ($$)
- );
- }
+ if ($4 == 0
+ || $4->coerce (AST_Expression::EV_ulong) == 0)
+ {
+ idl_global->err ()->coercion_error ($4,
+ AST_Expression::EV_ulong);
+ $$ = 0;
+ }
+ else
+ {
+ $$ = idl_global->gen ()->create_wstring ($4);
+ /*
+ * Add this AST_String to the types defined in the global scope.
+ */
+ (void) idl_global->root ()->fe_add_string (
+ AST_String::narrow_from_decl ($$)
+ );
+ }
}
| wstring_head
{
+// | wstring_head
idl_global->set_parse_state (IDL_GlobalData::PS_StringCompleted);
+
/*
- * Create a node representing a string
+ * Create a node representing a wstring.
*/
$$ =
idl_global->gen ()->create_wstring (
idl_global->gen ()->create_expr ((unsigned long) 0)
);
/*
- * Add this AST_String to the types defined in the global scope
+ * Add this AST_String to the types defined in the global scope.
*/
(void) idl_global->root ()->fe_add_string (
AST_String::narrow_from_decl ($$)
@@ -2238,9 +3159,10 @@ wstring_type_spec
}
;
-wstring_head:
+wstring_head :
IDL_WSTRING
{
+// wstring_head : IDL_WSTRING
idl_global->set_parse_state (IDL_GlobalData::PS_StringSeen);
}
;
@@ -2248,44 +3170,69 @@ wstring_head:
array_declarator :
id
{
+// array_declarator : id
idl_global->set_parse_state (IDL_GlobalData::PS_ArrayIDSeen);
}
at_least_one_array_dim
{
+// at_least_one_array_dim
idl_global->set_parse_state (IDL_GlobalData::PS_ArrayCompleted);
+
/*
- * Create a node representing an array
+ * Create a node representing an array.
*/
- if ($3 != 0) {
- $$ = idl_global->gen ()->create_array (new UTL_ScopedName ($1,
- 0),
- $3->length (),
- $3,
- 0,
- 0);
- }
+ if ($3 != 0)
+ {
+ UTL_ScopedName sn ($1,
+ 0);
+ $$ =
+ idl_global->gen ()->create_array (
+ &sn,
+ $3->length (),
+ $3,
+ 0,
+ 0
+ );
+ }
}
;
at_least_one_array_dim :
array_dim array_dims
{
- $$ = new UTL_ExprList ($1, $2);
+// at_least_one_array_dim : array_dim array_dims
+ ACE_NEW_RETURN ($$,
+ UTL_ExprList ($1,
+ $2),
+ 1);
}
;
array_dims
: array_dims array_dim
{
+// array_dims : array_dims array_dim
if ($1 == 0)
- $$ = new UTL_ExprList ($2, 0);
- else {
- $1->nconc (new UTL_ExprList ($2, 0));
- $$ = $1;
- }
+ {
+ ACE_NEW_RETURN ($$,
+ UTL_ExprList ($2,
+ 0),
+ 1);
+ }
+ else
+ {
+ UTL_ExprList *el = 0;
+ ACE_NEW_RETURN (el,
+ UTL_ExprList ($2,
+ 0),
+ 1);
+ $1->nconc (el);
+ $$ = $1;
+ }
}
| /* EMPTY */
{
+// | /* EMPTY */
$$ = 0;
}
;
@@ -2293,78 +3240,110 @@ array_dims
array_dim :
'['
{
+// array_dim : '['
idl_global->set_parse_state (IDL_GlobalData::PS_DimSqSeen);
}
positive_int_expr
{
+// positive_int_expr
idl_global->set_parse_state (IDL_GlobalData::PS_DimExprSeen);
}
']'
{
+// ']'
idl_global->set_parse_state (IDL_GlobalData::PS_DimQsSeen);
+
/*
* Array dimensions are expressions which must be coerced to
- * positive integers
+ * positive integers.
*/
- if ($3 == 0 || $3->coerce (AST_Expression::EV_ulong) == 0) {
- idl_global->err ()->coercion_error ($3, AST_Expression::EV_ulong);
- $$ = 0;
- } else
- $$ = $3;
+ if ($3 == 0
+ || $3->coerce (AST_Expression::EV_ulong) == 0)
+ {
+ idl_global->err ()->coercion_error ($3,
+ AST_Expression::EV_ulong);
+ $$ = 0;
+ }
+ else
+ {
+ $$ = $3;
+ }
}
;
-attribute:
+attribute :
opt_readonly
IDL_ATTRIBUTE
{
+// attribute : opt_readonly IDL_ATTRIBUTE
idl_global->set_parse_state (IDL_GlobalData::PS_AttrSeen);
}
param_type_spec
{
+// param_type_spec
idl_global->set_parse_state (IDL_GlobalData::PS_AttrTypeSeen);
}
at_least_one_simple_declarator
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+// at_least_one_simple_declarator
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Attribute *a = 0;
FE_Declarator *d = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_AttrCompleted);
+
/*
* Create nodes representing attributes and add them to the
- * enclosing scope
+ * enclosing scope.
*/
- if (s != 0 && $4 != 0 && $6 != 0) {
- for (UTL_DecllistActiveIterator l ($6); !l.is_done (); l.next ()) {
- d = l.item ();
- if (d == 0)
- continue;
- AST_Type *tp = d->compose ($4);
- if (tp == 0)
- continue;
- a = idl_global->gen ()->create_attribute ($1,
- tp,
- (UTL_IdList *) d->name()->copy (),
- s->is_local (),
- s->is_abstract ());
- /*
- * Add one attribute to the enclosing scope
- */
- (void) s->fe_add_attribute (a);
+ if (s != 0
+ && $4 != 0
+ && $6 != 0)
+ {
+ for (UTL_DecllistActiveIterator l ($6);
+ !l.is_done ();
+ l.next ())
+ {
+ d = l.item ();
+
+ if (d == 0)
+ {
+ continue;
+ }
+
+ AST_Type *tp = d->compose ($4);
+
+ if (tp == 0)
+ {
+ continue;
+ }
+
+ a =
+ idl_global->gen ()->create_attribute (
+ $1,
+ tp,
+ (UTL_IdList *) d->name ()->copy (),
+ s->is_local (),
+ s->is_abstract ()
+ );
+ /*
+ * Add one attribute to the enclosing scope.
+ */
+ (void) s->fe_add_attribute (a);
+ }
}
- }
}
;
opt_readonly
: IDL_READONLY
{
+// opt_readonly : IDL_READONLY
idl_global->set_parse_state (IDL_GlobalData::PS_AttrROSeen);
$$ = I_TRUE;
}
| /* EMPTY */
{
+// | /* EMPTY */
$$ = I_FALSE;
}
;
@@ -2372,45 +3351,53 @@ opt_readonly
exception :
IDL_EXCEPTION
{
+// exception : IDL_EXCEPTION
idl_global->set_parse_state (IDL_GlobalData::PS_ExceptSeen);
}
id
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- UTL_ScopedName *n = new UTL_ScopedName ($3, 0);
+// id
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n ($3,
+ 0);
AST_Exception *e = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_ExceptIDSeen);
+
/*
* Create a node representing an exception and add it to
- * the enclosing scope
+ * the enclosing scope.
*/
- if (s != 0) {
- e = idl_global->gen ()->create_exception (n,
- s->is_local (),
- s->is_abstract ());
- (void) s->fe_add_exception (e);
- }
+ if (s != 0)
+ {
+ e = idl_global->gen ()->create_exception (&n,
+ s->is_local (),
+ s->is_abstract ());
+ (void) s->fe_add_exception (e);
+ }
+
/*
- * Push the exception scope on the scope stack
+ * Push the exception scope on the scope stack.
*/
- idl_global->scopes()->push (e);
+ idl_global->scopes ().push (e);
}
'{'
{
+// '{'
idl_global->set_parse_state (IDL_GlobalData::PS_ExceptSqSeen);
}
members
{
+// members
idl_global->set_parse_state (IDL_GlobalData::PS_ExceptBodySeen);
}
'}'
{
+// '}'
idl_global->set_parse_state (IDL_GlobalData::PS_ExceptQsSeen);
/*
- * Done with this exception. Pop its scope from the scope stack
+ * Done with this exception. Pop its scope from the scope stack.
*/
- idl_global->scopes ()->pop ();
+ idl_global->scopes ().pop ();
}
;
@@ -2418,85 +3405,114 @@ operation :
opt_op_attribute
op_type_spec
{
+// operation : opt_op_attribute op_type_spec
idl_global->set_parse_state (IDL_GlobalData::PS_OpTypeSeen);
}
IDENTIFIER
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- UTL_ScopedName *n =
- new UTL_ScopedName (new Identifier ($4), 0);
+// IDENTIFIER
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ Identifier id ($4);
+ UTL_ScopedName n (&id,
+ 0);
AST_Operation *o = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen);
+
/*
* Create a node representing an operation on an interface
- * and add it to its enclosing scope
+ * and add it to its enclosing scope.
*/
- if (s != 0 && $2 != 0) {
- AST_Type *tp = AST_Type::narrow_from_decl ($2);
- if (tp == 0) {
- idl_global->err ()->not_a_type ($2);
- } else if (tp->node_type () == AST_Decl::NT_except) {
- idl_global->err ()->not_a_type ($2);
- } else {
- o = idl_global->gen ()->create_operation (tp,
- $1,
- n,
- s->is_local (),
- s->is_abstract ());
- (void) s->fe_add_operation (o);
+ if (s != 0 && $2 != 0)
+ {
+ AST_Type *tp =
+ AST_Type::narrow_from_decl ($2);
+
+ if (tp == 0)
+ {
+ idl_global->err ()->not_a_type ($2);
+ }
+ else if (tp->node_type () == AST_Decl::NT_except)
+ {
+ idl_global->err ()->not_a_type ($2);
+ }
+ else
+ {
+ o =
+ idl_global->gen ()->create_operation (tp,
+ $1,
+ &n,
+ s->is_local (),
+ s->is_abstract ());
+ (void) s->fe_add_operation (o);
+ }
}
- }
+
+ ACE_OS::free ($4);
+ $4 = 0;
+
/*
- * Push the operation scope onto the scopes stack
+ * Push the operation scope onto the scopes stack.
*/
- idl_global->scopes()->push (o);
+ idl_global->scopes ().push (o);
}
parameter_list
{
+// parameter_list
idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
}
opt_raises
{
+// opt_raises
idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
}
opt_context
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+// opt_context
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Operation *o = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_OpCompleted);
+
/*
- * Add exceptions and context to the operation
+ * Add exceptions and context to the operation.
*/
- if (s != 0 && s->scope_node_type() == AST_Decl::NT_op) {
- o = AST_Operation::narrow_from_scope (s);
+ if (s != 0 && s->scope_node_type () == AST_Decl::NT_op)
+ {
+ o = AST_Operation::narrow_from_scope (s);
+
+ if ($8 != 0 && o != 0)
+ {
+ (void) o->fe_add_exceptions ($8);
+ }
+
+ if ($10 != 0)
+ {
+ (void) o->fe_add_context ($10);
+ }
+ }
- if ($8 != 0 && o != 0)
- (void) o->fe_add_exceptions ($8);
- if ($10 != 0)
- (void) o->fe_add_context ($10);
- }
/*
- * Done with this operation. Pop its scope from the scopes stack
+ * Done with this operation. Pop its scope from the scopes stack.
*/
- idl_global->scopes ()->pop ();
+ idl_global->scopes ().pop ();
}
;
opt_op_attribute
: IDL_ONEWAY
{
+// opt_op_attribute : IDL_ONEWAY
idl_global->set_parse_state (IDL_GlobalData::PS_OpAttrSeen);
$$ = AST_Operation::OP_oneway;
}
| IDL_IDEMPOTENT
{
+// | IDL_IDEMPOTENT
idl_global->set_parse_state (IDL_GlobalData::PS_OpAttrSeen);
$$ = AST_Operation::OP_idempotent;
}
| /* EMPTY */
{
+// | /* EMPTY */
$$ = AST_Operation::OP_noflags;
}
;
@@ -2505,8 +3521,9 @@ op_type_spec
: param_type_spec
| IDL_VOID
{
+// op_type_spec : param_type_spec | IDL_VOID
$$ =
- idl_global->scopes ()->bottom ()->lookup_primitive_type (
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
AST_Expression::EV_void
);
}
@@ -2515,26 +3532,29 @@ op_type_spec
init_decl
: IDL_FACTORY
{
+// init_decl : IDL_FACTORY
//@@ PS_FactorySeen?
idl_global->set_parse_state (IDL_GlobalData::PS_OpTypeSeen);
}
IDENTIFIER
{
+// IDENTIFIER
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
if (s->is_abstract ())
- {
- //@@ Fire error
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("error in %s line %d:\n")
- ACE_TEXT ("Abstract valuetype can't have a ")
- ACE_TEXT ("factory construct.\n"),
- idl_global->filename ()->get_string (),
- idl_global->lineno ()));
- }
- UTL_ScopedName *n =
- new UTL_ScopedName (new Identifier ($3), 0);
-
+ {
+ //@@ Fire error
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("error in %s line %d:\n")
+ ACE_TEXT ("Abstract valuetype can't have a ")
+ ACE_TEXT ("factory construct.\n"),
+ idl_global->filename ()->get_string (),
+ idl_global->lineno ()));
+ }
+
+ Identifier id ($3);
+ UTL_ScopedName n (&id,
+ 0);
AST_Factory *factory = 0;
idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen);
@@ -2543,109 +3563,125 @@ init_decl
* and add it to its enclosing scope
*/
if (s != 0)
- {
- factory = idl_global->gen ()->create_factory (n);
- (void) s->fe_add_factory (factory);
- }
+ {
+ factory = idl_global->gen ()->create_factory (&n);
+ (void) s->fe_add_factory (factory);
+ }
+
/*
- * Push the operation scope onto the scopes stack
+ * Push the operation scope onto the scopes stack.
*/
- idl_global->scopes ()->push (factory);
+ idl_global->scopes ().push (factory);
}
init_parameter_list
{
- // TODO: replace parameter_list with rule that accepts only IN args
+// init_parameter_list
+ /* TODO: replace parameter_list with rule that accepts only IN args */
idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
- idl_global->scopes ()->pop ();
+ idl_global->scopes ().pop ();
}
;
init_parameter_list
: '('
{
+// init_parameter_list : '('
idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
}
- ')'
+ ')'
{
+// ')'
idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
}
| '('
{
+// | '('
idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
}
- at_least_one_in_parameter
- ')'
+ at_least_one_in_parameter
+ ')'
{
+// at_least_one_in_parameter ')'
idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
}
;
-at_least_one_in_parameter : in_parameter in_parameters ;
+at_least_one_in_parameter : in_parameters in_parameter ;
in_parameters
: in_parameters
','
{
+// in_parameters : in_parameters ','
idl_global->set_parse_state (IDL_GlobalData::PS_OpParCommaSeen);
}
- in_parameter
+ in_parameter
| /* EMPTY */
;
in_parameter :
IDL_IN
{
+// in_parameter : IDL_IN
idl_global->set_parse_state (IDL_GlobalData::PS_OpParDirSeen);
}
param_type_spec
{
+// param_type_spec
idl_global->set_parse_state (IDL_GlobalData::PS_OpParTypeSeen);
}
declarator
{
-
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+// declarator
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Argument *a = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_OpParDeclSeen);
+
/*
* Create a node representing an argument to an operation
- * Add it to the enclosing scope (the operation scope)
+ * Add it to the enclosing scope (the operation scope).
*/
- if ($3 != 0 && $5 != 0 && s != 0)
- {
- AST_Type *tp = $5->compose ($3);
- if (tp != 0)
+ if ($3 != 0
+ && $5 != 0 &&
+ s != 0)
{
- a = idl_global->gen ()->create_argument (
- AST_Argument::dir_IN,
- tp,
- (UTL_IdList *) $5->name ()->copy ()
- );
+ AST_Type *tp = $5->compose ($3);
+
+ if (tp != 0)
+ {
+ a = idl_global->gen ()->create_argument (
+ AST_Argument::dir_IN,
+ tp,
+ (UTL_IdList *) $5->name ()->copy ()
+ );
- (void) s->fe_add_argument (a);
+ (void) s->fe_add_argument (a);
+ }
}
- }
}
;
parameter_list
: '('
{
+// parameter_list : '('
idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
}
- ')'
+ ')'
{
+// ')'
idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
}
| '('
{
+// | '('
idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
}
- at_least_one_parameter
- ')'
+ at_least_one_parameter
+ ')'
{
+// at_least_one_parameter ')'
idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
}
;
@@ -2656,74 +3692,114 @@ parameters
: parameters
','
{
+// parameters : parameters ','
idl_global->set_parse_state (IDL_GlobalData::PS_OpParCommaSeen);
}
- parameter
+ parameter
| /* EMPTY */
;
parameter :
direction
{
+// parameter : direction
idl_global->set_parse_state (IDL_GlobalData::PS_OpParDirSeen);
}
param_type_spec
{
+// param_type_spec
idl_global->set_parse_state (IDL_GlobalData::PS_OpParTypeSeen);
}
declarator
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+// declarator
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Argument *a = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_OpParDeclSeen);
+
/*
* Create a node representing an argument to an operation
- * Add it to the enclosing scope (the operation scope)
+ * Add it to the enclosing scope (the operation scope).
*/
- if ($3 != 0 && $5 != 0 && s != 0) {
- AST_Type *tp = $5->compose ($3);
- if (tp != 0) {
- if (!s->is_local () && tp->is_local ())
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("error in %s line %d\n"),
- idl_global->filename ()->get_string (),
- idl_global->lineno ()));
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("Cannot use a local type as an ")
- ACE_TEXT ("argument of a remote operation\n")));
- }
- else
+ if ($3 != 0
+ && $5 != 0
+ && s != 0)
+ {
+ AST_Type *tp = $5->compose ($3);
+
+ if (tp != 0)
{
- a = idl_global->gen ()->create_argument (
- $1,
- tp,
- (UTL_IdList *) $5->name ()->copy ()
- );
- (void) s->fe_add_argument (a);
+ if (!s->is_local () && tp->is_local ())
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("error in %s line %d\n"),
+ idl_global->filename ()->get_string (),
+ idl_global->lineno ()));
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Cannot use a local type as an ")
+ ACE_TEXT ("argument of a remote ")
+ ACE_TEXT ("operation\n")));
+ }
+ else
+ {
+ a =
+ idl_global->gen ()->create_argument (
+ $1,
+ tp,
+ (UTL_IdList *) $5->name ()->copy ()
+ );
+ (void) s->fe_add_argument (a);
+ }
}
}
- }
}
;
param_type_spec
: base_type_spec
{
- $$ = idl_global->scopes ()->bottom ()->lookup_primitive_type ($1);
+// param_type_spec : base_type_spec
+ $$ =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ $1
+ );
}
| string_type_spec
| wstring_type_spec
| scoped_name
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+// | string_type_spec
+// | wstring_type_spec
+// | scoped_name
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Decl *d = 0;
if (s != 0)
- d = s->lookup_by_name ($1, I_TRUE);
+ {
+ d = s->lookup_by_name ($1,
+ I_TRUE);
+ }
+
if (d == 0)
- idl_global->err ()->lookup_error ($1);
+ {
+ idl_global->err ()->lookup_error ($1);
+ }
+ else
+ {
+ AST_Decl::NodeType nt = d->node_type ();
+
+ if (nt == AST_Decl::NT_struct_fwd
+ || nt == AST_Decl::NT_union_fwd)
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_ILLEGAL_ADD,
+ d);
+
+ // If we don't return here, we'll crash later.
+ return 1;
+ }
+ }
+
+
$$ = d;
}
;
@@ -2731,14 +3807,17 @@ param_type_spec
direction
: IDL_IN
{
+// direction : IDL_IN
$$ = AST_Argument::dir_IN;
}
| IDL_OUT
{
+// | IDL_OUT
$$ = AST_Argument::dir_OUT;
}
| IDL_INOUT
{
+// | IDL_INOUT
$$ = AST_Argument::dir_INOUT;
}
;
@@ -2746,41 +3825,49 @@ direction
opt_raises
: IDL_RAISES
{
+// opt_raises : IDL_RAISES
idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseSeen);
}
'('
{
+// '('
idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseSqSeen);
}
at_least_one_scoped_name
')'
{
+// at_least_one_scoped_name ')'
idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseQsSeen);
$$ = $5;
}
| /* EMPTY */
{
$$ = 0;
+// | /* EMPTY */
}
;
opt_context
: IDL_CONTEXT
{
+// opt_context : IDL_CONTEXT
idl_global->set_parse_state (IDL_GlobalData::PS_OpContextSeen);
}
- '('
+ '('
{
idl_global->set_parse_state (IDL_GlobalData::PS_OpContextSqSeen);
+// '('
}
- at_least_one_string_literal
- ')'
+ at_least_one_string_literal
+ ')'
{
+// at_least_one_string_literal ')'
idl_global->set_parse_state (IDL_GlobalData::PS_OpContextQsSeen);
$$ = $5;
}
| /* EMPTY */
{
+// | /* EMPTY */
$$ = 0;
}
;
@@ -2788,7 +3875,11 @@ opt_context
at_least_one_string_literal :
IDL_STRING_LITERAL string_literals
{
- $$ = new UTL_StrList ($1, $2);
+// at_least_one_string_literal : IDL_STRING_LITERAL string_literals
+ ACE_NEW_RETURN ($$,
+ UTL_StrList ($1,
+ $2),
+ 1);
}
;
@@ -2796,23 +3887,832 @@ string_literals
: string_literals
','
{
+// string_literals : string_literals ','
idl_global->set_parse_state (IDL_GlobalData::PS_OpContextCommaSeen);
}
- IDL_STRING_LITERAL
+ IDL_STRING_LITERAL
{
+// IDL_STRING_LITERAL
if ($1 == 0)
- $$ = new UTL_StrList ($4, 0);
- else {
- $1->nconc (new UTL_StrList ($4, 0));
- $$ = $1;
- }
+ {
+ ACE_NEW_RETURN ($$,
+ UTL_StrList ($4,
+ 0),
+ 1);
+ }
+ else
+ {
+ UTL_StrList *sl = 0;
+ ACE_NEW_RETURN (sl,
+ UTL_StrList ($4,
+ 0),
+ 1);
+ $1->nconc (sl);
+ $$ = $1;
+ }
+ }
+ | /* EMPTY */
+ {
+// | /* EMPTY */
+ $$ = 0;
+ }
+ ;
+
+typeid_dcl
+ : IDL_TYPEID scoped_name IDL_STRING_LITERAL
+ {
+// typeid_dcl : IDL_TYPEID scoped_name IDL_STRING_LITERAL
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Decl *d = s->lookup_by_name ($2,
+ I_TRUE);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error ($2);
+ }
+ else
+ {
+ d->set_id_with_typeid (
+ $3->get_string ()
+ );
+ }
+ }
+ ;
+
+typeprefix_dcl
+ : IDL_TYPEPREFIX scoped_name IDL_STRING_LITERAL
+ {
+// typeprefix_dcl : IDL_TYPEPREFIX scoped_name IDL_STRING_LITERAL
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Decl *d = s->lookup_by_name ($2,
+ I_TRUE);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error ($2);
+ }
+ else
+ {
+ d->set_prefix_with_typeprefix (
+ $3->get_string ()
+ );
+ }
+ }
+ ;
+
+component
+ : component_decl
+ | component_forward_decl
+ ;
+
+component_forward_decl :
+ IDL_COMPONENT
+ id
+ {
+// component_forward_decl : IDL_COMPONENT id
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n ($2,
+ 0);
+ AST_ComponentFwd *f = 0;
+ idl_global->set_parse_state (
+ IDL_GlobalData::PS_ComponentForwardSeen
+ );
+
+ /*
+ * Create a node representing a forward declaration of a
+ * component. Store it in the enclosing scope.
+ */
+ if (s != 0)
+ {
+ f = idl_global->gen ()->create_component_fwd (&n);
+ (void) s->fe_add_component_fwd (f);
+ }
+ }
+ ;
+
+component_decl :
+ component_header
+ {
+// component_decl : component_header
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Component *c = 0;
+
+ /*
+ * Make a new component node and add it to the enclosing scope.
+ */
+ if (s != 0 && $1 != 0)
+ {
+ c =
+ idl_global->gen ()->create_component (
+ $1->name (),
+ $1->base_component (),
+ $1->supports (),
+ $1->n_supports (),
+ $1->supports_flat (),
+ $1->n_supports_flat ()
+ );
+ AST_Interface *i = AST_Interface::narrow_from_decl (c);
+ AST_Interface::fwd_redefinition_helper (i,
+ s);
+ /*
+ * Add the component to its definition scope.
+ */
+ c = AST_Component::narrow_from_decl (i);
+ (void) s->fe_add_component (c);
+
+ // This FE_ComponentHeader class isn't destroyed with the AST.
+ $1->name ()->destroy ();
+ delete $1;
+ $1 = 0;
+ }
+
+ /*
+ * Push it on the scope stack.
+ */
+ idl_global->scopes ().push (c);
+ }
+ '{'
+ {
+// '{'
+ idl_global->set_parse_state (IDL_GlobalData::PS_ComponentSqSeen);
+ }
+ component_exports
+ {
+// component_exports
+ idl_global->set_parse_state (IDL_GlobalData::PS_ComponentBodySeen);
+ }
+ '}'
+ {
+// '}'
+ idl_global->set_parse_state (IDL_GlobalData::PS_ComponentQsSeen);
+
+ /*
+ * Done with this component - pop it off the scopes stack.
+ */
+ idl_global->scopes ().pop ();
+ }
+ ;
+
+component_header :
+ IDL_COMPONENT
+ id
+ {
+// id
+ idl_global->set_parse_state (IDL_GlobalData::PS_ComponentIDSeen);
+ }
+ component_inheritance_spec
+ {
+// component_inheritance_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
+ }
+ supports_spec
+ {
+// supports_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
+
+ /*
+ * Create an AST representation of the information in the header
+ * part of a component.
+ */
+ UTL_ScopedName n ($2,
+ 0);
+ ACE_NEW_RETURN ($$,
+ FE_ComponentHeader (&n,
+ $4,
+ $6,
+ I_FALSE),
+ 1);
+ }
+ ;
+
+component_inheritance_spec
+ : ':'
+ {
+// component_inheritance_spec : ':'
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritColonSeen);
+ }
+ scoped_name
+ {
+// scoped_name
+ $$ = $3;
+ }
+ | /* EMPTY */
+ {
+// | /* EMPTY */
+ $$ = 0;
+ }
+ ;
+
+component_exports
+ : component_exports component_export
+ | /* EMPTY */
+ ;
+
+component_export
+ : provides_decl
+ {
+// component_export : provides_decl
+ idl_global->set_parse_state (IDL_GlobalData::PS_ProvidesDeclSeen);
+ }
+ ';'
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ | uses_decl
+ {
+// | uses_decl
+ idl_global->set_parse_state (IDL_GlobalData::PS_UsesDeclSeen);
+ }
+ ';'
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ | emits_decl
+ {
+// | emits_decl
+ idl_global->set_parse_state (IDL_GlobalData::PS_EmitsDeclSeen);
+ }
+ ';'
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ | publishes_decl
+ {
+// | publishes_decl
+ idl_global->set_parse_state (IDL_GlobalData::PS_PublishesDeclSeen);
+ }
+ ';'
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ | consumes_decl
+ {
+// | consumes_decl
+ idl_global->set_parse_state (IDL_GlobalData::PS_ConsumesDeclSeen);
+ }
+ ';'
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ | attribute
+ {
+// | attribute
+ idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclSeen);
+ }
+ ';'
+ {
+// ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ ;
+
+provides_decl :
+ IDL_PROVIDES
+ interface_type
+ id
+ {
+// provides_decl : IDL_PROVIDES interface_type id
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Component *c = AST_Component::narrow_from_scope (s);
+
+ if (c != 0)
+ {
+ AST_Component::port_description pd;
+ pd.id = $3;
+ pd.impl = $2;
+ c->provides ().enqueue_tail (pd);
+ }
+ }
+ ;
+
+interface_type
+ : scoped_name
+ {
+// interface_type : scoped_name
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Decl *d = s->lookup_by_name ($1,
+ I_TRUE);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error ($1);
+ }
+ else if (d->node_type () != AST_Decl::NT_interface)
+ {
+ idl_global->err ()->interface_expected (d);
+ }
+
+ $$ = $1;
+ }
+ | IDL_OBJECT
+ {
+// | IDL_OBJECT
+ Identifier *corba_id = 0;
+ ACE_NEW_RETURN (corba_id,
+ Identifier ("Object"),
+ 1);
+ UTL_IdList *conc_name = 0;
+ ACE_NEW_RETURN (conc_name,
+ UTL_IdList (corba_id,
+ 0),
+ 1);
+ ACE_NEW_RETURN (corba_id,
+ Identifier ("CORBA"),
+ 1);
+ UTL_IdList *corba_name = 0;
+ ACE_NEW_RETURN (corba_name,
+ UTL_IdList (corba_id,
+ conc_name),
+ 1);
+ $$ = corba_name;
+ }
+ ;
+
+uses_decl :
+ IDL_USES
+ opt_multiple
+ interface_type
+ id
+ {
+// uses_decl : IDL_USES opt_multiple interface_type id
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Component *c = AST_Component::narrow_from_scope (s);
+
+ if (c != 0)
+ {
+ AST_Component::uses_description ud;
+ ud.id = $4;
+ ud.impl = $3;
+ ud.is_multiple = $2;
+ c->uses ().enqueue_tail (ud);
+ }
+ }
+ ;
+
+opt_multiple
+ : IDL_MULTIPLE
+ {
+// opt_multiple : IDL_MULTIPLE
+ $$ = I_TRUE;
}
| /* EMPTY */
{
+// | /* EMPTY */
+ $$ = I_FALSE;
+ }
+ ;
+
+emits_decl :
+ IDL_EMITS
+ scoped_name
+ id
+ {
+// emits_decl : IDL_EMITS scoped_name id
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Decl *d = s->lookup_by_name ($2,
+ I_TRUE);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error ($2);
+ }
+ else if (d->node_type () != AST_Decl::NT_valuetype)
+ {
+ idl_global->err ()->valuetype_expected (d);
+ }
+
+ AST_Component *c = AST_Component::narrow_from_scope (s);
+
+ if (c != 0)
+ {
+ AST_Component::port_description pd;
+ pd.id = $3;
+ pd.impl = $2;
+ c->emits ().enqueue_tail (pd);
+ }
+ }
+ ;
+
+publishes_decl :
+ IDL_PUBLISHES
+ scoped_name
+ id
+ {
+// publishes_decl : IDL_PUBLISHES scoped_name id
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Decl *d = s->lookup_by_name ($2,
+ I_TRUE);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error ($2);
+ }
+ else if (d->node_type () != AST_Decl::NT_valuetype)
+ {
+ idl_global->err ()->valuetype_expected (d);
+ }
+
+ AST_Component *c = AST_Component::narrow_from_scope (s);
+
+ if (c != 0)
+ {
+ AST_Component::port_description pd;
+ pd.id = $3;
+ pd.impl = $2;
+ c->publishes ().enqueue_tail (pd);
+ }
+ }
+ ;
+
+consumes_decl :
+ IDL_CONSUMES
+ scoped_name
+ id
+ {
+// consumes_decl : IDL_CONSUMES scoped_name id
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Decl *d = s->lookup_by_name ($2,
+ I_TRUE);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error ($2);
+ }
+ else if (d->node_type () != AST_Decl::NT_valuetype)
+ {
+ idl_global->err ()->valuetype_expected (d);
+ }
+
+ AST_Component *c = AST_Component::narrow_from_scope (s);
+
+ if (c != 0)
+ {
+ AST_Component::port_description pd;
+ pd.id = $3;
+ pd.impl = $2;
+ c->consumes ().enqueue_tail (pd);
+ }
+ }
+ ;
+
+home_decl :
+ home_header
+ {
+// home_decl : home_header
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Home *h = 0;
+
+ /*
+ * Make a new home node and add it to the enclosing scope.
+ */
+ if (s != 0 && $1 != 0)
+ {
+ h =
+ idl_global->gen ()->create_home (
+ $1->name (),
+ $1->base_home (),
+ $1->managed_component (),
+ $1->primary_key (),
+ $1->supports (),
+ $1->n_supports (),
+ $1->supports_flat (),
+ $1->n_supports_flat ()
+ );
+ /*
+ * Add the home to its definition scope.
+ */
+ (void) s->fe_add_home (h);
+
+ // This FE_HomeHeader class isn't destroyed with the AST.
+ $1->name ()->destroy ();
+ delete $1;
+ $1 = 0;
+ }
+
+ /*
+ * Push it on the scope stack.
+ */
+ idl_global->scopes ().push (h);
+ }
+ home_body
+ ;
+
+home_header :
+ IDL_HOME
+ {
+// home_header : IDL_HOME
+ idl_global->set_parse_state (IDL_GlobalData::PS_HomeSeen);
+ }
+ id
+ {
+// id
+ idl_global->set_parse_state (IDL_GlobalData::PS_HomeIDSeen);
+ }
+ home_inheritance_spec
+ {
+// home_inheritance_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
+ }
+ supports_spec
+ {
+// supports_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
+ }
+ IDL_MANAGES
+ {
+// IDL_MANAGES
+ idl_global->set_parse_state (IDL_GlobalData::PS_ManagesSeen);
+ }
+ scoped_name
+ {
+// scoped_name
+ idl_global->set_parse_state (IDL_GlobalData::PS_ManagesIDSeen);
+ }
+ primary_key_spec
+ {
+// primary_key_spec
+ idl_global->set_parse_state (IDL_GlobalData::PS_PrimaryKeySpecSeen);
+
+ /*
+ * Create an AST representation of the information in the header
+ * part of a component home.
+ */
+ UTL_ScopedName n ($3,
+ 0);
+ ACE_NEW_RETURN ($$,
+ FE_HomeHeader (&n,
+ $5,
+ $7,
+ $11,
+ $13),
+ 1);
+ }
+ ;
+
+home_inheritance_spec
+ : ':'
+ {
+// home_inheritance_spec ':'
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritColonSeen);
+ }
+ scoped_name
+ {
+// scoped_name
+ $$ = $3;
+ }
+ | /* EMPTY */
+ {
+// | /* EMPTY */
+ $$ = 0;
+ }
+ ;
+
+primary_key_spec
+ : IDL_PRIMARYKEY
+ scoped_name
+ {
+// primary_key_spec : IDL_PRIMARYKEY scoped_name
+ $$ = $2;
+ }
+ | /* EMPTY */
+ {
+// | /* EMPTY */
$$ = 0;
}
;
+home_body :
+ '{'
+ {
+// home_body : '{'
+ idl_global->set_parse_state (IDL_GlobalData::PS_HomeSqSeen);
+ }
+ home_exports
+ {
+// home_exports
+ idl_global->set_parse_state (IDL_GlobalData::PS_HomeBodySeen);
+ }
+ '}'
+ {
+// '}'
+ idl_global->set_parse_state (IDL_GlobalData::PS_HomeQsSeen);
+ }
+ ;
+
+home_exports
+ : home_exports home_export
+ | /* EMPTY */
+ ;
+
+home_export
+ : export
+ | factory_decl
+ {
+// home_export : factory_decl
+ idl_global->set_parse_state (IDL_GlobalData::PS_FactoryDeclSeen);
+ }
+ ';'
+ {
+// | ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ | finder_decl
+ {
+// | finder_decl
+ idl_global->set_parse_state (IDL_GlobalData::PS_FinderDeclSeen);
+ }
+ ';'
+ {
+// | ';'
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+ ;
+
+factory_decl :
+ IDL_FACTORY
+ id
+ {
+// factory_decl : IDL_FACTORY id
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n ($2,
+ 0);
+ AST_Operation *o = 0;
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen);
+
+ /*
+ * Create a node representing a factory operation
+ * and add it to the enclosing scope.
+ */
+ if (s != 0)
+ {
+ AST_Home *home = AST_Home::narrow_from_scope (s);
+ AST_Component *rt = home->managed_component ();
+
+ o =
+ idl_global->gen ()->create_operation (
+ rt,
+ AST_Operation::OP_noflags,
+ &n,
+ I_TRUE,
+ I_FALSE
+ );
+ (void) s->fe_add_operation (o);
+ home->factories ().enqueue_tail (o);
+ }
+
+ ACE_OS::free ($2);
+ $2 = 0;
+
+ /*
+ * Push the operation scope onto the scopes stack.
+ */
+ idl_global->scopes ().push (o);
+ }
+ init_parameter_list
+ {
+// init_parameter_list
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
+ }
+ opt_raises
+ {
+// opt_raises
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
+
+ /*
+ * Done with this operation. Pop its scope from the scopes stack.
+ */
+ idl_global->scopes ().pop ();
+ }
+ ;
+
+finder_decl :
+ IDL_FINDER
+ id
+ {
+// finder_decl : IDL_FINDER id
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n ($2,
+ 0);
+ AST_Operation *o = 0;
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen);
+
+ /*
+ * Create a node representing a finder operation
+ * and add it to the enclosing scope.
+ */
+ if (s != 0)
+ {
+ AST_Home *home = AST_Home::narrow_from_scope (s);
+ AST_Component *rt = home->managed_component ();
+
+ o =
+ idl_global->gen ()->create_operation (
+ rt,
+ AST_Operation::OP_noflags,
+ &n,
+ I_TRUE,
+ I_FALSE
+ );
+ (void) s->fe_add_operation (o);
+ home->finders ().enqueue_tail (o);
+ }
+
+ ACE_OS::free ($2);
+ $2 = 0;
+
+ /*
+ * Push the operation scope onto the scopes stack.
+ */
+ idl_global->scopes ().push (o);
+ }
+ init_parameter_list
+ {
+// init_parameter_list
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
+ }
+ opt_raises
+ {
+// opt_raises
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
+
+ /*
+ * Done with this operation. Pop its scope from the scopes stack.
+ */
+ idl_global->scopes ().pop ();
+ }
+ ;
+
+event
+ : event_decl
+ | event_abs_decl
+ | event_forward_decl
+ ;
+
+event_forward_decl
+ : event_abs_forward_decl
+ | event_concrete_forward_decl
+ ;
+
+event_concrete_forward_decl :
+ IDL_EVENTTYPE
+ id
+ ;
+
+event_abs_forward_decl :
+ IDL_ABSTRACT
+ IDL_EVENTTYPE
+ id
+ ;
+
+event_abs_decl :
+ event_abs_header
+ event_rest_of_header
+ '{'
+ exports
+ '}'
+ ;
+
+event_abs_header :
+ IDL_ABSTRACT
+ IDL_EVENTTYPE
+ id
+ ;
+
+event_custom_header :
+ IDL_CUSTOM
+ IDL_EVENTTYPE
+ id
+ ;
+
+event_plain_header :
+ IDL_EVENTTYPE
+ id
+ ;
+
+event_rest_of_header :
+ opt_truncatable
+ inheritance_spec
+ supports_spec
+ ;
+
+event_decl :
+ event_header
+ event_rest_of_header
+ '{'
+ value_elements
+ '}'
+ ;
+
+event_header
+ : event_custom_header
+ | event_plain_header
+ ;
+
%%
/* programs */
@@ -2820,7 +4720,7 @@ string_literals
* ???
*/
int
-yywrap ()
+yywrap (void)
{
return 1;
}
diff --git a/TAO/TAO_IDL/fe/lex.yy.cpp b/TAO/TAO_IDL/fe/lex.yy.cpp
index 73e2bc4a252..f6c08ece498 100644
--- a/TAO/TAO_IDL/fe/lex.yy.cpp
+++ b/TAO/TAO_IDL/fe/lex.yy.cpp
@@ -28,15 +28,15 @@
/* The "const" storage-class-modifier is valid. */
#define TAO_YY_USE_CONST
-#else /* ! __cplusplus */
+#else /* ! __cplusplus */
#if __STDC__
#define TAO_YY_USE_PROTOS
#define TAO_YY_USE_CONST
-#endif /* __STDC__ */
-#endif /* ! __cplusplus */
+#endif /* __STDC__ */
+#endif /* ! __cplusplus */
#ifdef __TURBOC__
#pragma warn -rch
@@ -105,10 +105,10 @@ extern FILE *tao_yyin, *tao_yyout;
* int a single C statement (which needs a semi-colon terminator). This
* avoids problems with code like:
*
- * if ( condition_holds )
- * tao_yyless( 5 );
- * else
- * do_something_else();
+ * if ( condition_holds )
+ * tao_yyless( 5 );
+ * else
+ * do_something_else();
*
* Prior to using the do-while the compiler would get upset at the
* "else" because it interpreted the "if" statement as being all
@@ -118,15 +118,15 @@ extern FILE *tao_yyin, *tao_yyout;
/* Return all but the first 'n' matched characters back to the input stream. */
#define tao_yyless(n) \
- do \
- { \
- /* Undo effects of setting up tao_yytext. */ \
- *tao_yy_cp = tao_yy_hold_char; \
- TAO_YY_RESTORE_TAO_YY_MORE_OFFSET \
- tao_yy_c_buf_p = tao_yy_cp = tao_yy_bp + n - TAO_YY_MORE_ADJ; \
- TAO_YY_DO_BEFORE_ACTION; /* set up tao_yytext again */ \
- } \
- while ( 0 )
+ do \
+ { \
+ /* Undo effects of setting up tao_yytext. */ \
+ *tao_yy_cp = tao_yy_hold_char; \
+ TAO_YY_RESTORE_TAO_YY_MORE_OFFSET \
+ tao_yy_c_buf_p = tao_yy_cp = tao_yy_bp + n - TAO_YY_MORE_ADJ; \
+ TAO_YY_DO_BEFORE_ACTION; /* set up tao_yytext again */ \
+ } \
+ while ( 0 )
#define unput(c) tao_yyunput( c, tao_yytext_ptr )
@@ -138,61 +138,61 @@ typedef unsigned int tao_yy_size_t;
struct tao_yy_buffer_state
- {
- FILE *tao_yy_input_file;
-
- char *tao_yy_ch_buf; /* input buffer */
- char *tao_yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- tao_yy_size_t tao_yy_buf_size;
-
- /* Number of characters read into tao_yy_ch_buf, not including EOB
- * characters.
- */
- int tao_yy_n_chars;
-
- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int tao_yy_is_our_buffer;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int tao_yy_is_interactive;
-
- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int tao_yy_at_bol;
-
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int tao_yy_fill_buffer;
-
- int tao_yy_buffer_status;
+ {
+ FILE *tao_yy_input_file;
+
+ char *tao_yy_ch_buf; /* input buffer */
+ char *tao_yy_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ tao_yy_size_t tao_yy_buf_size;
+
+ /* Number of characters read into tao_yy_ch_buf, not including EOB
+ * characters.
+ */
+ int tao_yy_n_chars;
+
+ /* Whether we "own" the buffer - i.e., we know we created it,
+ * and can realloc() it to grow it, and should free() it to
+ * delete it.
+ */
+ int tao_yy_is_our_buffer;
+
+ /* Whether this is an "interactive" input source; if so, and
+ * if we're using stdio for input, then we want to use getc()
+ * instead of fread(), to make sure we stop fetching input after
+ * each newline.
+ */
+ int tao_yy_is_interactive;
+
+ /* Whether we're considered to be at the beginning of a line.
+ * If so, '^' rules will be active on the next match, otherwise
+ * not.
+ */
+ int tao_yy_at_bol;
+
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int tao_yy_fill_buffer;
+
+ int tao_yy_buffer_status;
#define TAO_YY_BUFFER_NEW 0
#define TAO_YY_BUFFER_NORMAL 1
- /* When an EOF's been seen but there's still some text to process
- * then we mark the buffer as TAO_YY_EOF_PENDING, to indicate that we
- * shouldn't try reading from the input source any more. We might
- * still have a bunch of tokens to match, though, because of
- * possible backing-up.
- *
- * When we actually see the EOF, we change the status to "new"
- * (via tao_yyrestart()), so that the user can continue scanning by
- * just pointing tao_yyin at a new input file.
- */
+ /* When an EOF's been seen but there's still some text to process
+ * then we mark the buffer as TAO_YY_EOF_PENDING, to indicate that we
+ * shouldn't try reading from the input source any more. We might
+ * still have a bunch of tokens to match, though, because of
+ * possible backing-up.
+ *
+ * When we actually see the EOF, we change the status to "new"
+ * (via tao_yyrestart()), so that the user can continue scanning by
+ * just pointing tao_yyin at a new input file.
+ */
#define TAO_YY_BUFFER_EOF_PENDING 2
- };
+ };
static TAO_YY_BUFFER_STATE tao_yy_current_buffer = 0;
@@ -206,15 +206,15 @@ static TAO_YY_BUFFER_STATE tao_yy_current_buffer = 0;
/* tao_yy_hold_char holds the character lost when tao_yytext is formed. */
static char tao_yy_hold_char;
-static int tao_yy_n_chars; /* number of characters read into tao_yy_ch_buf */
+static int tao_yy_n_chars; /* number of characters read into tao_yy_ch_buf */
int tao_yyleng;
/* Points to current character in buffer. */
static char *tao_yy_c_buf_p = (char *) 0;
-static int tao_yy_init = 1; /* whether we need to initialize */
-static int tao_yy_start = 0; /* start state number */
+static int tao_yy_init = 1; /* whether we need to initialize */
+static int tao_yy_start = 0; /* start state number */
/* Flag which is used to allow tao_yywrap()'s to do buffer switches
* instead of setting up a fresh tao_yyin. A bit of a hack ...
@@ -242,18 +242,18 @@ static void tao_yy_flex_free TAO_YY_PROTO(( void * ));
#define tao_yy_new_buffer tao_yy_create_buffer
#define tao_yy_set_interactive(is_interactive) \
- { \
- if ( ! tao_yy_current_buffer ) \
- tao_yy_current_buffer = tao_yy_create_buffer( tao_yyin, TAO_YY_BUF_SIZE ); \
- tao_yy_current_buffer->tao_yy_is_interactive = is_interactive; \
- }
+ { \
+ if ( ! tao_yy_current_buffer ) \
+ tao_yy_current_buffer = tao_yy_create_buffer( tao_yyin, TAO_YY_BUF_SIZE ); \
+ tao_yy_current_buffer->tao_yy_is_interactive = is_interactive; \
+ }
#define tao_yy_set_bol(at_bol) \
- { \
- if ( ! tao_yy_current_buffer ) \
- tao_yy_current_buffer = tao_yy_create_buffer( tao_yyin, TAO_YY_BUF_SIZE ); \
- tao_yy_current_buffer->tao_yy_at_bol = at_bol; \
- }
+ { \
+ if ( ! tao_yy_current_buffer ) \
+ tao_yy_current_buffer = tao_yy_create_buffer( tao_yyin, TAO_YY_BUF_SIZE ); \
+ tao_yy_current_buffer->tao_yy_at_bol = at_bol; \
+ }
#define TAO_YY_AT_BOL() (tao_yy_current_buffer->tao_yy_at_bol)
@@ -272,68 +272,79 @@ static void tao_yy_fatal_error TAO_YY_PROTO(( tao_yyconst char msg[] ));
* corresponding action - sets up tao_yytext.
*/
#define TAO_YY_DO_BEFORE_ACTION \
- tao_yytext_ptr = tao_yy_bp; \
- tao_yyleng = (int) (tao_yy_cp - tao_yy_bp); \
- tao_yy_hold_char = *tao_yy_cp; \
- *tao_yy_cp = '\0'; \
- if ( tao_yyleng >= TAO_YYLMAX ) \
- TAO_YY_FATAL_ERROR( "token too large, exceeds TAO_YYLMAX" ); \
- tao_yy_flex_strncpy( tao_yytext, tao_yytext_ptr, tao_yyleng + 1 ); \
- tao_yy_c_buf_p = tao_yy_cp;
-
-#define TAO_YY_NUM_RULES 86
-#define TAO_YY_END_OF_BUFFER 87
-static tao_yyconst short int tao_yy_accept[445] =
+ tao_yytext_ptr = tao_yy_bp; \
+ tao_yyleng = (int) (tao_yy_cp - tao_yy_bp); \
+ tao_yy_hold_char = *tao_yy_cp; \
+ *tao_yy_cp = '\0'; \
+ if ( tao_yyleng >= TAO_YYLMAX ) \
+ TAO_YY_FATAL_ERROR( "token too large, exceeds TAO_YYLMAX" ); \
+ tao_yy_flex_strncpy( tao_yytext, tao_yytext_ptr, tao_yyleng + 1 ); \
+ tao_yy_c_buf_p = tao_yy_cp;
+
+#define TAO_YY_NUM_RULES 104
+#define TAO_YY_END_OF_BUFFER 105
+static tao_yyconst short int tao_yy_accept[549] =
{ 0,
- 83, 83, 87, 85, 83, 84, 84, 85, 85, 85,
- 85, 85, 58, 54, 85, 85, 85, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 85,
- 84, 83, 0, 59, 0, 0, 0, 0, 57, 53,
- 51, 82, 0, 51, 58, 0, 0, 0, 54, 49,
- 47, 48, 50, 50, 0, 0, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 44, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
-
- 50, 50, 50, 50, 50, 0, 77, 0, 0, 0,
- 0, 0, 0, 0, 0, 61, 0, 61, 0, 0,
- 57, 0, 53, 0, 51, 0, 81, 81, 51, 0,
- 52, 56, 50, 0, 60, 0, 0, 0, 50, 50,
- 1, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 45, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 0, 0, 0, 0, 0, 0, 0, 64, 62, 0,
- 0, 55, 0, 51, 52, 50, 0, 65, 0, 41,
-
- 50, 50, 50, 19, 26, 50, 50, 50, 50, 50,
- 12, 50, 50, 50, 50, 50, 50, 50, 23, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 30, 50,
- 50, 0, 0, 0, 0, 0, 0, 0, 78, 0,
- 0, 0, 0, 0, 0, 62, 0, 63, 0, 42,
- 0, 0, 50, 50, 50, 9, 50, 50, 50, 50,
- 50, 50, 17, 21, 43, 50, 32, 50, 50, 29,
- 50, 50, 50, 50, 50, 50, 24, 50, 50, 50,
- 50, 50, 50, 16, 50, 50, 27, 50, 73, 0,
+ 101, 101, 105, 103, 101, 102, 102, 103, 103, 103,
+ 103, 103, 76, 72, 103, 103, 103, 68, 68, 68,
+ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
+ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
+ 68, 68, 101, 103, 102, 101, 0, 77, 0, 0,
+ 0, 0, 75, 71, 69, 100, 0, 69, 76, 0,
+ 0, 0, 72, 67, 65, 66, 68, 68, 0, 0,
+ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
+ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
+ 68, 68, 62, 68, 68, 68, 68, 68, 68, 68,
+
+ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
+ 68, 68, 68, 68, 68, 68, 68, 68, 101, 0,
+ 0, 95, 0, 0, 0, 0, 0, 0, 0, 77,
+ 0, 0, 79, 0, 79, 0, 0, 75, 0, 71,
+ 0, 69, 0, 99, 99, 69, 0, 70, 74, 68,
+ 0, 78, 0, 0, 0, 68, 68, 68, 1, 68,
+ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
+ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
+ 68, 68, 68, 68, 68, 68, 68, 68, 68, 63,
+ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
+
+ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
+ 0, 0, 0, 0, 0, 0, 0, 82, 80, 0,
+ 0, 73, 0, 69, 70, 68, 0, 83, 0, 68,
+ 59, 68, 68, 68, 20, 27, 68, 68, 68, 68,
+ 68, 68, 68, 13, 68, 68, 68, 68, 68, 68,
+ 68, 48, 68, 68, 68, 68, 24, 68, 68, 68,
+ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
+ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
+ 57, 68, 31, 68, 68, 0, 0, 0, 0, 0,
+ 0, 0, 96, 0, 0, 0, 0, 0, 0, 80,
+
+ 0, 81, 0, 60, 0, 0, 68, 68, 68, 68,
+ 68, 10, 68, 68, 68, 68, 68, 44, 68, 68,
+ 68, 68, 18, 22, 68, 68, 61, 68, 33, 68,
+ 68, 68, 68, 30, 68, 68, 68, 68, 68, 68,
+ 68, 68, 68, 25, 68, 68, 68, 68, 68, 68,
+ 68, 68, 17, 68, 68, 28, 68, 91, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 84, 0, 2, 68, 68, 68, 68, 68, 68, 35,
+ 68, 23, 68, 68, 68, 46, 68, 49, 68, 68,
+ 3, 68, 32, 64, 68, 68, 68, 38, 68, 4,
+ 68, 68, 68, 14, 12, 68, 19, 68, 68, 55,
+ 68, 68, 68, 68, 0, 89, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 66, 0, 50, 50, 50, 50, 34, 50, 22,
- 50, 50, 50, 2, 31, 46, 50, 37, 3, 50,
- 50, 13, 11, 50, 18, 50, 50, 50, 50, 50,
- 0, 71, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 50, 50, 28, 7,
- 20, 50, 35, 50, 36, 50, 50, 50, 50, 10,
- 50, 50, 14, 0, 0, 69, 69, 0, 0, 75,
- 0, 0, 74, 0, 0, 0, 0, 0, 0, 0,
- 33, 50, 50, 50, 4, 15, 38, 50, 25, 50,
-
- 0, 79, 79, 0, 0, 0, 0, 72, 0, 0,
- 0, 0, 0, 0, 0, 5, 6, 8, 50, 40,
- 0, 67, 67, 0, 0, 70, 70, 0, 0, 0,
- 0, 50, 0, 80, 80, 0, 0, 0, 39, 76,
- 0, 68, 68, 0
+ 68, 68, 29, 68, 68, 8, 21, 68, 68, 36,
+ 68, 68, 58, 68, 68, 37, 68, 68, 68, 68,
+ 68, 68, 68, 11, 68, 68, 68, 15, 0, 0,
+ 87, 87, 0, 0, 93, 0, 0, 92, 0, 0,
+ 0, 0, 0, 0, 0, 34, 68, 68, 43, 68,
+ 68, 68, 68, 50, 68, 52, 68, 5, 16, 68,
+ 39, 68, 68, 26, 68, 0, 97, 97, 0, 0,
+
+ 0, 0, 90, 0, 0, 0, 0, 0, 0, 0,
+ 6, 42, 45, 7, 47, 9, 68, 53, 54, 68,
+ 68, 41, 0, 85, 85, 0, 0, 88, 88, 0,
+ 0, 0, 0, 51, 68, 56, 0, 98, 98, 0,
+ 0, 0, 40, 94, 0, 86, 86, 0
} ;
static tao_yyconst int tao_yy_ec[256] =
@@ -345,13 +356,13 @@ static tao_yyconst int tao_yy_ec[256] =
1, 9, 10, 1, 11, 12, 13, 14, 15, 15,
15, 15, 15, 15, 15, 16, 16, 17, 1, 18,
19, 20, 21, 1, 22, 23, 23, 23, 24, 25,
- 26, 26, 26, 26, 26, 27, 26, 26, 26, 26,
- 26, 28, 29, 30, 31, 26, 26, 32, 26, 26,
- 1, 33, 1, 1, 26, 1, 34, 35, 36, 37,
+ 26, 26, 26, 26, 26, 27, 26, 26, 28, 26,
+ 26, 29, 30, 31, 32, 26, 26, 33, 26, 26,
+ 1, 34, 1, 1, 26, 1, 35, 36, 37, 38,
- 38, 39, 40, 41, 42, 26, 26, 43, 44, 45,
- 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
- 56, 26, 1, 1, 1, 1, 1, 1, 1, 1,
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
+ 59, 26, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -368,348 +379,398 @@ static tao_yyconst int tao_yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static tao_yyconst int tao_yy_meta[57] =
+static tao_yyconst int tao_yy_meta[60] =
{ 0,
1, 1, 2, 1, 1, 3, 1, 4, 1, 1,
1, 1, 1, 5, 5, 5, 1, 1, 1, 1,
3, 5, 5, 5, 5, 6, 6, 6, 6, 6,
- 6, 6, 3, 7, 7, 5, 5, 5, 7, 6,
- 6, 6, 6, 6, 8, 6, 6, 6, 8, 6,
- 8, 6, 8, 6, 8, 6
+ 6, 6, 6, 3, 7, 7, 5, 5, 5, 7,
+ 6, 6, 6, 6, 6, 6, 6, 8, 6, 6,
+ 6, 8, 6, 8, 6, 8, 6, 8, 6
} ;
-static tao_yyconst short int tao_yy_base[472] =
+static tao_yyconst short int tao_yy_base[576] =
{ 0,
- 0, 50, 922, 923, 56, 923, 923, 53, 888, 48,
- 51, 59, 61, 66, 903, 901, 898, 0, 895, 81,
- 888, 49, 869, 57, 50, 24, 63, 869, 867, 866,
- 877, 56, 58, 36, 73, 46, 865, 83, 76, 128,
- 888, 113, 107, 923, 0, 900, 131, 105, 136, 141,
- 178, 923, 133, 162, 173, 184, 199, 0, 211, 923,
- 923, 923, 0, 880, 128, 873, 874, 854, 847, 851,
- 855, 850, 865, 853, 847, 857, 843, 842, 857, 856,
- 836, 844, 77, 102, 852, 837, 836, 848, 834, 842,
- 848, 840, 847, 832, 833, 829, 830, 834, 823, 827,
-
- 116, 830, 830, 830, 819, 826, 923, 116, 215, 826,
- 830, 824, 816, 845, 129, 923, 855, 854, 224, 853,
- 228, 0, 239, 246, 923, 169, 923, 180, 0, 166,
- 253, 0, 831, 200, 923, 807, 850, 196, 833, 805,
- 0, 806, 811, 815, 803, 195, 800, 816, 814, 804,
- 809, 795, 807, 810, 791, 804, 807, 800, 787, 796,
- 799, 782, 0, 782, 791, 783, 795, 779, 781, 182,
- 782, 777, 782, 788, 779, 782, 771, 785, 787, 771,
- 813, 812, 774, 778, 770, 780, 295, 923, 923, 250,
- 805, 0, 256, 279, 923, 788, 0, 923, 0, 0,
-
- 762, 768, 771, 0, 0, 757, 769, 760, 753, 761,
- 0, 756, 756, 764, 749, 748, 749, 754, 0, 753,
- 742, 743, 759, 758, 749, 752, 743, 750, 736, 741,
- 749, 738, 747, 746, 744, 735, 739, 740, 0, 728,
- 734, 769, 270, 736, 728, 734, 731, 727, 923, 241,
- 298, 727, 731, 725, 717, 923, 757, 923, 756, 0,
- 337, 755, 728, 726, 726, 0, 704, 714, 714, 718,
- 704, 705, 0, 0, 0, 714, 0, 657, 645, 0,
- 615, 616, 628, 611, 604, 601, 0, 597, 575, 561,
- 565, 571, 554, 0, 536, 528, 0, 533, 923, 325,
-
- 274, 525, 342, 531, 568, 567, 529, 533, 525, 535,
- 363, 923, 560, 530, 505, 510, 502, 0, 500, 0,
- 490, 473, 485, 0, 0, 0, 473, 0, 0, 467,
- 468, 0, 0, 442, 0, 429, 417, 416, 397, 404,
- 389, 923, 404, 284, 280, 412, 427, 390, 410, 328,
- 377, 366, 352, 349, 435, 376, 331, 329, 0, 0,
- 0, 323, 0, 332, 0, 311, 317, 304, 316, 0,
- 311, 298, 0, 431, 286, 923, 360, 362, 434, 923,
- 330, 281, 923, 461, 315, 284, 476, 281, 275, 307,
- 0, 221, 205, 203, 0, 0, 0, 202, 0, 190,
-
- 392, 923, 458, 206, 464, 480, 484, 923, 492, 499,
- 319, 507, 512, 407, 173, 0, 0, 0, 152, 0,
- 512, 923, 521, 531, 527, 923, 533, 535, 163, 158,
- 321, 103, 537, 923, 540, 77, 546, 556, 0, 923,
- 559, 923, 561, 923, 582, 590, 594, 600, 608, 616,
- 620, 627, 635, 640, 643, 650, 655, 658, 661, 665,
- 672, 677, 684, 689, 696, 704, 712, 720, 728, 736,
- 744
+ 0, 58, 1037, 1038, 59, 1038, 1038, 56, 1002, 54,
+ 57, 65, 68, 73, 1018, 1016, 1013, 0, 1010, 69,
+ 995, 1001, 45, 980, 56, 37, 48, 67, 989, 978,
+ 61, 977, 65, 990, 79, 63, 82, 83, 71, 71,
+ 93, 92, 134, 144, 1003, 130, 97, 148, 0, 1015,
+ 147, 152, 158, 184, 210, 1038, 148, 161, 197, 203,
+ 229, 0, 239, 1038, 1038, 1038, 0, 995, 137, 987,
+ 976, 987, 965, 958, 962, 966, 961, 978, 109, 959,
+ 971, 955, 966, 953, 968, 969, 968, 130, 955, 949,
+ 955, 951, 132, 96, 952, 961, 952, 943, 942, 956,
+
+ 940, 136, 957, 949, 956, 138, 941, 937, 938, 944,
+ 931, 935, 140, 945, 937, 939, 939, 926, 199, 0,
+ 174, 1038, 973, 243, 935, 939, 933, 923, 955, 226,
+ 196, 204, 1038, 965, 964, 252, 963, 256, 0, 261,
+ 272, 1038, 258, 1038, 286, 0, 277, 283, 0, 940,
+ 235, 1038, 914, 960, 257, 928, 942, 911, 0, 912,
+ 917, 923, 909, 910, 110, 905, 923, 921, 902, 908,
+ 906, 914, 898, 913, 911, 914, 896, 908, 897, 890,
+ 905, 908, 901, 906, 885, 885, 895, 898, 879, 0,
+ 247, 879, 888, 880, 894, 876, 878, 877, 152, 878,
+
+ 873, 878, 886, 875, 880, 869, 866, 882, 884, 866,
+ 911, 910, 869, 875, 865, 877, 328, 1038, 1038, 301,
+ 903, 0, 290, 310, 1038, 886, 0, 1038, 0, 872,
+ 0, 856, 864, 867, 0, 0, 856, 247, 865, 854,
+ 847, 855, 847, 0, 845, 848, 848, 857, 857, 840,
+ 858, 0, 840, 837, 838, 843, 0, 847, 841, 843,
+ 829, 830, 848, 847, 846, 837, 836, 839, 828, 837,
+ 840, 820, 825, 835, 822, 833, 832, 284, 820, 826,
+ 0, 827, 0, 813, 821, 857, 315, 823, 813, 821,
+ 818, 812, 1038, 268, 343, 814, 818, 812, 802, 1038,
+
+ 845, 1038, 844, 0, 373, 843, 796, 814, 812, 812,
+ 798, 0, 798, 786, 796, 796, 802, 0, 786, 785,
+ 786, 785, 0, 0, 793, 781, 0, 794, 0, 794,
+ 793, 781, 791, 0, 770, 776, 773, 788, 301, 772,
+ 776, 775, 779, 0, 780, 766, 767, 776, 782, 777,
+ 777, 762, 0, 765, 758, 0, 763, 1038, 378, 279,
+ 756, 361, 762, 802, 801, 760, 766, 756, 768, 400,
+ 1038, 794, 0, 764, 745, 751, 759, 701, 674, 0,
+ 662, 0, 653, 666, 647, 0, 641, 0, 656, 629,
+ 0, 625, 0, 0, 596, 612, 611, 0, 595, 0,
+
+ 580, 587, 569, 0, 0, 566, 0, 565, 578, 0,
+ 578, 577, 556, 573, 427, 1038, 442, 348, 360, 450,
+ 465, 578, 605, 381, 562, 551, 558, 551, 473, 579,
+ 523, 510, 0, 510, 502, 0, 0, 504, 501, 0,
+ 510, 506, 0, 493, 474, 0, 446, 455, 433, 452,
+ 443, 408, 425, 0, 414, 411, 378, 0, 469, 369,
+ 1038, 397, 400, 472, 1038, 421, 365, 1038, 500, 415,
+ 372, 515, 372, 305, 398, 0, 366, 337, 0, 322,
+ 312, 302, 314, 0, 306, 0, 288, 0, 0, 287,
+ 0, 292, 278, 0, 278, 430, 1038, 497, 307, 503,
+
+ 519, 523, 1038, 531, 538, 448, 546, 551, 558, 261,
+ 0, 0, 0, 0, 0, 0, 193, 0, 0, 187,
+ 171, 0, 565, 1038, 567, 575, 572, 1038, 577, 579,
+ 216, 197, 457, 0, 55, 0, 581, 1038, 591, 61,
+ 600, 602, 0, 1038, 604, 1038, 606, 1038, 627, 635,
+ 639, 645, 653, 661, 665, 672, 680, 685, 688, 695,
+ 700, 703, 706, 710, 717, 722, 729, 734, 741, 749,
+ 757, 765, 773, 781, 789
} ;
-static tao_yyconst short int tao_yy_def[472] =
+static tao_yyconst short int tao_yy_def[576] =
{ 0,
- 444, 1, 444, 444, 444, 444, 444, 445, 446, 444,
- 444, 444, 444, 444, 444, 444, 444, 447, 447, 447,
- 447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
- 447, 447, 447, 447, 447, 447, 447, 447, 447, 444,
- 444, 444, 445, 444, 448, 444, 449, 444, 444, 444,
- 444, 444, 450, 51, 444, 444, 444, 451, 444, 444,
- 444, 444, 447, 447, 452, 453, 447, 447, 447, 447,
- 447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
- 447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
- 447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
-
- 447, 447, 447, 447, 447, 40, 444, 40, 444, 444,
- 444, 444, 444, 444, 445, 444, 444, 444, 444, 454,
- 444, 455, 444, 444, 444, 450, 444, 450, 54, 444,
- 444, 451, 447, 452, 444, 444, 444, 444, 447, 447,
- 447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
- 447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
- 447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
- 447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
- 456, 444, 444, 444, 444, 444, 444, 444, 444, 444,
- 457, 455, 444, 444, 444, 447, 458, 444, 459, 447,
-
- 447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
- 447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
- 447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
- 447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
- 447, 456, 444, 444, 444, 444, 444, 187, 444, 187,
- 444, 444, 444, 444, 444, 444, 444, 444, 444, 447,
- 452, 460, 447, 447, 447, 447, 447, 447, 447, 447,
- 447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
- 447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
- 447, 447, 447, 447, 447, 447, 447, 447, 444, 444,
-
- 444, 444, 444, 444, 461, 444, 444, 444, 444, 444,
- 261, 444, 462, 447, 447, 447, 447, 447, 447, 447,
- 447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
- 447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
- 444, 444, 444, 463, 444, 444, 444, 444, 461, 444,
- 444, 444, 444, 444, 261, 464, 447, 447, 447, 447,
- 447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
- 447, 447, 447, 444, 463, 444, 463, 465, 444, 444,
- 466, 444, 444, 444, 444, 444, 444, 444, 452, 444,
- 447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
-
- 465, 444, 465, 466, 444, 467, 444, 444, 444, 468,
- 444, 444, 444, 444, 444, 447, 447, 447, 447, 447,
- 467, 444, 467, 444, 468, 444, 468, 469, 470, 444,
- 444, 447, 469, 444, 469, 470, 444, 471, 447, 444,
- 471, 444, 471, 0, 444, 444, 444, 444, 444, 444,
- 444, 444, 444, 444, 444, 444, 444, 444, 444, 444,
- 444, 444, 444, 444, 444, 444, 444, 444, 444, 444,
- 444
+ 548, 1, 548, 548, 548, 548, 548, 549, 550, 548,
+ 548, 548, 548, 548, 548, 548, 548, 551, 551, 551,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 548, 548, 548, 548, 549, 548, 552, 548,
+ 553, 548, 548, 548, 548, 548, 554, 55, 548, 548,
+ 548, 555, 548, 548, 548, 548, 551, 551, 556, 557,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 551, 551, 551, 548, 44,
+ 44, 548, 121, 548, 548, 548, 548, 548, 548, 548,
+ 549, 549, 548, 548, 548, 548, 558, 548, 559, 548,
+ 548, 548, 554, 548, 554, 58, 548, 548, 555, 551,
+ 556, 548, 548, 548, 548, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 560, 548, 548, 548, 548, 548, 548, 548, 548, 548,
+ 561, 559, 548, 548, 548, 551, 562, 548, 563, 551,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 560, 548, 548, 548, 548,
+ 548, 217, 548, 217, 548, 548, 548, 548, 548, 548,
+
+ 548, 548, 548, 551, 556, 564, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 551, 551, 548, 548, 548,
+ 548, 548, 548, 565, 548, 548, 548, 548, 548, 305,
+ 548, 566, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 548, 548, 548, 567, 548, 548,
+ 548, 548, 565, 548, 548, 548, 548, 548, 305, 568,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 551, 551, 551, 548, 567,
+ 548, 567, 569, 548, 548, 570, 548, 548, 548, 548,
+ 548, 548, 548, 556, 548, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 551, 551, 551, 569, 548, 569, 570, 548,
+
+ 571, 548, 548, 548, 572, 548, 548, 548, 548, 548,
+ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551,
+ 551, 551, 571, 548, 571, 548, 572, 548, 572, 573,
+ 574, 548, 548, 551, 551, 551, 573, 548, 573, 574,
+ 548, 575, 551, 548, 575, 548, 575, 0, 548, 548,
+ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548,
+ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548,
+ 548, 548, 548, 548, 548
} ;
-static tao_yyconst short int tao_yy_nxt[980] =
+static tao_yyconst short int tao_yy_nxt[1098] =
{ 0,
4, 5, 6, 7, 5, 8, 4, 9, 4, 4,
10, 11, 12, 13, 14, 14, 15, 16, 4, 17,
- 7, 18, 18, 18, 19, 18, 20, 18, 18, 21,
- 18, 18, 4, 22, 23, 24, 25, 26, 27, 18,
- 18, 28, 29, 30, 31, 32, 33, 18, 34, 35,
- 36, 37, 38, 39, 18, 18, 40, 42, 44, 48,
- 42, 49, 50, 50, 51, 51, 51, 52, 78, 92,
- 41, 53, 54, 93, 55, 55, 56, 54, 79, 59,
- 59, 59, 437, 68, 57, 45, 65, 76, 66, 57,
- 72, 87, 58, 69, 99, 77, 80, 73, 57, 70,
-
- 88, 100, 74, 57, 81, 82, 90, 89, 75, 91,
- 94, 104, 44, 95, 42, 58, 102, 42, 51, 51,
- 51, 181, 155, 96, 97, 105, 98, 156, 103, 106,
- 107, 107, 108, 135, 44, 127, 128, 157, 118, 45,
- 439, 109, 109, 109, 119, 119, 158, 54, 107, 121,
- 121, 56, 54, 128, 123, 123, 123, 175, 444, 57,
- 136, 45, 120, 429, 57, 176, 110, 122, 437, 111,
- 112, 127, 128, 57, 113, 129, 129, 129, 57, 131,
- 131, 131, 127, 128, 54, 120, 55, 55, 56, 128,
- 122, 51, 51, 51, 432, 54, 57, 56, 56, 56,
-
- 128, 124, 125, 198, 125, 135, 431, 57, 130, 130,
- 57, 405, 131, 131, 131, 124, 125, 107, 107, 182,
- 125, 57, 54, 230, 59, 59, 59, 420, 109, 109,
- 109, 189, 136, 231, 57, 107, 419, 190, 190, 54,
- 418, 121, 121, 56, 206, 207, 305, 199, 57, 417,
- 54, 57, 123, 123, 123, 193, 193, 256, 416, 194,
- 194, 194, 57, 257, 257, 57, 131, 131, 131, 194,
- 194, 194, 299, 299, 300, 344, 57, 195, 344, 195,
- 135, 378, 406, 444, 378, 406, 376, 377, 376, 377,
- 299, 195, 194, 194, 194, 195, 248, 249, 249, 250,
-
- 249, 249, 306, 125, 377, 125, 377, 136, 251, 251,
- 251, 251, 251, 251, 312, 249, 410, 125, 249, 410,
- 428, 125, 438, 428, 415, 438, 341, 342, 342, 341,
- 383, 383, 384, 252, 411, 405, 253, 254, 343, 343,
- 343, 255, 135, 346, 400, 342, 346, 399, 383, 398,
- 311, 311, 311, 397, 396, 347, 347, 347, 311, 311,
- 311, 311, 376, 377, 402, 403, 395, 394, 393, 136,
- 311, 311, 311, 311, 311, 311, 355, 355, 355, 392,
- 377, 391, 403, 312, 355, 355, 355, 355, 388, 387,
- 341, 342, 342, 341, 402, 403, 355, 355, 355, 355,
-
- 355, 355, 374, 374, 374, 341, 342, 342, 341, 342,
- 386, 430, 403, 346, 385, 350, 346, 343, 343, 343,
- 414, 414, 414, 382, 342, 347, 347, 347, 379, 380,
- 380, 379, 381, 342, 342, 379, 380, 380, 379, 381,
- 347, 347, 347, 373, 374, 374, 374, 380, 389, 389,
- 389, 342, 372, 371, 380, 370, 389, 389, 389, 389,
- 402, 403, 407, 408, 408, 407, 380, 380, 389, 389,
- 389, 389, 389, 389, 409, 409, 409, 412, 403, 369,
- 413, 408, 422, 423, 380, 407, 408, 408, 407, 414,
- 414, 414, 368, 407, 408, 408, 407, 424, 424, 424,
-
- 423, 426, 427, 367, 408, 409, 409, 409, 412, 366,
- 365, 413, 408, 412, 422, 423, 413, 429, 364, 427,
- 414, 414, 414, 422, 423, 414, 414, 414, 363, 426,
- 427, 362, 423, 408, 408, 426, 427, 434, 435, 434,
- 435, 423, 434, 435, 424, 424, 424, 427, 440, 440,
- 361, 408, 360, 427, 359, 435, 358, 435, 442, 443,
- 435, 442, 443, 442, 443, 357, 440, 312, 354, 353,
- 352, 351, 305, 350, 348, 345, 443, 340, 339, 443,
- 338, 443, 43, 43, 43, 43, 43, 43, 43, 43,
- 46, 337, 46, 46, 46, 46, 46, 46, 63, 63,
-
- 63, 63, 115, 115, 336, 335, 115, 115, 117, 334,
- 117, 117, 117, 117, 117, 117, 126, 126, 126, 126,
- 126, 126, 126, 126, 132, 333, 132, 134, 134, 134,
- 134, 134, 134, 134, 134, 137, 332, 137, 137, 137,
- 137, 137, 137, 191, 191, 331, 191, 192, 330, 192,
- 242, 242, 242, 242, 242, 242, 242, 242, 259, 259,
- 329, 259, 261, 328, 261, 262, 327, 262, 313, 313,
- 326, 313, 349, 349, 349, 349, 349, 349, 349, 349,
- 356, 356, 325, 356, 375, 375, 375, 375, 375, 375,
- 375, 375, 390, 390, 324, 390, 401, 401, 401, 401,
-
- 401, 401, 401, 401, 404, 404, 404, 404, 404, 404,
- 404, 404, 421, 421, 421, 421, 421, 421, 421, 421,
- 425, 425, 425, 425, 425, 425, 425, 425, 433, 433,
- 433, 433, 433, 433, 433, 433, 436, 436, 436, 436,
- 436, 436, 436, 436, 441, 441, 441, 441, 441, 441,
- 441, 441, 323, 322, 321, 320, 319, 318, 317, 316,
- 315, 314, 312, 258, 256, 310, 309, 308, 307, 444,
- 304, 303, 302, 301, 243, 298, 297, 296, 295, 294,
- 293, 292, 291, 290, 289, 288, 287, 286, 285, 284,
- 283, 282, 281, 280, 279, 278, 277, 276, 275, 274,
-
- 273, 272, 271, 270, 269, 268, 267, 266, 265, 264,
- 263, 260, 258, 247, 246, 245, 244, 181, 243, 241,
- 240, 239, 238, 237, 236, 235, 234, 233, 232, 229,
- 228, 227, 226, 225, 224, 223, 222, 221, 220, 219,
- 218, 217, 216, 215, 214, 213, 212, 211, 210, 209,
- 208, 205, 204, 203, 202, 201, 200, 198, 197, 196,
- 188, 188, 188, 187, 186, 185, 184, 183, 444, 180,
- 179, 178, 177, 174, 173, 172, 171, 170, 169, 168,
- 167, 166, 165, 164, 163, 162, 161, 160, 159, 154,
- 153, 152, 151, 150, 149, 148, 147, 146, 145, 144,
-
- 143, 142, 141, 140, 139, 138, 133, 116, 114, 101,
- 86, 85, 84, 83, 71, 67, 64, 62, 61, 60,
- 47, 444, 3, 444, 444, 444, 444, 444, 444, 444,
- 444, 444, 444, 444, 444, 444, 444, 444, 444, 444,
- 444, 444, 444, 444, 444, 444, 444, 444, 444, 444,
- 444, 444, 444, 444, 444, 444, 444, 444, 444, 444,
- 444, 444, 444, 444, 444, 444, 444, 444, 444, 444,
- 444, 444, 444, 444, 444, 444, 444, 444, 444
+ 7, 18, 18, 18, 19, 18, 20, 21, 18, 18,
+ 22, 18, 18, 4, 23, 24, 25, 26, 27, 28,
+ 29, 30, 31, 18, 18, 32, 33, 34, 35, 36,
+ 18, 37, 38, 39, 40, 41, 42, 18, 18, 43,
+ 46, 48, 43, 46, 44, 52, 541, 53, 54, 54,
+ 55, 55, 55, 56, 69, 81, 70, 57, 45, 58,
+ 73, 59, 59, 60, 58, 82, 63, 63, 63, 49,
+ 77, 61, 74, 543, 83, 84, 61, 78, 75, 95,
+
+ 62, 87, 48, 85, 79, 86, 61, 92, 93, 88,
+ 80, 61, 89, 96, 102, 99, 104, 103, 113, 97,
+ 105, 106, 111, 114, 107, 62, 100, 115, 117, 112,
+ 49, 46, 182, 101, 46, 119, 108, 109, 119, 110,
+ 120, 116, 152, 183, 118, 121, 122, 122, 123, 130,
+ 144, 145, 130, 131, 135, 164, 165, 124, 124, 124,
+ 136, 136, 238, 239, 122, 55, 55, 55, 145, 58,
+ 153, 138, 138, 60, 146, 146, 146, 174, 191, 137,
+ 180, 61, 204, 125, 192, 181, 126, 175, 196, 127,
+ 139, 197, 205, 128, 273, 58, 61, 140, 140, 140,
+
+ 119, 48, 531, 119, 137, 120, 274, 61, 58, 48,
+ 59, 59, 60, 548, 58, 139, 60, 60, 60, 548,
+ 61, 541, 61, 55, 55, 55, 61, 130, 536, 49,
+ 130, 131, 535, 141, 142, 61, 142, 49, 147, 147,
+ 152, 61, 148, 148, 148, 122, 122, 212, 141, 142,
+ 58, 534, 63, 63, 63, 142, 124, 124, 124, 219,
+ 144, 145, 61, 122, 228, 220, 220, 58, 153, 138,
+ 138, 60, 58, 364, 140, 140, 140, 61, 145, 61,
+ 418, 223, 223, 418, 61, 224, 224, 224, 144, 145,
+ 148, 148, 148, 264, 61, 533, 148, 148, 148, 61,
+
+ 312, 313, 265, 224, 224, 224, 145, 225, 300, 225,
+ 152, 229, 500, 548, 301, 301, 522, 358, 358, 359,
+ 521, 350, 225, 224, 224, 224, 351, 520, 225, 292,
+ 293, 293, 294, 352, 142, 358, 142, 398, 153, 519,
+ 518, 295, 295, 295, 517, 293, 293, 365, 293, 142,
+ 461, 462, 516, 399, 515, 142, 295, 295, 295, 514,
+ 513, 463, 420, 293, 463, 420, 501, 296, 462, 501,
+ 297, 461, 462, 298, 421, 421, 421, 299, 152, 415,
+ 416, 416, 415, 468, 468, 469, 370, 370, 370, 462,
+ 512, 417, 417, 417, 370, 370, 370, 370, 416, 461,
+
+ 462, 468, 497, 498, 511, 371, 153, 370, 370, 370,
+ 370, 370, 370, 429, 429, 429, 505, 462, 510, 505,
+ 498, 429, 429, 429, 429, 506, 500, 495, 415, 416,
+ 416, 415, 497, 498, 429, 429, 429, 429, 429, 429,
+ 459, 459, 459, 415, 416, 416, 415, 416, 494, 530,
+ 498, 420, 530, 493, 420, 417, 417, 417, 542, 492,
+ 491, 542, 416, 421, 421, 421, 464, 465, 465, 464,
+ 466, 416, 416, 464, 465, 465, 464, 466, 421, 421,
+ 421, 490, 459, 459, 459, 465, 474, 474, 474, 416,
+ 489, 488, 465, 487, 474, 474, 474, 474, 486, 497,
+
+ 498, 502, 503, 503, 502, 465, 465, 474, 474, 474,
+ 474, 474, 474, 504, 504, 504, 507, 498, 485, 508,
+ 503, 524, 525, 465, 502, 503, 503, 502, 509, 509,
+ 509, 484, 502, 503, 503, 502, 526, 526, 526, 525,
+ 528, 529, 483, 503, 504, 504, 504, 507, 482, 481,
+ 508, 503, 507, 480, 479, 508, 531, 478, 529, 509,
+ 509, 509, 532, 477, 509, 509, 509, 524, 525, 524,
+ 525, 509, 509, 509, 528, 529, 476, 503, 503, 528,
+ 529, 538, 539, 538, 539, 525, 371, 525, 526, 526,
+ 526, 473, 529, 538, 539, 503, 472, 529, 471, 539,
+
+ 470, 539, 544, 544, 546, 547, 546, 547, 546, 547,
+ 424, 539, 467, 458, 457, 456, 455, 454, 453, 452,
+ 544, 451, 547, 450, 547, 449, 547, 47, 47, 47,
+ 47, 47, 47, 47, 47, 50, 448, 50, 50, 50,
+ 50, 50, 50, 67, 67, 67, 67, 132, 132, 447,
+ 446, 132, 132, 134, 445, 134, 134, 134, 134, 134,
+ 134, 143, 143, 143, 143, 143, 143, 143, 143, 149,
+ 444, 149, 151, 151, 151, 151, 151, 151, 151, 151,
+ 154, 443, 154, 154, 154, 154, 154, 154, 221, 221,
+ 442, 221, 222, 441, 222, 286, 286, 286, 286, 286,
+
+ 286, 286, 286, 303, 303, 440, 303, 305, 439, 305,
+ 306, 438, 306, 372, 372, 437, 372, 423, 423, 423,
+ 423, 423, 423, 423, 423, 430, 430, 436, 430, 460,
+ 460, 460, 460, 460, 460, 460, 460, 475, 475, 435,
+ 475, 496, 496, 496, 496, 496, 496, 496, 496, 499,
+ 499, 499, 499, 499, 499, 499, 499, 523, 523, 523,
+ 523, 523, 523, 523, 523, 527, 527, 527, 527, 527,
+ 527, 527, 527, 537, 537, 537, 537, 537, 537, 537,
+ 537, 540, 540, 540, 540, 540, 540, 540, 540, 545,
+ 545, 545, 545, 545, 545, 545, 545, 434, 433, 432,
+
+ 431, 371, 428, 427, 426, 425, 364, 424, 422, 419,
+ 414, 413, 412, 411, 410, 409, 408, 407, 406, 405,
+ 404, 403, 402, 401, 400, 397, 396, 395, 394, 393,
+ 392, 391, 390, 389, 388, 387, 386, 385, 384, 383,
+ 382, 381, 380, 379, 378, 377, 376, 375, 374, 373,
+ 371, 302, 300, 369, 368, 367, 366, 548, 363, 362,
+ 361, 360, 287, 357, 356, 355, 354, 353, 349, 348,
+ 347, 346, 345, 344, 343, 342, 341, 340, 339, 338,
+ 337, 336, 335, 334, 333, 332, 331, 330, 329, 328,
+ 327, 326, 325, 324, 323, 322, 321, 320, 319, 318,
+
+ 317, 316, 315, 314, 311, 310, 309, 308, 307, 304,
+ 302, 291, 290, 289, 288, 211, 287, 285, 284, 283,
+ 282, 281, 280, 279, 278, 277, 276, 275, 272, 271,
+ 270, 269, 268, 267, 266, 263, 262, 261, 260, 259,
+ 258, 257, 256, 255, 254, 253, 252, 251, 250, 249,
+ 248, 247, 246, 245, 244, 243, 242, 241, 240, 237,
+ 236, 235, 234, 233, 232, 231, 230, 228, 227, 226,
+ 218, 218, 218, 217, 216, 215, 214, 213, 211, 210,
+ 209, 208, 207, 206, 203, 202, 201, 200, 199, 198,
+ 195, 194, 193, 190, 189, 188, 187, 186, 185, 184,
+
+ 179, 178, 177, 176, 173, 172, 171, 170, 169, 168,
+ 167, 166, 163, 162, 161, 160, 159, 158, 157, 156,
+ 155, 150, 133, 129, 98, 94, 91, 90, 76, 72,
+ 71, 68, 66, 65, 64, 51, 548, 3, 548, 548,
+ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548,
+ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548,
+ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548,
+ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548,
+ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548,
+ 548, 548, 548, 548, 548, 548, 548
+
} ;
-static tao_yyconst short int tao_yy_chk[980] =
+static tao_yyconst short int tao_yy_chk[1098] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 2, 5, 8, 10,
- 5, 10, 10, 10, 11, 11, 11, 12, 26, 34,
- 2, 12, 13, 34, 13, 13, 13, 14, 26, 14,
- 14, 14, 436, 22, 13, 8, 20, 25, 20, 14,
- 24, 32, 13, 22, 36, 25, 27, 24, 13, 22,
-
- 32, 36, 24, 14, 27, 27, 33, 32, 24, 33,
- 35, 39, 43, 35, 42, 13, 38, 42, 48, 48,
- 48, 108, 83, 35, 35, 39, 35, 83, 38, 40,
- 40, 40, 40, 65, 115, 53, 53, 84, 47, 43,
- 432, 40, 40, 40, 47, 47, 84, 49, 40, 49,
- 49, 49, 50, 53, 50, 50, 50, 101, 108, 49,
- 65, 115, 47, 430, 50, 101, 40, 49, 429, 40,
- 40, 126, 126, 49, 40, 54, 54, 54, 50, 130,
- 130, 130, 128, 128, 55, 47, 55, 55, 55, 126,
- 49, 51, 51, 51, 419, 56, 55, 56, 56, 56,
-
- 128, 51, 51, 138, 51, 134, 415, 56, 57, 57,
- 55, 404, 57, 57, 57, 51, 51, 109, 109, 109,
- 51, 56, 59, 170, 59, 59, 59, 400, 109, 109,
- 109, 119, 134, 170, 59, 109, 398, 119, 119, 121,
- 394, 121, 121, 121, 146, 146, 250, 138, 59, 393,
- 123, 121, 123, 123, 123, 124, 124, 190, 392, 124,
- 124, 124, 123, 190, 190, 121, 131, 131, 131, 193,
- 193, 193, 243, 243, 243, 301, 123, 131, 301, 131,
- 389, 345, 382, 250, 345, 382, 344, 344, 375, 375,
- 243, 131, 194, 194, 194, 131, 187, 187, 187, 187,
-
- 251, 251, 251, 194, 344, 194, 375, 389, 187, 187,
- 187, 251, 251, 251, 390, 187, 385, 194, 251, 385,
- 411, 194, 431, 411, 388, 431, 300, 300, 300, 300,
- 350, 350, 350, 187, 386, 381, 187, 187, 300, 300,
- 300, 187, 261, 303, 372, 300, 303, 371, 350, 369,
- 261, 261, 261, 368, 367, 303, 303, 303, 261, 261,
- 261, 261, 377, 377, 378, 378, 366, 364, 362, 261,
- 261, 261, 261, 261, 261, 261, 311, 311, 311, 358,
- 377, 357, 378, 356, 311, 311, 311, 311, 354, 353,
- 341, 341, 341, 341, 401, 401, 311, 311, 311, 311,
-
- 311, 311, 341, 341, 341, 343, 343, 343, 343, 341,
- 352, 414, 401, 346, 351, 349, 346, 343, 343, 343,
- 414, 414, 414, 348, 343, 346, 346, 346, 347, 347,
- 347, 347, 347, 374, 374, 379, 379, 379, 379, 379,
- 347, 347, 347, 340, 374, 374, 374, 347, 355, 355,
- 355, 374, 339, 338, 379, 337, 355, 355, 355, 355,
- 403, 403, 384, 384, 384, 384, 405, 405, 355, 355,
- 355, 355, 355, 355, 384, 384, 384, 387, 403, 336,
- 387, 384, 406, 406, 405, 407, 407, 407, 407, 387,
- 387, 387, 334, 409, 409, 409, 409, 407, 407, 407,
-
- 406, 410, 410, 331, 407, 409, 409, 409, 412, 330,
- 327, 412, 409, 413, 421, 421, 413, 413, 323, 410,
- 412, 412, 412, 423, 423, 413, 413, 413, 322, 425,
- 425, 321, 421, 424, 424, 427, 427, 428, 428, 433,
- 433, 423, 435, 435, 424, 424, 424, 425, 437, 437,
- 319, 424, 317, 427, 316, 428, 315, 433, 438, 438,
- 435, 441, 441, 443, 443, 314, 437, 313, 310, 309,
- 308, 307, 306, 305, 304, 302, 438, 298, 296, 441,
- 295, 443, 445, 445, 445, 445, 445, 445, 445, 445,
- 446, 293, 446, 446, 446, 446, 446, 446, 447, 447,
-
- 447, 447, 448, 448, 292, 291, 448, 448, 449, 290,
- 449, 449, 449, 449, 449, 449, 450, 450, 450, 450,
- 450, 450, 450, 450, 451, 289, 451, 452, 452, 452,
- 452, 452, 452, 452, 452, 453, 288, 453, 453, 453,
- 453, 453, 453, 454, 454, 286, 454, 455, 285, 455,
- 456, 456, 456, 456, 456, 456, 456, 456, 457, 457,
- 284, 457, 458, 283, 458, 459, 282, 459, 460, 460,
- 281, 460, 461, 461, 461, 461, 461, 461, 461, 461,
- 462, 462, 279, 462, 463, 463, 463, 463, 463, 463,
- 463, 463, 464, 464, 278, 464, 465, 465, 465, 465,
-
- 465, 465, 465, 465, 466, 466, 466, 466, 466, 466,
- 466, 466, 467, 467, 467, 467, 467, 467, 467, 467,
- 468, 468, 468, 468, 468, 468, 468, 468, 469, 469,
- 469, 469, 469, 469, 469, 469, 470, 470, 470, 470,
- 470, 470, 470, 470, 471, 471, 471, 471, 471, 471,
- 471, 471, 276, 272, 271, 270, 269, 268, 267, 265,
- 264, 263, 262, 259, 257, 255, 254, 253, 252, 248,
- 247, 246, 245, 244, 242, 241, 240, 238, 237, 236,
- 235, 234, 233, 232, 231, 230, 229, 228, 227, 226,
- 225, 224, 223, 222, 221, 220, 218, 217, 216, 215,
-
- 214, 213, 212, 210, 209, 208, 207, 206, 203, 202,
- 201, 196, 191, 186, 185, 184, 183, 182, 181, 180,
- 179, 178, 177, 176, 175, 174, 173, 172, 171, 169,
- 168, 167, 166, 165, 164, 162, 161, 160, 159, 158,
- 157, 156, 155, 154, 153, 152, 151, 150, 149, 148,
- 147, 145, 144, 143, 142, 140, 139, 137, 136, 133,
- 120, 118, 117, 114, 113, 112, 111, 110, 106, 105,
- 104, 103, 102, 100, 99, 98, 97, 96, 95, 94,
- 93, 92, 91, 90, 89, 88, 87, 86, 85, 82,
- 81, 80, 79, 78, 77, 76, 75, 74, 73, 72,
-
- 71, 70, 69, 68, 67, 66, 64, 46, 41, 37,
- 31, 30, 29, 28, 23, 21, 19, 17, 16, 15,
- 9, 3, 444, 444, 444, 444, 444, 444, 444, 444,
- 444, 444, 444, 444, 444, 444, 444, 444, 444, 444,
- 444, 444, 444, 444, 444, 444, 444, 444, 444, 444,
- 444, 444, 444, 444, 444, 444, 444, 444, 444, 444,
- 444, 444, 444, 444, 444, 444, 444, 444, 444, 444,
- 444, 444, 444, 444, 444, 444, 444, 444, 444
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
+ 5, 8, 2, 5, 2, 10, 540, 10, 10, 10,
+ 11, 11, 11, 12, 20, 26, 20, 12, 2, 13,
+ 23, 13, 13, 13, 14, 26, 14, 14, 14, 8,
+ 25, 13, 23, 535, 27, 27, 14, 25, 23, 33,
+
+ 13, 28, 47, 27, 25, 27, 13, 31, 31, 28,
+ 25, 14, 28, 33, 36, 35, 37, 36, 40, 33,
+ 37, 38, 39, 40, 38, 13, 35, 41, 42, 39,
+ 47, 46, 94, 35, 46, 43, 38, 38, 43, 38,
+ 43, 41, 69, 94, 42, 44, 44, 44, 44, 48,
+ 57, 57, 48, 48, 51, 79, 79, 44, 44, 44,
+ 51, 51, 165, 165, 44, 52, 52, 52, 57, 53,
+ 69, 53, 53, 53, 58, 58, 58, 88, 102, 51,
+ 93, 53, 113, 44, 102, 93, 44, 88, 106, 44,
+ 53, 106, 113, 44, 199, 54, 53, 54, 54, 54,
+
+ 119, 131, 532, 119, 51, 119, 199, 54, 59, 132,
+ 59, 59, 59, 121, 60, 53, 60, 60, 60, 121,
+ 59, 531, 54, 55, 55, 55, 60, 130, 521, 131,
+ 130, 130, 520, 55, 55, 59, 55, 132, 61, 61,
+ 151, 60, 61, 61, 61, 124, 124, 124, 55, 55,
+ 63, 517, 63, 63, 63, 55, 124, 124, 124, 136,
+ 143, 143, 63, 124, 155, 136, 136, 138, 151, 138,
+ 138, 138, 140, 294, 140, 140, 140, 63, 143, 138,
+ 360, 141, 141, 360, 140, 141, 141, 141, 145, 145,
+ 147, 147, 147, 191, 138, 510, 148, 148, 148, 140,
+
+ 238, 238, 191, 223, 223, 223, 145, 148, 220, 148,
+ 474, 155, 499, 294, 220, 220, 495, 287, 287, 287,
+ 493, 278, 148, 224, 224, 224, 278, 492, 148, 217,
+ 217, 217, 217, 278, 224, 287, 224, 339, 474, 490,
+ 487, 217, 217, 217, 485, 295, 295, 295, 217, 224,
+ 418, 418, 483, 339, 482, 224, 295, 295, 295, 481,
+ 480, 419, 362, 295, 419, 362, 467, 217, 418, 467,
+ 217, 460, 460, 217, 362, 362, 362, 217, 305, 359,
+ 359, 359, 359, 424, 424, 424, 305, 305, 305, 460,
+ 478, 359, 359, 359, 305, 305, 305, 305, 359, 462,
+
+ 462, 424, 463, 463, 477, 475, 305, 305, 305, 305,
+ 305, 305, 305, 370, 370, 370, 470, 462, 473, 470,
+ 463, 370, 370, 370, 370, 471, 466, 457, 415, 415,
+ 415, 415, 496, 496, 370, 370, 370, 370, 370, 370,
+ 415, 415, 415, 417, 417, 417, 417, 415, 456, 506,
+ 496, 420, 506, 455, 420, 417, 417, 417, 533, 453,
+ 452, 533, 417, 420, 420, 420, 421, 421, 421, 421,
+ 421, 459, 459, 464, 464, 464, 464, 464, 421, 421,
+ 421, 451, 459, 459, 459, 421, 429, 429, 429, 459,
+ 450, 449, 464, 448, 429, 429, 429, 429, 447, 498,
+
+ 498, 469, 469, 469, 469, 500, 500, 429, 429, 429,
+ 429, 429, 429, 469, 469, 469, 472, 498, 445, 472,
+ 469, 501, 501, 500, 502, 502, 502, 502, 472, 472,
+ 472, 444, 504, 504, 504, 504, 502, 502, 502, 501,
+ 505, 505, 442, 502, 504, 504, 504, 507, 441, 439,
+ 507, 504, 508, 438, 435, 508, 508, 434, 505, 507,
+ 507, 507, 509, 432, 508, 508, 508, 523, 523, 525,
+ 525, 509, 509, 509, 527, 527, 431, 526, 526, 529,
+ 529, 530, 530, 537, 537, 523, 430, 525, 526, 526,
+ 526, 428, 527, 539, 539, 526, 427, 529, 426, 530,
+
+ 425, 537, 541, 541, 542, 542, 545, 545, 547, 547,
+ 423, 539, 422, 414, 413, 412, 411, 409, 408, 406,
+ 541, 403, 542, 402, 545, 401, 547, 549, 549, 549,
+ 549, 549, 549, 549, 549, 550, 399, 550, 550, 550,
+ 550, 550, 550, 551, 551, 551, 551, 552, 552, 397,
+ 396, 552, 552, 553, 395, 553, 553, 553, 553, 553,
+ 553, 554, 554, 554, 554, 554, 554, 554, 554, 555,
+ 392, 555, 556, 556, 556, 556, 556, 556, 556, 556,
+ 557, 390, 557, 557, 557, 557, 557, 557, 558, 558,
+ 389, 558, 559, 387, 559, 560, 560, 560, 560, 560,
+
+ 560, 560, 560, 561, 561, 385, 561, 562, 384, 562,
+ 563, 383, 563, 564, 564, 381, 564, 565, 565, 565,
+ 565, 565, 565, 565, 565, 566, 566, 379, 566, 567,
+ 567, 567, 567, 567, 567, 567, 567, 568, 568, 378,
+ 568, 569, 569, 569, 569, 569, 569, 569, 569, 570,
+ 570, 570, 570, 570, 570, 570, 570, 571, 571, 571,
+ 571, 571, 571, 571, 571, 572, 572, 572, 572, 572,
+ 572, 572, 572, 573, 573, 573, 573, 573, 573, 573,
+ 573, 574, 574, 574, 574, 574, 574, 574, 574, 575,
+ 575, 575, 575, 575, 575, 575, 575, 377, 376, 375,
+
+ 374, 372, 369, 368, 367, 366, 365, 364, 363, 361,
+ 357, 355, 354, 352, 351, 350, 349, 348, 347, 346,
+ 345, 343, 342, 341, 340, 338, 337, 336, 335, 333,
+ 332, 331, 330, 328, 326, 325, 322, 321, 320, 319,
+ 317, 316, 315, 314, 313, 311, 310, 309, 308, 307,
+ 306, 303, 301, 299, 298, 297, 296, 292, 291, 290,
+ 289, 288, 286, 285, 284, 282, 280, 279, 277, 276,
+ 275, 274, 273, 272, 271, 270, 269, 268, 267, 266,
+ 265, 264, 263, 262, 261, 260, 259, 258, 256, 255,
+ 254, 253, 251, 250, 249, 248, 247, 246, 245, 243,
+
+ 242, 241, 240, 239, 237, 234, 233, 232, 230, 226,
+ 221, 216, 215, 214, 213, 212, 211, 210, 209, 208,
+ 207, 206, 205, 204, 203, 202, 201, 200, 198, 197,
+ 196, 195, 194, 193, 192, 189, 188, 187, 186, 185,
+ 184, 183, 182, 181, 180, 179, 178, 177, 176, 175,
+ 174, 173, 172, 171, 170, 169, 168, 167, 166, 164,
+ 163, 162, 161, 160, 158, 157, 156, 154, 153, 150,
+ 137, 135, 134, 129, 128, 127, 126, 125, 123, 118,
+ 117, 116, 115, 114, 112, 111, 110, 109, 108, 107,
+ 105, 104, 103, 101, 100, 99, 98, 97, 96, 95,
+
+ 92, 91, 90, 89, 87, 86, 85, 84, 83, 82,
+ 81, 80, 78, 77, 76, 75, 74, 73, 72, 71,
+ 70, 68, 50, 45, 34, 32, 30, 29, 24, 22,
+ 21, 19, 17, 16, 15, 9, 3, 548, 548, 548,
+ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548,
+ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548,
+ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548,
+ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548,
+ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548,
+ 548, 548, 548, 548, 548, 548, 548
+
} ;
static tao_yy_state_type tao_yy_last_accepting_state;
@@ -729,7 +790,7 @@ static char *tao_yy_last_accepting_cpos;
char tao_yytext[TAO_YYLMAX];
char *tao_yytext_ptr;
#define INITIAL 0
-/* $Id: idl.ll,v 1.56 2001/09/23 19:16:59 parsons Exp $
+/* $Id: idl.ll,v 1.60.4.5 2002/06/28 14:06:18 parsons Exp $
COPYRIGHT
@@ -797,8 +858,19 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
* idl.ll - Lexical scanner for IDL 1.1
*/
-#include "idl.h"
-#include "idl_extern.h"
+#include "utl_strlist.h"
+#include "utl_exprlist.h"
+#include "utl_labellist.h"
+#include "utl_decllist.h"
+#include "utl_string.h"
+#include "utl_err.h"
+#include "ast_union_label.h"
+#include "ast_field.h"
+#include "ast_expression.h"
+#include "ast_argument.h"
+#include "ast_operation.h"
+#include "fe_interface_header.h"
+#include "global_extern.h"
#include "fe_private.h"
#include "y.tab.h"
@@ -847,6 +919,19 @@ static int scan_obv_token (int token)
return IDENTIFIER;
}
+static int scan_ccm_token (int token)
+{
+ if (idl_global->component_support ())
+ {
+ return token;
+ }
+ else
+ {
+ tao_yylval.strval = ACE_OS::strdup (ace_tao_yytext);
+ return IDENTIFIER;
+ }
+}
+
/* SO we don't choke on files that use \r\n */
#define TAO_YY_NEVER_INTERACTIVE 1
@@ -935,21 +1020,21 @@ TAO_YY_MALLOC_DECL
*/
#ifndef TAO_YY_INPUT
#define TAO_YY_INPUT(buf,result,max_size) \
- if ( tao_yy_current_buffer->tao_yy_is_interactive ) \
- { \
- int c = '*', n; \
- for ( n = 0; n < max_size && \
- (c = getc( tao_yyin )) != EOF && c != '\n'; ++n ) \
- buf[n] = (char) c; \
- if ( c == '\n' ) \
- buf[n++] = (char) c; \
- if ( c == EOF && ferror( tao_yyin ) ) \
- TAO_YY_FATAL_ERROR( "input in flex scanner failed" ); \
- result = n; \
- } \
- else if ( ((result = fread( buf, 1, max_size, tao_yyin )) == 0) \
- && ferror( tao_yyin ) ) \
- TAO_YY_FATAL_ERROR( "input in flex scanner failed" );
+ if ( tao_yy_current_buffer->tao_yy_is_interactive ) \
+ { \
+ int c = '*', n; \
+ for ( n = 0; n < max_size && \
+ (c = getc( tao_yyin )) != EOF && c != '\n'; ++n ) \
+ buf[n] = (char) c; \
+ if ( c == '\n' ) \
+ buf[n++] = (char) c; \
+ if ( c == EOF && ferror( tao_yyin ) ) \
+ TAO_YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ result = n; \
+ } \
+ else if ( ((result = fread( buf, 1, max_size, tao_yyin )) == 0) \
+ && ferror( tao_yyin ) ) \
+ TAO_YY_FATAL_ERROR( "input in flex scanner failed" );
#endif
/* No semi-colon after return; correct usage is to write "tao_yyterminate();" -
@@ -990,303 +1075,375 @@ TAO_YY_MALLOC_DECL
#endif
#define TAO_YY_RULE_SETUP \
- if ( tao_yyleng > 0 ) \
- tao_yy_current_buffer->tao_yy_at_bol = \
- (tao_yytext[tao_yyleng - 1] == '\n'); \
- TAO_YY_USER_ACTION
+ if ( tao_yyleng > 0 ) \
+ tao_yy_current_buffer->tao_yy_at_bol = \
+ (tao_yytext[tao_yyleng - 1] == '\n'); \
+ TAO_YY_USER_ACTION
TAO_YY_DECL
- {
- register tao_yy_state_type tao_yy_current_state;
- register char *tao_yy_cp = 0, *tao_yy_bp = 0;
- register int tao_yy_act;
+ {
+ register tao_yy_state_type tao_yy_current_state;
+ register char *tao_yy_cp = 0, *tao_yy_bp = 0;
+ register int tao_yy_act;
- if ( tao_yy_init )
- {
- tao_yy_init = 0;
+ if ( tao_yy_init )
+ {
+ tao_yy_init = 0;
#ifdef TAO_YY_USER_INIT
- TAO_YY_USER_INIT;
+ TAO_YY_USER_INIT;
#endif
- if ( ! tao_yy_start )
- tao_yy_start = 1; /* first start state */
+ if ( ! tao_yy_start )
+ tao_yy_start = 1; /* first start state */
- if ( ! tao_yyin )
- tao_yyin = stdin;
+ if ( ! tao_yyin )
+ tao_yyin = stdin;
- if ( ! tao_yyout )
- tao_yyout = stdout;
+ if ( ! tao_yyout )
+ tao_yyout = stdout;
- if ( ! tao_yy_current_buffer )
- tao_yy_current_buffer =
- tao_yy_create_buffer( tao_yyin, TAO_YY_BUF_SIZE );
+ if ( ! tao_yy_current_buffer )
+ tao_yy_current_buffer =
+ tao_yy_create_buffer( tao_yyin, TAO_YY_BUF_SIZE );
- tao_yy_load_buffer_state();
- }
+ tao_yy_load_buffer_state();
+ }
- while ( 1 ) /* loops until end-of-file is reached */
- {
- tao_yy_cp = tao_yy_c_buf_p;
+ while ( 1 ) /* loops until end-of-file is reached */
+ {
+ tao_yy_cp = tao_yy_c_buf_p;
- /* Support of tao_yytext. */
- *tao_yy_cp = tao_yy_hold_char;
+ /* Support of tao_yytext. */
+ *tao_yy_cp = tao_yy_hold_char;
- /* tao_yy_bp points to the position in tao_yy_ch_buf of the start of
- * the current run.
- */
- tao_yy_bp = tao_yy_cp;
+ /* tao_yy_bp points to the position in tao_yy_ch_buf of the start of
+ * the current run.
+ */
+ tao_yy_bp = tao_yy_cp;
- tao_yy_current_state = tao_yy_start;
- tao_yy_current_state += TAO_YY_AT_BOL();
+ tao_yy_current_state = tao_yy_start;
+ tao_yy_current_state += TAO_YY_AT_BOL();
tao_yy_match:
- do
- {
- register TAO_YY_CHAR tao_yy_c = tao_yy_ec[TAO_YY_SC_TO_UI(*tao_yy_cp)];
- if ( tao_yy_accept[tao_yy_current_state] )
- {
- tao_yy_last_accepting_state = tao_yy_current_state;
- tao_yy_last_accepting_cpos = tao_yy_cp;
- }
- while ( tao_yy_chk[tao_yy_base[tao_yy_current_state] + tao_yy_c] != tao_yy_current_state )
- {
- tao_yy_current_state = (int) tao_yy_def[tao_yy_current_state];
- if ( tao_yy_current_state >= 445 )
- tao_yy_c = tao_yy_meta[(unsigned int) tao_yy_c];
- }
- tao_yy_current_state = tao_yy_nxt[tao_yy_base[tao_yy_current_state] + (unsigned int) tao_yy_c];
- ++tao_yy_cp;
- }
- while ( tao_yy_base[tao_yy_current_state] != 923 );
+ do
+ {
+ register TAO_YY_CHAR tao_yy_c = tao_yy_ec[TAO_YY_SC_TO_UI(*tao_yy_cp)];
+ if ( tao_yy_accept[tao_yy_current_state] )
+ {
+ tao_yy_last_accepting_state = tao_yy_current_state;
+ tao_yy_last_accepting_cpos = tao_yy_cp;
+ }
+ while ( tao_yy_chk[tao_yy_base[tao_yy_current_state] + tao_yy_c] != tao_yy_current_state )
+ {
+ tao_yy_current_state = (int) tao_yy_def[tao_yy_current_state];
+ if ( tao_yy_current_state >= 549 )
+ tao_yy_c = tao_yy_meta[(unsigned int) tao_yy_c];
+ }
+ tao_yy_current_state = tao_yy_nxt[tao_yy_base[tao_yy_current_state] + (unsigned int) tao_yy_c];
+ ++tao_yy_cp;
+ }
+ while ( tao_yy_base[tao_yy_current_state] != 1038 );
tao_yy_find_action:
- tao_yy_act = tao_yy_accept[tao_yy_current_state];
- if ( tao_yy_act == 0 )
- { /* have to back up */
- tao_yy_cp = tao_yy_last_accepting_cpos;
- tao_yy_current_state = tao_yy_last_accepting_state;
- tao_yy_act = tao_yy_accept[tao_yy_current_state];
- }
+ tao_yy_act = tao_yy_accept[tao_yy_current_state];
+ if ( tao_yy_act == 0 )
+ { /* have to back up */
+ tao_yy_cp = tao_yy_last_accepting_cpos;
+ tao_yy_current_state = tao_yy_last_accepting_state;
+ tao_yy_act = tao_yy_accept[tao_yy_current_state];
+ }
- TAO_YY_DO_BEFORE_ACTION;
+ TAO_YY_DO_BEFORE_ACTION;
-do_action: /* This label is used only to access EOF actions. */
+do_action: /* This label is used only to access EOF actions. */
- switch ( tao_yy_act )
- { /* beginning of action switch */
- case 0: /* must back up */
- /* undo the effects of TAO_YY_DO_BEFORE_ACTION */
- *tao_yy_cp = tao_yy_hold_char;
- tao_yy_cp = tao_yy_last_accepting_cpos;
- tao_yy_current_state = tao_yy_last_accepting_state;
- goto tao_yy_find_action;
+ switch ( tao_yy_act )
+ { /* beginning of action switch */
+ case 0: /* must back up */
+ /* undo the effects of TAO_YY_DO_BEFORE_ACTION */
+ *tao_yy_cp = tao_yy_hold_char;
+ tao_yy_cp = tao_yy_last_accepting_cpos;
+ tao_yy_current_state = tao_yy_last_accepting_state;
+ goto tao_yy_find_action;
case 1:
TAO_YY_RULE_SETUP
return IDL_ANY;
- TAO_YY_BREAK
+ TAO_YY_BREAK
case 2:
TAO_YY_RULE_SETUP
-return IDL_MODULE;
- TAO_YY_BREAK
+return IDL_OBJECT;
+ TAO_YY_BREAK
case 3:
TAO_YY_RULE_SETUP
-return IDL_RAISES;
- TAO_YY_BREAK
+return IDL_MODULE;
+ TAO_YY_BREAK
case 4:
TAO_YY_RULE_SETUP
-return IDL_READONLY;
- TAO_YY_BREAK
+return IDL_RAISES;
+ TAO_YY_BREAK
case 5:
TAO_YY_RULE_SETUP
-return IDL_ATTRIBUTE;
- TAO_YY_BREAK
+return IDL_READONLY;
+ TAO_YY_BREAK
case 6:
TAO_YY_RULE_SETUP
-return IDL_EXCEPTION;
- TAO_YY_BREAK
+return IDL_ATTRIBUTE;
+ TAO_YY_BREAK
case 7:
TAO_YY_RULE_SETUP
-return IDL_CONTEXT;
- TAO_YY_BREAK
+return IDL_EXCEPTION;
+ TAO_YY_BREAK
case 8:
TAO_YY_RULE_SETUP
-return IDL_INTERFACE;
- TAO_YY_BREAK
+return IDL_CONTEXT;
+ TAO_YY_BREAK
case 9:
TAO_YY_RULE_SETUP
-return IDL_CONST;
- TAO_YY_BREAK
+return IDL_INTERFACE;
+ TAO_YY_BREAK
case 10:
TAO_YY_RULE_SETUP
-return IDL_TYPEDEF;
- TAO_YY_BREAK
+return IDL_CONST;
+ TAO_YY_BREAK
case 11:
TAO_YY_RULE_SETUP
-return IDL_STRUCT;
- TAO_YY_BREAK
+return IDL_TYPEDEF;
+ TAO_YY_BREAK
case 12:
TAO_YY_RULE_SETUP
-return IDL_ENUM;
- TAO_YY_BREAK
+return IDL_STRUCT;
+ TAO_YY_BREAK
case 13:
TAO_YY_RULE_SETUP
-return IDL_STRING;
- TAO_YY_BREAK
+return IDL_ENUM;
+ TAO_YY_BREAK
case 14:
TAO_YY_RULE_SETUP
-return IDL_WSTRING;
- TAO_YY_BREAK
+return IDL_STRING;
+ TAO_YY_BREAK
case 15:
TAO_YY_RULE_SETUP
-return IDL_SEQUENCE;
- TAO_YY_BREAK
+return IDL_WSTRING;
+ TAO_YY_BREAK
case 16:
TAO_YY_RULE_SETUP
-return IDL_UNION;
- TAO_YY_BREAK
+return IDL_SEQUENCE;
+ TAO_YY_BREAK
case 17:
TAO_YY_RULE_SETUP
-return IDL_FIXED;
- TAO_YY_BREAK
+return IDL_UNION;
+ TAO_YY_BREAK
case 18:
TAO_YY_RULE_SETUP
-return IDL_SWITCH;
- TAO_YY_BREAK
+return IDL_FIXED;
+ TAO_YY_BREAK
case 19:
TAO_YY_RULE_SETUP
-return IDL_CASE;
- TAO_YY_BREAK
+return IDL_SWITCH;
+ TAO_YY_BREAK
case 20:
TAO_YY_RULE_SETUP
-return IDL_DEFAULT;
- TAO_YY_BREAK
+return IDL_CASE;
+ TAO_YY_BREAK
case 21:
TAO_YY_RULE_SETUP
-return IDL_FLOAT;
- TAO_YY_BREAK
+return IDL_DEFAULT;
+ TAO_YY_BREAK
case 22:
TAO_YY_RULE_SETUP
-return IDL_DOUBLE;
- TAO_YY_BREAK
+return IDL_FLOAT;
+ TAO_YY_BREAK
case 23:
TAO_YY_RULE_SETUP
-return IDL_LONG;
- TAO_YY_BREAK
+return IDL_DOUBLE;
+ TAO_YY_BREAK
case 24:
TAO_YY_RULE_SETUP
-return IDL_SHORT;
- TAO_YY_BREAK
+return IDL_LONG;
+ TAO_YY_BREAK
case 25:
TAO_YY_RULE_SETUP
-return IDL_UNSIGNED;
- TAO_YY_BREAK
+return IDL_SHORT;
+ TAO_YY_BREAK
case 26:
TAO_YY_RULE_SETUP
-return IDL_CHAR;
- TAO_YY_BREAK
+return IDL_UNSIGNED;
+ TAO_YY_BREAK
case 27:
TAO_YY_RULE_SETUP
-return IDL_WCHAR;
- TAO_YY_BREAK
+return IDL_CHAR;
+ TAO_YY_BREAK
case 28:
TAO_YY_RULE_SETUP
-return IDL_BOOLEAN;
- TAO_YY_BREAK
+return IDL_WCHAR;
+ TAO_YY_BREAK
case 29:
TAO_YY_RULE_SETUP
-return IDL_OCTET;
- TAO_YY_BREAK
+return IDL_BOOLEAN;
+ TAO_YY_BREAK
case 30:
TAO_YY_RULE_SETUP
-return IDL_VOID;
- TAO_YY_BREAK
+return IDL_OCTET;
+ TAO_YY_BREAK
case 31:
TAO_YY_RULE_SETUP
-return IDL_NATIVE;
- TAO_YY_BREAK
+return IDL_VOID;
+ TAO_YY_BREAK
case 32:
TAO_YY_RULE_SETUP
-return IDL_LOCAL;
- TAO_YY_BREAK
+return IDL_NATIVE;
+ TAO_YY_BREAK
case 33:
TAO_YY_RULE_SETUP
-return scan_obv_token (IDL_ABSTRACT);
- TAO_YY_BREAK
+return IDL_LOCAL;
+ TAO_YY_BREAK
case 34:
TAO_YY_RULE_SETUP
-return scan_obv_token (IDL_CUSTOM);
- TAO_YY_BREAK
+return scan_obv_token (IDL_ABSTRACT);
+ TAO_YY_BREAK
case 35:
TAO_YY_RULE_SETUP
-return scan_obv_token (IDL_FACTORY);
- TAO_YY_BREAK
+return scan_obv_token (IDL_CUSTOM);
+ TAO_YY_BREAK
case 36:
TAO_YY_RULE_SETUP
-return scan_obv_token (IDL_PRIVATE);
- TAO_YY_BREAK
+return scan_obv_token (IDL_FACTORY);
+ TAO_YY_BREAK
case 37:
TAO_YY_RULE_SETUP
-return scan_obv_token (IDL_PUBLIC);
- TAO_YY_BREAK
+return scan_obv_token (IDL_PRIVATE);
+ TAO_YY_BREAK
case 38:
TAO_YY_RULE_SETUP
-return scan_obv_token (IDL_SUPPORTS);
- TAO_YY_BREAK
+return scan_obv_token (IDL_PUBLIC);
+ TAO_YY_BREAK
case 39:
TAO_YY_RULE_SETUP
-return scan_obv_token (IDL_TRUNCATABLE);
- TAO_YY_BREAK
+return scan_obv_token (IDL_SUPPORTS);
+ TAO_YY_BREAK
case 40:
TAO_YY_RULE_SETUP
-return scan_obv_token (IDL_VALUETYPE);
- TAO_YY_BREAK
+return scan_obv_token (IDL_TRUNCATABLE);
+ TAO_YY_BREAK
case 41:
TAO_YY_RULE_SETUP
-return IDL_TRUETOK;
- TAO_YY_BREAK
+return scan_obv_token (IDL_VALUETYPE);
+ TAO_YY_BREAK
case 42:
TAO_YY_RULE_SETUP
-return IDL_FALSETOK;
- TAO_YY_BREAK
+return scan_ccm_token (IDL_COMPONENT);
+ TAO_YY_BREAK
case 43:
TAO_YY_RULE_SETUP
-return IDL_INOUT;
- TAO_YY_BREAK
+return scan_ccm_token (IDL_CONSUMES);
+ TAO_YY_BREAK
case 44:
TAO_YY_RULE_SETUP
-return IDL_IN;
- TAO_YY_BREAK
+return scan_ccm_token (IDL_EMITS);
+ TAO_YY_BREAK
case 45:
TAO_YY_RULE_SETUP
-return IDL_OUT;
- TAO_YY_BREAK
+return scan_ccm_token (IDL_EVENTTYPE);
+ TAO_YY_BREAK
case 46:
TAO_YY_RULE_SETUP
-return IDL_ONEWAY;
- TAO_YY_BREAK
+return scan_ccm_token (IDL_FINDER);
+ TAO_YY_BREAK
case 47:
TAO_YY_RULE_SETUP
-return IDL_LEFT_SHIFT;
- TAO_YY_BREAK
+return scan_ccm_token (IDL_GETRAISES);
+ TAO_YY_BREAK
case 48:
TAO_YY_RULE_SETUP
-return IDL_RIGHT_SHIFT;
- TAO_YY_BREAK
+return scan_ccm_token (IDL_HOME);
+ TAO_YY_BREAK
case 49:
TAO_YY_RULE_SETUP
-{
- tao_yylval.strval = (char *) "::";
- return IDL_SCOPE_DELIMITOR;
- }
- TAO_YY_BREAK
+return scan_ccm_token (IDL_IMPORT);
+ TAO_YY_BREAK
case 50:
TAO_YY_RULE_SETUP
+return scan_ccm_token (IDL_MULTIPLE);
+ TAO_YY_BREAK
+case 51:
+TAO_YY_RULE_SETUP
+return scan_ccm_token (IDL_PRIMARYKEY);
+ TAO_YY_BREAK
+case 52:
+TAO_YY_RULE_SETUP
+return scan_ccm_token (IDL_PROVIDES);
+ TAO_YY_BREAK
+case 53:
+TAO_YY_RULE_SETUP
+return scan_ccm_token (IDL_PUBLISHES);
+ TAO_YY_BREAK
+case 54:
+TAO_YY_RULE_SETUP
+return scan_ccm_token (IDL_SETRAISES);
+ TAO_YY_BREAK
+case 55:
+TAO_YY_RULE_SETUP
+return scan_ccm_token (IDL_TYPEID);
+ TAO_YY_BREAK
+case 56:
+TAO_YY_RULE_SETUP
+return scan_ccm_token (IDL_TYPEPREFIX);
+ TAO_YY_BREAK
+case 57:
+TAO_YY_RULE_SETUP
+return scan_ccm_token (IDL_USES);
+ TAO_YY_BREAK
+case 58:
+TAO_YY_RULE_SETUP
+return scan_ccm_token (IDL_MANAGES);
+ TAO_YY_BREAK
+case 59:
+TAO_YY_RULE_SETUP
+return IDL_TRUETOK;
+ TAO_YY_BREAK
+case 60:
+TAO_YY_RULE_SETUP
+return IDL_FALSETOK;
+ TAO_YY_BREAK
+case 61:
+TAO_YY_RULE_SETUP
+return IDL_INOUT;
+ TAO_YY_BREAK
+case 62:
+TAO_YY_RULE_SETUP
+return IDL_IN;
+ TAO_YY_BREAK
+case 63:
+TAO_YY_RULE_SETUP
+return IDL_OUT;
+ TAO_YY_BREAK
+case 64:
+TAO_YY_RULE_SETUP
+return IDL_ONEWAY;
+ TAO_YY_BREAK
+case 65:
+TAO_YY_RULE_SETUP
+return IDL_LEFT_SHIFT;
+ TAO_YY_BREAK
+case 66:
+TAO_YY_RULE_SETUP
+return IDL_RIGHT_SHIFT;
+ TAO_YY_BREAK
+case 67:
+TAO_YY_RULE_SETUP
+{
+ tao_yylval.strval = (char *) "::";
+ return IDL_SCOPE_DELIMITOR;
+ }
+ TAO_YY_BREAK
+case 68:
+TAO_YY_RULE_SETUP
{
// Make sure that this identifier is not a C++ keyword. If it is,
// prepend it with a _cxx_. Lookup in the perfect hash table for C++
@@ -1304,221 +1461,222 @@ TAO_YY_RULE_SETUP
return IDENTIFIER;
}
- TAO_YY_BREAK
-case 51:
+ TAO_YY_BREAK
+case 69:
TAO_YY_RULE_SETUP
{
tao_yylval.dval = idl_atof(ace_tao_yytext);
return IDL_FLOATING_PT_LITERAL;
}
- TAO_YY_BREAK
-case 52:
+ TAO_YY_BREAK
+case 70:
TAO_YY_RULE_SETUP
{
tao_yylval.dval = idl_atof(ace_tao_yytext);
return IDL_FLOATING_PT_LITERAL;
}
- TAO_YY_BREAK
-case 53:
+ TAO_YY_BREAK
+case 71:
TAO_YY_RULE_SETUP
{
- tao_yylval.ival = idl_atoi(ace_tao_yytext, 10);
- return IDL_INTEGER_LITERAL;
- }
- TAO_YY_BREAK
-case 54:
+ tao_yylval.ival = idl_atoi(ace_tao_yytext, 10);
+ return IDL_INTEGER_LITERAL;
+ }
+ TAO_YY_BREAK
+case 72:
TAO_YY_RULE_SETUP
{
- tao_yylval.uival = idl_atoui(ace_tao_yytext, 10);
- return IDL_UINTEGER_LITERAL;
- }
- TAO_YY_BREAK
-case 55:
+ tao_yylval.uival = idl_atoui(ace_tao_yytext, 10);
+ return IDL_UINTEGER_LITERAL;
+ }
+ TAO_YY_BREAK
+case 73:
TAO_YY_RULE_SETUP
{
- tao_yylval.ival = idl_atoi(ace_tao_yytext, 16);
- return IDL_INTEGER_LITERAL;
- }
- TAO_YY_BREAK
-case 56:
+ tao_yylval.ival = idl_atoi(ace_tao_yytext, 16);
+ return IDL_INTEGER_LITERAL;
+ }
+ TAO_YY_BREAK
+case 74:
TAO_YY_RULE_SETUP
{
tao_yylval.uival = idl_atoui(ace_tao_yytext, 16);
- return IDL_UINTEGER_LITERAL;
- }
- TAO_YY_BREAK
-case 57:
+ return IDL_UINTEGER_LITERAL;
+ }
+ TAO_YY_BREAK
+case 75:
TAO_YY_RULE_SETUP
{
- tao_yylval.ival = idl_atoi(ace_tao_yytext, 8);
- return IDL_INTEGER_LITERAL;
- }
- TAO_YY_BREAK
-case 58:
+ tao_yylval.ival = idl_atoi(ace_tao_yytext, 8);
+ return IDL_INTEGER_LITERAL;
+ }
+ TAO_YY_BREAK
+case 76:
TAO_YY_RULE_SETUP
{
- tao_yylval.uival = idl_atoui(ace_tao_yytext, 8);
- return IDL_UINTEGER_LITERAL;
- }
- TAO_YY_BREAK
-case 59:
+ tao_yylval.uival = idl_atoui(ace_tao_yytext, 8);
+ return IDL_UINTEGER_LITERAL;
+ }
+ TAO_YY_BREAK
+case 77:
TAO_YY_RULE_SETUP
{
- /* Skip the quotes */
- char *tmp = ace_tao_yytext;
- tmp[strlen(tmp)-1] = '\0';
- tao_yylval.sval = new UTL_String(tmp + 1);
- return IDL_STRING_LITERAL;
- }
- TAO_YY_BREAK
-case 60:
+ /* Skip the quotes */
+ char *tmp = ace_tao_yytext;
+ tmp[strlen(tmp)-1] = '\0';
+ tao_yylval.sval = new UTL_String(tmp + 1);
+ return IDL_STRING_LITERAL;
+ }
+ TAO_YY_BREAK
+case 78:
TAO_YY_RULE_SETUP
{
- /* Skip the bookends */
- char *tmp = ACE_OS::strdup (ace_tao_yytext);
- tmp[strlen (tmp) - 1] = '\0';
- tao_yylval.wsval = idl_wstring_escape_reader(tmp + 2);
- return IDL_WSTRING_LITERAL;
- }
- TAO_YY_BREAK
-case 61:
+ /* Skip the bookends */
+ char *tmp = ACE_OS::strdup (ace_tao_yytext);
+ tmp[strlen (tmp) - 1] = '\0';
+ tao_yylval.wsval = idl_wstring_escape_reader(tmp + 2);
+ return IDL_WSTRING_LITERAL;
+ }
+ TAO_YY_BREAK
+case 79:
TAO_YY_RULE_SETUP
{
- tao_yylval.cval = ace_tao_yytext [1];
- return IDL_CHARACTER_LITERAL;
- }
- TAO_YY_BREAK
-case 62:
+ tao_yylval.cval = ace_tao_yytext [1];
+ return IDL_CHARACTER_LITERAL;
+ }
+ TAO_YY_BREAK
+case 80:
TAO_YY_RULE_SETUP
{
- // octal character constant
- tao_yylval.cval = idl_escape_reader(ace_tao_yytext + 1);
- return IDL_CHARACTER_LITERAL;
- }
- TAO_YY_BREAK
-case 63:
+ // octal character constant
+ tao_yylval.cval = idl_escape_reader(ace_tao_yytext + 1);
+ return IDL_CHARACTER_LITERAL;
+ }
+ TAO_YY_BREAK
+case 81:
TAO_YY_RULE_SETUP
{
- // hexadecimal character constant
- tao_yylval.cval = idl_escape_reader(ace_tao_yytext + 1);
- return IDL_CHARACTER_LITERAL;
- }
- TAO_YY_BREAK
-case 64:
+ // hexadecimal character constant
+ tao_yylval.cval = idl_escape_reader(ace_tao_yytext + 1);
+ return IDL_CHARACTER_LITERAL;
+ }
+ TAO_YY_BREAK
+case 82:
TAO_YY_RULE_SETUP
{
- tao_yylval.cval = idl_escape_reader(ace_tao_yytext + 1);
- return IDL_CHARACTER_LITERAL;
- }
- TAO_YY_BREAK
-case 65:
+ tao_yylval.cval = idl_escape_reader(ace_tao_yytext + 1);
+ return IDL_CHARACTER_LITERAL;
+ }
+ TAO_YY_BREAK
+case 83:
TAO_YY_RULE_SETUP
{
- // wide character constant
- tao_yylval.wcval = ace_tao_yytext [2];
- return IDL_WCHAR_LITERAL;
- }
- TAO_YY_BREAK
-case 66:
+ // wide character constant
+ tao_yylval.wcval = ace_tao_yytext [2];
+ return IDL_WCHAR_LITERAL;
+ }
+ TAO_YY_BREAK
+case 84:
TAO_YY_RULE_SETUP
{
- // hexadecimal wide character constant
- tao_yylval.wcval = idl_wchar_escape_reader(ace_tao_yytext + 2);
- return IDL_WCHAR_LITERAL;
- }
- TAO_YY_BREAK
-case 67:
-case 68:
+ // hexadecimal wide character constant
+ tao_yylval.wcval = idl_wchar_escape_reader(ace_tao_yytext + 2);
+ return IDL_WCHAR_LITERAL;
+ }
+ TAO_YY_BREAK
+case 85:
+case 86:
TAO_YY_RULE_SETUP
{/* remember pragma */
- idl_global->set_lineno(idl_global->lineno() + 1);
- idl_store_pragma(ace_tao_yytext);
-}
+ idl_global->set_lineno(idl_global->lineno() + 1);
+ idl_store_pragma(ace_tao_yytext);
+ }
break;
-case 69:
-case 70:
+case 87:
+case 88:
TAO_YY_RULE_SETUP
{/* ignore file */
- idl_global->set_lineno(idl_global->lineno() + 1);
- }
- break;
-case 71:
-case 72:
+ idl_global->set_lineno(idl_global->lineno() + 1);
+ }
+ TAO_YY_BREAK
+case 89:
+case 90:
TAO_YY_RULE_SETUP
{
- idl_parse_line_and_file(ace_tao_yytext);
- }
- break;
-case 73:
-case 74:
+ idl_parse_line_and_file(ace_tao_yytext);
+ }
+ TAO_YY_BREAK
+case 91:
+case 92:
TAO_YY_RULE_SETUP
{
- idl_parse_line_and_file(ace_tao_yytext);
- }
- break;
-case 75:
-case 76:
+ idl_parse_line_and_file(ace_tao_yytext);
+ }
+ break;
+case 93:
+case 94:
TAO_YY_RULE_SETUP
{
- idl_parse_line_and_file(ace_tao_yytext);
- }
- break;
-case 77:
-case 78:
+ idl_parse_line_and_file(ace_tao_yytext);
+ }
+ break;
+case 95:
+case 96:
TAO_YY_RULE_SETUP
{
- idl_parse_line_and_file(ace_tao_yytext);
- }
- break;
-case 79:
-case 80:
+ idl_parse_line_and_file(ace_tao_yytext);
+ }
+ break;
+case 97:
+case 98:
TAO_YY_RULE_SETUP
{
- /* ignore cpp ident */
- idl_global->set_lineno(idl_global->lineno() + 1);
- }
- break;
-case 81:
+ /* ignore cpp ident */
+ idl_global->set_lineno(idl_global->lineno() + 1);
+ }
+ break;
+case 99:
TAO_YY_RULE_SETUP
{
- /* ignore comments */
- idl_global->set_lineno(idl_global->lineno() + 1);
- }
- break;
-case 82:
+ /* ignore comments */
+ idl_global->set_lineno(idl_global->lineno() + 1);
+ }
+ break;
+case 100:
TAO_YY_RULE_SETUP
{
- for(;;) {
- char c = tao_yyinput();
- if (c == '*') {
- char next = tao_yyinput();
- if (next == '/')
- break;
- else
- tao_yyunput(c, NULL);
- if (c == '\n')
- idl_global->set_lineno(idl_global->lineno() + 1);
- }
- }
- }
- break;
-case 83:
+ for(;;) {
+ char c = tao_yyinput();
+ if (c == '*') {
+ char next = tao_yyinput();
+ if (next == '/')
+ break;
+ else
+ tao_yyunput(c, NULL);
+ if (c == '\n')
+ idl_global->set_lineno(idl_global->lineno() + 1);
+ }
+ }
+ }
+ break;
+case 101:
TAO_YY_RULE_SETUP
;
- break;
-case 84:
+ break;
+case 102:
TAO_YY_RULE_SETUP
{
- idl_global->set_lineno(idl_global->lineno() + 1);
- }
- break;
-case 85:
+ idl_global->set_lineno(idl_global->lineno() + 1);
+ }
+ break;
+case 103:
TAO_YY_RULE_SETUP
return ace_tao_yytext [0];
-case 86:
+ break;
+case 104:
TAO_YY_RULE_SETUP
TAO_YY_ECHO;
- break;
+ break;
case TAO_YY_STATE_EOF(INITIAL):
tao_yyterminate();
@@ -1651,67 +1809,68 @@ case TAO_YY_STATE_EOF(INITIAL):
} /* end of scanning one token */
} /* end of tao_yylex */
+
/* tao_yy_get_next_buffer - try to read in a new buffer
*
* Returns a code representing an action:
- * EOB_ACT_LAST_MATCH -
- * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- * EOB_ACT_END_OF_FILE - end of file
+ * EOB_ACT_LAST_MATCH -
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ * EOB_ACT_END_OF_FILE - end of file
*/
static int tao_yy_get_next_buffer()
- {
- register char *dest = tao_yy_current_buffer->tao_yy_ch_buf;
- register char *source = tao_yytext_ptr;
- register int number_to_move, i;
- int ret_val;
-
- if ( tao_yy_c_buf_p > &tao_yy_current_buffer->tao_yy_ch_buf[tao_yy_n_chars + 1] )
- TAO_YY_FATAL_ERROR(
- "fatal flex scanner internal error--end of buffer missed" );
-
- if ( tao_yy_current_buffer->tao_yy_fill_buffer == 0 )
- { /* Don't try to fill the buffer, so this is an EOF. */
- if ( tao_yy_c_buf_p - tao_yytext_ptr - TAO_YY_MORE_ADJ == 1 )
- {
- /* We matched a single character, the EOB, so
- * treat this as a final EOF.
- */
- return EOB_ACT_END_OF_FILE;
- }
-
- else
- {
- /* We matched some text prior to the EOB, first
- * process it.
- */
- return EOB_ACT_LAST_MATCH;
- }
- }
+ {
+ register char *dest = tao_yy_current_buffer->tao_yy_ch_buf;
+ register char *source = tao_yytext_ptr;
+ register int number_to_move, i;
+ int ret_val;
+
+ if ( tao_yy_c_buf_p > &tao_yy_current_buffer->tao_yy_ch_buf[tao_yy_n_chars + 1] )
+ TAO_YY_FATAL_ERROR(
+ "fatal flex scanner internal error--end of buffer missed" );
+
+ if ( tao_yy_current_buffer->tao_yy_fill_buffer == 0 )
+ { /* Don't try to fill the buffer, so this is an EOF. */
+ if ( tao_yy_c_buf_p - tao_yytext_ptr - TAO_YY_MORE_ADJ == 1 )
+ {
+ /* We matched a single character, the EOB, so
+ * treat this as a final EOF.
+ */
+ return EOB_ACT_END_OF_FILE;
+ }
+
+ else
+ {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
- /* Try to read more data. */
+ /* Try to read more data. */
- /* First move last chars to start of buffer. */
- number_to_move = (int) (tao_yy_c_buf_p - tao_yytext_ptr) - 1;
+ /* First move last chars to start of buffer. */
+ number_to_move = (int) (tao_yy_c_buf_p - tao_yytext_ptr) - 1;
- for ( i = 0; i < number_to_move; ++i )
- *(dest++) = *(source++);
+ for ( i = 0; i < number_to_move; ++i )
+ *(dest++) = *(source++);
- if ( tao_yy_current_buffer->tao_yy_buffer_status == TAO_YY_BUFFER_EOF_PENDING )
- /* don't do the read, it's not guaranteed to return an EOF,
- * just force an EOF
- */
- tao_yy_current_buffer->tao_yy_n_chars = tao_yy_n_chars = 0;
+ if ( tao_yy_current_buffer->tao_yy_buffer_status == TAO_YY_BUFFER_EOF_PENDING )
+ /* don't do the read, it's not guaranteed to return an EOF,
+ * just force an EOF
+ */
+ tao_yy_current_buffer->tao_yy_n_chars = tao_yy_n_chars = 0;
- else
- {
- int num_to_read =
- tao_yy_current_buffer->tao_yy_buf_size - number_to_move - 1;
+ else
+ {
+ int num_to_read =
+ tao_yy_current_buffer->tao_yy_buf_size - number_to_move - 1;
- while ( num_to_read <= 0 )
- { /* Not enough room in the buffer - grow it. */
+ while ( num_to_read <= 0 )
+ { /* Not enough room in the buffer - grow it. */
#ifdef TAO_YY_USES_REJECT
- TAO_YY_FATAL_ERROR(
+ TAO_YY_FATAL_ERROR(
"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
#else
@@ -1788,41 +1947,42 @@ static int tao_yy_get_next_buffer()
return ret_val;
}
+
/* tao_yy_get_previous_state - get the state just before the EOB char was reached */
static tao_yy_state_type tao_yy_get_previous_state()
- {
- register tao_yy_state_type tao_yy_current_state;
- register char *tao_yy_cp;
-
- tao_yy_current_state = tao_yy_start;
- tao_yy_current_state += TAO_YY_AT_BOL();
-
- for ( tao_yy_cp = tao_yytext_ptr + TAO_YY_MORE_ADJ; tao_yy_cp < tao_yy_c_buf_p; ++tao_yy_cp )
- {
- register TAO_YY_CHAR tao_yy_c = (*tao_yy_cp ? tao_yy_ec[TAO_YY_SC_TO_UI(*tao_yy_cp)] : 1);
- if ( tao_yy_accept[tao_yy_current_state] )
- {
- tao_yy_last_accepting_state = tao_yy_current_state;
- tao_yy_last_accepting_cpos = tao_yy_cp;
- }
- while ( tao_yy_chk[tao_yy_base[tao_yy_current_state] + tao_yy_c] != tao_yy_current_state )
- {
- tao_yy_current_state = (int) tao_yy_def[tao_yy_current_state];
- if ( tao_yy_current_state >= 445 )
- tao_yy_c = tao_yy_meta[(unsigned int) tao_yy_c];
- }
- tao_yy_current_state = tao_yy_nxt[tao_yy_base[tao_yy_current_state] + (unsigned int) tao_yy_c];
- }
+ {
+ register tao_yy_state_type tao_yy_current_state;
+ register char *tao_yy_cp;
- return tao_yy_current_state;
- }
+ tao_yy_current_state = tao_yy_start;
+ tao_yy_current_state += TAO_YY_AT_BOL();
+
+ for ( tao_yy_cp = tao_yytext_ptr + TAO_YY_MORE_ADJ; tao_yy_cp < tao_yy_c_buf_p; ++tao_yy_cp )
+ {
+ register TAO_YY_CHAR tao_yy_c = (*tao_yy_cp ? tao_yy_ec[TAO_YY_SC_TO_UI(*tao_yy_cp)] : 1);
+ if ( tao_yy_accept[tao_yy_current_state] )
+ {
+ tao_yy_last_accepting_state = tao_yy_current_state;
+ tao_yy_last_accepting_cpos = tao_yy_cp;
+ }
+ while ( tao_yy_chk[tao_yy_base[tao_yy_current_state] + tao_yy_c] != tao_yy_current_state )
+ {
+ tao_yy_current_state = (int) tao_yy_def[tao_yy_current_state];
+ if ( tao_yy_current_state >= 549 )
+ tao_yy_c = tao_yy_meta[(unsigned int) tao_yy_c];
+ }
+ tao_yy_current_state = tao_yy_nxt[tao_yy_base[tao_yy_current_state] + (unsigned int) tao_yy_c];
+ }
+
+ return tao_yy_current_state;
+ }
/* tao_yy_try_NUL_trans - try to make a transition on the NUL character
*
* synopsis
- * next_state = tao_yy_try_NUL_trans( current_state );
+ * next_state = tao_yy_try_NUL_trans( current_state );
*/
#ifdef TAO_YY_USE_PROTOS
@@ -1831,27 +1991,27 @@ static tao_yy_state_type tao_yy_try_NUL_trans( tao_yy_state_type tao_yy_current_
static tao_yy_state_type tao_yy_try_NUL_trans( tao_yy_current_state )
tao_yy_state_type tao_yy_current_state;
#endif
- {
- register int tao_yy_is_jam;
- register char *tao_yy_cp = tao_yy_c_buf_p;
-
- register TAO_YY_CHAR tao_yy_c = 1;
- if ( tao_yy_accept[tao_yy_current_state] )
- {
- tao_yy_last_accepting_state = tao_yy_current_state;
- tao_yy_last_accepting_cpos = tao_yy_cp;
- }
- while ( tao_yy_chk[tao_yy_base[tao_yy_current_state] + tao_yy_c] != tao_yy_current_state )
- {
- tao_yy_current_state = (int) tao_yy_def[tao_yy_current_state];
- if ( tao_yy_current_state >= 445 )
- tao_yy_c = tao_yy_meta[(unsigned int) tao_yy_c];
- }
- tao_yy_current_state = tao_yy_nxt[tao_yy_base[tao_yy_current_state] + (unsigned int) tao_yy_c];
- tao_yy_is_jam = (tao_yy_current_state == 444);
+ {
+ register int tao_yy_is_jam;
+ register char *tao_yy_cp = tao_yy_c_buf_p;
- return tao_yy_is_jam ? 0 : tao_yy_current_state;
- }
+ register TAO_YY_CHAR tao_yy_c = 1;
+ if ( tao_yy_accept[tao_yy_current_state] )
+ {
+ tao_yy_last_accepting_state = tao_yy_current_state;
+ tao_yy_last_accepting_cpos = tao_yy_cp;
+ }
+ while ( tao_yy_chk[tao_yy_base[tao_yy_current_state] + tao_yy_c] != tao_yy_current_state )
+ {
+ tao_yy_current_state = (int) tao_yy_def[tao_yy_current_state];
+ if ( tao_yy_current_state >= 549 )
+ tao_yy_c = tao_yy_meta[(unsigned int) tao_yy_c];
+ }
+ tao_yy_current_state = tao_yy_nxt[tao_yy_base[tao_yy_current_state] + (unsigned int) tao_yy_c];
+ tao_yy_is_jam = (tao_yy_current_state == 548);
+
+ return tao_yy_is_jam ? 0 : tao_yy_current_state;
+ }
#ifndef TAO_YY_NO_UNPUT
@@ -1862,41 +2022,41 @@ static void tao_yyunput( c, tao_yy_bp )
int c;
register char *tao_yy_bp;
#endif
- {
- register char *tao_yy_cp = tao_yy_c_buf_p;
-
- /* undo effects of setting up tao_yytext */
- *tao_yy_cp = tao_yy_hold_char;
-
- if ( tao_yy_cp < tao_yy_current_buffer->tao_yy_ch_buf + 2 )
- { /* need to shift things up to make room */
- /* +2 for EOB chars. */
- register int number_to_move = tao_yy_n_chars + 2;
- register char *dest = &tao_yy_current_buffer->tao_yy_ch_buf[
- tao_yy_current_buffer->tao_yy_buf_size + 2];
- register char *source =
- &tao_yy_current_buffer->tao_yy_ch_buf[number_to_move];
-
- while ( source > tao_yy_current_buffer->tao_yy_ch_buf )
- *--dest = *--source;
-
- tao_yy_cp += (int) (dest - source);
- tao_yy_bp += (int) (dest - source);
- tao_yy_current_buffer->tao_yy_n_chars =
- tao_yy_n_chars = tao_yy_current_buffer->tao_yy_buf_size;
-
- if ( tao_yy_cp < tao_yy_current_buffer->tao_yy_ch_buf + 2 )
- TAO_YY_FATAL_ERROR( "flex scanner push-back overflow" );
- }
+ {
+ register char *tao_yy_cp = tao_yy_c_buf_p;
+
+ /* undo effects of setting up tao_yytext */
+ *tao_yy_cp = tao_yy_hold_char;
+
+ if ( tao_yy_cp < tao_yy_current_buffer->tao_yy_ch_buf + 2 )
+ { /* need to shift things up to make room */
+ /* +2 for EOB chars. */
+ register int number_to_move = tao_yy_n_chars + 2;
+ register char *dest = &tao_yy_current_buffer->tao_yy_ch_buf[
+ tao_yy_current_buffer->tao_yy_buf_size + 2];
+ register char *source =
+ &tao_yy_current_buffer->tao_yy_ch_buf[number_to_move];
+
+ while ( source > tao_yy_current_buffer->tao_yy_ch_buf )
+ *--dest = *--source;
+
+ tao_yy_cp += (int) (dest - source);
+ tao_yy_bp += (int) (dest - source);
+ tao_yy_current_buffer->tao_yy_n_chars =
+ tao_yy_n_chars = tao_yy_current_buffer->tao_yy_buf_size;
+
+ if ( tao_yy_cp < tao_yy_current_buffer->tao_yy_ch_buf + 2 )
+ TAO_YY_FATAL_ERROR( "flex scanner push-back overflow" );
+ }
- *--tao_yy_cp = (char) c;
+ *--tao_yy_cp = (char) c;
- tao_yytext_ptr = tao_yy_bp;
- tao_yy_hold_char = *tao_yy_cp;
- tao_yy_c_buf_p = tao_yy_cp;
- }
-#endif /* ifndef TAO_YY_NO_UNPUT */
+ tao_yytext_ptr = tao_yy_bp;
+ tao_yy_hold_char = *tao_yy_cp;
+ tao_yy_c_buf_p = tao_yy_cp;
+ }
+#endif /* ifndef TAO_YY_NO_UNPUT */
#ifdef __cplusplus
@@ -1904,73 +2064,73 @@ static int tao_yyinput()
#else
static int input()
#endif
- {
- int c;
-
- *tao_yy_c_buf_p = tao_yy_hold_char;
-
- if ( *tao_yy_c_buf_p == TAO_YY_END_OF_BUFFER_CHAR )
- {
- /* tao_yy_c_buf_p now points to the character we want to return.
- * If this occurs *before* the EOB characters, then it's a
- * valid NUL; if not, then we've hit the end of the buffer.
- */
- if ( tao_yy_c_buf_p < &tao_yy_current_buffer->tao_yy_ch_buf[tao_yy_n_chars] )
- /* This was really a NUL. */
- *tao_yy_c_buf_p = '\0';
-
- else
- { /* need more input */
- int offset = tao_yy_c_buf_p - tao_yytext_ptr;
- ++tao_yy_c_buf_p;
-
- switch ( tao_yy_get_next_buffer() )
- {
- case EOB_ACT_LAST_MATCH:
- /* This happens because tao_yy_g_n_b()
- * sees that we've accumulated a
- * token and flags that we need to
- * try matching the token before
- * proceeding. But for input(),
- * there's no matching to consider.
- * So convert the EOB_ACT_LAST_MATCH
- * to EOB_ACT_END_OF_FILE.
- */
-
- /* Reset buffer status. */
- tao_yyrestart( tao_yyin );
-
- /* fall through */
-
- case EOB_ACT_END_OF_FILE:
- {
- if ( tao_yywrap() )
- return EOF;
-
- if ( ! tao_yy_did_buffer_switch_on_eof )
- TAO_YY_NEW_FILE;
+ {
+ int c;
+
+ *tao_yy_c_buf_p = tao_yy_hold_char;
+
+ if ( *tao_yy_c_buf_p == TAO_YY_END_OF_BUFFER_CHAR )
+ {
+ /* tao_yy_c_buf_p now points to the character we want to return.
+ * If this occurs *before* the EOB characters, then it's a
+ * valid NUL; if not, then we've hit the end of the buffer.
+ */
+ if ( tao_yy_c_buf_p < &tao_yy_current_buffer->tao_yy_ch_buf[tao_yy_n_chars] )
+ /* This was really a NUL. */
+ *tao_yy_c_buf_p = '\0';
+
+ else
+ { /* need more input */
+ int offset = tao_yy_c_buf_p - tao_yytext_ptr;
+ ++tao_yy_c_buf_p;
+
+ switch ( tao_yy_get_next_buffer() )
+ {
+ case EOB_ACT_LAST_MATCH:
+ /* This happens because tao_yy_g_n_b()
+ * sees that we've accumulated a
+ * token and flags that we need to
+ * try matching the token before
+ * proceeding. But for input(),
+ * there's no matching to consider.
+ * So convert the EOB_ACT_LAST_MATCH
+ * to EOB_ACT_END_OF_FILE.
+ */
+
+ /* Reset buffer status. */
+ tao_yyrestart( tao_yyin );
+
+ /* fall through */
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( tao_yywrap() )
+ return EOF;
+
+ if ( ! tao_yy_did_buffer_switch_on_eof )
+ TAO_YY_NEW_FILE;
#ifdef __cplusplus
- return tao_yyinput();
+ return tao_yyinput();
#else
- return input();
+ return input();
#endif
- }
+ }
- case EOB_ACT_CONTINUE_SCAN:
- tao_yy_c_buf_p = tao_yytext_ptr + offset;
- break;
- }
- }
- }
+ case EOB_ACT_CONTINUE_SCAN:
+ tao_yy_c_buf_p = tao_yytext_ptr + offset;
+ break;
+ }
+ }
+ }
- c = *(unsigned char *) tao_yy_c_buf_p; /* cast for 8-bit char's */
- *tao_yy_c_buf_p = '\0'; /* preserve tao_yytext */
- tao_yy_hold_char = *++tao_yy_c_buf_p;
+ c = *(unsigned char *) tao_yy_c_buf_p; /* cast for 8-bit char's */
+ *tao_yy_c_buf_p = '\0'; /* preserve tao_yytext */
+ tao_yy_hold_char = *++tao_yy_c_buf_p;
- tao_yy_current_buffer->tao_yy_at_bol = (c == '\n');
+ tao_yy_current_buffer->tao_yy_at_bol = (c == '\n');
- return c;
- }
+ return c;
+ }
#ifdef TAO_YY_USE_PROTOS
@@ -1979,13 +2139,13 @@ void tao_yyrestart( FILE *input_file )
void tao_yyrestart( input_file )
FILE *input_file;
#endif
- {
- if ( ! tao_yy_current_buffer )
- tao_yy_current_buffer = tao_yy_create_buffer( tao_yyin, TAO_YY_BUF_SIZE );
+ {
+ if ( ! tao_yy_current_buffer )
+ tao_yy_current_buffer = tao_yy_create_buffer( tao_yyin, TAO_YY_BUF_SIZE );
- tao_yy_init_buffer( tao_yy_current_buffer, input_file );
- tao_yy_load_buffer_state();
- }
+ tao_yy_init_buffer( tao_yy_current_buffer, input_file );
+ tao_yy_load_buffer_state();
+ }
#ifdef TAO_YY_USE_PROTOS
@@ -2017,17 +2177,18 @@ TAO_YY_BUFFER_STATE new_buffer;
tao_yy_did_buffer_switch_on_eof = 1;
}
+
#ifdef TAO_YY_USE_PROTOS
void tao_yy_load_buffer_state( void )
#else
void tao_yy_load_buffer_state()
#endif
- {
- tao_yy_n_chars = tao_yy_current_buffer->tao_yy_n_chars;
- tao_yytext_ptr = tao_yy_c_buf_p = tao_yy_current_buffer->tao_yy_buf_pos;
- tao_yyin = tao_yy_current_buffer->tao_yy_input_file;
- tao_yy_hold_char = *tao_yy_c_buf_p;
- }
+ {
+ tao_yy_n_chars = tao_yy_current_buffer->tao_yy_n_chars;
+ tao_yytext_ptr = tao_yy_c_buf_p = tao_yy_current_buffer->tao_yy_buf_pos;
+ tao_yyin = tao_yy_current_buffer->tao_yy_input_file;
+ tao_yy_hold_char = *tao_yy_c_buf_p;
+ }
#ifdef TAO_YY_USE_PROTOS
@@ -2037,28 +2198,28 @@ TAO_YY_BUFFER_STATE tao_yy_create_buffer( file, size )
FILE *file;
int size;
#endif
- {
- TAO_YY_BUFFER_STATE b;
+ {
+ TAO_YY_BUFFER_STATE b;
- b = (TAO_YY_BUFFER_STATE) tao_yy_flex_alloc( sizeof( struct tao_yy_buffer_state ) );
- if ( ! b )
- TAO_YY_FATAL_ERROR( "out of dynamic memory in tao_yy_create_buffer()" );
+ b = (TAO_YY_BUFFER_STATE) tao_yy_flex_alloc( sizeof( struct tao_yy_buffer_state ) );
+ if ( ! b )
+ TAO_YY_FATAL_ERROR( "out of dynamic memory in tao_yy_create_buffer()" );
- b->tao_yy_buf_size = size;
+ b->tao_yy_buf_size = size;
- /* tao_yy_ch_buf has to be 2 characters longer than the size given because
- * we need to put in 2 end-of-buffer characters.
- */
- b->tao_yy_ch_buf = (char *) tao_yy_flex_alloc( b->tao_yy_buf_size + 2 );
- if ( ! b->tao_yy_ch_buf )
- TAO_YY_FATAL_ERROR( "out of dynamic memory in tao_yy_create_buffer()" );
+ /* tao_yy_ch_buf has to be 2 characters longer than the size given because
+ * we need to put in 2 end-of-buffer characters.
+ */
+ b->tao_yy_ch_buf = (char *) tao_yy_flex_alloc( b->tao_yy_buf_size + 2 );
+ if ( ! b->tao_yy_ch_buf )
+ TAO_YY_FATAL_ERROR( "out of dynamic memory in tao_yy_create_buffer()" );
- b->tao_yy_is_our_buffer = 1;
+ b->tao_yy_is_our_buffer = 1;
- tao_yy_init_buffer( b, file );
+ tao_yy_init_buffer( b, file );
- return b;
- }
+ return b;
+ }
#ifdef TAO_YY_USE_PROTOS
@@ -2067,18 +2228,18 @@ void tao_yy_delete_buffer( TAO_YY_BUFFER_STATE b )
void tao_yy_delete_buffer( b )
TAO_YY_BUFFER_STATE b;
#endif
- {
- if ( ! b )
- return;
+ {
+ if ( ! b )
+ return;
- if ( b == tao_yy_current_buffer )
- tao_yy_current_buffer = (TAO_YY_BUFFER_STATE) 0;
+ if ( b == tao_yy_current_buffer )
+ tao_yy_current_buffer = (TAO_YY_BUFFER_STATE) 0;
- if ( b->tao_yy_is_our_buffer )
- tao_yy_flex_free( (void *) b->tao_yy_ch_buf );
+ if ( b->tao_yy_is_our_buffer )
+ tao_yy_flex_free( (void *) b->tao_yy_ch_buf );
- tao_yy_flex_free( (void *) b );
- }
+ tao_yy_flex_free( (void *) b );
+ }
#ifndef TAO_YY_ALWAYS_INTERACTIVE
@@ -2096,22 +2257,22 @@ FILE *file;
#endif
- {
- tao_yy_flush_buffer( b );
+ {
+ tao_yy_flush_buffer( b );
- b->tao_yy_input_file = file;
- b->tao_yy_fill_buffer = 1;
+ b->tao_yy_input_file = file;
+ b->tao_yy_fill_buffer = 1;
#if TAO_YY_ALWAYS_INTERACTIVE
- b->tao_yy_is_interactive = 1;
+ b->tao_yy_is_interactive = 1;
#else
#if TAO_YY_NEVER_INTERACTIVE
- b->tao_yy_is_interactive = 0;
+ b->tao_yy_is_interactive = 0;
#else
- b->tao_yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+ b->tao_yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
#endif
#endif
- }
+ }
#ifdef TAO_YY_USE_PROTOS
@@ -2121,27 +2282,27 @@ void tao_yy_flush_buffer( b )
TAO_YY_BUFFER_STATE b;
#endif
- {
- if ( ! b )
- return;
+ {
+ if ( ! b )
+ return;
- b->tao_yy_n_chars = 0;
+ b->tao_yy_n_chars = 0;
- /* We always need two end-of-buffer characters. The first causes
- * a transition to the end-of-buffer state. The second causes
- * a jam in that state.
- */
- b->tao_yy_ch_buf[0] = TAO_YY_END_OF_BUFFER_CHAR;
- b->tao_yy_ch_buf[1] = TAO_YY_END_OF_BUFFER_CHAR;
+ /* We always need two end-of-buffer characters. The first causes
+ * a transition to the end-of-buffer state. The second causes
+ * a jam in that state.
+ */
+ b->tao_yy_ch_buf[0] = TAO_YY_END_OF_BUFFER_CHAR;
+ b->tao_yy_ch_buf[1] = TAO_YY_END_OF_BUFFER_CHAR;
- b->tao_yy_buf_pos = &b->tao_yy_ch_buf[0];
+ b->tao_yy_buf_pos = &b->tao_yy_ch_buf[0];
- b->tao_yy_at_bol = 1;
- b->tao_yy_buffer_status = TAO_YY_BUFFER_NEW;
+ b->tao_yy_at_bol = 1;
+ b->tao_yy_buffer_status = TAO_YY_BUFFER_NEW;
- if ( b == tao_yy_current_buffer )
- tao_yy_load_buffer_state();
- }
+ if ( b == tao_yy_current_buffer )
+ tao_yy_load_buffer_state();
+ }
#ifndef TAO_YY_NO_SCAN_BUFFER
@@ -2152,33 +2313,33 @@ TAO_YY_BUFFER_STATE tao_yy_scan_buffer( base, size )
char *base;
tao_yy_size_t size;
#endif
- {
- TAO_YY_BUFFER_STATE b;
-
- if ( size < 2 ||
- base[size-2] != TAO_YY_END_OF_BUFFER_CHAR ||
- base[size-1] != TAO_YY_END_OF_BUFFER_CHAR )
- /* They forgot to leave room for the EOB's. */
- return 0;
-
- b = (TAO_YY_BUFFER_STATE) tao_yy_flex_alloc( sizeof( struct tao_yy_buffer_state ) );
- if ( ! b )
- TAO_YY_FATAL_ERROR( "out of dynamic memory in tao_yy_scan_buffer()" );
-
- b->tao_yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
- b->tao_yy_buf_pos = b->tao_yy_ch_buf = base;
- b->tao_yy_is_our_buffer = 0;
- b->tao_yy_input_file = 0;
- b->tao_yy_n_chars = b->tao_yy_buf_size;
- b->tao_yy_is_interactive = 0;
- b->tao_yy_at_bol = 1;
- b->tao_yy_fill_buffer = 0;
- b->tao_yy_buffer_status = TAO_YY_BUFFER_NEW;
-
- tao_yy_switch_to_buffer( b );
-
- return b;
- }
+ {
+ TAO_YY_BUFFER_STATE b;
+
+ if ( size < 2 ||
+ base[size-2] != TAO_YY_END_OF_BUFFER_CHAR ||
+ base[size-1] != TAO_YY_END_OF_BUFFER_CHAR )
+ /* They forgot to leave room for the EOB's. */
+ return 0;
+
+ b = (TAO_YY_BUFFER_STATE) tao_yy_flex_alloc( sizeof( struct tao_yy_buffer_state ) );
+ if ( ! b )
+ TAO_YY_FATAL_ERROR( "out of dynamic memory in tao_yy_scan_buffer()" );
+
+ b->tao_yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
+ b->tao_yy_buf_pos = b->tao_yy_ch_buf = base;
+ b->tao_yy_is_our_buffer = 0;
+ b->tao_yy_input_file = 0;
+ b->tao_yy_n_chars = b->tao_yy_buf_size;
+ b->tao_yy_is_interactive = 0;
+ b->tao_yy_at_bol = 1;
+ b->tao_yy_fill_buffer = 0;
+ b->tao_yy_buffer_status = TAO_YY_BUFFER_NEW;
+
+ tao_yy_switch_to_buffer( b );
+
+ return b;
+ }
#endif
@@ -2189,13 +2350,13 @@ TAO_YY_BUFFER_STATE tao_yy_scan_string( tao_yyconst char *tao_yy_str )
TAO_YY_BUFFER_STATE tao_yy_scan_string( tao_yy_str )
tao_yyconst char *tao_yy_str;
#endif
- {
- int len;
- for ( len = 0; tao_yy_str[len]; ++len )
- ;
+ {
+ int len;
+ for ( len = 0; tao_yy_str[len]; ++len )
+ ;
- return tao_yy_scan_bytes( tao_yy_str, len );
- }
+ return tao_yy_scan_bytes( tao_yy_str, len );
+ }
#endif
@@ -2207,34 +2368,34 @@ TAO_YY_BUFFER_STATE tao_yy_scan_bytes( bytes, len )
tao_yyconst char *bytes;
int len;
#endif
- {
- TAO_YY_BUFFER_STATE b;
- char *buf;
- tao_yy_size_t n;
- int i;
+ {
+ TAO_YY_BUFFER_STATE b;
+ char *buf;
+ tao_yy_size_t n;
+ int i;
- /* Get memory for full buffer, including space for trailing EOB's. */
- n = len + 2;
- buf = (char *) tao_yy_flex_alloc( n );
- if ( ! buf )
- TAO_YY_FATAL_ERROR( "out of dynamic memory in tao_yy_scan_bytes()" );
+ /* Get memory for full buffer, including space for trailing EOB's. */
+ n = len + 2;
+ buf = (char *) tao_yy_flex_alloc( n );
+ if ( ! buf )
+ TAO_YY_FATAL_ERROR( "out of dynamic memory in tao_yy_scan_bytes()" );
- for ( i = 0; i < len; ++i )
- buf[i] = bytes[i];
+ for ( i = 0; i < len; ++i )
+ buf[i] = bytes[i];
- buf[len] = buf[len+1] = TAO_YY_END_OF_BUFFER_CHAR;
+ buf[len] = buf[len+1] = TAO_YY_END_OF_BUFFER_CHAR;
- b = tao_yy_scan_buffer( buf, n );
- if ( ! b )
- TAO_YY_FATAL_ERROR( "bad buffer in tao_yy_scan_bytes()" );
+ b = tao_yy_scan_buffer( buf, n );
+ if ( ! b )
+ TAO_YY_FATAL_ERROR( "bad buffer in tao_yy_scan_bytes()" );
- /* It's okay to grow etc. this buffer, and we should throw it
- * away when we're done.
- */
- b->tao_yy_is_our_buffer = 1;
+ /* It's okay to grow etc. this buffer, and we should throw it
+ * away when we're done.
+ */
+ b->tao_yy_is_our_buffer = 1;
- return b;
- }
+ return b;
+ }
#endif
@@ -2245,49 +2406,49 @@ static void tao_yy_push_state( int new_state )
static void tao_yy_push_state( new_state )
int new_state;
#endif
- {
- if ( tao_yy_start_stack_ptr >= tao_yy_start_stack_depth )
- {
- tao_yy_size_t new_size;
+ {
+ if ( tao_yy_start_stack_ptr >= tao_yy_start_stack_depth )
+ {
+ tao_yy_size_t new_size;
- tao_yy_start_stack_depth += TAO_YY_START_STACK_INCR;
- new_size = tao_yy_start_stack_depth * sizeof( int );
+ tao_yy_start_stack_depth += TAO_YY_START_STACK_INCR;
+ new_size = tao_yy_start_stack_depth * sizeof( int );
- if ( ! tao_yy_start_stack )
- tao_yy_start_stack = (int *) tao_yy_flex_alloc( new_size );
+ if ( ! tao_yy_start_stack )
+ tao_yy_start_stack = (int *) tao_yy_flex_alloc( new_size );
- else
- tao_yy_start_stack = (int *) tao_yy_flex_realloc(
- (void *) tao_yy_start_stack, new_size );
+ else
+ tao_yy_start_stack = (int *) tao_yy_flex_realloc(
+ (void *) tao_yy_start_stack, new_size );
- if ( ! tao_yy_start_stack )
- TAO_YY_FATAL_ERROR(
- "out of memory expanding start-condition stack" );
- }
+ if ( ! tao_yy_start_stack )
+ TAO_YY_FATAL_ERROR(
+ "out of memory expanding start-condition stack" );
+ }
- tao_yy_start_stack[tao_yy_start_stack_ptr++] = TAO_YY_START;
+ tao_yy_start_stack[tao_yy_start_stack_ptr++] = TAO_YY_START;
- BEGIN(new_state);
- }
+ BEGIN(new_state);
+ }
#endif
#ifndef TAO_YY_NO_POP_STATE
static void tao_yy_pop_state()
- {
- if ( --tao_yy_start_stack_ptr < 0 )
- TAO_YY_FATAL_ERROR( "start-condition stack underflow" );
+ {
+ if ( --tao_yy_start_stack_ptr < 0 )
+ TAO_YY_FATAL_ERROR( "start-condition stack underflow" );
- BEGIN(tao_yy_start_stack[tao_yy_start_stack_ptr]);
- }
+ BEGIN(tao_yy_start_stack[tao_yy_start_stack_ptr]);
+ }
#endif
#ifndef TAO_YY_NO_TOP_STATE
static int tao_yy_top_state()
- {
- return tao_yy_start_stack[tao_yy_start_stack_ptr - 1];
- }
+ {
+ return tao_yy_start_stack[tao_yy_start_stack_ptr - 1];
+ }
#endif
#ifndef TAO_YY_EXIT_FAILURE
@@ -2300,10 +2461,10 @@ static void tao_yy_fatal_error( tao_yyconst char msg[] )
static void tao_yy_fatal_error( msg )
char msg[];
#endif
- {
- (void) fprintf( stderr, "%s\n", msg );
- exit( TAO_YY_EXIT_FAILURE );
- }
+ {
+ (void) fprintf( stderr, "%s\n", msg );
+ exit( TAO_YY_EXIT_FAILURE );
+ }
@@ -2311,16 +2472,16 @@ char msg[];
#undef tao_yyless
#define tao_yyless(n) \
- do \
- { \
- /* Undo effects of setting up tao_yytext. */ \
- tao_yytext[tao_yyleng] = tao_yy_hold_char; \
- tao_yy_c_buf_p = tao_yytext + n; \
- tao_yy_hold_char = *tao_yy_c_buf_p; \
- *tao_yy_c_buf_p = '\0'; \
- tao_yyleng = n; \
- } \
- while ( 0 )
+ do \
+ { \
+ /* Undo effects of setting up tao_yytext. */ \
+ tao_yytext[tao_yyleng] = tao_yy_hold_char; \
+ tao_yy_c_buf_p = tao_yytext + n; \
+ tao_yy_hold_char = *tao_yy_c_buf_p; \
+ *tao_yy_c_buf_p = '\0'; \
+ tao_yyleng = n; \
+ } \
+ while ( 0 )
/* Internal utility routines. */
@@ -2334,11 +2495,11 @@ char *s1;
tao_yyconst char *s2;
int n;
#endif
- {
- register int i;
- for ( i = 0; i < n; ++i )
- s1[i] = s2[i];
- }
+ {
+ register int i;
+ for ( i = 0; i < n; ++i )
+ s1[i] = s2[i];
+ }
#endif
#ifdef TAO_YY_NEED_STRLEN
@@ -2348,13 +2509,13 @@ static int tao_yy_flex_strlen( tao_yyconst char *s )
static int tao_yy_flex_strlen( s )
tao_yyconst char *s;
#endif
- {
- register int n;
- for ( n = 0; s[n]; ++n )
- ;
+ {
+ register int n;
+ for ( n = 0; s[n]; ++n )
+ ;
- return n;
- }
+ return n;
+ }
#endif
@@ -2364,9 +2525,9 @@ static void *tao_yy_flex_alloc( tao_yy_size_t size )
static void *tao_yy_flex_alloc( size )
tao_yy_size_t size;
#endif
- {
- return (void *) malloc( size );
- }
+ {
+ return (void *) malloc( size );
+ }
#ifdef TAO_YY_USE_PROTOS
static void *tao_yy_flex_realloc( void *ptr, tao_yy_size_t size )
@@ -2375,16 +2536,16 @@ static void *tao_yy_flex_realloc( ptr, size )
void *ptr;
tao_yy_size_t size;
#endif
- {
- /* The cast to (char *) in the following accommodates both
- * implementations that use char* generic pointers, and those
- * that use void* generic pointers. It works with the latter
- * because both ANSI C and C++ allow castless assignment from
- * any pointer type to void*, and deal with argument conversions
- * as though doing an assignment.
- */
- return (void *) realloc( (char *) ptr, size );
- }
+ {
+ /* The cast to (char *) in the following accommodates both
+ * implementations that use char* generic pointers, and those
+ * that use void* generic pointers. It works with the latter
+ * because both ANSI C and C++ allow castless assignment from
+ * any pointer type to void*, and deal with argument conversions
+ * as though doing an assignment.
+ */
+ return (void *) realloc( (char *) ptr, size );
+ }
#ifdef TAO_YY_USE_PROTOS
static void tao_yy_flex_free( void *ptr )
@@ -2392,19 +2553,19 @@ static void tao_yy_flex_free( void *ptr )
static void tao_yy_flex_free( ptr )
void *ptr;
#endif
- {
- free( ptr );
- }
+ {
+ free( ptr );
+ }
#if TAO_YY_MAIN
int main()
- {
- tao_yylex();
- return 0;
- }
+ {
+ tao_yylex();
+ return 0;
+ }
#endif
- /* subroutines */
+ /* subroutines */
/*
* Strip down a name to the last component, i.e. everything after the last
@@ -2413,11 +2574,11 @@ int main()
static char *
stripped_name(UTL_String *fn)
{
- char *n = fn->get_string();
- long l;
+ char *n = fn->get_string();
+ long l;
if (n == NULL)
- return NULL;
+ return NULL;
l = strlen(n);
for (n += l; l > 0 && *n != '/'; l--, n--);
if (*n == '/') n++;
@@ -2542,7 +2703,7 @@ idl_parse_line_and_file (char *buf)
}
else if (is_main_filename
&& idl_global->pragma_prefixes ().size () > 1
- && idl_global->scopes ()->depth () == 1)
+ && idl_global->scopes ().depth () == 1)
{
// If we're here, we have come to the end of an included file, so we
// pop its prefix.
@@ -2607,12 +2768,12 @@ idl_store_pragma (char *buf)
if (new_prefix != 0)
{
- unsigned long depth = idl_global->scopes ()->depth ();
+ unsigned long depth = idl_global->scopes ().depth ();
// At global scope, we always replace the prefix. For all
// other scopes, we replace only if there is a prefix already
// associated with that scope, otherwise we add the prefix.
- if (depth == 1 || idl_global->scopes ()->top ()->has_prefix ())
+ if (depth == 1 || idl_global->scopes ().top ()->has_prefix ())
{
char *trash = 0;
idl_global->pragma_prefixes ().pop (trash);
@@ -2621,7 +2782,7 @@ idl_store_pragma (char *buf)
if (depth > 1)
{
- idl_global->scopes ()->top ()->has_prefix (1);
+ idl_global->scopes ().top ()->has_prefix (1);
}
idl_global->pragma_prefixes ().push (new_prefix);
@@ -2658,7 +2819,7 @@ idl_store_pragma (char *buf)
d->version (ACE::strnew (number));
}
- else if (ACE_OS::strncmp (buf + 8, "ident", 5) == 0)
+ else if (ACE_OS::strncmp (buf + 8, "ident", 5) == 0)
{
idl_global->ident_string (buf + 8);
}
@@ -2683,6 +2844,7 @@ idl_store_pragma (char *buf)
if (new_id != 0)
{
d->repoID (new_id);
+ d->typeid_set (1);
}
}
}
@@ -2693,25 +2855,25 @@ idl_store_pragma (char *buf)
static long
idl_atoi(char *s, long b)
{
- long r = 0;
- s++;
-
- if (b == 8 && *s == '0')
- s++;
- else if (b == 16 && *s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X'))
- s += 2;
-
- for (; *s; s++)
- if (*s <= '9' && *s >= '0')
- r = (r * b) + (*s - '0');
- else if (b > 10 && *s <= 'f' && *s >= 'a')
- r = (r * b) + (*s - 'a' + 10);
- else if (b > 10 && *s <= 'F' && *s >= 'A')
- r = (r * b) + (*s - 'A' + 10);
- else
- break;
-
- return -r;
+ long r = 0;
+ s++;
+
+ if (b == 8 && *s == '0')
+ s++;
+ else if (b == 16 && *s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X'))
+ s += 2;
+
+ for (; *s; s++)
+ if (*s <= '9' && *s >= '0')
+ r = (r * b) + (*s - '0');
+ else if (b > 10 && *s <= 'f' && *s >= 'a')
+ r = (r * b) + (*s - 'a' + 10);
+ else if (b > 10 && *s <= 'F' && *s >= 'A')
+ r = (r * b) + (*s - 'A' + 10);
+ else
+ break;
+
+ return -r;
}
/*
@@ -2720,24 +2882,24 @@ idl_atoi(char *s, long b)
static unsigned long
idl_atoui(char *s, long b)
{
- long r = 0;
-
- if (b == 8 && *s == '0')
- s++;
- else if (b == 16 && *s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X'))
- s += 2;
-
- for (; *s; s++)
- if (*s <= '9' && *s >= '0')
- r = (r * b) + (*s - '0');
- else if (b > 10 && *s <= 'f' && *s >= 'a')
- r = (r * b) + (*s - 'a' + 10);
- else if (b > 10 && *s <= 'F' && *s >= 'A')
- r = (r * b) + (*s - 'A' + 10);
- else
- break;
-
- return r;
+ long r = 0;
+
+ if (b == 8 && *s == '0')
+ s++;
+ else if (b == 16 && *s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X'))
+ s += 2;
+
+ for (; *s; s++)
+ if (*s <= '9' && *s >= '0')
+ r = (r * b) + (*s - '0');
+ else if (b > 10 && *s <= 'f' && *s >= 'a')
+ r = (r * b) + (*s - 'a' + 10);
+ else if (b > 10 && *s <= 'F' && *s >= 'A')
+ r = (r * b) + (*s - 'A' + 10);
+ else
+ break;
+
+ return r;
}
/*
@@ -2746,56 +2908,56 @@ idl_atoui(char *s, long b)
static double
idl_atof(char *s)
{
- char *h = s;
- double d = 0.0;
- double f = 0.0;
- double e, k;
- long neg = 0, negexp = 0;
-
- ACE_UNUSED_ARG (f);
- ACE_UNUSED_ARG (h);
-
- if (*s == '-') {
- neg = 1;
- s++;
- }
- while (*s >= '0' && *s <= '9') {
- d = (d * 10) + *s - '0';
- s++;
- }
- if (*s == '.') {
- s++;
- e = 10;
- while (*s >= '0' && *s <= '9') {
- d += (*s - '0') / (e * 1.0);
- e *= 10;
- s++;
- }
- }
- if (*s == 'e' || *s == 'E') {
- s++;
- if (*s == '-') {
- negexp = 1;
- s++;
- } else if (*s == '+')
- s++;
- e = 0;
- while (*s >= '0' && *s <= '9') {
- e = (e * 10) + *s - '0';
- s++;
- }
- if (e > 0) {
- for (k = 1; e > 0; k *= 10, e--);
- if (negexp)
- d /= k;
- else
- d *= k;
- }
- }
+ char *h = s;
+ double d = 0.0;
+ double f = 0.0;
+ double e, k;
+ long neg = 0, negexp = 0;
+
+ ACE_UNUSED_ARG (f);
+ ACE_UNUSED_ARG (h);
+
+ if (*s == '-') {
+ neg = 1;
+ s++;
+ }
+ while (*s >= '0' && *s <= '9') {
+ d = (d * 10) + *s - '0';
+ s++;
+ }
+ if (*s == '.') {
+ s++;
+ e = 10;
+ while (*s >= '0' && *s <= '9') {
+ d += (*s - '0') / (e * 1.0);
+ e *= 10;
+ s++;
+ }
+ }
+ if (*s == 'e' || *s == 'E') {
+ s++;
+ if (*s == '-') {
+ negexp = 1;
+ s++;
+ } else if (*s == '+')
+ s++;
+ e = 0;
+ while (*s >= '0' && *s <= '9') {
+ e = (e * 10) + *s - '0';
+ s++;
+ }
+ if (e > 0) {
+ for (k = 1; e > 0; k *= 10, e--);
+ if (negexp)
+ d /= k;
+ else
+ d *= k;
+ }
+ }
- if (neg) d *= -1.0;
+ if (neg) d *= -1.0;
- return d;
+ return d;
}
/*
@@ -2807,62 +2969,62 @@ idl_escape_reader(
)
{
if (str[0] != '\\') {
- return str[0];
+ return str[0];
}
switch (str[1]) {
case 'n':
- return '\n';
+ return '\n';
case 't':
- return '\t';
+ return '\t';
case 'v':
- return '\v';
+ return '\v';
case 'b':
- return '\b';
+ return '\b';
case 'r':
- return '\r';
+ return '\r';
case 'f':
- return '\f';
+ return '\f';
case 'a':
- return '\a';
+ return '\a';
case '\\':
- return '\\';
+ return '\\';
case '\?':
- return '?';
+ return '?';
case '\'':
- return '\'';
+ return '\'';
case '"':
- return '"';
+ return '"';
case 'x':
- {
- int i;
- // hex value
- for (i = 2; str[i] != '\0' && isxdigit(str[i]); i++) {
- continue;
- }
- char save = str[i];
- str[i] = '\0';
- char out = (char)idl_atoui(&str[2], 16);
- str[i] = save;
- return out;
- }
- ACE_NOTREACHED (break;)
+ {
+ int i;
+ // hex value
+ for (i = 2; str[i] != '\0' && isxdigit(str[i]); i++) {
+ continue;
+ }
+ char save = str[i];
+ str[i] = '\0';
+ char out = (char)idl_atoui(&str[2], 16);
+ str[i] = save;
+ return out;
+ }
+ ACE_NOTREACHED (break;)
default:
- // check for octal value
- if (str[1] >= '0' && str[1] <= '7') {
- int i;
- for (i = 1; str[i] >= '0' && str[i] <= '7'; i++) {
- continue;
- }
- char save = str[i];
- str[i] = '\0';
- char out = (char)idl_atoui(&str[1], 8);
- str[i] = save;
- return out;
- } else {
- return str[1] - 'a';
- }
- ACE_NOTREACHED (break;)
+ // check for octal value
+ if (str[1] >= '0' && str[1] <= '7') {
+ int i;
+ for (i = 1; str[i] >= '0' && str[i] <= '7'; i++) {
+ continue;
+ }
+ char save = str[i];
+ str[i] = '\0';
+ char out = (char)idl_atoui(&str[1], 8);
+ str[i] = save;
+ return out;
+ } else {
+ return str[1] - 'a';
+ }
+ ACE_NOTREACHED (break;)
}
}
/*
@@ -2955,9 +3117,7 @@ idl_valid_version (char *s)
char *tmp = minor + 1;
- // Some preprocessors leave trailing whitespace, hence the
- // check for a space character.
- for (i = 0; tmp[i] != '\0' && !ACE_OS::ace_isspace (tmp[i]); ++i)
+ for (i = 0; tmp[i] != '\0'; ++i)
{
if (!isdigit (tmp[i]))
{
@@ -2993,7 +3153,7 @@ idl_find_node (char *s)
if (node != 0)
{
- d = idl_global->scopes ()->top_non_null ()->lookup_by_name (node,
+ d = idl_global->scopes ().top_non_null ()->lookup_by_name (node,
I_TRUE);
}
diff --git a/TAO/TAO_IDL/fe/lex.yy.cpp.diff b/TAO/TAO_IDL/fe/lex.yy.cpp.diff
index 8b1734507cf..953b9c5927b 100644
--- a/TAO/TAO_IDL/fe/lex.yy.cpp.diff
+++ b/TAO/TAO_IDL/fe/lex.yy.cpp.diff
@@ -1,3 +1,5 @@
+--- lex.yy.cpp Fri Jan 25 11:06:56 2002
++++ lex.yy.cpp.mod Fri Jan 25 11:09:03 2002
@@ -987,7 +987,7 @@
/* Code executed at the end of each rule. */
#ifndef TAO_YY_BREAK
@@ -14,107 +16,107 @@
+ register char *tao_yy_cp = 0, *tao_yy_bp = 0;
register int tao_yy_act;
-@@ -1435,7 +1435,7 @@
+@@ -1585,7 +1585,7 @@
idl_global->set_lineno(idl_global->lineno() + 1);
idl_store_pragma(ace_tao_yytext);
}
- TAO_YY_BREAK
+ break;
- case 69:
- case 70:
+ case 87:
+ case 88:
-@@ -1442,7 +1442,7 @@
+@@ -1592,7 +1592,7 @@
{/* ignore file */
idl_global->set_lineno(idl_global->lineno() + 1);
}
- TAO_YY_BREAK
+ break;
-case 71:
-case 72:
+case 89:
+case 90:
TAO_YY_RULE_SETUP
{
idl_parse_line_and_file(ace_tao_yytext);
}
- TAO_YY_BREAK
+ break;
- case 73:
- case 74:
+ case 91:
+ case 92:
-@@ -1455,7 +1455,7 @@
+@@ -1605,7 +1605,7 @@
TAO_YY_RULE_SETUP
{
idl_parse_line_and_file(ace_tao_yytext);
}
- TAO_YY_BREAK
+ break;
- case 75:
- case 76:
+ case 93:
+ case 94:
-@@ -1462,7 +1462,7 @@
+@@ -1612,7 +1612,7 @@
TAO_YY_RULE_SETUP
{
idl_parse_line_and_file(ace_tao_yytext);
}
- TAO_YY_BREAK
+ break;
- case 77:
- case 78:
+ case 95:
+ case 96:
-@@ -1469,7 +1469,7 @@
+@@ -1619,7 +1619,7 @@
TAO_YY_RULE_SETUP
{
idl_parse_line_and_file(ace_tao_yytext);
}
- TAO_YY_BREAK
+ break;
- case 79:
- case 80:
+ case 97:
+ case 98:
-@@ -1478,14 +1478,14 @@
+@@ -1628,14 +1628,14 @@
/* ignore cpp ident */
idl_global->set_lineno(idl_global->lineno() + 1);
}
- TAO_YY_BREAK
+ break;
- case 81:
+ case 99:
TAO_YY_RULE_SETUP
-@@ -1484,7 +1484,7 @@
+@@ -1634,7 +1634,7 @@
{
/* ignore comments */
idl_global->set_lineno(idl_global->lineno() + 1);
}
- TAO_YY_BREAK
+ break;
- case 82:
+ case 100:
TAO_YY_RULE_SETUP
-@@ -1502,25 +1502,25 @@
+@@ -1651,25 +1651,25 @@
}
}
}
- TAO_YY_BREAK
+ break;
- case 83:
+ case 101:
TAO_YY_RULE_SETUP
;
- TAO_YY_BREAK
+ break;
- case 84:
+ case 102:
TAO_YY_RULE_SETUP
{
idl_global->set_lineno(idl_global->lineno() + 1);
}
- TAO_YY_BREAK
+ break;
- case 85:
+ case 103:
TAO_YY_RULE_SETUP
-@@ -1518,7 +1518,7 @@
+@@ -1667,7 +1667,7 @@
return ace_tao_yytext [0];
- TAO_YY_BREAK
+ break;
- case 86:
+ case 104:
TAO_YY_RULE_SETUP
TAO_YY_ECHO;
- TAO_YY_BREAK
diff --git a/TAO/TAO_IDL/fe/y.tab.cpp b/TAO/TAO_IDL/fe/y.tab.cpp
index cd060235a96..3e60bbade2e 100644
--- a/TAO/TAO_IDL/fe/y.tab.cpp
+++ b/TAO/TAO_IDL/fe/y.tab.cpp
@@ -3,10 +3,41 @@
char tao_yysccsid[] = "@(#)yaccpar 1.4 (Berkeley) 02/25/90 \n\
Modified 5/2/90 by J. Roskind to support graphic debugging modes";
#endif
-#include "idl.h"
-#include "idl_extern.h"
-#include "fe_private.h"
-#include <stdio.h>
+#include "utl_strlist.h"
+#include "utl_namelist.h"
+#include "fe_interface_header.h"
+#include "utl_exprlist.h"
+#include "utl_labellist.h"
+#include "utl_decllist.h"
+#include "ast_field.h"
+#include "ast_expression.h"
+#include "ast_argument.h"
+#include "ast_operation.h"
+#include "global_extern.h"
+#include "utl_identifier.h"
+#include "utl_err.h"
+#include "ast_generator.h"
+#include "ast_module.h"
+#include "ast_valuetype.h"
+#include "ast_valuetype_fwd.h"
+#include "ast_component.h"
+#include "ast_component_fwd.h"
+#include "ast_home.h"
+#include "utl_string.h"
+#include "ast_constant.h"
+#include "fe_declarator.h"
+#include "ast_union.h"
+#include "ast_union_fwd.h"
+#include "ast_structure_fwd.h"
+#include "ast_extern.h"
+#include "ast_enum.h"
+#include "ast_root.h"
+#include "ast_sequence.h"
+#include "ast_string.h"
+#include "ast_factory.h"
+#include "ast_exception.h"
+#include "ast_array.h"
+#include "nr_extern.h"
#if (defined(apollo) || defined(hpux)) && defined(__cplusplus)
extern "C" int tao_yywrap();
@@ -18,6 +49,7 @@ int tao_yylex (void);
extern "C" int tao_yywrap (void);
extern char tao_yytext[];
extern int tao_yyleng;
+AST_Decl *tao_enum_constant_decl = 0;
#define TAO_YYDEBUG_LEXER_TEXT (tao_yytext[tao_yyleng] = '\0', tao_yytext)
/* Force the pretty debugging code to compile.*/
#define TAO_YYDEBUG 1
@@ -29,7 +61,9 @@ typedef union {
UTL_LabelList *llval; /* Label list */
UTL_DeclList *dlval; /* Declaration list */
FE_InterfaceHeader *ihval; /* Interface header */
- FE_obv_header *vhval; /* Valuetype header */
+ FE_OBVHeader *vhval; /* Valuetype header */
+ FE_ComponentHeader *chval; /* Component header */
+ FE_HomeHeader *hhval; /* Home header */
AST_Expression *exval; /* Expression value */
AST_UnionLabel *ulval; /* Union label */
AST_Field *ffval; /* Field value */
@@ -67,519 +101,685 @@ typedef union {
#define IDL_BOOLEAN 270
#define IDL_FIXED 271
#define IDL_ANY 272
-#define IDL_STRUCT 273
-#define IDL_UNION 274
-#define IDL_SWITCH 275
-#define IDL_ENUM 276
-#define IDL_SEQUENCE 277
-#define IDL_STRING 278
-#define IDL_WSTRING 279
-#define IDL_EXCEPTION 280
-#define IDL_CASE 281
-#define IDL_DEFAULT 282
-#define IDL_READONLY 283
-#define IDL_ATTRIBUTE 284
-#define IDL_ONEWAY 285
-#define IDL_IDEMPOTENT 286
-#define IDL_VOID 287
-#define IDL_IN 288
-#define IDL_OUT 289
-#define IDL_INOUT 290
-#define IDL_RAISES 291
-#define IDL_CONTEXT 292
-#define IDL_NATIVE 293
-#define IDL_LOCAL 294
-#define IDL_ABSTRACT 295
-#define IDL_CUSTOM 296
-#define IDL_FACTORY 297
-#define IDL_PRIVATE 298
-#define IDL_PUBLIC 299
-#define IDL_SUPPORTS 300
-#define IDL_TRUNCATABLE 301
-#define IDL_VALUETYPE 302
-#define IDL_INTEGER_LITERAL 303
-#define IDL_UINTEGER_LITERAL 304
-#define IDL_STRING_LITERAL 305
-#define IDL_CHARACTER_LITERAL 306
-#define IDL_FLOATING_PT_LITERAL 307
-#define IDL_TRUETOK 308
-#define IDL_FALSETOK 309
-#define IDL_SCOPE_DELIMITOR 310
-#define IDL_LEFT_SHIFT 311
-#define IDL_RIGHT_SHIFT 312
-#define IDL_WCHAR_LITERAL 313
-#define IDL_WSTRING_LITERAL 314
+#define IDL_OBJECT 273
+#define IDL_STRUCT 274
+#define IDL_UNION 275
+#define IDL_SWITCH 276
+#define IDL_ENUM 277
+#define IDL_SEQUENCE 278
+#define IDL_STRING 279
+#define IDL_WSTRING 280
+#define IDL_EXCEPTION 281
+#define IDL_CASE 282
+#define IDL_DEFAULT 283
+#define IDL_READONLY 284
+#define IDL_ATTRIBUTE 285
+#define IDL_ONEWAY 286
+#define IDL_IDEMPOTENT 287
+#define IDL_VOID 288
+#define IDL_IN 289
+#define IDL_OUT 290
+#define IDL_INOUT 291
+#define IDL_RAISES 292
+#define IDL_CONTEXT 293
+#define IDL_NATIVE 294
+#define IDL_LOCAL 295
+#define IDL_ABSTRACT 296
+#define IDL_CUSTOM 297
+#define IDL_FACTORY 298
+#define IDL_PRIVATE 299
+#define IDL_PUBLIC 300
+#define IDL_SUPPORTS 301
+#define IDL_TRUNCATABLE 302
+#define IDL_VALUETYPE 303
+#define IDL_COMPONENT 304
+#define IDL_CONSUMES 305
+#define IDL_EMITS 306
+#define IDL_EVENTTYPE 307
+#define IDL_FINDER 308
+#define IDL_GETRAISES 309
+#define IDL_HOME 310
+#define IDL_IMPORT 311
+#define IDL_MULTIPLE 312
+#define IDL_PRIMARYKEY 313
+#define IDL_PROVIDES 314
+#define IDL_PUBLISHES 315
+#define IDL_SETRAISES 316
+#define IDL_TYPEID 317
+#define IDL_TYPEPREFIX 318
+#define IDL_USES 319
+#define IDL_MANAGES 320
+#define IDL_INTEGER_LITERAL 321
+#define IDL_UINTEGER_LITERAL 322
+#define IDL_STRING_LITERAL 323
+#define IDL_CHARACTER_LITERAL 324
+#define IDL_FLOATING_PT_LITERAL 325
+#define IDL_TRUETOK 326
+#define IDL_FALSETOK 327
+#define IDL_SCOPE_DELIMITOR 328
+#define IDL_LEFT_SHIFT 329
+#define IDL_RIGHT_SHIFT 330
+#define IDL_WCHAR_LITERAL 331
+#define IDL_WSTRING_LITERAL 332
#define TAO_YYERRCODE 256
short tao_yylhs[] = { -1,
- 0, 72, 72, 74, 73, 76, 73, 78, 73, 80,
- 73, 82, 73, 84, 73, 85, 73, 86, 87, 88,
- 89, 81, 79, 79, 92, 94, 95, 90, 96, 68,
- 33, 33, 33, 97, 22, 22, 83, 83, 83, 83,
- 98, 98, 103, 105, 106, 102, 107, 108, 109, 99,
- 34, 110, 69, 67, 67, 24, 24, 100, 100, 101,
- 104, 104, 111, 111, 111, 116, 112, 117, 112, 93,
- 93, 118, 113, 119, 113, 120, 113, 122, 113, 124,
- 113, 125, 113, 20, 126, 21, 21, 16, 127, 16,
- 128, 16, 70, 91, 91, 91, 129, 130, 131, 132,
- 75, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 35, 36, 37, 37, 38, 38, 39, 39, 40, 40,
- 40, 41, 41, 41, 42, 42, 42, 42, 43, 43,
- 43, 43, 44, 44, 44, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 46, 134, 71, 71, 71, 71,
- 71, 135, 133, 1, 1, 2, 2, 2, 59, 59,
- 59, 59, 59, 59, 59, 4, 4, 4, 3, 3,
- 3, 29, 136, 30, 30, 63, 63, 31, 137, 32,
- 32, 64, 65, 51, 51, 57, 57, 57, 58, 58,
- 58, 54, 54, 54, 56, 52, 52, 60, 53, 55,
- 138, 139, 141, 142, 7, 140, 144, 144, 145, 143,
- 146, 147, 115, 148, 115, 149, 150, 151, 152, 153,
- 154, 156, 157, 10, 9, 9, 9, 9, 9, 9,
- 155, 159, 159, 160, 161, 158, 162, 158, 27, 28,
- 28, 163, 48, 164, 165, 48, 166, 49, 167, 168,
- 170, 171, 8, 169, 174, 173, 173, 172, 175, 176,
- 5, 5, 177, 178, 13, 180, 181, 6, 6, 179,
- 183, 184, 14, 14, 182, 185, 11, 25, 26, 26,
- 186, 187, 47, 188, 189, 121, 66, 66, 190, 191,
- 192, 193, 77, 194, 196, 197, 198, 123, 62, 62,
- 62, 12, 12, 199, 201, 114, 202, 200, 204, 200,
- 203, 207, 206, 206, 208, 209, 205, 210, 195, 212,
- 195, 211, 215, 214, 214, 216, 217, 213, 15, 15,
- 15, 15, 61, 61, 61, 218, 219, 23, 23, 220,
- 221, 17, 17, 18, 222, 19, 19,
+ 0, 82, 82, 84, 83, 86, 83, 88, 83, 90,
+ 83, 92, 83, 94, 83, 96, 83, 98, 83, 100,
+ 83, 102, 83, 104, 83, 105, 83, 106, 107, 108,
+ 109, 95, 93, 93, 112, 114, 115, 110, 116, 76,
+ 37, 37, 37, 117, 26, 26, 97, 97, 97, 97,
+ 118, 118, 123, 125, 126, 122, 127, 128, 129, 119,
+ 130, 38, 131, 77, 74, 74, 28, 28, 120, 120,
+ 121, 124, 124, 132, 132, 132, 137, 133, 138, 133,
+ 113, 113, 139, 134, 140, 134, 141, 134, 142, 134,
+ 143, 134, 145, 134, 147, 134, 148, 134, 24, 149,
+ 25, 25, 16, 150, 16, 151, 16, 80, 111, 111,
+ 111, 152, 153, 154, 155, 89, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 41, 42, 43, 43, 44,
+ 44, 45, 45, 46, 46, 46, 47, 47, 47, 48,
+ 48, 48, 48, 49, 49, 49, 49, 50, 50, 50,
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 52,
+ 157, 81, 81, 81, 81, 81, 81, 159, 156, 1,
+ 1, 2, 2, 2, 65, 65, 65, 65, 65, 65,
+ 65, 65, 4, 4, 4, 3, 3, 3, 158, 158,
+ 33, 162, 34, 34, 70, 70, 35, 163, 36, 36,
+ 71, 72, 57, 57, 63, 63, 63, 64, 64, 64,
+ 60, 60, 60, 61, 58, 58, 66, 59, 62, 67,
+ 164, 79, 165, 167, 168, 7, 166, 170, 170, 171,
+ 169, 172, 173, 136, 174, 136, 175, 78, 176, 177,
+ 178, 179, 181, 182, 10, 9, 9, 9, 9, 9,
+ 9, 180, 184, 184, 185, 186, 183, 187, 183, 31,
+ 32, 32, 188, 54, 189, 190, 54, 191, 55, 160,
+ 161, 192, 193, 195, 196, 8, 194, 199, 198, 198,
+ 197, 200, 201, 5, 5, 202, 203, 13, 205, 206,
+ 6, 6, 204, 208, 209, 14, 14, 207, 210, 11,
+ 29, 30, 30, 211, 212, 53, 213, 214, 144, 73,
+ 73, 215, 216, 217, 218, 91, 219, 221, 222, 223,
+ 146, 69, 69, 69, 12, 12, 224, 226, 135, 227,
+ 225, 229, 225, 228, 232, 230, 230, 233, 234, 231,
+ 235, 220, 237, 220, 236, 240, 239, 239, 241, 242,
+ 238, 15, 15, 15, 15, 68, 68, 68, 243, 244,
+ 27, 27, 245, 246, 21, 21, 22, 247, 23, 23,
+ 85, 87, 99, 99, 249, 250, 252, 253, 248, 254,
+ 255, 39, 256, 18, 18, 251, 251, 259, 257, 261,
+ 257, 263, 257, 265, 257, 267, 257, 268, 257, 258,
+ 17, 17, 260, 75, 75, 262, 264, 266, 270, 101,
+ 271, 272, 273, 274, 275, 276, 40, 277, 19, 19,
+ 20, 20, 279, 280, 269, 278, 278, 281, 283, 281,
+ 285, 281, 286, 287, 282, 288, 289, 284, 103, 103,
+ 103, 292, 292, 294, 293, 291, 295, 297, 298, 296,
+ 290, 299, 299,
};
short tao_yylen[] = { 2,
1, 2, 0, 0, 3, 0, 3, 0, 3, 0,
+ 3, 0, 3, 0, 3, 0, 3, 0, 3, 0,
3, 0, 3, 0, 3, 0, 3, 0, 0, 0,
0, 9, 1, 1, 0, 0, 0, 7, 0, 3,
2, 3, 3, 0, 3, 0, 1, 1, 1, 1,
2, 1, 0, 0, 0, 7, 0, 0, 0, 8,
- 4, 0, 3, 1, 0, 2, 0, 2, 1, 2,
- 2, 0, 1, 1, 2, 0, 3, 0, 3, 2,
- 0, 0, 3, 0, 3, 0, 3, 0, 3, 0,
- 3, 0, 3, 2, 0, 4, 0, 1, 0, 3,
- 0, 4, 1, 1, 2, 2, 0, 0, 0, 0,
- 9, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 3, 1, 3, 1, 3, 1, 3,
- 3, 1, 3, 3, 1, 3, 3, 3, 1, 2,
- 2, 2, 1, 1, 3, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 0, 3, 1, 1, 1,
- 2, 0, 3, 1, 1, 1, 1, 1, 1, 1,
+ 0, 5, 0, 3, 1, 0, 2, 0, 2, 1,
+ 2, 2, 0, 1, 1, 2, 0, 3, 0, 3,
+ 2, 0, 0, 3, 0, 3, 0, 3, 0, 3,
+ 0, 3, 0, 3, 0, 3, 0, 3, 2, 0,
+ 4, 0, 1, 0, 3, 0, 4, 1, 1, 2,
+ 2, 0, 0, 0, 0, 9, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
+ 3, 1, 3, 1, 3, 3, 1, 3, 3, 1,
+ 3, 3, 3, 1, 2, 2, 2, 1, 1, 3,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 0, 4, 0, 1, 1, 2, 0, 4,
- 0, 1, 1, 1, 1, 1, 2, 1, 2, 3,
- 2, 1, 1, 2, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 9, 2, 2, 0, 0, 2,
- 0, 0, 5, 0, 3, 0, 0, 0, 0, 0,
- 0, 0, 0, 17, 1, 1, 1, 1, 1, 1,
- 2, 2, 0, 0, 0, 5, 0, 3, 2, 2,
- 0, 0, 3, 0, 0, 5, 0, 3, 0, 0,
- 0, 0, 9, 2, 0, 4, 0, 1, 0, 0,
- 6, 2, 0, 0, 5, 0, 0, 6, 1, 1,
- 0, 0, 6, 1, 1, 0, 3, 2, 2, 0,
- 0, 0, 5, 0, 0, 6, 1, 0, 0, 0,
- 0, 0, 9, 0, 0, 0, 0, 10, 1, 1,
- 0, 1, 1, 0, 0, 5, 0, 3, 0, 4,
- 2, 0, 4, 0, 0, 0, 5, 0, 3, 0,
- 4, 2, 0, 4, 0, 0, 0, 5, 1, 1,
- 1, 1, 1, 1, 1, 0, 0, 6, 0, 0,
- 0, 6, 0, 2, 0, 4, 0,
+ 0, 3, 1, 1, 1, 2, 1, 0, 3, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 0, 4, 0, 1, 1, 2, 0, 4, 0,
+ 1, 1, 1, 1, 1, 2, 1, 2, 3, 2,
+ 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
+ 0, 3, 0, 0, 0, 7, 2, 2, 0, 0,
+ 2, 0, 0, 5, 0, 3, 0, 3, 0, 0,
+ 0, 0, 0, 0, 14, 1, 1, 1, 1, 1,
+ 1, 2, 2, 0, 0, 0, 5, 0, 3, 2,
+ 2, 0, 0, 3, 0, 0, 5, 0, 3, 1,
+ 1, 0, 0, 0, 0, 9, 2, 0, 4, 0,
+ 1, 0, 0, 6, 2, 0, 0, 5, 0, 0,
+ 6, 1, 1, 0, 0, 6, 1, 1, 0, 3,
+ 2, 2, 0, 0, 0, 5, 0, 0, 6, 1,
+ 0, 0, 0, 0, 0, 9, 0, 0, 0, 0,
+ 10, 1, 1, 0, 1, 1, 0, 0, 5, 0,
+ 3, 0, 4, 2, 0, 4, 0, 0, 0, 5,
+ 0, 3, 0, 4, 2, 0, 4, 0, 0, 0,
+ 5, 1, 1, 1, 1, 1, 1, 1, 0, 0,
+ 6, 0, 0, 0, 6, 0, 2, 0, 4, 0,
+ 3, 3, 1, 1, 2, 0, 0, 0, 7, 0,
+ 0, 6, 0, 3, 0, 2, 0, 0, 3, 0,
+ 3, 0, 3, 0, 3, 0, 3, 0, 3, 3,
+ 1, 1, 4, 1, 0, 3, 3, 3, 0, 3,
+ 0, 0, 0, 0, 0, 0, 13, 0, 3, 0,
+ 2, 0, 0, 0, 5, 2, 0, 1, 0, 3,
+ 0, 3, 0, 0, 6, 0, 0, 6, 1, 1,
+ 1, 1, 1, 2, 3, 5, 3, 3, 2, 3,
+ 5, 1, 1,
};
short tao_yydefred[] = { 3,
- 0, 0, 16, 97, 18, 29, 146, 201, 216, 249,
- 289, 0, 0, 0, 0, 52, 148, 150, 149, 25,
- 43, 0, 0, 4, 2, 6, 8, 10, 12, 14,
- 23, 24, 37, 38, 39, 40, 42, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 93, 151, 182, 0,
- 47, 0, 0, 0, 41, 0, 0, 0, 34, 31,
- 0, 188, 0, 192, 193, 196, 197, 198, 199, 195,
- 200, 263, 270, 275, 54, 89, 60, 154, 155, 157,
- 166, 167, 169, 171, 170, 0, 168, 0, 159, 161,
- 162, 160, 165, 164, 184, 185, 156, 163, 0, 88,
- 0, 0, 0, 0, 0, 0, 0, 0, 17, 108,
- 109, 0, 98, 102, 103, 105, 106, 107, 104, 19,
- 30, 152, 147, 202, 217, 250, 290, 32, 0, 33,
- 53, 26, 44, 0, 187, 194, 0, 191, 0, 0,
- 259, 262, 91, 0, 266, 271, 5, 7, 9, 11,
- 13, 15, 0, 0, 0, 0, 0, 0, 0, 48,
- 71, 62, 0, 35, 190, 264, 90, 0, 0, 0,
- 51, 0, 0, 99, 20, 183, 153, 175, 176, 177,
- 0, 203, 218, 251, 291, 71, 0, 0, 0, 0,
- 136, 137, 138, 140, 142, 143, 144, 141, 139, 0,
- 0, 0, 0, 0, 145, 0, 0, 0, 0, 0,
- 0, 125, 129, 134, 260, 92, 0, 267, 272, 0,
- 3, 0, 0, 209, 0, 0, 208, 0, 82, 287,
- 299, 300, 0, 0, 72, 74, 76, 0, 70, 78,
- 80, 304, 68, 66, 0, 61, 63, 64, 0, 85,
- 265, 130, 131, 132, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 100, 0,
- 173, 281, 277, 280, 204, 208, 0, 219, 258, 252,
- 257, 0, 0, 0, 303, 330, 294, 331, 302, 0,
- 329, 284, 0, 0, 0, 28, 0, 0, 0, 0,
- 0, 46, 65, 0, 135, 0, 0, 0, 0, 0,
- 0, 0, 126, 127, 128, 261, 268, 273, 0, 0,
- 0, 0, 0, 0, 0, 214, 211, 210, 0, 0,
- 0, 207, 0, 50, 83, 0, 0, 73, 75, 77,
- 79, 81, 305, 69, 67, 0, 101, 111, 22, 174,
- 282, 279, 205, 0, 0, 0, 229, 220, 0, 225,
- 226, 228, 227, 253, 255, 293, 295, 285, 0, 0,
- 215, 212, 0, 0, 0, 0, 0, 306, 283, 0,
- 221, 256, 0, 296, 286, 181, 0, 0, 213, 0,
- 0, 0, 0, 0, 308, 315, 0, 314, 222, 319,
- 333, 334, 335, 326, 0, 325, 336, 297, 179, 0,
- 310, 0, 0, 0, 321, 0, 0, 0, 0, 316,
- 312, 237, 244, 242, 234, 241, 223, 233, 327, 323,
- 337, 340, 298, 180, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 317, 313, 238,
- 245, 243, 247, 235, 240, 224, 232, 328, 324, 0,
- 341, 0, 0, 0, 338, 0, 246, 248, 236, 347,
- 0, 0, 342, 345, 0, 346,
+ 0, 0, 26, 112, 28, 39, 161, 221, 237, 272,
+ 312, 0, 0, 0, 0, 63, 0, 0, 411, 0,
+ 0, 163, 165, 164, 35, 53, 376, 409, 0, 0,
+ 0, 0, 4, 2, 6, 8, 10, 12, 14, 16,
+ 18, 20, 22, 24, 33, 34, 47, 48, 49, 50,
+ 52, 167, 189, 190, 373, 374, 439, 440, 441, 442,
+ 443, 0, 452, 453, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 108, 166, 201, 0, 0, 57,
+ 0, 0, 0, 0, 51, 0, 0, 0, 0, 104,
+ 0, 103, 0, 0, 0, 0, 0, 44, 41, 0,
+ 207, 0, 211, 212, 215, 216, 217, 218, 214, 219,
+ 220, 286, 293, 298, 65, 71, 170, 171, 173, 183,
+ 184, 186, 188, 187, 0, 185, 0, 175, 177, 178,
+ 176, 180, 181, 203, 204, 172, 179, 182, 0, 0,
+ 223, 0, 0, 239, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 27,
+ 123, 124, 0, 113, 117, 118, 120, 121, 122, 119,
+ 29, 40, 168, 162, 222, 238, 273, 313, 42, 0,
+ 0, 43, 448, 64, 0, 412, 0, 371, 106, 372,
+ 36, 54, 377, 423, 410, 0, 206, 213, 0, 210,
+ 0, 282, 285, 61, 289, 294, 0, 224, 5, 7,
+ 9, 11, 13, 15, 17, 19, 21, 23, 25, 0,
+ 82, 73, 0, 0, 0, 0, 0, 58, 383, 381,
+ 0, 105, 0, 82, 73, 387, 427, 0, 45, 209,
+ 287, 0, 0, 0, 0, 240, 230, 0, 450, 0,
+ 0, 114, 30, 202, 169, 194, 195, 196, 0, 274,
+ 314, 82, 0, 0, 418, 413, 107, 0, 0, 0,
+ 0, 0, 0, 151, 152, 153, 155, 157, 158, 159,
+ 156, 154, 0, 0, 0, 0, 0, 160, 0, 0,
+ 0, 0, 0, 0, 140, 144, 149, 283, 62, 290,
+ 295, 0, 225, 229, 0, 67, 97, 310, 322, 323,
+ 446, 0, 0, 83, 85, 87, 89, 91, 81, 93,
+ 95, 327, 79, 77, 451, 72, 74, 75, 0, 0,
+ 3, 0, 0, 0, 229, 0, 0, 382, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 398, 0, 386,
+ 388, 390, 392, 394, 396, 0, 0, 428, 0, 426,
+ 429, 431, 100, 288, 145, 146, 147, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 250, 241, 0, 246, 247, 249, 248, 0,
+ 0, 235, 232, 231, 0, 326, 353, 317, 354, 325,
+ 0, 352, 307, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 76, 115, 0, 192, 304, 300, 303,
+ 281, 275, 280, 0, 0, 0, 414, 38, 56, 0,
+ 0, 402, 0, 0, 0, 404, 0, 0, 379, 0,
+ 0, 0, 0, 0, 433, 436, 425, 0, 0, 0,
+ 150, 0, 0, 0, 0, 0, 0, 0, 141, 142,
+ 143, 284, 291, 296, 0, 226, 228, 0, 0, 98,
+ 0, 0, 84, 86, 88, 90, 92, 94, 96, 328,
+ 80, 78, 0, 0, 0, 0, 0, 0, 0, 0,
+ 60, 0, 408, 406, 400, 407, 0, 399, 389, 391,
+ 393, 395, 397, 0, 0, 430, 432, 0, 242, 236,
+ 233, 318, 308, 0, 116, 126, 32, 193, 305, 302,
+ 276, 278, 316, 415, 403, 0, 434, 437, 0, 0,
+ 0, 0, 329, 0, 0, 0, 0, 337, 0, 0,
+ 243, 234, 0, 319, 309, 200, 306, 279, 0, 331,
+ 0, 0, 359, 435, 438, 0, 0, 0, 0, 0,
+ 0, 333, 338, 335, 334, 0, 258, 265, 263, 255,
+ 262, 244, 254, 342, 356, 357, 358, 349, 0, 348,
+ 320, 198, 0, 417, 0, 0, 360, 0, 0, 0,
+ 0, 0, 0, 0, 0, 344, 0, 0, 0, 0,
+ 339, 336, 0, 259, 266, 264, 268, 256, 261, 245,
+ 253, 350, 346, 363, 321, 199, 0, 0, 0, 0,
+ 0, 0, 0, 0, 340, 361, 267, 269, 257, 351,
+ 347, 364, 0, 370, 0, 0, 365, 368, 0, 369,
};
short tao_yydgoto[] = { 1,
- 327, 78, 79, 80, 81, 82, 83, 84, 358, 85,
- 176, 287, 86, 87, 289, 204, 433, 471, 472, 164,
- 189, 60, 408, 171, 273, 323, 425, 441, 177, 222,
- 385, 394, 20, 21, 347, 205, 206, 207, 208, 209,
- 210, 211, 212, 213, 214, 215, 274, 426, 454, 113,
- 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
- 404, 233, 178, 179, 180, 234, 99, 22, 23, 100,
- 235, 2, 25, 103, 236, 104, 237, 105, 28, 106,
- 29, 107, 30, 108, 38, 40, 154, 221, 320, 31,
- 32, 57, 187, 161, 238, 41, 134, 33, 34, 35,
- 36, 37, 58, 188, 162, 245, 129, 186, 283, 56,
- 246, 247, 239, 249, 328, 301, 300, 293, 294, 295,
- 240, 297, 241, 298, 284, 304, 140, 169, 39, 153,
- 220, 319, 123, 42, 155, 321, 419, 43, 156, 275,
- 224, 324, 332, 282, 277, 355, 380, 354, 44, 157,
- 225, 329, 373, 390, 427, 413, 442, 428, 443, 440,
- 464, 437, 439, 438, 462, 463, 45, 158, 280, 226,
- 330, 281, 331, 374, 168, 266, 139, 190, 101, 172,
- 267, 102, 173, 268, 223, 322, 370, 337, 376, 46,
- 159, 227, 333, 336, 384, 375, 393, 418, 299, 378,
- 369, 387, 397, 388, 398, 412, 436, 410, 435, 391,
- 405, 392, 406, 416, 445, 414, 444, 417, 446, 447,
- 466, 475,
+ 393, 117, 118, 119, 120, 121, 22, 23, 384, 24,
+ 254, 398, 125, 126, 400, 287, 434, 230, 266, 584,
+ 615, 635, 636, 239, 272, 99, 554, 249, 419, 487,
+ 570, 592, 255, 332, 545, 560, 25, 26, 27, 28,
+ 515, 288, 289, 290, 291, 292, 293, 294, 295, 296,
+ 297, 298, 420, 571, 608, 164, 128, 129, 130, 131,
+ 132, 133, 134, 135, 136, 137, 138, 578, 312, 256,
+ 257, 258, 313, 139, 437, 29, 30, 31, 32, 92,
+ 314, 2, 34, 146, 315, 147, 316, 148, 317, 149,
+ 318, 150, 39, 151, 40, 152, 41, 153, 42, 154,
+ 43, 155, 44, 156, 66, 68, 224, 331, 484, 45,
+ 46, 94, 250, 234, 341, 69, 196, 47, 48, 49,
+ 50, 51, 95, 251, 235, 342, 181, 262, 425, 243,
+ 86, 326, 327, 319, 329, 394, 413, 412, 404, 405,
+ 406, 407, 408, 320, 409, 321, 410, 395, 450, 187,
+ 233, 67, 223, 330, 483, 174, 70, 52, 225, 53,
+ 54, 485, 599, 71, 145, 303, 247, 390, 467, 391,
+ 305, 469, 530, 468, 72, 207, 302, 465, 529, 572,
+ 556, 593, 573, 594, 591, 621, 588, 590, 589, 619,
+ 620, 73, 226, 422, 334, 488, 423, 489, 535, 242,
+ 379, 201, 273, 142, 244, 380, 143, 245, 381, 333,
+ 486, 534, 472, 532, 74, 227, 335, 490, 471, 544,
+ 531, 559, 598, 411, 527, 514, 537, 551, 538, 552,
+ 565, 586, 585, 617, 557, 579, 558, 580, 597, 623,
+ 595, 622, 566, 603, 624, 633, 639, 55, 56, 96,
+ 270, 236, 349, 185, 264, 263, 350, 351, 440, 352,
+ 441, 353, 442, 354, 443, 355, 444, 438, 195, 97,
+ 89, 231, 340, 492, 536, 561, 339, 271, 237, 359,
+ 360, 361, 448, 362, 449, 504, 539, 505, 540, 57,
+ 58, 59, 60, 61, 62, 158, 63, 64, 65,
};
short tao_yysindex[] = { 0,
- 0, 575, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, -216, -200, -235, -229, 0, 0, 0, 0, 0,
- 0, 37, 411, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 42, 536, -173,
- -216, 437, -216, -216, -216, -216, 0, 0, 0, 37,
- 0, 37, -215, -215, 0, -216, -16, 12, 0, 0,
- -171, 0, -125, 0, 0, 0, 0, 0, 0, 0,
+ 0, 807, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, -216, -194, -159, -123, 0, -216, -216, 0, -217,
+ -217, 0, 0, 0, 0, 0, 0, 0, 92, 602,
+ -172, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 72, 0, -207, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 37, 0,
- 62, 80, 106, 108, 111, 113, 119, 121, 0, 0,
- 0, -207, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 67, 0,
- 0, 0, 0, -220, 0, 0, -67, 0, 140, -216,
- 0, 0, 0, -97, 0, 0, 0, 0, 0, 0,
- 0, 0, -216, 83, -216, 87, -44, 100, 110, 0,
- 0, 0, -207, 0, 0, 0, 0, 13, -216, -220,
- 0, 13, 13, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 631, 600, 212, 486,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 31,
- 31, 31, 13, -207, 0, 134, 166, 228, -96, 27,
- 122, 0, 0, 0, 0, 0, -207, 0, 0, 207,
- 0, 225, 180, 0, 232, 16, 0, 631, 0, 0,
- 0, 0, 510, -8, 0, 0, 0, 150, 0, 0,
- 0, 0, 0, 0, 152, 0, 0, 0, 224, 0,
- 0, 0, 0, 0, 245, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 229, 234, 243, 0, 575,
- 0, 0, 0, 0, 0, 0, 381, 0, 0, 0,
- 0, 0, 162, 230, 0, 0, 0, 0, 0, -207,
- 0, 0, 231, 249, 254, 0, 255, 266, 73, 381,
- 381, 0, 0, -220, 0, 166, 228, -96, 27, 27,
- 122, 122, 0, 0, 0, 0, 0, 0, 13, 217,
- -216, 13, 180, 221, 0, 0, 0, 0, 554, 222,
- 288, 0, 226, 0, 0, 95, 361, 0, 0, 0,
- 0, 0, 0, 0, 0, -207, 0, 0, 0, 0,
- 0, 0, 0, 294, -216, 92, 0, 0, -207, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 315, 264,
- 0, 0, 317, 16, 319, -216, 0, 0, 0, 301,
- 0, 0, 0, 0, 0, 0, 320, 77, 0, 247,
- 327, -63, 90, 338, 0, 0, 330, 0, 0, 0,
- 0, 0, 0, 0, 342, 0, 0, 0, 0, 361,
- 0, 341, -68, 361, 0, 345, 353, 104, -216, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, -216, 77, 343, 13, 339, 437,
- -52, 276, -68, -216, -63, -220, 363, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 364,
- 0, 346, -216, 352, 0, 109, 0, 0, 0, 0,
- 372, 371, 0, 0, 112, 0,
+ 0, -141, 0, 0, -141, 115, 768, -43, -216, 621,
+ -216, -216, -216, -216, 0, 0, 0, 92, -216, 0,
+ 92, -141, -216, -141, 0, -216, 0, 0, -216, 0,
+ -81, 0, -55, 97, 149, 161, 164, 0, 0, -125,
+ 0, -59, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 8, 0, -29, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 92, -172,
+ 0, 255, 260, 0, 201, 272, 277, 280, 295, 300,
+ 302, 333, 340, 343, 345, 348, 92, 241, 291, 0,
+ 0, 0, -29, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 304, 0, 0, 0, 371, 0, -216, 0, 0, 0,
+ 0, 0, 0, 0, 0, -217, 0, 0, 172, 0,
+ 376, 0, 0, 0, 0, 0, 405, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 148,
+ 0, 0, -216, 324, -216, 327, 330, 0, 0, 0,
+ 396, 0, -216, 0, 0, 0, 0, -29, 0, 0,
+ 0, -18, 148, -18, -18, 0, 0, -217, 0, 545,
+ 510, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, -217, 148, 0, 0, 0, 926, 860, 137,
+ 887, 414, 698, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 25, 25, 25, -18, -29, 0, 337, 369,
+ 428, -85, 251, 293, 0, 0, 0, 0, 0, 0,
+ 0, 787, 0, 0, 578, 0, 0, 0, 0, 0,
+ 0, 717, 183, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 412, 408,
+ 0, 430, 381, 219, 0, 926, -29, 0, -217, 148,
+ 352, 353, -217, -217, -185, -217, 167, 0, 355, 0,
+ 0, 0, 0, 0, 0, -216, -216, 0, 356, 0,
+ 0, 0, 0, 0, 0, 0, 0, 441, -18, -18,
+ -18, -18, -18, -18, -18, -18, -18, -18, 421, 422,
+ 424, 227, 0, 0, -29, 0, 0, 0, 0, 365,
+ 0, 0, 0, 0, 433, 0, 0, 0, 0, 0,
+ -29, 0, 0, 436, 437, 459, 465, 467, 468, 470,
+ 273, 578, 578, 0, 0, 807, 0, 0, 0, 0,
+ 0, 0, 0, 0, 406, -29, 0, 0, 0, -193,
+ -193, 0, -29, -216, -193, 0, -185, 473, 0, 474,
+ 475, 477, 478, 480, 0, 0, 0, 481, 482, -217,
+ 0, 369, 428, -85, 251, 251, 293, 293, 0, 0,
+ 0, 0, 0, 0, 503, 0, 0, 486, -216, 0,
+ 289, 744, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, -18, 423, -216, -18, 381, 425, 505, 426,
+ 0, 232, 0, 0, 0, 0, -216, 0, 0, 0,
+ 0, 0, 0, 507, 507, 0, 0, -29, 0, 0,
+ 0, 0, 0, 507, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 431, 496,
+ 516, -216, 0, 464, 219, -217, 517, 0, 267, 267,
+ 0, 0, 0, 0, 0, 0, 0, 0, -29, 0,
+ 521, -14, 0, 0, 0, 87, 526, 82, 267, 527,
+ 262, 0, 0, 0, 0, 533, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 536, 0,
+ 0, 0, -217, 0, 744, 290, 0, 523, -18, 525,
+ 621, -25, 460, 87, 744, 0, 546, 296, -216, -29,
+ 0, 0, -217, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, -216, 550, 534, -216,
+ 535, -216, 82, 553, 0, 0, 0, 0, 0, 0,
+ 0, 0, 274, 0, 559, 557, 0, 0, 281, 0,
};
short tao_yyrindex[] = { 0,
- 0, 416, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 603, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 31, 59,
+ 552, 33, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 7, 29, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 19,
- 0, 26, 56, -43, 0, 0, 0, 0, 0, 0,
- 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 24, 0, 0, 24, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 46, 0, 0,
+ 68, 62, 0, 24, 0, 0, 64, 36, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 146,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 49, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, -93, 0,
- 74, 127, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 163, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 6, 0, 0, 0,
- 0, 0, 0, 302, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 156, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, -76, 0,
+ 0, 189, 191, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, -76, 0, 0, 0,
+ 0, 0, 374, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 40,
+ 0, 0, 0, 0, -67, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 178, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, -6, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 509,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 176, 0, 0, 0, 0, 0, 253, 281, 28, 0,
+ -175, 0, 0, 0, 0, 0, 0, -20, 0, 0,
+ 0, 0, 509, 0, 0, 0, 0, 0, 0, 671,
+ 671, 0, 0, 0, 0, 0, 0, 0, -13, 0,
+ 0, 0, 0, 509, 0, 0, 0, 388, 417, -86,
+ 455, -4, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 38, 0, 208, 119,
+ 502, 317, 130, 48, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, -19, 0, 135, 543, 350, 328, 51,
- 38, 0, 0, 0, 0, 0, 305, 0, 0, 0,
- 0, 374, 0, 0, 0, 0, 0, 309, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 577, 0, 0, 0, 484, -65, 0, 0, 318,
+ 0, 0, 0, 0, 0, 0, -121, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 306,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 199, 0, 0, 0, 0, 0, 0, 0, 178,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 548, 541, 336, 88, 125,
- 61, 115, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 18, 0, 223, 0, 0, 0, 0, 0,
- 313, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 398, 0, 0, 399, 0,
+ 0, 596, 0, 0, 598, 0, 0, 0, 0, 0,
+ 237, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 383, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 518, 0, 0, 0, 0,
+ 0, 0, 0, 350, 0, -163, 0, 0, 0, 0,
+ 0, 0, 384, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, -27, 0, 0, 0,
- 0, 0, 22, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, -7, 382, 0, 0, 0, 0, 0, 0,
+ 0, 607, 540, 429, 135, 168, 71, 108, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 401, 0, 0, 0, 404, 0, 387, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 43, 0, 519, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 460, 0, 322, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, -8, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, -9, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 583, 583,
+ 0, 0, 28, 0, 0, 0, 0, 0, -97, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 9, 587,
+ 524, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 407, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 645, 0, 537, 0, 0, 608, 604, 0, 548,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 631, 0, 0, 0, 0,
};
short tao_yygindex[] = { 0,
- -21, 259, 0, 0, 0, -35, 14, 4, 0, 34,
- 0, 0, 0, -34, -289, -22, 0, 0, 0, 8,
- 0, -1, 0, 0, 0, 0, 0, 0, 98, 0,
- 0, 0, 0, 436, 0, -192, 0, 201, 202, 200,
- -23, -14, -20, 50, 0, -118, 158, 41, 0, 0,
- -32, -31, -30, 444, 0, 445, 0, 0, -176, -29,
- 0, 0, -239, -9, 0, 0, 0, 227, 239, -12,
- 10, 277, 0, 0, 11, 0, 25, 0, 0, 0,
+ -21, 402, 0, 0, 0, -60, -22, -28, 0, -19,
+ 0, 0, 0, -57, -399, -17, 240, 0, 0, 0,
+ 0, 0, 0, -229, 0, 305, -401, -130, 0, 0,
+ 0, 0, 222, 0, 0, 0, 0, 678, 0, 0,
+ 0, -266, 0, 325, 323, 328, -39, 34, 4, 104,
+ 0, -120, 211, 103, 0, 0, -38, -33, -24, 634,
+ 636, 0, 0, 0, -274, -23, 0, 0, 0, -357,
+ -11, 0, 0, 176, 0, 403, 410, -15, -7, -12,
+ 10, 373, 0, 0, 12, 0, 14, 0, 15, 0,
+ 16, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, -79, 0, 0, 0, 0, 0, 0, 0,
+ 0, 691, 0, 472, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 20, 0, 27, 0, 0, 0, 0,
+ 0, 0, 0, 438, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 462, 375,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 318, 0, 0, 0, 0, 0, 0, 0,
- 0, 488, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 323, 0, -36, 0, 0, 0, 0, 0,
+ 0, 0, 117, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 179, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 282, 236, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 64, 0, 0,
+ 0, 0, 0, 0, -460, 0, 0, 0, 0, 0,
+ 127, 0, 0, 0, 0, 0, 0, 106, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 131, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 78, 0, 0, 0, 0, 0,
- 0, 0, 63, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 650, 0, 0, 0,
};
-#define TAO_YYTABLESIZE 924
-short tao_yytable[] = { 49,
- 88, 77, 48, 110, 111, 18, 114, 115, 116, 119,
- 255, 24, 26, 307, 55, 17, 112, 133, 133, 88,
- 122, 133, 133, 133, 6, 133, 27, 133, 121, 36,
- 124, 125, 126, 127, 87, 19, 47, 87, 133, 133,
- 47, 86, 133, 131, 86, 186, 189, 368, 128, 189,
- 130, 339, 203, 218, 219, 200, 291, 201, 278, 6,
- 186, 278, 318, 186, 189, 94, 16, 189, 84, 261,
- 203, 262, 16, 133, 133, 122, 278, 95, 122, 55,
- 122, 350, 122, 120, 96, 75, 55, 59, 119, 76,
- 135, 119, 158, 136, 59, 122, 122, 144, 123, 122,
- 109, 123, 143, 123, 133, 123, 132, 158, 119, 119,
- 158, 163, 119, 55, 58, 141, 87, 269, 123, 123,
- 420, 145, 123, 86, 429, 120, 348, 167, 120, 36,
- 122, 122, 269, 142, 133, 269, 137, 138, 202, 146,
- 174, 36, 181, 119, 119, 120, 120, 217, 36, 120,
- 84, 55, 124, 123, 123, 124, 216, 124, 265, 124,
- 291, 122, 121, 263, 147, 121, 148, 88, 264, 149,
- 274, 150, 124, 124, 119, 112, 124, 151, 55, 152,
- 120, 120, 121, 121, 123, 274, 121, 422, 274, 160,
- 18, 18, 112, 112, 165, 448, 112, 286, 288, 166,
- 17, 17, 170, 351, 458, 175, 36, 124, 124, 182,
- 290, 120, 423, 424, 259, 260, 182, 121, 121, 182,
- 19, 19, 184, 468, 401, 402, 403, 112, 423, 424,
- 183, 18, 185, 291, 182, 309, 310, 291, 124, 50,
- 52, 17, 313, 314, 315, 451, 311, 312, 121, 252,
- 253, 254, 53, 54, 88, 250, 55, 256, 186, 257,
- 309, 19, 189, 344, 345, 258, 276, 269, 271, 47,
- 272, 278, 279, 18, 296, 292, 302, 88, 88, 24,
- 26, 346, 303, 17, 339, 305, 334, 47, 335, 338,
- 316, 133, 133, 87, 27, 317, 360, 361, 362, 363,
- 86, 286, 288, 19, 318, 158, 359, 339, 181, 320,
- 320, 320, 340, 341, 290, 191, 192, 193, 194, 195,
- 196, 197, 76, 292, 342, 198, 199, 84, 55, 343,
- 269, 365, 357, 191, 192, 193, 194, 195, 196, 197,
- 76, 349, 181, 198, 199, 353, 364, 206, 122, 122,
- 366, 367, 371, 135, 377, 55, 379, 381, 383, 389,
- 395, 119, 119, 49, 396, 117, 386, 400, 117, 399,
- 411, 123, 123, 118, 286, 288, 118, 27, 286, 288,
- 407, 409, 415, 274, 421, 117, 117, 290, 430, 117,
- 115, 290, 431, 118, 118, 432, 452, 118, 120, 120,
- 456, 450, 461, 467, 465, 45, 49, 115, 115, 434,
- 469, 115, 473, 470, 474, 1, 476, 88, 453, 110,
- 117, 117, 181, 163, 57, 124, 124, 56, 118, 118,
- 21, 181, 172, 49, 332, 121, 121, 254, 186, 230,
- 178, 311, 115, 115, 322, 343, 231, 344, 251, 51,
- 181, 117, 372, 460, 209, 209, 306, 308, 307, 118,
- 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
- 209, 209, 209, 115, 209, 209, 209, 209, 209, 209,
- 352, 455, 117, 118, 209, 209, 209, 209, 209, 209,
- 209, 209, 209, 209, 209, 209, 209, 270, 209, 209,
- 209, 209, 55, 228, 382, 276, 457, 459, 209, 301,
- 248, 325, 0, 449, 301, 301, 301, 301, 301, 301,
- 301, 301, 301, 301, 301, 0, 0, 0, 0, 0,
- 301, 301, 209, 0, 0, 0, 288, 301, 0, 301,
- 0, 0, 301, 301, 301, 301, 301, 301, 301, 301,
- 301, 301, 301, 0, 0, 0, 0, 0, 301, 301,
- 0, 0, 301, 0, 288, 301, 0, 301, 0, 0,
- 301, 301, 301, 301, 301, 301, 301, 301, 301, 301,
- 301, 116, 0, 113, 0, 0, 301, 301, 114, 0,
- 301, 0, 288, 0, 0, 301, 0, 0, 116, 116,
- 113, 113, 116, 0, 113, 114, 114, 0, 0, 114,
- 0, 0, 0, 0, 0, 0, 0, 47, 301, 0,
- 0, 0, 61, 62, 63, 64, 65, 66, 67, 68,
- 69, 70, 71, 116, 116, 113, 326, 47, 73, 74,
- 114, 0, 61, 62, 63, 64, 65, 66, 67, 68,
- 69, 70, 71, 8, 9, 0, 10, 72, 73, 74,
- 0, 0, 0, 0, 116, 0, 113, 47, 0, 0,
- 76, 114, 61, 62, 63, 64, 65, 66, 67, 68,
- 69, 70, 71, 8, 9, 0, 10, 72, 73, 74,
- 76, 0, 0, 47, 0, 0, 0, 0, 61, 62,
- 63, 64, 65, 66, 67, 68, 69, 70, 71, 8,
- 9, 75, 10, 72, 73, 74, 239, 0, 0, 0,
- 76, 239, 239, 239, 239, 239, 239, 239, 239, 239,
- 239, 239, 239, 239, 0, 239, 239, 239, 239, 0,
- 0, 0, 47, 0, 0, 0, 76, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 0, 0,
- 0, 0, 72, 73, 74, 0, 47, 0, 0, 239,
- 0, 61, 62, 63, 64, 65, 66, 67, 68, 69,
- 70, 71, 0, 0, 0, 0, 0, 73, 74, 0,
- 0, 0, 47, 0, 0, 76, 285, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 0, 0, 0,
- 47, 0, 0, 73, 74, 356, 62, 63, 0, 76,
- 66, 67, 68, 69, 0, 0, 0, 0, 0, 10,
- 3, 0, 4, 5, 6, 7, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 76, 0, 8, 9, 0,
- 10, 0, 0, 0, 11, 229, 0, 4, 0, 0,
- 7, 0, 0, 76, 0, 0, 0, 12, 13, 14,
- 15, 0, 8, 9, 0, 10, 16, 0, 0, 11,
- 0, 0, 230, 0, 231, 232, 229, 0, 4, 0,
- 0, 7, 12, 0, 0, 0, 242, 243, 244, 0,
+#define TAO_YYTABLESIZE 1244
+short tao_yytable[] = { 77,
+ 76, 123, 91, 93, 87, 88, 161, 122, 116, 162,
+ 124, 33, 127, 35, 140, 36, 37, 38, 306, 368,
+ 102, 286, 141, 102, 283, 416, 284, 201, 165, 564,
+ 201, 330, 101, 166, 332, 101, 99, 402, 378, 75,
+ 75, 123, 167, 170, 528, 201, 46, 122, 173, 163,
+ 124, 202, 127, 533, 140, 385, 172, 384, 175, 176,
+ 177, 178, 141, 75, 286, 6, 180, 362, 341, 203,
+ 183, 75, 513, 184, 148, 148, 186, 299, 148, 148,
+ 148, 66, 148, 301, 148, 137, 301, 432, 137, 109,
+ 137, 270, 137, 449, 444, 148, 148, 447, 445, 148,
+ 6, 301, 102, 144, 110, 137, 137, 285, 138, 137,
+ 90, 138, 299, 138, 101, 138, 66, 70, 99, 66,
+ 69, 380, 375, 300, 301, 420, 111, 518, 138, 138,
+ 148, 148, 138, 338, 189, 405, 197, 419, 555, 198,
+ 137, 137, 90, 16, 420, 139, 66, 79, 139, 98,
+ 139, 405, 139, 46, 268, 223, 419, 581, 449, 128,
+ 115, 148, 447, 138, 138, 139, 139, 134, 46, 139,
+ 134, 137, 135, 160, 232, 135, 128, 128, 238, 16,
+ 128, 66, 336, 83, 66, 601, 380, 134, 134, 205,
+ 46, 134, 135, 135, 138, 612, 135, 402, 311, 174,
+ 139, 139, 199, 200, 205, 136, 405, 205, 136, 427,
+ 252, 128, 259, 171, 174, 416, 516, 174, 208, 191,
+ 267, 208, 134, 134, 46, 136, 136, 135, 135, 136,
+ 238, 139, 292, 385, 297, 384, 208, 157, 75, 208,
+ 157, 188, 128, 372, 373, 337, 189, 292, 127, 297,
+ 292, 397, 297, 134, 399, 127, 568, 569, 135, 625,
+ 136, 136, 628, 386, 630, 127, 127, 190, 387, 127,
+ 328, 192, 189, 383, 563, 201, 123, 388, 389, 332,
+ 102, 75, 122, 193, 385, 124, 194, 127, 328, 140,
+ 358, 136, 101, 374, 401, 375, 99, 141, 189, 102,
+ 127, 362, 274, 275, 276, 277, 278, 279, 280, 90,
+ 402, 101, 281, 282, 205, 99, 343, 343, 343, 206,
+ 402, 426, 605, 208, 66, 430, 431, 433, 435, 378,
+ 209, 301, 455, 456, 376, 210, 449, 449, 211, 377,
+ 447, 447, 567, 445, 446, 274, 275, 276, 277, 278,
+ 279, 280, 90, 212, 132, 281, 282, 132, 213, 66,
+ 214, 227, 66, 221, 380, 519, 148, 148, 568, 569,
+ 575, 576, 577, 618, 132, 132, 137, 137, 132, 459,
+ 460, 461, 179, 123, 123, 182, 365, 366, 367, 122,
+ 122, 215, 124, 124, 127, 127, 140, 140, 216, 138,
+ 138, 217, 205, 218, 141, 141, 219, 457, 458, 132,
+ 132, 397, 174, 222, 399, 78, 81, 493, 494, 433,
+ 308, 495, 496, 82, 84, 33, 228, 35, 229, 36,
+ 37, 38, 508, 240, 208, 241, 139, 139, 481, 482,
+ 132, 343, 344, 204, 246, 292, 253, 297, 248, 260,
+ 345, 346, 261, 265, 401, 347, 259, 363, 134, 134,
+ 369, 220, 370, 135, 135, 371, 133, 403, 415, 133,
+ 414, 418, 259, 417, 315, 421, 428, 429, 436, 439,
+ 447, 451, 462, 463, 525, 464, 133, 133, 197, 466,
+ 133, 470, 230, 230, 473, 474, 136, 136, 230, 230,
+ 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
+ 230, 230, 37, 230, 230, 230, 230, 475, 549, 77,
+ 546, 133, 133, 476, 397, 477, 478, 399, 479, 480,
+ 491, 498, 499, 500, 397, 501, 502, 399, 503, 506,
+ 507, 55, 130, 509, 510, 512, 526, 517, 522, 521,
+ 523, 524, 133, 541, 542, 543, 547, 550, 553, 130,
+ 130, 562, 123, 130, 230, 600, 574, 401, 122, 607,
+ 582, 124, 587, 127, 583, 140, 596, 401, 563, 424,
+ 131, 604, 606, 141, 610, 238, 77, 616, 614, 613,
+ 626, 627, 632, 629, 130, 130, 634, 131, 131, 637,
+ 638, 131, 1, 640, 259, 230, 230, 259, 59, 259,
+ 271, 230, 230, 230, 230, 230, 230, 230, 230, 230,
+ 230, 230, 230, 230, 230, 130, 230, 230, 230, 230,
+ 125, 68, 131, 131, 325, 191, 205, 68, 251, 355,
+ 401, 362, 31, 277, 324, 197, 422, 129, 345, 324,
+ 324, 324, 324, 324, 324, 324, 324, 324, 324, 324,
+ 324, 252, 366, 131, 129, 129, 324, 324, 129, 311,
+ 421, 367, 311, 324, 364, 324, 497, 230, 324, 324,
+ 324, 324, 324, 324, 324, 324, 324, 324, 324, 324,
+ 511, 80, 453, 452, 609, 324, 324, 520, 454, 129,
+ 168, 311, 169, 416, 324, 85, 269, 348, 304, 424,
+ 611, 324, 602, 548, 159, 324, 324, 324, 324, 324,
+ 324, 324, 324, 324, 324, 324, 324, 324, 631, 0,
+ 129, 0, 0, 324, 324, 0, 0, 0, 0, 311,
+ 324, 0, 324, 0, 324, 324, 324, 324, 324, 324,
+ 324, 324, 324, 324, 324, 324, 324, 0, 0, 0,
+ 0, 0, 324, 324, 0, 307, 0, 4, 311, 0,
+ 7, 324, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 324, 8, 9, 0, 10, 0, 0, 0,
+ 11, 0, 0, 308, 0, 309, 310, 0, 0, 0,
+ 307, 0, 4, 12, 0, 7, 0, 322, 323, 324,
+ 0, 324, 0, 0, 0, 0, 0, 0, 8, 9,
+ 0, 10, 0, 0, 0, 11, 20, 21, 308, 0,
+ 309, 310, 0, 392, 75, 0, 0, 0, 12, 100,
+ 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
+ 111, 8, 9, 0, 10, 112, 113, 114, 75, 0,
+ 0, 20, 21, 100, 101, 102, 103, 104, 105, 106,
+ 107, 108, 109, 110, 111, 8, 9, 75, 10, 112,
+ 113, 114, 100, 101, 102, 103, 104, 105, 106, 107,
+ 108, 109, 110, 111, 8, 9, 0, 10, 112, 113,
+ 114, 260, 0, 115, 0, 90, 260, 260, 260, 260,
+ 260, 260, 260, 260, 260, 260, 260, 260, 260, 260,
+ 0, 260, 260, 260, 260, 0, 0, 324, 0, 90,
+ 0, 0, 324, 324, 324, 324, 324, 324, 324, 324,
+ 324, 324, 324, 324, 0, 0, 0, 0, 90, 324,
+ 324, 0, 0, 0, 75, 311, 0, 0, 324, 100,
+ 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
+ 111, 0, 260, 75, 0, 112, 113, 114, 100, 101,
+ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
+ 0, 0, 0, 0, 0, 113, 114, 0, 324, 0,
+ 75, 0, 0, 0, 396, 100, 101, 102, 103, 104,
+ 105, 106, 107, 108, 109, 110, 111, 0, 0, 0,
+ 0, 0, 113, 114, 75, 90, 0, 0, 0, 100,
+ 101, 102, 103, 104, 105, 106, 107, 108, 109, 0,
+ 0, 0, 0, 75, 90, 0, 113, 114, 382, 101,
+ 102, 0, 0, 105, 106, 107, 108, 0, 0, 0,
+ 0, 0, 3, 10, 4, 5, 6, 7, 0, 0,
+ 0, 90, 0, 0, 0, 0, 0, 0, 0, 0,
+ 8, 9, 0, 10, 0, 0, 0, 11, 0, 0,
+ 0, 0, 0, 0, 0, 90, 0, 0, 0, 0,
+ 12, 13, 14, 15, 0, 0, 0, 0, 0, 16,
+ 17, 0, 0, 18, 90, 307, 19, 4, 0, 0,
+ 7, 0, 0, 20, 21, 0, 0, 0, 0, 0,
0, 0, 0, 8, 9, 0, 10, 0, 0, 0,
- 11, 0, 0, 230, 0, 231, 232, 0, 0, 0,
- 0, 0, 0, 12,
+ 11, 0, 307, 308, 4, 309, 310, 7, 0, 0,
+ 0, 0, 0, 12, 0, 0, 0, 322, 323, 324,
+ 8, 9, 0, 10, 0, 0, 0, 11, 0, 0,
+ 308, 0, 309, 310, 0, 0, 20, 21, 0, 0,
+ 12, 307, 0, 4, 356, 0, 7, 0, 0, 0,
+ 0, 0, 0, 0, 357, 0, 0, 0, 0, 8,
+ 9, 0, 10, 20, 21, 0, 11, 0, 0, 308,
+ 0, 309, 310, 0, 0, 0, 0, 0, 0, 12,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 20, 21,
};
short tao_yycheck[] = { 12,
- 23, 23, 12, 39, 39, 2, 39, 39, 39, 39,
- 203, 2, 2, 41, 58, 2, 39, 37, 38, 42,
- 42, 41, 42, 43, 260, 45, 2, 47, 41, 123,
- 43, 44, 45, 46, 41, 2, 257, 44, 58, 59,
- 257, 41, 62, 56, 44, 44, 41, 337, 50, 44,
- 52, 59, 40, 172, 173, 43, 233, 45, 41, 260,
- 59, 44, 41, 62, 59, 59, 302, 62, 41, 43,
- 40, 45, 302, 93, 94, 38, 59, 59, 41, 123,
- 43, 321, 45, 257, 59, 301, 58, 59, 38, 310,
- 262, 41, 44, 265, 58, 58, 59, 99, 38, 62,
- 59, 41, 310, 43, 124, 45, 123, 59, 58, 59,
- 62, 134, 62, 58, 59, 44, 123, 44, 58, 59,
- 410, 60, 62, 123, 414, 38, 319, 140, 41, 123,
- 93, 94, 59, 62, 123, 62, 262, 263, 126, 60,
- 153, 123, 155, 93, 94, 58, 59, 170, 123, 62,
- 123, 123, 38, 93, 94, 41, 169, 43, 37, 45,
- 337, 124, 38, 42, 59, 41, 59, 190, 47, 59,
- 44, 59, 58, 59, 124, 41, 62, 59, 123, 59,
- 93, 94, 58, 59, 124, 59, 62, 256, 62, 123,
- 187, 188, 58, 59, 262, 435, 62, 233, 233, 60,
- 187, 188, 300, 322, 444, 123, 300, 93, 94, 123,
- 233, 124, 281, 282, 311, 312, 41, 93, 94, 44,
- 187, 188, 123, 463, 288, 289, 290, 93, 281, 282,
- 275, 228, 123, 410, 59, 259, 260, 414, 124, 13,
- 14, 228, 263, 264, 265, 438, 261, 262, 124, 200,
- 201, 202, 14, 15, 277, 44, 300, 124, 257, 94,
- 288, 228, 257, 300, 301, 38, 91, 61, 44, 257,
- 91, 40, 257, 270, 125, 284, 125, 300, 301, 270,
- 270, 304, 59, 270, 292, 41, 125, 257, 59, 59,
- 62, 311, 312, 300, 270, 62, 329, 329, 329, 329,
- 300, 337, 337, 270, 62, 257, 329, 59, 321, 288,
- 289, 290, 59, 59, 337, 303, 304, 305, 306, 307,
- 308, 309, 310, 125, 59, 313, 314, 300, 300, 257,
- 257, 44, 329, 303, 304, 305, 306, 307, 308, 309,
- 310, 125, 355, 313, 314, 125, 125, 125, 311, 312,
- 125, 257, 59, 262, 40, 300, 93, 41, 40, 59,
- 41, 311, 312, 376, 288, 38, 376, 41, 41, 123,
- 41, 311, 312, 38, 410, 410, 41, 125, 414, 414,
- 291, 44, 41, 257, 44, 58, 59, 410, 44, 62,
- 41, 414, 40, 58, 59, 292, 58, 62, 311, 312,
- 125, 59, 40, 58, 41, 125, 419, 58, 59, 419,
- 59, 62, 41, 305, 44, 0, 305, 440, 440, 257,
- 93, 94, 435, 446, 123, 311, 312, 123, 93, 94,
- 125, 444, 59, 125, 257, 311, 312, 125, 41, 41,
- 59, 41, 93, 94, 41, 59, 125, 41, 190, 14,
- 463, 124, 355, 446, 256, 257, 256, 258, 257, 124,
- 262, 263, 264, 265, 266, 267, 268, 269, 270, 271,
- 272, 273, 274, 124, 276, 277, 278, 279, 256, 257,
- 323, 441, 39, 39, 262, 263, 264, 265, 266, 267,
- 268, 269, 270, 271, 272, 273, 274, 221, 276, 277,
- 278, 279, 15, 186, 374, 224, 443, 445, 310, 257,
- 188, 276, -1, 436, 262, 263, 264, 265, 266, 267,
- 268, 269, 270, 271, 272, -1, -1, -1, -1, -1,
- 278, 279, 310, -1, -1, -1, 284, 257, -1, 287,
- -1, -1, 262, 263, 264, 265, 266, 267, 268, 269,
- 270, 271, 272, -1, -1, -1, -1, -1, 278, 279,
- -1, -1, 310, -1, 284, 257, -1, 287, -1, -1,
- 262, 263, 264, 265, 266, 267, 268, 269, 270, 271,
- 272, 41, -1, 41, -1, -1, 278, 279, 41, -1,
- 310, -1, 284, -1, -1, 287, -1, -1, 58, 59,
- 58, 59, 62, -1, 62, 58, 59, -1, -1, 62,
- -1, -1, -1, -1, -1, -1, -1, 257, 310, -1,
+ 12, 30, 20, 21, 17, 18, 67, 30, 30, 67,
+ 30, 2, 30, 2, 30, 2, 2, 2, 248, 286,
+ 41, 40, 30, 44, 43, 123, 45, 41, 67, 44,
+ 44, 41, 41, 67, 44, 44, 41, 312, 125, 257,
+ 257, 70, 67, 67, 505, 59, 123, 70, 70, 67,
+ 70, 44, 70, 514, 70, 123, 69, 123, 71, 72,
+ 73, 74, 70, 257, 40, 260, 79, 59, 41, 62,
+ 83, 257, 472, 86, 37, 38, 89, 91, 41, 42,
+ 43, 58, 45, 41, 47, 38, 44, 273, 41, 59,
+ 43, 59, 45, 58, 59, 58, 59, 58, 59, 62,
+ 260, 59, 123, 276, 59, 58, 59, 126, 38, 62,
+ 328, 41, 243, 43, 123, 45, 58, 59, 123, 58,
+ 59, 58, 59, 244, 245, 301, 59, 485, 58, 59,
+ 93, 94, 62, 264, 328, 257, 262, 301, 540, 265,
+ 93, 94, 328, 303, 320, 38, 123, 307, 41, 58,
+ 43, 273, 45, 123, 234, 123, 320, 559, 123, 41,
+ 302, 124, 123, 93, 94, 58, 59, 38, 123, 62,
+ 41, 124, 38, 59, 187, 41, 58, 59, 196, 303,
+ 62, 123, 262, 307, 123, 585, 123, 58, 59, 44,
+ 123, 62, 58, 59, 124, 595, 62, 472, 285, 44,
+ 93, 94, 262, 263, 59, 38, 328, 62, 41, 340,
+ 223, 93, 225, 257, 59, 313, 483, 62, 41, 123,
+ 233, 44, 93, 94, 301, 58, 59, 93, 94, 62,
+ 248, 124, 44, 301, 44, 301, 59, 62, 257, 62,
+ 65, 323, 124, 329, 330, 263, 328, 59, 41, 59,
+ 62, 312, 62, 124, 312, 273, 282, 283, 124, 617,
+ 93, 94, 620, 302, 622, 58, 59, 323, 302, 62,
+ 251, 123, 328, 302, 289, 289, 305, 302, 302, 289,
+ 301, 257, 305, 123, 302, 305, 123, 305, 269, 305,
+ 271, 124, 301, 43, 312, 45, 301, 305, 328, 320,
+ 93, 293, 321, 322, 323, 324, 325, 326, 327, 328,
+ 585, 320, 331, 332, 60, 320, 289, 290, 291, 60,
+ 595, 339, 589, 123, 301, 343, 344, 345, 346, 37,
+ 59, 289, 372, 373, 42, 59, 301, 302, 59, 47,
+ 301, 302, 256, 356, 357, 321, 322, 323, 324, 325,
+ 326, 327, 328, 59, 38, 331, 332, 41, 59, 301,
+ 59, 125, 301, 123, 301, 486, 329, 330, 282, 283,
+ 289, 290, 291, 603, 58, 59, 329, 330, 62, 376,
+ 377, 378, 78, 412, 413, 81, 283, 284, 285, 412,
+ 413, 59, 412, 413, 412, 413, 412, 413, 59, 329,
+ 330, 59, 257, 59, 412, 413, 59, 374, 375, 93,
+ 94, 472, 257, 123, 472, 13, 14, 430, 431, 437,
+ 284, 434, 435, 14, 15, 416, 123, 416, 58, 416,
+ 416, 416, 450, 262, 257, 60, 329, 330, 412, 413,
+ 124, 305, 306, 139, 40, 257, 123, 257, 301, 123,
+ 314, 315, 123, 58, 472, 319, 469, 44, 329, 330,
+ 124, 157, 94, 329, 330, 38, 38, 285, 61, 41,
+ 59, 91, 485, 44, 125, 257, 125, 125, 312, 125,
+ 125, 41, 62, 62, 497, 62, 58, 59, 262, 125,
+ 62, 59, 256, 257, 59, 59, 329, 330, 262, 263,
+ 264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
+ 274, 275, 125, 277, 278, 279, 280, 59, 536, 532,
+ 532, 93, 94, 59, 585, 59, 59, 585, 59, 257,
+ 125, 59, 59, 59, 595, 59, 59, 595, 59, 59,
+ 59, 125, 41, 41, 59, 257, 40, 125, 44, 125,
+ 125, 320, 124, 123, 59, 40, 93, 41, 292, 58,
+ 59, 41, 591, 62, 328, 583, 41, 585, 591, 591,
+ 44, 591, 40, 591, 313, 591, 41, 595, 289, 125,
+ 41, 59, 58, 591, 125, 603, 599, 599, 293, 44,
+ 41, 58, 40, 59, 93, 94, 323, 58, 59, 41,
+ 44, 62, 0, 323, 617, 256, 257, 620, 125, 622,
+ 59, 262, 263, 264, 265, 266, 267, 268, 269, 270,
+ 271, 272, 273, 274, 275, 124, 277, 278, 279, 280,
+ 257, 123, 93, 94, 125, 59, 41, 320, 41, 257,
+ 257, 59, 125, 125, 257, 59, 123, 41, 41, 262,
+ 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
+ 273, 125, 59, 124, 58, 59, 279, 280, 62, 125,
+ 123, 41, 285, 257, 273, 288, 437, 328, 262, 263,
+ 264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
+ 469, 14, 370, 369, 592, 279, 280, 487, 371, 93,
+ 67, 285, 67, 331, 288, 15, 235, 270, 247, 335,
+ 594, 257, 586, 535, 65, 328, 262, 263, 264, 265,
+ 266, 267, 268, 269, 270, 271, 272, 273, 623, -1,
+ 124, -1, -1, 279, 280, -1, -1, -1, -1, 285,
+ 257, -1, 288, -1, 328, 262, 263, 264, 265, 266,
+ 267, 268, 269, 270, 271, 272, 273, -1, -1, -1,
+ -1, -1, 279, 280, -1, 256, -1, 258, 285, -1,
+ 261, 288, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 328, 274, 275, -1, 277, -1, -1, -1,
+ 281, -1, -1, 284, -1, 286, 287, -1, -1, -1,
+ 256, -1, 258, 294, -1, 261, -1, 298, 299, 300,
+ -1, 328, -1, -1, -1, -1, -1, -1, 274, 275,
+ -1, 277, -1, -1, -1, 281, 317, 318, 284, -1,
+ 286, 287, -1, 256, 257, -1, -1, -1, 294, 262,
+ 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
+ 273, 274, 275, -1, 277, 278, 279, 280, 257, -1,
+ -1, 317, 318, 262, 263, 264, 265, 266, 267, 268,
+ 269, 270, 271, 272, 273, 274, 275, 257, 277, 278,
+ 279, 280, 262, 263, 264, 265, 266, 267, 268, 269,
+ 270, 271, 272, 273, 274, 275, -1, 277, 278, 279,
+ 280, 257, -1, 302, -1, 328, 262, 263, 264, 265,
+ 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
+ -1, 277, 278, 279, 280, -1, -1, 257, -1, 328,
-1, -1, 262, 263, 264, 265, 266, 267, 268, 269,
- 270, 271, 272, 93, 94, 93, 256, 257, 278, 279,
- 93, -1, 262, 263, 264, 265, 266, 267, 268, 269,
- 270, 271, 272, 273, 274, -1, 276, 277, 278, 279,
- -1, -1, -1, -1, 124, -1, 124, 257, -1, -1,
- 310, 124, 262, 263, 264, 265, 266, 267, 268, 269,
- 270, 271, 272, 273, 274, -1, 276, 277, 278, 279,
- 310, -1, -1, 257, -1, -1, -1, -1, 262, 263,
+ 270, 271, 272, 273, -1, -1, -1, -1, 328, 279,
+ 280, -1, -1, -1, 257, 285, -1, -1, 288, 262,
+ 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
+ 273, -1, 328, 257, -1, 278, 279, 280, 262, 263,
264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
- 274, 301, 276, 277, 278, 279, 257, -1, -1, -1,
- 310, 262, 263, 264, 265, 266, 267, 268, 269, 270,
- 271, 272, 273, 274, -1, 276, 277, 278, 279, -1,
- -1, -1, 257, -1, -1, -1, 310, 262, 263, 264,
- 265, 266, 267, 268, 269, 270, 271, 272, -1, -1,
- -1, -1, 277, 278, 279, -1, 257, -1, -1, 310,
- -1, 262, 263, 264, 265, 266, 267, 268, 269, 270,
- 271, 272, -1, -1, -1, -1, -1, 278, 279, -1,
- -1, -1, 257, -1, -1, 310, 287, 262, 263, 264,
- 265, 266, 267, 268, 269, 270, 271, -1, -1, -1,
- 257, -1, -1, 278, 279, 262, 263, 264, -1, 310,
- 267, 268, 269, 270, -1, -1, -1, -1, -1, 276,
- 256, -1, 258, 259, 260, 261, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 310, -1, 273, 274, -1,
- 276, -1, -1, -1, 280, 256, -1, 258, -1, -1,
- 261, -1, -1, 310, -1, -1, -1, 293, 294, 295,
- 296, -1, 273, 274, -1, 276, 302, -1, -1, 280,
- -1, -1, 283, -1, 285, 286, 256, -1, 258, -1,
- -1, 261, 293, -1, -1, -1, 297, 298, 299, -1,
- -1, -1, -1, 273, 274, -1, 276, -1, -1, -1,
- 280, -1, -1, 283, -1, 285, 286, -1, -1, -1,
- -1, -1, -1, 293,
+ -1, -1, -1, -1, -1, 279, 280, -1, 328, -1,
+ 257, -1, -1, -1, 288, 262, 263, 264, 265, 266,
+ 267, 268, 269, 270, 271, 272, 273, -1, -1, -1,
+ -1, -1, 279, 280, 257, 328, -1, -1, -1, 262,
+ 263, 264, 265, 266, 267, 268, 269, 270, 271, -1,
+ -1, -1, -1, 257, 328, -1, 279, 280, 262, 263,
+ 264, -1, -1, 267, 268, 269, 270, -1, -1, -1,
+ -1, -1, 256, 277, 258, 259, 260, 261, -1, -1,
+ -1, 328, -1, -1, -1, -1, -1, -1, -1, -1,
+ 274, 275, -1, 277, -1, -1, -1, 281, -1, -1,
+ -1, -1, -1, -1, -1, 328, -1, -1, -1, -1,
+ 294, 295, 296, 297, -1, -1, -1, -1, -1, 303,
+ 304, -1, -1, 307, 328, 256, 310, 258, -1, -1,
+ 261, -1, -1, 317, 318, -1, -1, -1, -1, -1,
+ -1, -1, -1, 274, 275, -1, 277, -1, -1, -1,
+ 281, -1, 256, 284, 258, 286, 287, 261, -1, -1,
+ -1, -1, -1, 294, -1, -1, -1, 298, 299, 300,
+ 274, 275, -1, 277, -1, -1, -1, 281, -1, -1,
+ 284, -1, 286, 287, -1, -1, 317, 318, -1, -1,
+ 294, 256, -1, 258, 298, -1, 261, -1, -1, -1,
+ -1, -1, -1, -1, 308, -1, -1, -1, -1, 274,
+ 275, -1, 277, 317, 318, -1, 281, -1, -1, 284,
+ -1, 286, 287, -1, -1, -1, -1, -1, -1, 294,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 317, 318,
};
#define TAO_YYFINAL 1
#ifndef TAO_YYDEBUG
#define TAO_YYDEBUG 0
#endif
-#define TAO_YYMAXTOKEN 314
+#define TAO_YYMAXTOKEN 332
#if TAO_YYDEBUG
const char *tao_yyname[] = {
"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -592,16 +792,19 @@ const char *tao_yyname[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"IDENTIFIER","IDL_CONST",
"IDL_MODULE","IDL_INTERFACE","IDL_TYPEDEF","IDL_LONG","IDL_SHORT",
"IDL_UNSIGNED","IDL_DOUBLE","IDL_FLOAT","IDL_CHAR","IDL_WCHAR","IDL_OCTET",
-"IDL_BOOLEAN","IDL_FIXED","IDL_ANY","IDL_STRUCT","IDL_UNION","IDL_SWITCH",
-"IDL_ENUM","IDL_SEQUENCE","IDL_STRING","IDL_WSTRING","IDL_EXCEPTION","IDL_CASE",
-"IDL_DEFAULT","IDL_READONLY","IDL_ATTRIBUTE","IDL_ONEWAY","IDL_IDEMPOTENT",
-"IDL_VOID","IDL_IN","IDL_OUT","IDL_INOUT","IDL_RAISES","IDL_CONTEXT",
-"IDL_NATIVE","IDL_LOCAL","IDL_ABSTRACT","IDL_CUSTOM","IDL_FACTORY",
-"IDL_PRIVATE","IDL_PUBLIC","IDL_SUPPORTS","IDL_TRUNCATABLE","IDL_VALUETYPE",
-"IDL_INTEGER_LITERAL","IDL_UINTEGER_LITERAL","IDL_STRING_LITERAL",
-"IDL_CHARACTER_LITERAL","IDL_FLOATING_PT_LITERAL","IDL_TRUETOK","IDL_FALSETOK",
-"IDL_SCOPE_DELIMITOR","IDL_LEFT_SHIFT","IDL_RIGHT_SHIFT","IDL_WCHAR_LITERAL",
-"IDL_WSTRING_LITERAL",
+"IDL_BOOLEAN","IDL_FIXED","IDL_ANY","IDL_OBJECT","IDL_STRUCT","IDL_UNION",
+"IDL_SWITCH","IDL_ENUM","IDL_SEQUENCE","IDL_STRING","IDL_WSTRING",
+"IDL_EXCEPTION","IDL_CASE","IDL_DEFAULT","IDL_READONLY","IDL_ATTRIBUTE",
+"IDL_ONEWAY","IDL_IDEMPOTENT","IDL_VOID","IDL_IN","IDL_OUT","IDL_INOUT",
+"IDL_RAISES","IDL_CONTEXT","IDL_NATIVE","IDL_LOCAL","IDL_ABSTRACT","IDL_CUSTOM",
+"IDL_FACTORY","IDL_PRIVATE","IDL_PUBLIC","IDL_SUPPORTS","IDL_TRUNCATABLE",
+"IDL_VALUETYPE","IDL_COMPONENT","IDL_CONSUMES","IDL_EMITS","IDL_EVENTTYPE",
+"IDL_FINDER","IDL_GETRAISES","IDL_HOME","IDL_IMPORT","IDL_MULTIPLE",
+"IDL_PRIMARYKEY","IDL_PROVIDES","IDL_PUBLISHES","IDL_SETRAISES","IDL_TYPEID",
+"IDL_TYPEPREFIX","IDL_USES","IDL_MANAGES","IDL_INTEGER_LITERAL",
+"IDL_UINTEGER_LITERAL","IDL_STRING_LITERAL","IDL_CHARACTER_LITERAL",
+"IDL_FLOATING_PT_LITERAL","IDL_TRUETOK","IDL_FALSETOK","IDL_SCOPE_DELIMITOR",
+"IDL_LEFT_SHIFT","IDL_RIGHT_SHIFT","IDL_WCHAR_LITERAL","IDL_WSTRING_LITERAL",
};
const char *tao_yyrule[] = {
"$accept : start",
@@ -611,35 +814,45 @@ const char *tao_yyrule[] = {
"$$1 :",
"definition : type_dcl $$1 ';'",
"$$2 :",
-"definition : const_dcl $$2 ';'",
+"definition : typeid_dcl $$2 ';'",
"$$3 :",
-"definition : exception $$3 ';'",
+"definition : typeprefix_dcl $$3 ';'",
"$$4 :",
-"definition : interface_def $$4 ';'",
+"definition : const_dcl $$4 ';'",
"$$5 :",
-"definition : module $$5 ';'",
+"definition : exception $$5 ';'",
"$$6 :",
-"definition : value_def $$6 ';'",
+"definition : interface_def $$6 ';'",
"$$7 :",
-"definition : error $$7 ';'",
+"definition : module $$7 ';'",
"$$8 :",
+"definition : value_def $$8 ';'",
"$$9 :",
+"definition : component $$9 ';'",
"$$10 :",
+"definition : home_decl $$10 ';'",
"$$11 :",
-"module : IDL_MODULE $$8 IDENTIFIER $$9 '{' $$10 definitions $$11 '}'",
-"interface_def : interface",
-"interface_def : forward",
+"definition : event $$11 ';'",
"$$12 :",
+"definition : error $$12 ';'",
"$$13 :",
"$$14 :",
-"interface : interface_header $$12 '{' $$13 exports $$14 '}'",
"$$15 :",
-"interface_decl : IDL_INTERFACE $$15 id",
+"$$16 :",
+"module : IDL_MODULE $$13 IDENTIFIER $$14 '{' $$15 definitions $$16 '}'",
+"interface_def : interface",
+"interface_def : interface_forward",
+"$$17 :",
+"$$18 :",
+"$$19 :",
+"interface : interface_header $$17 '{' $$18 exports $$19 '}'",
+"$$20 :",
+"interface_decl : IDL_INTERFACE $$20 id",
"interface_header : interface_decl inheritance_spec",
"interface_header : IDL_LOCAL interface_decl inheritance_spec",
"interface_header : IDL_ABSTRACT interface_decl inheritance_spec",
-"$$16 :",
-"inheritance_spec : ':' $$16 at_least_one_scoped_name",
+"$$21 :",
+"inheritance_spec : ':' $$21 at_least_one_scoped_name",
"inheritance_spec :",
"value_def : valuetype",
"value_def : value_abs_decl",
@@ -647,20 +860,21 @@ const char *tao_yyrule[] = {
"value_def : value_box_decl",
"valuetype : IDL_CUSTOM value_concrete_decl",
"valuetype : value_concrete_decl",
-"$$17 :",
-"$$18 :",
-"$$19 :",
-"value_concrete_decl : value_header $$17 '{' $$18 value_elements $$19 '}'",
-"$$20 :",
-"$$21 :",
"$$22 :",
-"value_abs_decl : IDL_ABSTRACT value_header $$20 '{' $$21 exports $$22 '}'",
-"value_header : value_decl opt_truncatable inheritance_spec supports_spec",
"$$23 :",
-"value_decl : IDL_VALUETYPE $$23 id",
+"$$24 :",
+"value_concrete_decl : value_header $$22 '{' $$23 value_elements $$24 '}'",
+"$$25 :",
+"$$26 :",
+"$$27 :",
+"value_abs_decl : IDL_ABSTRACT value_header $$25 '{' $$26 exports $$27 '}'",
+"$$28 :",
+"value_header : value_decl opt_truncatable inheritance_spec $$28 supports_spec",
+"$$29 :",
+"value_decl : IDL_VALUETYPE $$29 id",
"opt_truncatable : IDL_TRUNCATABLE",
"opt_truncatable :",
-"supports_spec : IDL_SUPPORTS scoped_name",
+"supports_spec : IDL_SUPPORTS at_least_one_scoped_name",
"supports_spec :",
"value_forward_decl : IDL_ABSTRACT value_decl",
"value_forward_decl : value_decl",
@@ -670,42 +884,46 @@ const char *tao_yyrule[] = {
"value_element : state_member",
"value_element : export",
"value_element : init_decl ';'",
-"$$24 :",
-"state_member : IDL_PUBLIC $$24 member_i",
-"$$25 :",
-"state_member : IDL_PRIVATE $$25 member_i",
-"exports : exports export",
-"exports :",
-"$$26 :",
-"export : type_dcl $$26 ';'",
-"$$27 :",
-"export : const_dcl $$27 ';'",
-"$$28 :",
-"export : exception $$28 ';'",
-"$$29 :",
-"export : attribute $$29 ';'",
"$$30 :",
-"export : operation $$30 ';'",
+"state_member : IDL_PUBLIC $$30 member_i",
"$$31 :",
-"export : error $$31 ';'",
-"at_least_one_scoped_name : scoped_name scoped_names",
+"state_member : IDL_PRIVATE $$31 member_i",
+"exports : exports export",
+"exports :",
"$$32 :",
-"scoped_names : scoped_names ',' $$32 scoped_name",
-"scoped_names :",
-"scoped_name : id",
+"export : type_dcl $$32 ';'",
"$$33 :",
-"scoped_name : IDL_SCOPE_DELIMITOR $$33 id",
+"export : typeid_dcl $$33 ';'",
"$$34 :",
-"scoped_name : scoped_name IDL_SCOPE_DELIMITOR $$34 id",
-"id : IDENTIFIER",
-"forward : interface_decl",
-"forward : IDL_LOCAL interface_decl",
-"forward : IDL_ABSTRACT interface_decl",
+"export : typeprefix_dcl $$34 ';'",
"$$35 :",
+"export : const_dcl $$35 ';'",
"$$36 :",
+"export : exception $$36 ';'",
"$$37 :",
+"export : attribute $$37 ';'",
"$$38 :",
-"const_dcl : IDL_CONST $$35 const_type $$36 id $$37 '=' $$38 expression",
+"export : operation $$38 ';'",
+"$$39 :",
+"export : error $$39 ';'",
+"at_least_one_scoped_name : scoped_name scoped_names",
+"$$40 :",
+"scoped_names : scoped_names ',' $$40 scoped_name",
+"scoped_names :",
+"scoped_name : id",
+"$$41 :",
+"scoped_name : IDL_SCOPE_DELIMITOR $$41 id",
+"$$42 :",
+"scoped_name : scoped_name IDL_SCOPE_DELIMITOR $$42 id",
+"id : IDENTIFIER",
+"interface_forward : interface_decl",
+"interface_forward : IDL_LOCAL interface_decl",
+"interface_forward : IDL_ABSTRACT interface_decl",
+"$$43 :",
+"$$44 :",
+"$$45 :",
+"$$46 :",
+"const_dcl : IDL_CONST $$43 const_type $$44 id $$45 '=' $$46 expression",
"const_type : integer_type",
"const_type : char_type",
"const_type : octet_type",
@@ -750,14 +968,15 @@ const char *tao_yyrule[] = {
"literal : IDL_TRUETOK",
"literal : IDL_FALSETOK",
"positive_int_expr : const_expr",
-"$$39 :",
-"type_dcl : IDL_TYPEDEF $$39 type_declarator",
+"$$47 :",
+"type_dcl : IDL_TYPEDEF $$47 type_declarator",
"type_dcl : struct_type",
"type_dcl : union_type",
"type_dcl : enum_type",
"type_dcl : IDL_NATIVE simple_declarator",
-"$$40 :",
-"type_declarator : type_spec $$40 at_least_one_declarator",
+"type_dcl : constructed_forward_type_spec",
+"$$48 :",
+"type_declarator : type_spec $$48 at_least_one_declarator",
"type_spec : simple_type_spec",
"type_spec : constructed_type_spec",
"simple_type_spec : base_type_spec",
@@ -770,21 +989,24 @@ const char *tao_yyrule[] = {
"base_type_spec : octet_type",
"base_type_spec : fixed_type",
"base_type_spec : any_type",
+"base_type_spec : object_type",
"template_type_spec : sequence_type_spec",
"template_type_spec : string_type_spec",
"template_type_spec : wstring_type_spec",
"constructed_type_spec : struct_type",
"constructed_type_spec : union_type",
"constructed_type_spec : enum_type",
+"constructed_forward_type_spec : struct_forward_type",
+"constructed_forward_type_spec : union_forward_type",
"at_least_one_declarator : declarator declarators",
-"$$41 :",
-"declarators : declarators ',' $$41 declarator",
+"$$49 :",
+"declarators : declarators ',' $$49 declarator",
"declarators :",
"declarator : simple_declarator",
"declarator : complex_declarator",
"at_least_one_simple_declarator : simple_declarator simple_declarators",
-"$$42 :",
-"simple_declarators : simple_declarators ',' $$42 simple_declarator",
+"$$50 :",
+"simple_declarators : simple_declarators ',' $$50 simple_declarator",
"simple_declarators :",
"simple_declarator : id",
"complex_declarator : array_declarator",
@@ -805,30 +1027,32 @@ const char *tao_yyrule[] = {
"octet_type : IDL_OCTET",
"boolean_type : IDL_BOOLEAN",
"any_type : IDL_ANY",
-"$$43 :",
-"$$44 :",
-"$$45 :",
-"$$46 :",
-"struct_type : IDL_STRUCT $$43 id $$44 '{' $$45 at_least_one_member $$46 '}'",
-"at_least_one_member : member members",
-"members : members member",
-"members :",
-"$$47 :",
-"member : $$47 member_i",
-"$$48 :",
-"$$49 :",
-"member_i : type_spec $$48 at_least_one_declarator $$49 ';'",
-"$$50 :",
-"member_i : error $$50 ';'",
+"object_type : IDL_OBJECT",
"$$51 :",
+"struct_decl : IDL_STRUCT $$51 id",
"$$52 :",
"$$53 :",
"$$54 :",
+"struct_type : struct_decl $$52 '{' $$53 at_least_one_member $$54 '}'",
+"at_least_one_member : member members",
+"members : members member",
+"members :",
"$$55 :",
+"member : $$55 member_i",
"$$56 :",
"$$57 :",
+"member_i : type_spec $$56 at_least_one_declarator $$57 ';'",
"$$58 :",
-"union_type : IDL_UNION $$51 id $$52 IDL_SWITCH $$53 '(' $$54 switch_type_spec $$55 ')' $$56 '{' $$57 at_least_one_case_branch $$58 '}'",
+"member_i : error $$58 ';'",
+"$$59 :",
+"union_decl : IDL_UNION $$59 id",
+"$$60 :",
+"$$61 :",
+"$$62 :",
+"$$63 :",
+"$$64 :",
+"$$65 :",
+"union_type : union_decl IDL_SWITCH $$60 '(' $$61 switch_type_spec $$62 ')' $$63 '{' $$64 at_least_one_case_branch $$65 '}'",
"switch_type_spec : integer_type",
"switch_type_spec : char_type",
"switch_type_spec : octet_type",
@@ -838,101 +1062,103 @@ const char *tao_yyrule[] = {
"at_least_one_case_branch : case_branch case_branches",
"case_branches : case_branches case_branch",
"case_branches :",
-"$$59 :",
-"$$60 :",
-"case_branch : at_least_one_case_label $$59 element_spec $$60 ';'",
-"$$61 :",
-"case_branch : error $$61 ';'",
-"at_least_one_case_label : case_label case_labels",
-"case_labels : case_labels case_label",
-"case_labels :",
-"$$62 :",
-"case_label : IDL_DEFAULT $$62 ':'",
-"$$63 :",
-"$$64 :",
-"case_label : IDL_CASE $$63 const_expr $$64 ':'",
-"$$65 :",
-"element_spec : type_spec $$65 declarator",
"$$66 :",
"$$67 :",
+"case_branch : at_least_one_case_label $$66 element_spec $$67 ';'",
"$$68 :",
+"case_branch : error $$68 ';'",
+"at_least_one_case_label : case_label case_labels",
+"case_labels : case_labels case_label",
+"case_labels :",
"$$69 :",
-"enum_type : IDL_ENUM $$66 id $$67 '{' $$68 at_least_one_enumerator $$69 '}'",
-"at_least_one_enumerator : enumerator enumerators",
+"case_label : IDL_DEFAULT $$69 ':'",
"$$70 :",
-"enumerators : enumerators ',' $$70 enumerator",
-"enumerators :",
-"enumerator : IDENTIFIER",
"$$71 :",
+"case_label : IDL_CASE $$70 const_expr $$71 ':'",
"$$72 :",
-"sequence_type_spec : seq_head ',' $$71 positive_int_expr $$72 '>'",
-"sequence_type_spec : seq_head '>'",
+"element_spec : type_spec $$72 declarator",
+"struct_forward_type : struct_decl",
+"union_forward_type : union_decl",
"$$73 :",
"$$74 :",
-"seq_head : IDL_SEQUENCE $$73 '<' $$74 simple_type_spec",
"$$75 :",
"$$76 :",
-"string_type_spec : string_head '<' $$75 positive_int_expr $$76 '>'",
-"string_type_spec : string_head",
-"string_head : IDL_STRING",
+"enum_type : IDL_ENUM $$73 id $$74 '{' $$75 at_least_one_enumerator $$76 '}'",
+"at_least_one_enumerator : enumerator enumerators",
"$$77 :",
+"enumerators : enumerators ',' $$77 enumerator",
+"enumerators :",
+"enumerator : IDENTIFIER",
"$$78 :",
-"wstring_type_spec : wstring_head '<' $$77 positive_int_expr $$78 '>'",
-"wstring_type_spec : wstring_head",
-"wstring_head : IDL_WSTRING",
"$$79 :",
-"array_declarator : id $$79 at_least_one_array_dim",
-"at_least_one_array_dim : array_dim array_dims",
-"array_dims : array_dims array_dim",
-"array_dims :",
+"sequence_type_spec : seq_head ',' $$78 positive_int_expr $$79 '>'",
+"sequence_type_spec : seq_head '>'",
"$$80 :",
"$$81 :",
-"array_dim : '[' $$80 positive_int_expr $$81 ']'",
+"seq_head : IDL_SEQUENCE $$80 '<' $$81 simple_type_spec",
"$$82 :",
"$$83 :",
-"attribute : opt_readonly IDL_ATTRIBUTE $$82 param_type_spec $$83 at_least_one_simple_declarator",
-"opt_readonly : IDL_READONLY",
-"opt_readonly :",
+"string_type_spec : string_head '<' $$82 positive_int_expr $$83 '>'",
+"string_type_spec : string_head",
+"string_head : IDL_STRING",
"$$84 :",
"$$85 :",
+"wstring_type_spec : wstring_head '<' $$84 positive_int_expr $$85 '>'",
+"wstring_type_spec : wstring_head",
+"wstring_head : IDL_WSTRING",
"$$86 :",
+"array_declarator : id $$86 at_least_one_array_dim",
+"at_least_one_array_dim : array_dim array_dims",
+"array_dims : array_dims array_dim",
+"array_dims :",
"$$87 :",
-"exception : IDL_EXCEPTION $$84 id $$85 '{' $$86 members $$87 '}'",
"$$88 :",
+"array_dim : '[' $$87 positive_int_expr $$88 ']'",
"$$89 :",
"$$90 :",
+"attribute : opt_readonly IDL_ATTRIBUTE $$89 param_type_spec $$90 at_least_one_simple_declarator",
+"opt_readonly : IDL_READONLY",
+"opt_readonly :",
"$$91 :",
-"operation : opt_op_attribute op_type_spec $$88 IDENTIFIER $$89 parameter_list $$90 opt_raises $$91 opt_context",
-"opt_op_attribute : IDL_ONEWAY",
-"opt_op_attribute : IDL_IDEMPOTENT",
-"opt_op_attribute :",
-"op_type_spec : param_type_spec",
-"op_type_spec : IDL_VOID",
"$$92 :",
"$$93 :",
-"init_decl : IDL_FACTORY $$92 IDENTIFIER $$93 init_parameter_list",
"$$94 :",
-"init_parameter_list : '(' $$94 ')'",
+"exception : IDL_EXCEPTION $$91 id $$92 '{' $$93 members $$94 '}'",
"$$95 :",
-"init_parameter_list : '(' $$95 at_least_one_in_parameter ')'",
-"at_least_one_in_parameter : in_parameter in_parameters",
"$$96 :",
-"in_parameters : in_parameters ',' $$96 in_parameter",
-"in_parameters :",
"$$97 :",
"$$98 :",
-"in_parameter : IDL_IN $$97 param_type_spec $$98 declarator",
+"operation : opt_op_attribute op_type_spec $$95 IDENTIFIER $$96 parameter_list $$97 opt_raises $$98 opt_context",
+"opt_op_attribute : IDL_ONEWAY",
+"opt_op_attribute : IDL_IDEMPOTENT",
+"opt_op_attribute :",
+"op_type_spec : param_type_spec",
+"op_type_spec : IDL_VOID",
"$$99 :",
-"parameter_list : '(' $$99 ')'",
"$$100 :",
-"parameter_list : '(' $$100 at_least_one_parameter ')'",
-"at_least_one_parameter : parameter parameters",
+"init_decl : IDL_FACTORY $$99 IDENTIFIER $$100 init_parameter_list",
"$$101 :",
-"parameters : parameters ',' $$101 parameter",
-"parameters :",
+"init_parameter_list : '(' $$101 ')'",
"$$102 :",
+"init_parameter_list : '(' $$102 at_least_one_in_parameter ')'",
+"at_least_one_in_parameter : in_parameters in_parameter",
"$$103 :",
-"parameter : direction $$102 param_type_spec $$103 declarator",
+"in_parameters : in_parameters ',' $$103 in_parameter",
+"in_parameters :",
+"$$104 :",
+"$$105 :",
+"in_parameter : IDL_IN $$104 param_type_spec $$105 declarator",
+"$$106 :",
+"parameter_list : '(' $$106 ')'",
+"$$107 :",
+"parameter_list : '(' $$107 at_least_one_parameter ')'",
+"at_least_one_parameter : parameter parameters",
+"$$108 :",
+"parameters : parameters ',' $$108 parameter",
+"parameters :",
+"$$109 :",
+"$$110 :",
+"parameter : direction $$109 param_type_spec $$110 declarator",
"param_type_spec : base_type_spec",
"param_type_spec : string_type_spec",
"param_type_spec : wstring_type_spec",
@@ -940,18 +1166,101 @@ const char *tao_yyrule[] = {
"direction : IDL_IN",
"direction : IDL_OUT",
"direction : IDL_INOUT",
-"$$104 :",
-"$$105 :",
-"opt_raises : IDL_RAISES $$104 '(' $$105 at_least_one_scoped_name ')'",
+"$$111 :",
+"$$112 :",
+"opt_raises : IDL_RAISES $$111 '(' $$112 at_least_one_scoped_name ')'",
"opt_raises :",
-"$$106 :",
-"$$107 :",
-"opt_context : IDL_CONTEXT $$106 '(' $$107 at_least_one_string_literal ')'",
+"$$113 :",
+"$$114 :",
+"opt_context : IDL_CONTEXT $$113 '(' $$114 at_least_one_string_literal ')'",
"opt_context :",
"at_least_one_string_literal : IDL_STRING_LITERAL string_literals",
-"$$108 :",
-"string_literals : string_literals ',' $$108 IDL_STRING_LITERAL",
+"$$115 :",
+"string_literals : string_literals ',' $$115 IDL_STRING_LITERAL",
"string_literals :",
+"typeid_dcl : IDL_TYPEID scoped_name IDL_STRING_LITERAL",
+"typeprefix_dcl : IDL_TYPEPREFIX scoped_name IDL_STRING_LITERAL",
+"component : component_decl",
+"component : component_forward_decl",
+"component_forward_decl : IDL_COMPONENT id",
+"$$116 :",
+"$$117 :",
+"$$118 :",
+"component_decl : component_header $$116 '{' $$117 component_exports $$118 '}'",
+"$$119 :",
+"$$120 :",
+"component_header : IDL_COMPONENT id $$119 component_inheritance_spec $$120 supports_spec",
+"$$121 :",
+"component_inheritance_spec : ':' $$121 scoped_name",
+"component_inheritance_spec :",
+"component_exports : component_exports component_export",
+"component_exports :",
+"$$122 :",
+"component_export : provides_decl $$122 ';'",
+"$$123 :",
+"component_export : uses_decl $$123 ';'",
+"$$124 :",
+"component_export : emits_decl $$124 ';'",
+"$$125 :",
+"component_export : publishes_decl $$125 ';'",
+"$$126 :",
+"component_export : consumes_decl $$126 ';'",
+"$$127 :",
+"component_export : attribute $$127 ';'",
+"provides_decl : IDL_PROVIDES interface_type id",
+"interface_type : scoped_name",
+"interface_type : IDL_OBJECT",
+"uses_decl : IDL_USES opt_multiple interface_type id",
+"opt_multiple : IDL_MULTIPLE",
+"opt_multiple :",
+"emits_decl : IDL_EMITS scoped_name id",
+"publishes_decl : IDL_PUBLISHES scoped_name id",
+"consumes_decl : IDL_CONSUMES scoped_name id",
+"$$128 :",
+"home_decl : home_header $$128 home_body",
+"$$129 :",
+"$$130 :",
+"$$131 :",
+"$$132 :",
+"$$133 :",
+"$$134 :",
+"home_header : IDL_HOME $$129 id $$130 home_inheritance_spec $$131 supports_spec $$132 IDL_MANAGES $$133 scoped_name $$134 primary_key_spec",
+"$$135 :",
+"home_inheritance_spec : ':' $$135 scoped_name",
+"home_inheritance_spec :",
+"primary_key_spec : IDL_PRIMARYKEY scoped_name",
+"primary_key_spec :",
+"$$136 :",
+"$$137 :",
+"home_body : '{' $$136 home_exports $$137 '}'",
+"home_exports : home_exports home_export",
+"home_exports :",
+"home_export : export",
+"$$138 :",
+"home_export : factory_decl $$138 ';'",
+"$$139 :",
+"home_export : finder_decl $$139 ';'",
+"$$140 :",
+"$$141 :",
+"factory_decl : IDL_FACTORY id $$140 init_parameter_list $$141 opt_raises",
+"$$142 :",
+"$$143 :",
+"finder_decl : IDL_FINDER id $$142 init_parameter_list $$143 opt_raises",
+"event : event_decl",
+"event : event_abs_decl",
+"event : event_forward_decl",
+"event_forward_decl : event_abs_forward_decl",
+"event_forward_decl : event_concrete_forward_decl",
+"event_concrete_forward_decl : IDL_EVENTTYPE id",
+"event_abs_forward_decl : IDL_ABSTRACT IDL_EVENTTYPE id",
+"event_abs_decl : event_abs_header event_rest_of_header '{' exports '}'",
+"event_abs_header : IDL_ABSTRACT IDL_EVENTTYPE id",
+"event_custom_header : IDL_CUSTOM IDL_EVENTTYPE id",
+"event_plain_header : IDL_EVENTTYPE id",
+"event_rest_of_header : opt_truncatable inheritance_spec supports_spec",
+"event_decl : event_header event_rest_of_header '{' value_elements '}'",
+"event_header : event_custom_header",
+"event_header : event_plain_header",
};
#endif
#define tao_yyclearin (tao_yychar=(-1))
@@ -980,7 +1289,7 @@ TAO_YYSTYPE tao_yyvs[TAO_YYSTACKSIZE];
* ???
*/
int
-tao_yywrap ()
+tao_yywrap (void)
{
return 1;
}
@@ -1301,232 +1610,365 @@ tao_yyreduce:
{
case 4:
{
+/* definition : type_dcl*/
idl_global->set_parse_state (IDL_GlobalData::PS_TypeDeclSeen);
}
break;
case 5:
{
+/* ';'*/
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
break;
case 6:
{
- idl_global->set_parse_state (IDL_GlobalData::PS_ConstDeclSeen);
+/* | typeid_dcl*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_TypeIdDeclSeen);
}
break;
case 7:
{
+/* ';'*/
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
break;
case 8:
{
- idl_global->set_parse_state (IDL_GlobalData::PS_ExceptDeclSeen);
+/* | typeprefix_dcl*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_TypePrefixDeclSeen);
}
break;
case 9:
{
+/* ';'*/
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
break;
case 10:
{
- idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceDeclSeen);
+/* | const_dcl*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_ConstDeclSeen);
}
break;
case 11:
{
+/* ';'*/
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
break;
case 12:
{
- idl_global->set_parse_state (IDL_GlobalData::PS_ModuleDeclSeen);
+/* | exception*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_ExceptDeclSeen);
}
break;
case 13:
{
- idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+/* ';'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
break;
case 14:
{
- idl_global->set_parse_state (IDL_GlobalData::PS_ValuetypeDeclSeen);
+/* | interface_def*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceDeclSeen);
}
break;
case 15:
{
+/* ';'*/
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
break;
case 16:
{
- idl_global->err()->syntax_error (idl_global->parse_state());
+/* | module*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_ModuleDeclSeen);
}
break;
case 17:
{
+/* ';'*/
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
- tao_yyerrok;
}
break;
case 18:
{
+/* | value_def*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeDeclSeen);
+ }
+break;
+case 19:
+{
+/* ';'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+break;
+case 20:
+{
+/* | component*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_ComponentDeclSeen);
+ }
+break;
+case 21:
+{
+/* ';'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+break;
+case 22:
+{
+/* | home_decl*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_HomeDeclSeen);
+ }
+break;
+case 23:
+{
+/* ';'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+break;
+case 24:
+{
+/* | event*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_EventDeclSeen);
+ }
+break;
+case 25:
+{
+/* ';'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+break;
+case 26:
+{
+/* | error*/
+ idl_global->err()->syntax_error (idl_global->parse_state());
+ }
+break;
+case 27:
+{
+/* ';'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ tao_yyerrok;
+ }
+break;
+case 28:
+{
+/* module : IDL_MODULE*/
idl_global->set_parse_state (IDL_GlobalData::PS_ModuleSeen);
}
break;
-case 19:
+case 29:
{
- UTL_ScopedName *n =
- new UTL_ScopedName(new Identifier (tao_yyvsp[0].strval), 0);
+/* IDENTIFIER*/
+ Identifier id (tao_yyvsp[0].strval);
+ UTL_ScopedName n (&id,
+ 0);
AST_Module *m = 0;
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
idl_global->set_parse_state (IDL_GlobalData::PS_ModuleIDSeen);
/*
* Make a new module and add it to the enclosing scope
*/
- if (s != 0) {
- m = idl_global->gen ()->create_module (s, n);
- (void) s->fe_add_module (m);
- }
+ if (s != 0)
+ {
+ m = idl_global->gen ()->create_module (s,
+ &n);
+ (void) s->fe_add_module (m);
+ }
/*
* Push it on the stack
*/
- idl_global->scopes ()->push (m);
+ idl_global->scopes ().push (m);
}
break;
-case 20:
+case 30:
{
+/* '{'*/
idl_global->set_parse_state (IDL_GlobalData::PS_ModuleSqSeen);
}
break;
-case 21:
+case 31:
{
+/* definitions*/
idl_global->set_parse_state (IDL_GlobalData::PS_ModuleBodySeen);
}
break;
-case 22:
+case 32:
{
+/* '}'*/
idl_global->set_parse_state (IDL_GlobalData::PS_ModuleQsSeen);
/*
- * Finished with this module - pop it from the scope stack
+ * Finished with this module - pop it from the scope stack.
*/
- idl_global->scopes ()->pop ();
+ idl_global->scopes ().pop ();
}
break;
-case 25:
+case 35:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+/* interface : interface_header */
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Interface *i = 0;
/*
- * Make a new interface node and add it to its enclosing scope
+ * Make a new interface node and add it to its enclosing scope.
*/
- if (s != 0 && tao_yyvsp[0].ihval != 0) {
- i = idl_global->gen ()->create_interface (
- tao_yyvsp[0].ihval->interface_name (),
- tao_yyvsp[0].ihval->inherits (),
- tao_yyvsp[0].ihval->n_inherits (),
- tao_yyvsp[0].ihval->inherits_flat (),
- tao_yyvsp[0].ihval->n_inherits_flat (),
- tao_yyvsp[0].ihval->is_local (),
- tao_yyvsp[0].ihval->is_abstract ()
- );
- AST_Interface::fwd_redefinition_helper (i, s);
- /*
- * Add the interface to its definition scope
- */
- (void) s->fe_add_interface (i);
- }
+ if (s != 0 && tao_yyvsp[0].ihval != 0)
+ {
+ i =
+ idl_global->gen ()->create_interface (
+ tao_yyvsp[0].ihval->name (),
+ tao_yyvsp[0].ihval->inherits (),
+ tao_yyvsp[0].ihval->n_inherits (),
+ tao_yyvsp[0].ihval->inherits_flat (),
+ tao_yyvsp[0].ihval->n_inherits_flat (),
+ tao_yyvsp[0].ihval->is_local (),
+ tao_yyvsp[0].ihval->is_abstract ()
+ );
+ AST_Interface::fwd_redefinition_helper (i,
+ s);
+ /*
+ * Add the interface to its definition scope.
+ */
+ (void) s->fe_add_interface (i);
+
+ /* This FE_InterfaceHeader class isn't destroyed with the AST.*/
+ tao_yyvsp[0].ihval->name ()->destroy ();
+ delete tao_yyvsp[0].ihval;
+ tao_yyvsp[0].ihval = 0;
+ }
+
/*
- * Push it on the scope stack
+ * Push it on the scope stack.
*/
- idl_global->scopes ()->push (i);
+ idl_global->scopes ().push (i);
}
break;
-case 26:
+case 36:
{
+/* '{'*/
idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSqSeen);
}
break;
-case 27:
+case 37:
{
+/* exports*/
idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceBodySeen);
}
break;
-case 28:
+case 38:
{
+/* '}'*/
idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceQsSeen);
+
/*
* Done with this interface - pop it off the scopes stack
*/
- idl_global->scopes ()->pop ();
+ idl_global->scopes ().pop ();
}
break;
-case 29:
+case 39:
{
+/* interface_decl : IDL_INTERFACE*/
idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSeen);
}
break;
-case 30:
+case 40:
{
+/* id*/
idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceIDSeen);
tao_yyval.idval = tao_yyvsp[0].idval;
}
break;
-case 31:
+case 41:
{
+/* interface_header : interface_decl inheritance_spec*/
idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
+
/*
* Create an AST representation of the information in the header
* part of an interface - this representation contains a computed
* list of all interfaces which this interface inherits from,
* recursively
*/
- tao_yyval.ihval = new FE_InterfaceHeader (new UTL_ScopedName (tao_yyvsp[-1].idval, 0), tao_yyvsp[0].nlval);
+ UTL_ScopedName n (tao_yyvsp[-1].idval,
+ 0);
+ ACE_NEW_RETURN (tao_yyval.ihval,
+ FE_InterfaceHeader (&n,
+ tao_yyvsp[0].nlval,
+ I_FALSE,
+ I_FALSE,
+ I_TRUE),
+ 1);
}
break;
-case 32:
+case 42:
{
+/* | IDL_LOCAL interface_decl inheritance_spec*/
idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
+
/*
* Create an AST representation of the information in the header
* part of an interface - this representation contains a computed
* list of all interfaces which this interface inherits from,
* recursively
*/
- tao_yyval.ihval = new FE_Local_InterfaceHeader (new UTL_ScopedName(tao_yyvsp[-1].idval, 0), tao_yyvsp[0].nlval);
+ UTL_ScopedName n (tao_yyvsp[-1].idval,
+ 0);
+ ACE_NEW_RETURN (tao_yyval.ihval,
+ FE_InterfaceHeader (&n,
+ tao_yyvsp[0].nlval,
+ I_TRUE,
+ I_FALSE,
+ I_TRUE),
+ 1);
}
break;
-case 33:
+case 43:
{
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("error in %s line %d\n"),
- idl_global->filename ()->get_string (),
- idl_global->lineno ()));
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("Sorry, I (TAO_IDL) can't handle abstract")
- ACE_TEXT (" interfaces yet\n")));
+/* | IDL_ABSTRACT interface_decl inheritance_spec*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
+
+ /*
+ * Create an AST representation of the information in the header
+ * part of an interface - this representation contains a computed
+ * list of all interfaces which this interface inherits from,
+ * recursively
+ */
+ UTL_ScopedName n (tao_yyvsp[-1].idval,
+ 0);
+ ACE_NEW_RETURN (tao_yyval.ihval,
+ FE_InterfaceHeader (&n,
+ tao_yyvsp[0].nlval,
+ I_FALSE,
+ I_TRUE,
+ I_TRUE),
+ 1);
}
break;
-case 34:
+case 44:
{
+/* inheritance_spec : ':'*/
idl_global->set_parse_state (IDL_GlobalData::PS_InheritColonSeen);
}
break;
-case 35:
+case 45:
{
+/* at_least_one_scoped_name*/
tao_yyval.nlval = tao_yyvsp[0].nlval;
}
break;
-case 36:
+case 46:
{
+/* | /* EMPTY * /*/
tao_yyval.nlval = 0;
}
break;
-case 41:
+case 51:
{
+/* valuetype : IDL_CUSTOM value_concrete_decl*/
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("error in %s line %d\n"),
idl_global->filename ()->get_string (),
@@ -1536,178 +1978,243 @@ case 41:
ACE_TEXT (" custom yet\n")));
}
break;
-case 43:
+case 53:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+/* value_concrete_decl : value_header*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_ValueType *v = 0;
AST_Interface *i = 0;
- if (s != 0 && tao_yyvsp[0].vhval != 0) {
- i = idl_global->gen ()->create_valuetype (tao_yyvsp[0].vhval->interface_name (),
- tao_yyvsp[0].vhval->inherits (),
- tao_yyvsp[0].vhval->n_inherits ());
- AST_Interface::fwd_redefinition_helper (i, s);
- /*
- * Add the valuetype to its definition scope
- */
- (void) s->fe_add_interface (i);
- }
+ if (s != 0 && tao_yyvsp[0].vhval != 0)
+ {
+ v =
+ idl_global->gen ()->create_valuetype (
+ tao_yyvsp[0].vhval->name (),
+ tao_yyvsp[0].vhval->inherits (),
+ tao_yyvsp[0].vhval->n_inherits (),
+ tao_yyvsp[0].vhval->inherits_concrete (),
+ tao_yyvsp[0].vhval->inherits_flat (),
+ tao_yyvsp[0].vhval->n_inherits_flat (),
+ tao_yyvsp[0].vhval->supports (),
+ tao_yyvsp[0].vhval->n_supports (),
+ tao_yyvsp[0].vhval->supports_concrete (),
+ I_FALSE,
+ tao_yyvsp[0].vhval->truncatable ()
+ );
+ i = AST_Interface::narrow_from_decl (v);
+ AST_Interface::fwd_redefinition_helper (i,
+ s);
+ /*
+ * Add the valuetype to its definition scope
+ */
+ v = AST_ValueType::narrow_from_decl (i);
+ (void) s->fe_add_valuetype (v);
+ }
+
/*
* Push it on the scope stack
*/
- idl_global->scopes ()->push (i);
+ idl_global->scopes ().push (v);
}
break;
-case 44:
+case 54:
{
- idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSqSeen);
+/* '{'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeSqSeen);
}
break;
-case 45:
+case 55:
{
- idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceBodySeen);
+/* value_elements*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeBodySeen);
}
break;
-case 46:
+case 56:
{
- idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceQsSeen);
+/* '}'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeQsSeen);
+
/*
- * Done with this interface - pop it off the scopes stack
+ * Done with this valuetype - pop it off the scopes stack
*/
- UTL_Scope* s = idl_global->scopes ()->top ();
- AST_Interface* m = AST_Interface::narrow_from_scope (s);
- m->inherited_name_clash ();
- idl_global->scopes ()->pop ();
+ idl_global->scopes ().pop ();
}
break;
-case 47:
+case 57:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+/* value_abs_decl : IDL_ABSTRACT value_header*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_ValueType *v = 0;
AST_Interface *i = 0;
- if (s != 0 && tao_yyvsp[0].vhval != 0) {
-
- if (tao_yyvsp[0].vhval->n_concrete() > 0) {
- idl_global->err ()->abstract_inheritance_error (tao_yyvsp[0].vhval->interface_name ());
+ if (s != 0 && tao_yyvsp[0].vhval != 0)
+ {
+ v =
+ idl_global->gen ()->create_valuetype (
+ tao_yyvsp[0].vhval->name (),
+ tao_yyvsp[0].vhval->inherits (),
+ tao_yyvsp[0].vhval->n_inherits (),
+ tao_yyvsp[0].vhval->inherits_concrete (),
+ tao_yyvsp[0].vhval->inherits_flat (),
+ tao_yyvsp[0].vhval->n_inherits_flat (),
+ tao_yyvsp[0].vhval->supports (),
+ tao_yyvsp[0].vhval->n_supports (),
+ tao_yyvsp[0].vhval->supports_concrete (),
+ I_TRUE,
+ I_FALSE
+ );
+ i = AST_Interface::narrow_from_decl (v);
+ AST_Interface::fwd_redefinition_helper (i,
+ s);
+ /*
+ * Add the valuetype to its definition scope
+ */
+ v = AST_ValueType::narrow_from_decl (i);
+ (void) s->fe_add_valuetype (v);
}
- i = idl_global->gen()->create_valuetype (tao_yyvsp[0].vhval->interface_name (),
- tao_yyvsp[0].vhval->inherits (),
- tao_yyvsp[0].vhval->n_inherits ());
- i->set_abstract_valuetype ();
- AST_Interface::fwd_redefinition_helper (i, s);
- /*
- * Add the valuetype to its definition scope
- */
- (void) s->fe_add_interface (i);
- }
/*
- * Push it on the scope stack
+ * Push it on the scope stack.
*/
- idl_global->scopes ()->push (i);
+ idl_global->scopes ().push (v);
}
break;
-case 48:
+case 58:
{
- idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSqSeen);
+/* '{'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeSqSeen);
}
break;
-case 49:
+case 59:
{
- idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceBodySeen);
+/* exports*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeBodySeen);
}
break;
-case 50:
+case 60:
{
- idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceQsSeen);
+/* '}'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeQsSeen);
+
/*
- * Done with this interface - pop it off the scopes stack
+ * Done with this valuetype - pop it off the scopes stack.
*/
- UTL_Scope* s = idl_global->scopes ()->top ();
- AST_Interface* m = AST_Interface::narrow_from_scope (s);
- m->inherited_name_clash ();
- idl_global->scopes ()->pop ();
+ idl_global->scopes ().pop ();
}
break;
-case 51:
+case 61:
{
- tao_yyval.vhval = new FE_obv_header (new UTL_ScopedName (tao_yyvsp[-3].idval, 0), tao_yyvsp[-1].nlval, tao_yyvsp[0].nlval);
+/* value_header : value_decl opt_truncatable inheritance_spec */
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
}
break;
-case 52:
+case 62:
{
- idl_global->set_parse_state (IDL_GlobalData::PS_ValuetypeSeen);
+/* supports_spec*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
+
+ UTL_ScopedName *sn = 0;
+ ACE_NEW_RETURN (sn,
+ UTL_ScopedName (tao_yyvsp[-4].idval,
+ 0),
+ 1);
+ ACE_NEW_RETURN (tao_yyval.vhval,
+ FE_OBVHeader (sn,
+ tao_yyvsp[-2].nlval,
+ tao_yyvsp[0].nlval,
+ tao_yyvsp[-3].bval),
+ 1);
}
break;
-case 53:
+case 63:
{
- idl_global->set_parse_state (IDL_GlobalData::PS_ValuetypeIDSeen);
- tao_yyval.idval = tao_yyvsp[0].idval;
+/* value_decl : IDL_VALUETYPE*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeSeen);
}
break;
-case 54:
+case 64:
{
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("warning in %s line %d\n"),
- idl_global->filename ()->get_string (),
- idl_global->lineno ()));
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("truncatable modifier not supported ")
- ACE_TEXT ("and is ignored\n")));
- tao_yyval.bval = I_FALSE;
- }
+/* id*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeIDSeen);
+ tao_yyval.idval = tao_yyvsp[0].idval;
+ }
break;
-case 55:
+case 65:
{
- tao_yyval.bval = I_FALSE;
- }
+/* opt_truncatable : IDL_TRUNCATABLE*/
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("warning in %s line %d\n"),
+ idl_global->filename ()->get_string (),
+ idl_global->lineno ()));
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("truncatable modifier not supported ")
+ ACE_TEXT ("and is ignored\n")));
+ tao_yyval.bval = I_FALSE;
+ }
break;
-case 56:
+case 66:
{
- tao_yyval.nlval = new UTL_NameList (tao_yyvsp[0].idlist, 0);
- }
+/* | /* EMPTY * /*/
+ tao_yyval.bval = I_FALSE;
+ }
break;
-case 57:
+case 67:
{
- tao_yyval.nlval = 0;
- }
+/* supports_spec : IDL_SUPPORTS at_least_one_scoped_name*/
+ tao_yyval.nlval = tao_yyvsp[0].nlval;
+ }
break;
-case 58:
+case 68:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- UTL_ScopedName *n = new UTL_ScopedName (tao_yyvsp[0].idval, 0);
- AST_InterfaceFwd *f = 0;
+/* | /* EMPTY * /*/
+ tao_yyval.nlval = 0;
+ }
+break;
+case 69:
+{
+/* value_forward_decl : IDL_ABSTRACT value_decl*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n (tao_yyvsp[0].idval,
+ 0);
+ AST_ValueTypeFwd *f = 0;
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeForwardSeen);
- idl_global->set_parse_state (IDL_GlobalData::PS_ForwardDeclSeen);
/*
* Create a node representing a forward declaration of an
* valuetype. Store it in the enclosing scope
*/
- if (s != 0) {
- f = idl_global->gen()->create_valuetype_fwd (n);
- f->set_abstract_valuetype ();
- (void) s->fe_add_interface_fwd (f);
- }
+ if (s != 0)
+ {
+ f = idl_global->gen ()->create_valuetype_fwd (&n,
+ I_TRUE);
+ (void) s->fe_add_valuetype_fwd (f);
+ }
}
break;
-case 59:
+case 70:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- UTL_ScopedName *n = new UTL_ScopedName (tao_yyvsp[0].idval, 0);
- AST_InterfaceFwd *f = 0;
+/* | value_decl*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n (tao_yyvsp[0].idval,
+ 0);
+ AST_ValueTypeFwd *f = 0;
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueTypeForwardSeen);
- idl_global->set_parse_state (IDL_GlobalData::PS_ForwardDeclSeen);
/*
* Create a node representing a forward declaration of an
* valuetype. Store it in the enclosing scope
*/
- if (s != 0) {
- f = idl_global->gen ()->create_valuetype_fwd (n);
- (void) s->fe_add_interface_fwd (f);
- }
+ if (s != 0)
+ {
+ f = idl_global->gen ()->create_valuetype_fwd (&n,
+ I_FALSE);
+ (void) s->fe_add_valuetype_fwd (f);
+ }
}
break;
-case 60:
+case 71:
{
+/* value_box_decl : value_decl type_spec*/
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("error in %s line %d\n"),
idl_global->filename ()->get_string (),
@@ -1717,251 +2224,388 @@ case 60:
ACE_TEXT (" boxes yet\n")));
}
break;
-case 66:
+case 77:
{
- /* is $0 to member_i */
- tao_yyval.vival = AST_Field::vis_PUBLIC;
- }
+/* state_member : IDL_PUBLIC*/
+ /* is $0 to member_i */
+ tao_yyval.vival = AST_Field::vis_PUBLIC;
+ }
break;
-case 68:
+case 79:
{
- /* is $0 to member_i */
- tao_yyval.vival = AST_Field::vis_PRIVATE;
- }
+/* IDL_PRIVATE*/
+ /* is $0 to member_i */
+ tao_yyval.vival = AST_Field::vis_PRIVATE;
+ }
break;
-case 72:
+case 83:
{
+/* export : type_dcl*/
idl_global->set_parse_state (IDL_GlobalData::PS_TypeDeclSeen);
}
break;
-case 73:
+case 84:
+{
+/* ';'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+break;
+case 85:
{
+/* | typeid_dcl*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_TypeIdDeclSeen);
+ }
+break;
+case 86:
+{
+/* ';'*/
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
break;
-case 74:
+case 87:
{
+/* | typeprefix_dcl*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_TypePrefixDeclSeen);
+ }
+break;
+case 88:
+{
+/* ';'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+break;
+case 89:
+{
+/* | const_dcl*/
idl_global->set_parse_state (IDL_GlobalData::PS_ConstDeclSeen);
}
break;
-case 75:
+case 90:
{
+/* ';'*/
idl_global->set_parse_state(IDL_GlobalData::PS_NoState);
}
break;
-case 76:
+case 91:
{
+/* | exception*/
idl_global->set_parse_state (IDL_GlobalData::PS_ExceptDeclSeen);
}
break;
-case 77:
+case 92:
{
+/* ';'*/
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
break;
-case 78:
+case 93:
{
+/* | attribute*/
idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclSeen);
}
break;
-case 79:
+case 94:
{
+/* ';'*/
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
break;
-case 80:
+case 95:
{
+/* | operation*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpDeclSeen);
}
break;
-case 81:
+case 96:
{
+/* ';'*/
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
}
break;
-case 82:
+case 97:
{
+/* | error*/
idl_global->err()->syntax_error (idl_global->parse_state());
}
break;
-case 83:
+case 98:
{
+/* ';'*/
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
tao_yyerrok;
}
break;
-case 84:
+case 99:
{
- tao_yyval.nlval = new UTL_NameList (tao_yyvsp[-1].idlist, tao_yyvsp[0].nlval);
+/* at_least_one_scoped_name : scoped_name scoped_names*/
+ ACE_NEW_RETURN (tao_yyval.nlval,
+ UTL_NameList (tao_yyvsp[-1].idlist,
+ tao_yyvsp[0].nlval),
+ 1);
}
break;
-case 85:
+case 100:
{
+/* scoped_names : scoped_names ','*/
idl_global->set_parse_state (IDL_GlobalData::PS_SNListCommaSeen);
}
break;
-case 86:
+case 101:
{
+/* scoped_name*/
idl_global->set_parse_state (IDL_GlobalData::PS_ScopedNameSeen);
if (tao_yyvsp[-3].nlval == 0)
- tao_yyval.nlval = new UTL_NameList (tao_yyvsp[0].idlist, 0);
- else {
- tao_yyvsp[-3].nlval->nconc (new UTL_NameList (tao_yyvsp[0].idlist, 0));
- tao_yyval.nlval = tao_yyvsp[-3].nlval;
- }
+ {
+ ACE_NEW_RETURN (tao_yyval.nlval,
+ UTL_NameList (tao_yyvsp[0].idlist,
+ 0),
+ 1);
+ }
+ else
+ {
+ UTL_NameList *nl = 0;
+ ACE_NEW_RETURN (nl,
+ UTL_NameList (tao_yyvsp[0].idlist,
+ 0),
+ 1);
+ tao_yyvsp[-3].nlval->nconc (nl);
+ tao_yyval.nlval = tao_yyvsp[-3].nlval;
+ }
}
break;
-case 87:
+case 102:
{
+/* | /* EMPTY * /*/
tao_yyval.nlval = 0;
}
break;
-case 88:
+case 103:
{
+/* scoped_name : id*/
idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen);
- tao_yyval.idlist = new UTL_IdList(tao_yyvsp[0].idval, 0);
+ ACE_NEW_RETURN (tao_yyval.idlist,
+ UTL_IdList (tao_yyvsp[0].idval,
+ 0),
+ 1);
}
break;
-case 89:
+case 104:
{
+/* | IDL_SCOPE_DELIMITOR*/
idl_global->set_parse_state (IDL_GlobalData::PS_ScopeDelimSeen);
}
break;
-case 90:
+case 105:
{
+/* id*/
idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen);
- tao_yyval.idlist = new UTL_IdList (new Identifier (tao_yyvsp[-2].strval),
- new UTL_IdList (tao_yyvsp[0].idval, 0));
- }
-break;
-case 91:
-{
+ Identifier *id = 0;
+ ACE_NEW_RETURN (id,
+ Identifier (tao_yyvsp[-2].strval),
+ 1);
+ UTL_IdList *sn = 0;
+ ACE_NEW_RETURN (sn,
+ UTL_IdList (tao_yyvsp[0].idval,
+ 0),
+ 1);
+ ACE_NEW_RETURN (tao_yyval.idlist,
+ UTL_IdList (id,
+ sn),
+ 1);
+ }
+break;
+case 106:
+{
+/* | scoped_name IDL_SCOPE_DELIMITOR*/
idl_global->set_parse_state (IDL_GlobalData::PS_ScopeDelimSeen);
}
break;
-case 92:
+case 107:
{
+/* id*/
idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen);
- tao_yyvsp[-3].idlist->nconc (new UTL_IdList (tao_yyvsp[0].idval, 0));
+ UTL_IdList *sn = 0;
+ ACE_NEW_RETURN (sn,
+ UTL_IdList (tao_yyvsp[0].idval,
+ 0),
+ 1);
+ tao_yyvsp[-3].idlist->nconc (sn);
tao_yyval.idlist = tao_yyvsp[-3].idlist;
}
break;
-case 93:
+case 108:
{
- tao_yyval.idval = new Identifier (tao_yyvsp[0].strval);
+/* id: IDENTIFIER*/
+ ACE_NEW_RETURN (tao_yyval.idval,
+ Identifier (tao_yyvsp[0].strval),
+ 1);
+ ACE_OS::free (tao_yyvsp[0].strval);
}
break;
-case 94:
+case 109:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- UTL_ScopedName *n = new UTL_ScopedName(tao_yyvsp[0].idval, 0);
+/* interface_forward : interface_decl*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n (tao_yyvsp[0].idval,
+ 0);
AST_InterfaceFwd *f = 0;
+ idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceForwardSeen);
- idl_global->set_parse_state (IDL_GlobalData::PS_ForwardDeclSeen);
/*
* Create a node representing a forward declaration of an
* interface. Store it in the enclosing scope
*/
- if (s != 0) {
- f = idl_global->gen ()->create_interface_fwd (n, 0, 0);
- (void) s->fe_add_interface_fwd (f);
- }
+ if (s != 0)
+ {
+ f = idl_global->gen ()->create_interface_fwd (&n,
+ 0,
+ 0);
+ (void) s->fe_add_interface_fwd (f);
+ }
}
break;
-case 95:
+case 110:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- UTL_ScopedName *n = new UTL_ScopedName (tao_yyvsp[0].idval, 0);
+/* | IDL_LOCAL interface_decl*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n (tao_yyvsp[0].idval,
+ 0);
AST_InterfaceFwd *f = 0;
+ idl_global->set_parse_state (
+ IDL_GlobalData::PS_InterfaceForwardSeen
+ );
- idl_global->set_parse_state (IDL_GlobalData::PS_ForwardDeclSeen);
/*
* Create a node representing a forward declaration of an
* interface. Store it in the enclosing scope
*/
- if (s != 0) {
- f = idl_global->gen ()->create_interface_fwd (n, 1, 0);
- (void) s->fe_add_interface_fwd (f);
- }
+ if (s != 0)
+ {
+ f = idl_global->gen ()->create_interface_fwd (&n,
+ 1,
+ 0);
+ (void) s->fe_add_interface_fwd (f);
+ }
}
break;
-case 96:
+case 111:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- UTL_ScopedName *n = new UTL_ScopedName (tao_yyvsp[0].idval, 0);
+/* | IDL_ABSTRACT interface_decl*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n (tao_yyvsp[0].idval,
+ 0);
AST_InterfaceFwd *f = 0;
+ idl_global->set_parse_state (
+ IDL_GlobalData::PS_InterfaceForwardSeen
+ );
- idl_global->set_parse_state (IDL_GlobalData::PS_ForwardDeclSeen);
/*
* Create a node representing a forward declaration of an
* interface. Store it in the enclosing scope
*/
- if (s != 0) {
- f = idl_global->gen ()->create_interface_fwd (n, 0, 1);
- (void) s->fe_add_interface_fwd (f);
- }
+ if (s != 0)
+ {
+ f = idl_global->gen ()->create_interface_fwd (&n,
+ 0,
+ 1);
+ (void) s->fe_add_interface_fwd (f);
+ }
}
break;
-case 97:
+case 112:
{
+/* const_dcl : IDL_CONST*/
idl_global->set_parse_state (IDL_GlobalData::PS_ConstSeen);
}
break;
-case 98:
+case 113:
{
+/* const_type*/
idl_global->set_parse_state (IDL_GlobalData::PS_ConstTypeSeen);
}
break;
-case 99:
+case 114:
{
+/* id*/
idl_global->set_parse_state (IDL_GlobalData::PS_ConstIDSeen);
}
break;
-case 100:
+case 115:
{
+/* '='*/
idl_global->set_parse_state (IDL_GlobalData::PS_ConstAssignSeen);
}
break;
-case 101:
+case 116:
{
- UTL_ScopedName *n = new UTL_ScopedName (tao_yyvsp[-4].idval, 0);
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+/* expression*/
+ UTL_ScopedName n (tao_yyvsp[-4].idval,
+ 0);
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Constant *c = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_ConstExprSeen);
+
/*
* Create a node representing a constant declaration. Store
- * it in the enclosing scope
+ * it in the enclosing scope.
*/
- if (tao_yyvsp[0].exval != 0 && s != 0) {
- if (tao_yyvsp[0].exval->coerce (tao_yyvsp[-6].etval) == 0)
- idl_global->err ()->coercion_error (tao_yyvsp[0].exval, tao_yyvsp[-6].etval);
- else {
- c =
- idl_global->gen ()->create_constant (tao_yyvsp[-6].etval, tao_yyvsp[0].exval, n);
- (void) s->fe_add_constant (c);
+ if (tao_yyvsp[0].exval != 0 && s != 0)
+ {
+ AST_Expression::AST_ExprValue *result =
+ tao_yyvsp[0].exval->check_and_coerce (tao_yyvsp[-6].etval,
+ tao_enum_constant_decl);
+ tao_enum_constant_decl = 0;
+
+ if (result == 0)
+ {
+ idl_global->err ()->coercion_error (tao_yyvsp[0].exval,
+ tao_yyvsp[-6].etval);
+ }
+ else
+ {
+ c =
+ idl_global->gen ()->create_constant (
+ tao_yyvsp[-6].etval,
+ tao_yyvsp[0].exval,
+ &n
+ );
+ (void) s->fe_add_constant (c);
+ delete result;
+ }
+
+ tao_yyvsp[-4].idval->destroy ();
+ delete tao_yyvsp[-4].idval;
+ tao_yyvsp[-4].idval = 0;
}
- }
}
break;
-case 108:
+case 123:
{
+/* const_type*/
+/* : integer_type*/
+/* | char_type*/
+/* | octet_type*/
+/* | boolean_type*/
+/* | floating_pt_type*/
+/* | fixed_type*/
+/* | string_type_spec*/
tao_yyval.etval = AST_Expression::EV_string;
}
break;
-case 109:
+case 124:
{
+/* | wstring_type_spec*/
tao_yyval.etval = AST_Expression::EV_wstring;
}
break;
-case 110:
+case 125:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- AST_Decl *d = 0;
+/* | scoped_name*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_PredefinedType *c = 0;
AST_Typedef *t = 0;
@@ -1969,137 +2613,221 @@ case 110:
* If the constant's type is a scoped name, it must resolve
* to a scalar constant type
*/
- if (s != 0 && (d = s->lookup_by_name (tao_yyvsp[0].idlist, I_TRUE)) != 0) {
- /*
- * Look through typedefs
- */
- while (d->node_type () == AST_Decl::NT_typedef) {
- t = AST_Typedef::narrow_from_decl (d);
- if (t == 0)
- break;
- d = t->base_type ();
- }
- if (d == 0)
- tao_yyval.etval = AST_Expression::EV_any;
- else if (d->node_type () == AST_Decl::NT_pre_defined) {
- c = AST_PredefinedType::narrow_from_decl (d);
- if (c != 0) {
- tao_yyval.etval = idl_global->PredefinedTypeToExprType (c->pt ());
- } else {
- tao_yyval.etval = AST_Expression::EV_any;
- }
- } else if (d->node_type () == AST_Decl::NT_string) {
- tao_yyval.etval = AST_Expression::EV_string;
- } else if (d->node_type () == AST_Decl::NT_wstring) {
- tao_yyval.etval = AST_Expression::EV_wstring;
- } else
- tao_yyval.etval = AST_Expression::EV_any;
- } else
- tao_yyval.etval = AST_Expression::EV_any;
+ AST_Decl *d =
+ s->lookup_by_name (tao_yyvsp[0].idlist,
+ I_TRUE);
+
+ if (s != 0 && d != 0)
+ {
+ tao_enum_constant_decl = d;
+
+ /*
+ * Look through typedefs.
+ */
+ while (d->node_type () == AST_Decl::NT_typedef)
+ {
+ t = AST_Typedef::narrow_from_decl (d);
+
+ if (t == 0)
+ {
+ break;
+ }
+
+ d = t->base_type ();
+ }
+
+ if (d == 0)
+ {
+ tao_yyval.etval = AST_Expression::EV_enum;
+ }
+ else if (d->node_type () == AST_Decl::NT_pre_defined)
+ {
+ c = AST_PredefinedType::narrow_from_decl (d);
+
+ if (c != 0)
+ {
+ tao_yyval.etval = idl_global->PredefinedTypeToExprType (c->pt ());
+ }
+ else
+ {
+ tao_yyval.etval = AST_Expression::EV_enum;
+ }
+ }
+ else if (d->node_type () == AST_Decl::NT_string)
+ {
+ tao_yyval.etval = AST_Expression::EV_string;
+ }
+ else if (d->node_type () == AST_Decl::NT_wstring)
+ {
+ tao_yyval.etval = AST_Expression::EV_wstring;
+ }
+ else
+ {
+ tao_yyval.etval = AST_Expression::EV_enum;
+ }
+ }
+ else
+ {
+ tao_yyval.etval = AST_Expression::EV_enum;
+ }
}
break;
-case 114:
+case 129:
{
- tao_yyval.exval = idl_global->gen ()->create_expr (AST_Expression::EC_or,
- tao_yyvsp[-2].exval,
- tao_yyvsp[0].exval);
+/* or_expr : xor_expr*/
+/* | or_expr '|' xor_expr*/
+ tao_yyval.exval =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_or,
+ tao_yyvsp[-2].exval,
+ tao_yyvsp[0].exval
+ );
}
break;
-case 116:
+case 131:
{
- tao_yyval.exval = idl_global->gen ()->create_expr (AST_Expression::EC_xor,
- tao_yyvsp[-2].exval,
- tao_yyvsp[0].exval);
+/* xor_expr : and_expr*/
+/* | xor_expr '^' and_expr*/
+ tao_yyval.exval =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_xor,
+ tao_yyvsp[-2].exval,
+ tao_yyvsp[0].exval
+ );
}
break;
-case 118:
+case 133:
{
- tao_yyval.exval = idl_global->gen ()->create_expr (AST_Expression::EC_and,
- tao_yyvsp[-2].exval,
- tao_yyvsp[0].exval);
+/* and_expr : shift_expr | and_expr '&' shift_expr*/
+ tao_yyval.exval =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_and,
+ tao_yyvsp[-2].exval,
+ tao_yyvsp[0].exval
+ );
}
break;
-case 120:
+case 135:
{
- tao_yyval.exval = idl_global->gen ()->create_expr (AST_Expression::EC_left,
- tao_yyvsp[-2].exval,
- tao_yyvsp[0].exval);
+/* shift_expr : add_expr | shift_expr IDL_LEFT_SHIFT add_expr*/
+ tao_yyval.exval =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_left,
+ tao_yyvsp[-2].exval,
+ tao_yyvsp[0].exval
+ );
}
break;
-case 121:
+case 136:
{
- tao_yyval.exval = idl_global->gen ()->create_expr (AST_Expression::EC_right,
- tao_yyvsp[-2].exval,
- tao_yyvsp[0].exval);
+/* | shift_expr IDL_RIGHT_SHIFT add_expr*/
+ tao_yyval.exval =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_right,
+ tao_yyvsp[-2].exval,
+ tao_yyvsp[0].exval
+ );
}
break;
-case 123:
+case 138:
{
- tao_yyval.exval = idl_global->gen ()->create_expr (AST_Expression::EC_add,
- tao_yyvsp[-2].exval,
- tao_yyvsp[0].exval);
+/* add_expr : mult_expr | add_expr '+' mult_expr*/
+ tao_yyval.exval =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_add,
+ tao_yyvsp[-2].exval,
+ tao_yyvsp[0].exval
+ );
}
break;
-case 124:
+case 139:
{
- tao_yyval.exval = idl_global->gen ()->create_expr (AST_Expression::EC_minus,
- tao_yyvsp[-2].exval,
- tao_yyvsp[0].exval);
+/* | add_expr '-' mult_expr*/
+ tao_yyval.exval =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_minus,
+ tao_yyvsp[-2].exval,
+ tao_yyvsp[0].exval
+ );
}
break;
-case 126:
+case 141:
{
- tao_yyval.exval = idl_global->gen ()->create_expr (AST_Expression::EC_mul,
- tao_yyvsp[-2].exval,
- tao_yyvsp[0].exval);
+/* mult_expr : unary_expr | mult_expr '*' unary_expr*/
+ tao_yyval.exval =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_mul,
+ tao_yyvsp[-2].exval,
+ tao_yyvsp[0].exval
+ );
}
break;
-case 127:
+case 142:
{
- tao_yyval.exval = idl_global->gen ()->create_expr (AST_Expression::EC_div,
- tao_yyvsp[-2].exval,
- tao_yyvsp[0].exval);
+/* | mult_expr '/' unary_expr*/
+ tao_yyval.exval =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_div,
+ tao_yyvsp[-2].exval,
+ tao_yyvsp[0].exval
+ );
}
break;
-case 128:
+case 143:
{
- tao_yyval.exval = idl_global->gen ()->create_expr (AST_Expression::EC_mod,
- tao_yyvsp[-2].exval,
- tao_yyvsp[0].exval);
+/* | mult_expr '%' unary_expr*/
+ tao_yyval.exval =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_mod,
+ tao_yyvsp[-2].exval,
+ tao_yyvsp[0].exval
+ );
}
break;
-case 130:
+case 145:
{
- tao_yyval.exval = idl_global->gen ()->create_expr (AST_Expression::EC_u_plus,
- tao_yyvsp[0].exval,
- 0);
+/* unary_expr : primary_expr | '+' primary_expr*/
+ tao_yyval.exval =
+ idl_global->gen ()->create_expr (
+ AST_Expression::EC_u_plus,
+ tao_yyvsp[0].exval,
+ 0
+ );
}
break;
-case 131:
+case 146:
{
- tao_yyval.exval = idl_global->gen()->create_expr (AST_Expression::EC_u_minus,
- tao_yyvsp[0].exval,
- 0);
+/* | '-' primary_expr*/
+ tao_yyval.exval =
+ idl_global->gen()->create_expr (
+ AST_Expression::EC_u_minus,
+ tao_yyvsp[0].exval,
+ 0
+ );
}
break;
-case 132:
+case 147:
{
- tao_yyval.exval = idl_global->gen()->create_expr (AST_Expression::EC_bit_neg,
- tao_yyvsp[0].exval,
- 0);
+/* | '~' primary_expr*/
+ tao_yyval.exval =
+ idl_global->gen()->create_expr (
+ AST_Expression::EC_bit_neg,
+ tao_yyvsp[0].exval,
+ 0
+ );
}
break;
-case 133:
+case 148:
{
+/* primary_expr : scoped_name*/
/*
* An expression which is a scoped name is not resolved now,
* but only when it is evaluated (such as when it is assigned
* as a constant value).
*/
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
-
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Decl *d = s->lookup_by_name (tao_yyvsp[0].idlist,
- 1);
+ I_TRUE);
/*
* If the scoped name is an IDL constant, it may be used in an
@@ -2120,65 +2848,75 @@ case 133:
}
}
break;
-case 135:
+case 150:
{
+/* | literal*/
+/* | '(' const_expr ')'*/
tao_yyval.exval = tao_yyvsp[-1].exval;
}
break;
-case 136:
+case 151:
{
+/* literal : IDL_INTEGER_LITERAL*/
tao_yyval.exval = idl_global->gen ()->create_expr (tao_yyvsp[0].ival);
}
break;
-case 137:
+case 152:
{
+/* | IDL_UINTEGER_LITERAL*/
tao_yyval.exval = idl_global->gen ()->create_expr (tao_yyvsp[0].uival);
}
break;
-case 138:
+case 153:
{
+/* | IDL_STRING_LITERAL*/
tao_yyval.exval = idl_global->gen ()->create_expr (tao_yyvsp[0].sval);
}
break;
-case 139:
+case 154:
{
+/* | IDL_WSTRING_LITERAL*/
tao_yyval.exval = idl_global->gen ()->create_expr (tao_yyvsp[0].wsval);
}
break;
-case 140:
+case 155:
{
+/* | IDL_CHARACTER_LITERAL*/
tao_yyval.exval = idl_global->gen ()->create_expr (tao_yyvsp[0].cval);
}
break;
-case 141:
+case 156:
{
+/* | IDL_WCHAR_LITERAL*/
ACE_OutputCDR::from_wchar wc (tao_yyvsp[0].wcval);
tao_yyval.exval = idl_global->gen ()->create_expr (wc);
}
break;
-case 142:
+case 157:
{
+/* | IDL_FLOATING_PT_LITERAL*/
tao_yyval.exval = idl_global->gen ()->create_expr (tao_yyvsp[0].dval);
}
break;
-case 143:
+case 158:
{
+/* | IDL_TRUETOK*/
tao_yyval.exval = idl_global->gen ()->create_expr ((idl_bool) I_TRUE,
AST_Expression::EV_bool);
}
break;
-case 144:
+case 159:
{
+/* | IDL_FALSETOK*/
tao_yyval.exval = idl_global->gen ()->create_expr ((idl_bool) I_FALSE,
AST_Expression::EV_bool);
}
break;
-case 145:
+case 160:
{
+/* positive_int_expr : const_expr*/
int good_expression = 1;
-
tao_yyvsp[0].exval->evaluate (AST_Expression::EK_positive_int);
-
AST_Expression::AST_ExprValue *ev = tao_yyvsp[0].exval->ev ();
/*
@@ -2195,30 +2933,35 @@ case 145:
{
good_expression = 0;
}
+
break;
case AST_Expression::EV_ulong:
if (ev->u.ulval == 0)
{
good_expression = 0;
}
+
break;
case AST_Expression::EV_ulonglong:
if (ev->u.ullval == 0)
{
good_expression = 0;
}
+
break;
case AST_Expression::EV_octet:
if (ev->u.oval == 0)
{
good_expression = 0;
}
+
break;
case AST_Expression::EV_bool:
if (ev->u.bval == 0)
{
good_expression = 0;
}
+
break;
default:
good_expression = 0;
@@ -2238,207 +2981,331 @@ case 145:
}
}
break;
-case 146:
+case 161:
{
- idl_global->set_parse_state (IDL_GlobalData::PS_TypedefSeen);
- }
+/* type_dcl : IDL_TYPEDEF*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_TypedefSeen);
+ }
break;
-case 147:
-{tao_yyval.ival = 0;}
+case 162:
+{
+/* type_declarator */
+ tao_yyval.ival = 0;
+ }
break;
-case 148:
-{ tao_yyval.ival = 0;}
+case 163:
+{
+/* | struct_type */
+ tao_yyval.ival = 0;
+ }
break;
-case 149:
-{ tao_yyval.ival = 0;}
+case 164:
+{
+/* | union_type */
+ tao_yyval.ival = 0;
+ }
break;
-case 150:
-{ tao_yyval.ival = 0;}
+case 165:
+{
+/* | enum_type */
+ tao_yyval.ival = 0;
+ }
break;
-case 151:
+case 166:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+/* | IDL_NATIVE simple_declarator*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Native *node = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_NativeSeen);
+
/*
* Create a node representing a Native and add it to its
* enclosing scope
*/
- if (s != 0) {
- node = idl_global->gen ()->create_native (tao_yyvsp[0].deval->name ());
- /*
- * Add it to its defining scope
- */
- (void) s->fe_add_native (node);
- }
+ if (s != 0)
+ {
+ node =
+ idl_global->gen ()->create_native (
+ tao_yyvsp[0].deval->name ()
+ );
+ /*
+ * Add it to its defining scope
+ */
+ (void) s->fe_add_native (node);
+ }
}
break;
-case 152:
+case 167:
+{
+/* | constructed_forward_type_spec*/
+ tao_yyval.ival = 0;
+ }
+break;
+case 168:
{
+/* type_declarator : type_spec*/
idl_global->set_parse_state (IDL_GlobalData::PS_TypeSpecSeen);
}
break;
-case 153:
+case 169:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+/* at_least_one_declarator*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
FE_Declarator *d = 0;
AST_Typedef *t = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_DeclaratorsSeen);
+
/*
* Create a list of type renamings. Add them to the
* enclosing scope
*/
- if (s != 0 && tao_yyvsp[-2].dcval != 0 && tao_yyvsp[0].dlval != 0) {
- for (UTL_DecllistActiveIterator l (tao_yyvsp[0].dlval); !l.is_done (); l.next ()) {
- d = l.item ();
- if (d == 0)
- continue;
- AST_Type * tp = d->compose (tao_yyvsp[-2].dcval);
- if (tp == 0)
- continue;
- t = idl_global->gen ()->create_typedef (tp,
- d->name (),
- s->is_local (),
- s->is_abstract ());
- (void) s->fe_add_typedef (t);
+ if (s != 0 && tao_yyvsp[-2].dcval != 0 && tao_yyvsp[0].dlval != 0)
+ {
+ for (UTL_DecllistActiveIterator l (tao_yyvsp[0].dlval);
+ !l.is_done ();
+ l.next ())
+ {
+ d = l.item ();
+
+ if (d == 0)
+ {
+ continue;
+ }
+
+ AST_Type * tp = d->compose (tao_yyvsp[-2].dcval);
+
+ if (tp == 0)
+ {
+ continue;
+ }
+
+ t = idl_global->gen ()->create_typedef (tp,
+ d->name (),
+ s->is_local (),
+ s->is_abstract ());
+ (void) s->fe_add_typedef (t);
+ }
+
+ /* This FE_Declarator class isn't destroyed with the AST.*/
+ tao_yyvsp[0].dlval->destroy ();
+ delete tao_yyvsp[0].dlval;
+ tao_yyvsp[0].dlval = 0;
}
- }
}
break;
-case 156:
+case 172:
{
- tao_yyval.dcval = idl_global->scopes ()->bottom ()->lookup_primitive_type (tao_yyvsp[0].etval);
+/* simple_type_spec : base_type_spec*/
+ tao_yyval.dcval =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ tao_yyvsp[0].etval
+ );
}
break;
-case 158:
+case 174:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+/* | template_type_spec*/
+/* | scoped_name*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Decl *d = 0;
if (s != 0)
- d = s->lookup_by_name (tao_yyvsp[0].idlist, I_TRUE);
+ {
+ d = s->lookup_by_name (tao_yyvsp[0].idlist,
+ I_TRUE);
+ }
+
if (d == 0)
- idl_global->err ()->lookup_error (tao_yyvsp[0].idlist);
+ {
+ idl_global->err ()->lookup_error (tao_yyvsp[0].idlist);
+ }
+ else
+ {
+ d->last_referenced_as (tao_yyvsp[0].idlist);
+ }
+
tao_yyval.dcval = d;
}
break;
-case 172:
+case 191:
{
- tao_yyval.dlval = new UTL_DeclList (tao_yyvsp[-1].deval, tao_yyvsp[0].dlval);
+/* at_least_one_declarator : declarator declarators*/
+ ACE_NEW_RETURN (tao_yyval.dlval,
+ UTL_DeclList (tao_yyvsp[-1].deval,
+ tao_yyvsp[0].dlval),
+ 1);
}
break;
-case 173:
+case 192:
{
+/* declarators : declarators ','*/
idl_global->set_parse_state (IDL_GlobalData::PS_DeclsCommaSeen);
}
break;
-case 174:
+case 193:
{
+/* declarator*/
idl_global->set_parse_state (IDL_GlobalData::PS_DeclsDeclSeen);
if (tao_yyvsp[-3].dlval == 0)
- tao_yyval.dlval = new UTL_DeclList (tao_yyvsp[0].deval, 0);
- else {
- tao_yyvsp[-3].dlval->nconc (new UTL_DeclList (tao_yyvsp[0].deval, 0));
- tao_yyval.dlval = tao_yyvsp[-3].dlval;
- }
+ {
+ ACE_NEW_RETURN (tao_yyval.dlval,
+ UTL_DeclList (tao_yyvsp[0].deval,
+ 0),
+ 1);
+ }
+ else
+ {
+ UTL_DeclList *dl = 0;
+ ACE_NEW_RETURN (dl,
+ UTL_DeclList (tao_yyvsp[0].deval,
+ 0),
+ 1);
+ tao_yyvsp[-3].dlval->nconc (dl);
+ tao_yyval.dlval = tao_yyvsp[-3].dlval;
+ }
}
break;
-case 175:
+case 194:
{
+/* | /* EMPTY * /*/
tao_yyval.dlval = 0;
}
break;
-case 178:
+case 197:
{
- tao_yyval.dlval = new UTL_DeclList (tao_yyvsp[-1].deval, tao_yyvsp[0].dlval);
+/* at_least_one_simple_declarator : simple_declarator simple_declarators*/
+ ACE_NEW_RETURN (tao_yyval.dlval,
+ UTL_DeclList (tao_yyvsp[-1].deval,
+ tao_yyvsp[0].dlval),
+ 1);
}
break;
-case 179:
+case 198:
{
+/* simple_declarators : simple_declarators ','*/
idl_global->set_parse_state (IDL_GlobalData::PS_DeclsCommaSeen);
}
break;
-case 180:
+case 199:
{
+/* simple_declarator*/
idl_global->set_parse_state (IDL_GlobalData::PS_DeclsDeclSeen);
if (tao_yyvsp[-3].dlval == 0)
- tao_yyval.dlval = new UTL_DeclList (tao_yyvsp[0].deval, 0);
- else {
- tao_yyvsp[-3].dlval->nconc (new UTL_DeclList (tao_yyvsp[0].deval, 0));
- tao_yyval.dlval = tao_yyvsp[-3].dlval;
- }
+ {
+ ACE_NEW_RETURN (tao_yyval.dlval,
+ UTL_DeclList (tao_yyvsp[0].deval,
+ 0),
+ 1);
+ }
+ else
+ {
+ UTL_DeclList *dl = 0;
+ ACE_NEW_RETURN (dl,
+ UTL_DeclList (tao_yyvsp[0].deval,
+ 0),
+ 1);
+ tao_yyvsp[-3].dlval->nconc (dl);
+ tao_yyval.dlval = tao_yyvsp[-3].dlval;
+ }
}
break;
-case 181:
+case 200:
{
+/* | /* EMPTY * /*/
tao_yyval.dlval = 0;
}
break;
-case 182:
+case 201:
{
- tao_yyval.deval = new FE_Declarator (new UTL_ScopedName (tao_yyvsp[0].idval, 0),
- FE_Declarator::FD_simple, 0);
+/* simple_declarator : id*/
+ UTL_ScopedName *sn = 0;
+ ACE_NEW_RETURN (sn,
+ UTL_ScopedName (tao_yyvsp[0].idval,
+ 0),
+ 1);
+ ACE_NEW_RETURN (tao_yyval.deval,
+ FE_Declarator (sn,
+ FE_Declarator::FD_simple,
+ 0),
+ 1);
}
break;
-case 183:
+case 202:
{
- tao_yyval.deval = new FE_Declarator (new UTL_ScopedName (tao_yyvsp[0].dcval->local_name (),
- 0),
- FE_Declarator::FD_complex,
- tao_yyvsp[0].dcval);
+/* complex_declarator : array_declarator*/
+ UTL_ScopedName *sn = 0;
+ ACE_NEW_RETURN (sn,
+ UTL_ScopedName (
+ tao_yyvsp[0].dcval->local_name ()->copy (),
+ 0
+ ),
+ 1);
+ ACE_NEW_RETURN (tao_yyval.deval,
+ FE_Declarator (sn,
+ FE_Declarator::FD_complex,
+ tao_yyvsp[0].dcval),
+ 1);
}
break;
-case 186:
+case 205:
{
+/* signed_int : IDL_LONG*/
tao_yyval.etval = AST_Expression::EV_long;
}
break;
-case 187:
+case 206:
{
+/* | IDL_LONG IDL_LONG*/
tao_yyval.etval = AST_Expression::EV_longlong;
}
break;
-case 188:
+case 207:
{
+/* | IDL_SHORT*/
tao_yyval.etval = AST_Expression::EV_short;
}
break;
-case 189:
+case 208:
{
+/* unsigned_int : IDL_UNSIGNED IDL_LONG*/
tao_yyval.etval = AST_Expression::EV_ulong;
}
break;
-case 190:
+case 209:
{
+/* | IDL_UNSIGNED IDL_LONG IDL_LONG*/
tao_yyval.etval = AST_Expression::EV_ulonglong;
}
break;
-case 191:
+case 210:
{
+/* | IDL_UNSIGNED IDL_SHORT*/
tao_yyval.etval = AST_Expression::EV_ushort;
}
break;
-case 192:
+case 211:
{
+/* floating_pt_type : IDL_DOUBLE*/
tao_yyval.etval = AST_Expression::EV_double;
}
break;
-case 193:
+case 212:
{
+/* | IDL_FLOAT*/
tao_yyval.etval = AST_Expression::EV_float;
}
break;
-case 194:
+case 213:
{
+/* | IDL_LONG IDL_DOUBLE*/
tao_yyval.etval = AST_Expression::EV_longdouble;
}
break;
-case 195:
+case 214:
{
+/* fixed_type : IDL_FIXED*/
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("error in %s line %d\n"),
idl_global->filename ()->get_string (),
@@ -2448,390 +3315,535 @@ case 195:
ACE_TEXT (" fixed types yet\n")));
}
break;
-case 196:
+case 215:
{
+/* char_type : IDL_CHAR*/
tao_yyval.etval = AST_Expression::EV_char;
}
break;
-case 197:
+case 216:
{
+/* | IDL_WCHAR*/
tao_yyval.etval = AST_Expression::EV_wchar;
}
break;
-case 198:
+case 217:
{
+/* octet_type : IDL_OCTET*/
tao_yyval.etval = AST_Expression::EV_octet;
}
break;
-case 199:
+case 218:
{
+/* boolean_type : IDL_BOOLEAN*/
tao_yyval.etval = AST_Expression::EV_bool;
}
break;
-case 200:
+case 219:
{
+/* any_type : IDL_ANY*/
tao_yyval.etval = AST_Expression::EV_any;
}
break;
-case 201:
+case 220:
+{
+/* object_type : IDL_OBJECT*/
+ tao_yyval.etval = AST_Expression::EV_object;
+ }
+break;
+case 221:
{
+/* struct_decl : IDL_STRUCT*/
idl_global->set_parse_state (IDL_GlobalData::PS_StructSeen);
}
break;
-case 202:
+case 222:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- UTL_ScopedName *n = new UTL_ScopedName (tao_yyvsp[0].idval, 0);
+/* id*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_StructIDSeen);
+ tao_yyval.idval = tao_yyvsp[0].idval;
+ }
+break;
+case 223:
+{
+/* struct_type : struct_header*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n (tao_yyvsp[0].idval,
+ 0);
AST_Structure *d = 0;
- idl_global->set_parse_state (IDL_GlobalData::PS_StructIDSeen);
/*
* Create a node representing a struct declaration. Add it
* to the enclosing scope
*/
- if (s != 0) {
- d = idl_global->gen ()->create_structure (n,
- s->is_local (),
- s->is_abstract ());
- (void) s->fe_add_structure (d);
- }
+ if (s != 0)
+ {
+ d =
+ idl_global->gen ()->create_structure (
+ &n,
+ s->is_local (),
+ s->is_abstract ()
+ );
+ (void) s->fe_add_structure (d);
+ }
+
/*
- * Push the scope of the struct on the scopes stack
+ * Push the scope of the struct on the scopes stack.
*/
- idl_global->scopes ()->push (d);
+ idl_global->scopes ().push (d);
}
break;
-case 203:
+case 224:
{
+/* '{'*/
idl_global->set_parse_state (IDL_GlobalData::PS_StructSqSeen);
}
break;
-case 204:
+case 225:
{
+/* at_least_one_member*/
idl_global->set_parse_state (IDL_GlobalData::PS_StructBodySeen);
}
break;
-case 205:
+case 226:
{
+/* '}'*/
idl_global->set_parse_state (IDL_GlobalData::PS_StructQsSeen);
+
/*
- * Done with this struct. Pop its scope off the scopes stack
+ * Done with this struct. Pop its scope off the scopes stack.
*/
tao_yyval.dcval = AST_Structure::narrow_from_scope (
- idl_global->scopes ()->top_non_null ()
+ idl_global->scopes ().top_non_null ()
);
- idl_global->scopes ()->pop ();
+ idl_global->scopes ().pop ();
}
break;
-case 209:
+case 230:
{
+/* member :*/
/* is $0 to member_i */
tao_yyval.vival = AST_Field::vis_NA;
}
break;
-case 211:
+case 232:
{
+/* member_i : type_spec*/
idl_global->set_parse_state (IDL_GlobalData::PS_MemberTypeSeen);
}
break;
-case 212:
+case 233:
{
+/* at_least_one_declarator*/
idl_global->set_parse_state (IDL_GlobalData::PS_MemberDeclsSeen);
}
break;
-case 213:
+case 234:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+/* ';'*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
FE_Declarator *d = 0;
AST_Field *f = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_MemberDeclsCompleted);
+
/*
- * Check for illegal recursive use of type
+ * Check for illegal recursive use of type.
*/
- if (tao_yyvsp[-4].dcval != 0 && AST_illegal_recursive_type (tao_yyvsp[-4].dcval))
- idl_global->err ()->error1 (UTL_Error::EIDL_RECURSIVE_TYPE,
- tao_yyvsp[-4].dcval);
+ if (tao_yyvsp[-4].dcval != 0
+ && AST_illegal_recursive_type (tao_yyvsp[-4].dcval))
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_RECURSIVE_TYPE,
+ tao_yyvsp[-4].dcval);
+ }
/*
* Create a node representing a struct or exception member
- * Add it to the enclosing scope
+ * Add it to the enclosing scope.
*/
- else if (s != 0 && tao_yyvsp[-4].dcval != 0 && tao_yyvsp[-2].dlval != 0) {
- for (UTL_DecllistActiveIterator l (tao_yyvsp[-2].dlval); !(l.is_done ()); l.next ()) {
- d = l.item ();
- if (d == 0)
- continue;
- AST_Type *tp = d->compose (tao_yyvsp[-4].dcval);
- if (tp == 0)
- continue;
- /* $0 denotes Visibility, must be on yacc reduction stack */
- f = idl_global->gen ()->create_field (tp,
- d->name (),
- tao_yyvsp[-5].vival);
- (void) s->fe_add_field (f);
+ else if (s != 0
+ && tao_yyvsp[-4].dcval != 0
+ && tao_yyvsp[-2].dlval != 0)
+ {
+ for (UTL_DecllistActiveIterator l (tao_yyvsp[-2].dlval);
+ !l.is_done ();
+ l.next ())
+ {
+ d = l.item ();
+
+ if (d == 0)
+ {
+ continue;
+ }
+
+ AST_Type *tp = d->compose (tao_yyvsp[-4].dcval);
+
+ if (tp == 0)
+ {
+ continue;
+ }
+
+ /* $0 denotes Visibility, must be on yacc reduction stack. */
+ f =
+ idl_global->gen ()->create_field (
+ tp,
+ d->name (),
+ tao_yyvsp[-5].vival
+ );
+ (void) s->fe_add_field (f);
+ }
}
- }
}
break;
-case 214:
+case 235:
{
+/* | error*/
idl_global->err()->syntax_error (idl_global->parse_state ());
}
break;
-case 215:
+case 236:
{
+/* ';'*/
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
tao_yyerrok;
}
break;
-case 216:
+case 237:
{
+/* union_decl : IDL_UNION*/
idl_global->set_parse_state (IDL_GlobalData::PS_UnionSeen);
}
break;
-case 217:
+case 238:
{
+/* id*/
idl_global->set_parse_state (IDL_GlobalData::PS_UnionIDSeen);
+ tao_yyval.idval = tao_yyvsp[0].idval;
}
break;
-case 218:
+case 239:
{
+/* union_type : union_decl IDL_SWITCH*/
idl_global->set_parse_state (IDL_GlobalData::PS_SwitchSeen);
}
break;
-case 219:
+case 240:
{
+/* '('*/
idl_global->set_parse_state (IDL_GlobalData::PS_SwitchOpenParSeen);
}
break;
-case 220:
+case 241:
{
+/* switch_type_spec*/
idl_global->set_parse_state (IDL_GlobalData::PS_SwitchTypeSeen);
}
break;
-case 221:
+case 242:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- UTL_ScopedName *n = new UTL_ScopedName (tao_yyvsp[-8].idval, 0);
+/* ')'*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n (tao_yyvsp[-7].idval,
+ 0);
AST_Union *u = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_SwitchCloseParSeen);
+
/*
* Create a node representing a union. Add it to its enclosing
- * scope
- */
- if (tao_yyvsp[-2].dcval != 0 && s != 0) {
- AST_ConcreteType *tp = AST_ConcreteType::narrow_from_decl (tao_yyvsp[-2].dcval);
- if (tp == 0) {
- idl_global->err ()->not_a_type (tao_yyvsp[-2].dcval);
- } else {
- u = idl_global->gen ()->create_union (tp,
- n,
- s->is_local (),
- s->is_abstract ());
- (void) s->fe_add_union (u);
+ * scope.
+ */
+ if (tao_yyvsp[-2].dcval != 0
+ && s != 0)
+ {
+ AST_ConcreteType *tp =
+ AST_ConcreteType::narrow_from_decl (tao_yyvsp[-2].dcval);
+
+ if (tp == 0)
+ {
+ idl_global->err ()->not_a_type (tao_yyvsp[-2].dcval);
+ }
+ else
+ {
+ u = idl_global->gen ()->create_union (tp,
+ &n,
+ s->is_local (),
+ s->is_abstract ());
+ }
+
+ (void) s->fe_add_union (u);
}
- }
+
/*
* Push the scope of the union on the scopes stack
*/
- idl_global->scopes()->push (u);
+ idl_global->scopes ().push (u);
}
break;
-case 222:
+case 243:
{
+/* '{'*/
idl_global->set_parse_state (IDL_GlobalData::PS_UnionSqSeen);
}
break;
-case 223:
+case 244:
{
+/* at_least_one_case_branch*/
idl_global->set_parse_state (IDL_GlobalData::PS_UnionBodySeen);
}
break;
-case 224:
+case 245:
{
+/* '}'*/
idl_global->set_parse_state (IDL_GlobalData::PS_UnionQsSeen);
+
/*
- * Done with this union. Pop its scope from the scopes stack
+ * Done with this union. Pop its scope from the scopes stack.
*/
tao_yyval.dcval = AST_Union::narrow_from_scope (
- idl_global->scopes ()->top_non_null ()
+ idl_global->scopes ().top_non_null ()
);
+
if (tao_yyval.dcval != 0)
{
- idl_global->scopes ()->pop ();
+ idl_global->scopes ().pop ();
}
}
break;
-case 225:
+case 246:
{
- tao_yyval.dcval = idl_global->scopes ()->bottom ()->lookup_primitive_type (tao_yyvsp[0].etval);
+/* switch_type_spec : integer_type*/
+ tao_yyval.dcval =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ tao_yyvsp[0].etval
+ );
}
break;
-case 226:
+case 247:
{
- /* wchars are not allowed */
+/* | char_type*/
+ /* wchars are not allowed. */
if (tao_yyvsp[0].etval == AST_Expression::EV_wchar)
{
idl_global->err ()->error0 (UTL_Error::EIDL_DISC_TYPE);
}
- tao_yyval.dcval =
- idl_global->scopes ()->bottom ()->lookup_primitive_type (
- tao_yyvsp[0].etval
- );
+ tao_yyval.dcval =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ tao_yyvsp[0].etval
+ );
}
break;
-case 227:
+case 248:
{
- /* octets are not allowed */
+/* | octet_type*/
+ /* octets are not allowed. */
idl_global->err ()->error0 (UTL_Error::EIDL_DISC_TYPE);
- tao_yyval.dcval = idl_global->scopes ()->bottom ()->lookup_primitive_type (tao_yyvsp[0].etval);
+ tao_yyval.dcval =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ tao_yyvsp[0].etval
+ );
}
break;
-case 228:
+case 249:
{
- tao_yyval.dcval = idl_global->scopes ()->bottom ()->lookup_primitive_type (tao_yyvsp[0].etval);
+/* | boolean_type*/
+ tao_yyval.dcval =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ tao_yyvsp[0].etval
+ );
}
break;
-case 230:
+case 251:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+/* | enum_type*/
+/* | scoped_name*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Decl *d = 0;
AST_PredefinedType *p = 0;
AST_Typedef *t = 0;
- long found = I_FALSE;
+ idl_bool found = I_FALSE;
/*
* The discriminator is a scoped name. Try to resolve to
* one of the scalar types or to an enum. Thread through
* typedef's to arrive at the base type at the end of the
- * chain
- */
- if (s != 0 && (d = s->lookup_by_name (tao_yyvsp[0].idlist, I_TRUE)) != 0) {
- while (!found) {
- switch (d->node_type ()) {
- case AST_Decl::NT_enum:
- tao_yyval.dcval = d;
- found = I_TRUE;
- break;
- case AST_Decl::NT_pre_defined:
- p = AST_PredefinedType::narrow_from_decl (d);
- if (p != 0) {
- switch (p->pt ()) {
- case AST_PredefinedType::PT_long:
- case AST_PredefinedType::PT_ulong:
- case AST_PredefinedType::PT_longlong:
- case AST_PredefinedType::PT_ulonglong:
- case AST_PredefinedType::PT_short:
- case AST_PredefinedType::PT_ushort:
- case AST_PredefinedType::PT_char:
- case AST_PredefinedType::PT_boolean:
- tao_yyval.dcval = p;
- found = I_TRUE;
- break;
- case AST_PredefinedType::PT_wchar:
- case AST_PredefinedType::PT_octet:
- /* octets and wchars are not allowed */
- idl_global->err ()->error0 (UTL_Error::EIDL_DISC_TYPE);
- tao_yyval.dcval = 0;
- found = I_TRUE;
- break;
- default:
- tao_yyval.dcval = 0;
- found = I_TRUE;
- break;
- }
- } else
+ * chain.
+ */
+ d = s->lookup_by_name (tao_yyvsp[0].idlist,
+ I_TRUE);
+
+ if (s != 0 && d != 0)
+ {
+ while (!found)
{
- tao_yyval.dcval = 0;
- found = I_TRUE;
+ switch (d->node_type ())
+ {
+ case AST_Decl::NT_enum:
+ tao_yyval.dcval = d;
+ found = I_TRUE;
+ break;
+ case AST_Decl::NT_pre_defined:
+ p = AST_PredefinedType::narrow_from_decl (d);
+
+ if (p != 0)
+ {
+ switch (p->pt ())
+ {
+ case AST_PredefinedType::PT_long:
+ case AST_PredefinedType::PT_ulong:
+ case AST_PredefinedType::PT_longlong:
+ case AST_PredefinedType::PT_ulonglong:
+ case AST_PredefinedType::PT_short:
+ case AST_PredefinedType::PT_ushort:
+ case AST_PredefinedType::PT_char:
+ case AST_PredefinedType::PT_boolean:
+ tao_yyval.dcval = p;
+ found = I_TRUE;
+ break;
+ case AST_PredefinedType::PT_wchar:
+ case AST_PredefinedType::PT_octet:
+ /* octets and wchars are not allowed */
+ idl_global->err ()->error0 (
+ UTL_Error::EIDL_DISC_TYPE
+ );
+ tao_yyval.dcval = 0;
+ found = I_TRUE;
+ break;
+ default:
+ tao_yyval.dcval = 0;
+ found = I_TRUE;
+ break;
+ }
+ }
+ else
+ {
+ tao_yyval.dcval = 0;
+ found = I_TRUE;
+ }
+
+ break;
+ case AST_Decl::NT_typedef:
+ t = AST_Typedef::narrow_from_decl (d);
+
+ if (t != 0)
+ {
+ d = t->base_type ();
+ }
+
+ break;
+ default:
+ tao_yyval.dcval = 0;
+ found = I_TRUE;
+ break;
+ }
}
- break;
- case AST_Decl::NT_typedef:
- t = AST_Typedef::narrow_from_decl (d);
- if (t != 0) d = t->base_type ();
- break;
- default:
- tao_yyval.dcval = 0;
- found = I_TRUE;
- break;
- }
+ }
+ else
+ {
+ tao_yyval.dcval = 0;
}
- } else
- tao_yyval.dcval = 0;
if (tao_yyval.dcval == 0)
- idl_global->err ()->lookup_error (tao_yyvsp[0].idlist);
+ {
+ idl_global->err ()->lookup_error (tao_yyvsp[0].idlist);
+ }
}
break;
-case 234:
+case 255:
{
+/* case_branch : at_least_one_case_label*/
idl_global->set_parse_state (IDL_GlobalData::PS_UnionLabelSeen);
}
break;
-case 235:
+case 256:
{
+/* element_spec*/
idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemSeen);
}
break;
-case 236:
+case 257:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+/* ';'*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_UnionBranch *b = 0;
AST_Field *f = tao_yyvsp[-2].ffval;
-
idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemCompleted);
+
/*
* Create several nodes representing branches of a union.
* Add them to the enclosing scope (the union scope)
*/
- if (s != 0 && tao_yyvsp[-4].llval != 0 && tao_yyvsp[-2].ffval != 0) {
- b = idl_global->gen ()->create_union_branch (tao_yyvsp[-4].llval,
- f->field_type (),
- f->name ());
+ if (s != 0
+ && tao_yyvsp[-4].llval != 0
+ && tao_yyvsp[-2].ffval != 0)
+ {
+ b =
+ idl_global->gen ()->create_union_branch (
+ tao_yyvsp[-4].llval,
+ f->field_type (),
+ f->name ()
+ );
(void) s->fe_add_union_branch (b);
- }
+ }
}
break;
-case 237:
+case 258:
{
+/* | error*/
idl_global->err()->syntax_error (idl_global->parse_state());
}
break;
-case 238:
+case 259:
{
+/* ';'*/
idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
tao_yyerrok;
}
break;
-case 239:
+case 260:
{
- tao_yyval.llval = new UTL_LabelList (tao_yyvsp[-1].ulval, tao_yyvsp[0].llval);
+/* at_least_one_case_label : case_label case_labels*/
+ ACE_NEW_RETURN (tao_yyval.llval,
+ UTL_LabelList (tao_yyvsp[-1].ulval,
+ tao_yyvsp[0].llval),
+ 1);
}
break;
-case 240:
+case 261:
{
+/* case_labels : case_labels case_label*/
if (tao_yyvsp[-1].llval == 0)
- tao_yyval.llval = new UTL_LabelList (tao_yyvsp[0].ulval, 0);
- else {
- tao_yyvsp[-1].llval->nconc(new UTL_LabelList (tao_yyvsp[0].ulval, 0));
- tao_yyval.llval = tao_yyvsp[-1].llval;
- }
+ {
+ ACE_NEW_RETURN (tao_yyval.llval,
+ UTL_LabelList (tao_yyvsp[0].ulval,
+ 0),
+ 1);
+ }
+ else
+ {
+ UTL_LabelList *ll = 0;
+ ACE_NEW_RETURN (ll,
+ UTL_LabelList (tao_yyvsp[0].ulval,
+ 0),
+ 1);
+ tao_yyvsp[-1].llval->nconc (ll);
+ tao_yyval.llval = tao_yyvsp[-1].llval;
+ }
}
break;
-case 241:
+case 262:
{
+/* | /* EMPTY * /*/
tao_yyval.llval = 0;
}
break;
-case 242:
+case 263:
{
+/* case_label : IDL_DEFAULT*/
idl_global->set_parse_state (IDL_GlobalData::PS_DefaultSeen);
}
break;
-case 243:
+case 264:
{
+/* ':'*/
idl_global->set_parse_state (IDL_GlobalData::PS_LabelColonSeen);
tao_yyval.ulval = idl_global->gen ()->create_union_label (
@@ -2840,18 +3852,20 @@ case 243:
);
}
break;
-case 244:
+case 265:
{
+/* | IDL_CASE*/
idl_global->set_parse_state (IDL_GlobalData::PS_CaseSeen);
}
break;
-case 245:
+case 266:
{
idl_global->set_parse_state (IDL_GlobalData::PS_LabelExprSeen);
}
break;
-case 246:
+case 267:
{
+/* const_expr*/
idl_global->set_parse_state (IDL_GlobalData::PS_LabelColonSeen);
tao_yyval.ulval = idl_global->gen()->create_union_label (
@@ -2860,101 +3874,170 @@ case 246:
);
}
break;
-case 247:
+case 268:
{
+/* element_spec : type_spec*/
idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemTypeSeen);
}
break;
-case 248:
+case 269:
{
+/* declarator*/
idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemDeclSeen);
+
/*
* Check for illegal recursive use of type
*/
- if (tao_yyvsp[-2].dcval != 0 && AST_illegal_recursive_type (tao_yyvsp[-2].dcval))
- idl_global->err()->error1 (UTL_Error::EIDL_RECURSIVE_TYPE, tao_yyvsp[-2].dcval);
+ if (tao_yyvsp[-2].dcval != 0
+ && AST_illegal_recursive_type (tao_yyvsp[-2].dcval))
+ {
+ idl_global->err()->error1 (UTL_Error::EIDL_RECURSIVE_TYPE,
+ tao_yyvsp[-2].dcval);
+ }
/*
* Create a field in a union branch
*/
- else if (tao_yyvsp[-2].dcval == 0 || tao_yyvsp[0].deval == 0)
- tao_yyval.ffval = 0;
- else {
- AST_Type *tp = tao_yyvsp[0].deval->compose (tao_yyvsp[-2].dcval);
- if (tp == 0)
+ else if (tao_yyvsp[-2].dcval == 0
+ || tao_yyvsp[0].deval == 0)
+ {
tao_yyval.ffval = 0;
- else
- tao_yyval.ffval = idl_global->gen ()->create_field (tp,
- tao_yyvsp[0].deval->name());
- }
+ }
+ else
+ {
+ AST_Type *tp = tao_yyvsp[0].deval->compose (tao_yyvsp[-2].dcval);
+
+ if (tp == 0)
+ {
+ tao_yyval.ffval = 0;
+ }
+ else
+ {
+ tao_yyval.ffval = idl_global->gen ()->create_field (
+ tp,
+ tao_yyvsp[0].deval->name ()
+ );
+ }
+ }
}
break;
-case 249:
+case 270:
+{
+/* struct_forward_type : struct_decl*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n (tao_yyvsp[0].idval,
+ 0);
+ AST_StructureFwd *d = 0;
+
+ /*
+ * Create a node representing a forward declaration of a struct.
+ */
+ if (s != 0)
+ {
+ d = idl_global->gen ()->create_structure_fwd (&n);
+ (void) s->fe_add_structure_fwd (d);
+ }
+ }
+break;
+case 271:
{
+/* union_forward_type : union_decl*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n (tao_yyvsp[0].idval,
+ 0);
+ AST_UnionFwd *u = 0;
+
+ /*
+ * Create a node representing a forward declaration of a union.
+ */
+ if (s != 0)
+ {
+ u = idl_global->gen ()->create_union_fwd (&n);
+ (void) s->fe_add_union_fwd (u);
+ }
+ }
+break;
+case 272:
+{
+/* enum_type : IDL_ENUM*/
idl_global->set_parse_state (IDL_GlobalData::PS_EnumSeen);
}
break;
-case 250:
+case 273:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- UTL_ScopedName *n = new UTL_ScopedName(tao_yyvsp[0].idval, 0);
+/* id*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n (tao_yyvsp[0].idval,
+ 0);
AST_Enum *e = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_EnumIDSeen);
+
/*
* Create a node representing an enum and add it to its
- * enclosing scope
+ * enclosing scope.
*/
- if (s != 0) {
- e = idl_global->gen ()->create_enum (n,
- s->is_local (),
- s->is_abstract ());
- /*
- * Add it to its defining scope
- */
- (void) s->fe_add_enum (e);
- }
+ if (s != 0)
+ {
+ e = idl_global->gen ()->create_enum (&n,
+ s->is_local (),
+ s->is_abstract ());
+ /*
+ * Add it to its defining scope
+ */
+ (void) s->fe_add_enum (e);
+ }
+
/*
- * Push the enum scope on the scopes stack
+ * Push the enum scope on the scopes stack.
*/
- idl_global->scopes ()->push (e);
+ idl_global->scopes ().push (e);
}
break;
-case 251:
+case 274:
{
+/* '{'*/
idl_global->set_parse_state (IDL_GlobalData::PS_EnumSqSeen);
}
break;
-case 252:
+case 275:
{
+/* at_least_one_enumerator*/
idl_global->set_parse_state (IDL_GlobalData::PS_EnumBodySeen);
}
break;
-case 253:
+case 276:
{
+/* '}'*/
idl_global->set_parse_state (IDL_GlobalData::PS_EnumQsSeen);
+
/*
- * Done with this enum. Pop its scope from the scopes stack
+ * Done with this enum. Pop its scope from the scopes stack.
*/
- if (idl_global->scopes ()->top () == 0)
- tao_yyval.dcval = 0;
- else {
- tao_yyval.dcval = AST_Enum::narrow_from_scope (
- idl_global->scopes ()->top_non_null ()
- );
- idl_global->scopes ()->pop ();
- }
+ if (idl_global->scopes ().top () == 0)
+ {
+ tao_yyval.dcval = 0;
+ }
+ else
+ {
+ tao_yyval.dcval = AST_Enum::narrow_from_scope (
+ idl_global->scopes ().top_non_null ()
+ );
+ idl_global->scopes ().pop ();
+ }
}
break;
-case 255:
+case 278:
{
+/* enumerators : enumerators ','*/
idl_global->set_parse_state (IDL_GlobalData::PS_EnumCommaSeen);
}
break;
-case 258:
+case 281:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- UTL_ScopedName *n =
- new UTL_ScopedName (new Identifier (tao_yyvsp[0].strval), 0);
+/* enumerator : IDENTIFIER*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ Identifier id (tao_yyvsp[0].strval);
+ UTL_ScopedName n (&id,
+ 0);
AST_EnumVal *e = 0;
AST_Enum *c = 0;
@@ -2962,495 +4045,676 @@ case 258:
* Create a node representing one enumerator in an enum
* Add it to the enclosing scope (the enum scope)
*/
- if (s != 0 && s->scope_node_type () == AST_Decl::NT_enum) {
- c = AST_Enum::narrow_from_scope (s);
- if (c != 0)
- e = idl_global->gen ()->create_enum_val (c->next_enum_val (),
- n);
- (void) s->fe_add_enum_val (e);
- }
+ if (s != 0
+ && s->scope_node_type () == AST_Decl::NT_enum)
+ {
+ c = AST_Enum::narrow_from_scope (s);
+
+ if (c != 0)
+ {
+ e = idl_global->gen ()->create_enum_val (
+ c->next_enum_val (),
+ &n
+ );
+ }
+
+ (void) s->fe_add_enum_val (e);
+ }
}
break;
-case 259:
+case 282:
{
+/* sequence_type_spec : seq_head ','*/
idl_global->set_parse_state (IDL_GlobalData::PS_SequenceCommaSeen);
}
break;
-case 260:
+case 283:
{
+/* positive_int_expr*/
idl_global->set_parse_state (IDL_GlobalData::PS_SequenceExprSeen);
}
break;
-case 261:
+case 284:
{
+/* '>'*/
idl_global->set_parse_state (IDL_GlobalData::PS_SequenceQsSeen);
+
/*
- * Remove sequence marker from scopes stack
+ * Remove sequence marker from scopes stack.
*/
- if (idl_global->scopes ()->top() == 0)
- idl_global->scopes ()->pop ();
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+ if (idl_global->scopes ().top() == 0)
+ {
+ idl_global->scopes ().pop ();
+ }
+
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+
/*
* Create a node representing a sequence
*/
- if (tao_yyvsp[-2].exval == 0 || tao_yyvsp[-2].exval->coerce(AST_Expression::EV_ulong) == 0) {
- idl_global->err ()->coercion_error (tao_yyvsp[-2].exval, AST_Expression::EV_ulong);
- tao_yyval.dcval = 0;
- } else if (tao_yyvsp[-5].dcval == 0) {
- tao_yyval.dcval = 0;
- } else {
- AST_Type *tp = AST_Type::narrow_from_decl (tao_yyvsp[-5].dcval);
- if (tp == 0)
- ; /* Error will be caught in FE_Declarator.*/
- else {
- tao_yyval.dcval = idl_global->gen ()->create_sequence (tao_yyvsp[-2].exval,
- tp,
- s->is_local (),
- s->is_abstract ());
+ if (tao_yyvsp[-2].exval == 0 || tao_yyvsp[-2].exval->coerce (AST_Expression::EV_ulong) == 0)
+ {
+ idl_global->err ()->coercion_error (tao_yyvsp[-2].exval,
+ AST_Expression::EV_ulong);
+ tao_yyval.dcval = 0;
+ }
+ else if (tao_yyvsp[-5].dcval == 0)
+ {
+ tao_yyval.dcval = 0;
+ }
+ else
+ {
+ AST_Type *tp = AST_Type::narrow_from_decl (tao_yyvsp[-5].dcval);
+
+ if (tp == 0)
+ {
+ ; /* Error will be caught in FE_Declarator.*/
+ }
+ else
+ {
+ Identifier id ("sequence");
+ UTL_ScopedName sn (&id,
+ 0);
+
+ tao_yyval.dcval =
+ idl_global->gen ()->create_sequence (
+ tao_yyvsp[-2].exval,
+ tp,
+ &sn,
+ s->is_local (),
+ s->is_abstract ()
+ );
+ }
}
- }
}
break;
-case 262:
+case 285:
{
+/* | seq_head '>'*/
idl_global->set_parse_state (IDL_GlobalData::PS_SequenceQsSeen);
+
/*
- * Remove sequence marker from scopes stack
+ * Remove sequence marker from scopes stack.
*/
- if (idl_global->scopes ()->top () == 0)
- idl_global->scopes ()->pop ();
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+ if (idl_global->scopes ().top () == 0)
+ {
+ idl_global->scopes ().pop ();
+ }
+
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+
/*
- * Create a node representing a sequence
+ * Create a node representing a sequence.
*/
if (tao_yyvsp[-1].dcval == 0)
- tao_yyval.dcval = 0;
- else {
- AST_Type *tp = AST_Type::narrow_from_decl (tao_yyvsp[-1].dcval);
- if (tp == 0)
- ; /* Error will be caught in FE_Declarator.*/
- else {
- tao_yyval.dcval =
- idl_global->gen ()->create_sequence (
- idl_global->gen ()->create_expr ((unsigned long) 0),
- tp,
- s->is_local (),
- s->is_abstract ()
- );
+ {
+ tao_yyval.dcval = 0;
+ }
+ else
+ {
+ AST_Type *tp = AST_Type::narrow_from_decl (tao_yyvsp[-1].dcval);
+
+ if (tp == 0)
+ {
+ ; /* Error will be caught in FE_Declarator.*/
+ }
+ else
+ {
+ Identifier id ("sequence");
+ UTL_ScopedName sn (&id,
+ 0);
+
+ tao_yyval.dcval =
+ idl_global->gen ()->create_sequence (
+ idl_global->gen ()->create_expr ((unsigned long) 0),
+ tp,
+ &sn,
+ s->is_local (),
+ s->is_abstract ()
+ );
+ }
}
- }
}
break;
-case 263:
+case 286:
{
+/* seq_head : IDL_SEQUENCE*/
idl_global->set_parse_state (IDL_GlobalData::PS_SequenceSeen);
+
/*
- * Push a sequence marker on scopes stack
+ * Push a sequence marker on scopes stack.
*/
- idl_global->scopes ()->push (0);
+ idl_global->scopes ().push (0);
}
break;
-case 264:
+case 287:
{
+/* '<'*/
idl_global->set_parse_state (IDL_GlobalData::PS_SequenceSqSeen);
}
break;
-case 265:
+case 288:
{
+/* simple_type_spec*/
idl_global->set_parse_state (IDL_GlobalData::PS_SequenceTypeSeen);
tao_yyval.dcval = tao_yyvsp[0].dcval;
}
break;
-case 266:
+case 289:
{
+/* string_type_spec : string_head '<'*/
idl_global->set_parse_state (IDL_GlobalData::PS_StringSqSeen);
}
break;
-case 267:
+case 290:
{
+/* positive_int_expr*/
idl_global->set_parse_state (IDL_GlobalData::PS_StringExprSeen);
}
break;
-case 268:
+case 291:
{
+/* '>'*/
idl_global->set_parse_state (IDL_GlobalData::PS_StringQsSeen);
+
/*
- * Create a node representing a string
+ * Create a node representing a string.
*/
- if (tao_yyvsp[-2].exval == 0 || tao_yyvsp[-2].exval->coerce (AST_Expression::EV_ulong) == 0) {
- idl_global->err ()->coercion_error (tao_yyvsp[-2].exval, AST_Expression::EV_ulong);
- tao_yyval.dcval = 0;
- } else {
- tao_yyval.dcval = idl_global->gen ()->create_string (tao_yyvsp[-2].exval);
- /*
- * Add this AST_String to the types defined in the global scope
- */
- (void) idl_global->root ()->fe_add_string (
- AST_String::narrow_from_decl (tao_yyval.dcval)
- );
- }
+ if (tao_yyvsp[-2].exval == 0
+ || tao_yyvsp[-2].exval->coerce (AST_Expression::EV_ulong) == 0)
+ {
+ idl_global->err ()->coercion_error (tao_yyvsp[-2].exval,
+ AST_Expression::EV_ulong);
+ tao_yyval.dcval = 0;
+ }
+ else
+ {
+ tao_yyval.dcval = idl_global->gen ()->create_string (tao_yyvsp[-2].exval);
+ /*
+ * Add this AST_String to the types defined in the global scope.
+ */
+ (void) idl_global->root ()->fe_add_string (
+ AST_String::narrow_from_decl (
+ tao_yyval.dcval
+ )
+ );
+ }
}
break;
-case 269:
+case 292:
{
+/* | string_head*/
idl_global->set_parse_state (IDL_GlobalData::PS_StringCompleted);
/*
- * Create a node representing a string
+ * Create a node representing a string.
*/
tao_yyval.dcval =
idl_global->gen ()->create_string (
idl_global->gen ()->create_expr ((unsigned long) 0)
);
/*
- * Add this AST_String to the types defined in the global scope
+ * Add this AST_String to the types defined in the global scope.
*/
(void) idl_global->root ()->fe_add_string (
- AST_String::narrow_from_decl (tao_yyval.dcval)
+ AST_String::narrow_from_decl (
+ tao_yyval.dcval
+ )
);
}
break;
-case 270:
+case 293:
{
+/* string_head : IDL_STRING*/
idl_global->set_parse_state (IDL_GlobalData::PS_StringSeen);
}
break;
-case 271:
+case 294:
{
+/* wstring_type_spec : wstring_head '<'*/
idl_global->set_parse_state (IDL_GlobalData::PS_StringSqSeen);
}
break;
-case 272:
+case 295:
{
+/* positive_int_expr*/
idl_global->set_parse_state (IDL_GlobalData::PS_StringExprSeen);
}
break;
-case 273:
+case 296:
{
+/* '>'*/
idl_global->set_parse_state (IDL_GlobalData::PS_StringQsSeen);
+
/*
- * Create a node representing a string
+ * Create a node representing a string.
*/
- if (tao_yyvsp[-2].exval == 0 || tao_yyvsp[-2].exval->coerce(AST_Expression::EV_ulong) == 0) {
- idl_global->err ()->coercion_error (tao_yyvsp[-2].exval, AST_Expression::EV_ulong);
- tao_yyval.dcval = 0;
- } else {
- tao_yyval.dcval = idl_global->gen ()->create_wstring (tao_yyvsp[-2].exval);
- /*
- * Add this AST_String to the types defined in the global scope
- */
- (void) idl_global->root ()->fe_add_string (
- AST_String::narrow_from_decl (tao_yyval.dcval)
- );
- }
+ if (tao_yyvsp[-2].exval == 0
+ || tao_yyvsp[-2].exval->coerce (AST_Expression::EV_ulong) == 0)
+ {
+ idl_global->err ()->coercion_error (tao_yyvsp[-2].exval,
+ AST_Expression::EV_ulong);
+ tao_yyval.dcval = 0;
+ }
+ else
+ {
+ tao_yyval.dcval = idl_global->gen ()->create_wstring (tao_yyvsp[-2].exval);
+ /*
+ * Add this AST_String to the types defined in the global scope.
+ */
+ (void) idl_global->root ()->fe_add_string (
+ AST_String::narrow_from_decl (tao_yyval.dcval)
+ );
+ }
}
break;
-case 274:
+case 297:
{
+/* | wstring_head*/
idl_global->set_parse_state (IDL_GlobalData::PS_StringCompleted);
+
/*
- * Create a node representing a string
+ * Create a node representing a wstring.
*/
tao_yyval.dcval =
idl_global->gen ()->create_wstring (
idl_global->gen ()->create_expr ((unsigned long) 0)
);
/*
- * Add this AST_String to the types defined in the global scope
+ * Add this AST_String to the types defined in the global scope.
*/
(void) idl_global->root ()->fe_add_string (
AST_String::narrow_from_decl (tao_yyval.dcval)
);
}
break;
-case 275:
+case 298:
{
+/* wstring_head : IDL_WSTRING*/
idl_global->set_parse_state (IDL_GlobalData::PS_StringSeen);
}
break;
-case 276:
+case 299:
{
+/* array_declarator : id*/
idl_global->set_parse_state (IDL_GlobalData::PS_ArrayIDSeen);
}
break;
-case 277:
+case 300:
{
+/* at_least_one_array_dim*/
idl_global->set_parse_state (IDL_GlobalData::PS_ArrayCompleted);
+
/*
- * Create a node representing an array
+ * Create a node representing an array.
*/
- if (tao_yyvsp[0].elval != 0) {
- tao_yyval.dcval = idl_global->gen ()->create_array (new UTL_ScopedName (tao_yyvsp[-2].idval,
- 0),
- tao_yyvsp[0].elval->length (),
- tao_yyvsp[0].elval,
- 0,
- 0);
- }
+ if (tao_yyvsp[0].elval != 0)
+ {
+ UTL_ScopedName sn (tao_yyvsp[-2].idval,
+ 0);
+ tao_yyval.dcval =
+ idl_global->gen ()->create_array (
+ &sn,
+ tao_yyvsp[0].elval->length (),
+ tao_yyvsp[0].elval,
+ 0,
+ 0
+ );
+ }
}
break;
-case 278:
+case 301:
{
- tao_yyval.elval = new UTL_ExprList (tao_yyvsp[-1].exval, tao_yyvsp[0].elval);
+/* at_least_one_array_dim : array_dim array_dims*/
+ ACE_NEW_RETURN (tao_yyval.elval,
+ UTL_ExprList (tao_yyvsp[-1].exval,
+ tao_yyvsp[0].elval),
+ 1);
}
break;
-case 279:
+case 302:
{
+/* array_dims : array_dims array_dim*/
if (tao_yyvsp[-1].elval == 0)
- tao_yyval.elval = new UTL_ExprList (tao_yyvsp[0].exval, 0);
- else {
- tao_yyvsp[-1].elval->nconc (new UTL_ExprList (tao_yyvsp[0].exval, 0));
- tao_yyval.elval = tao_yyvsp[-1].elval;
- }
+ {
+ ACE_NEW_RETURN (tao_yyval.elval,
+ UTL_ExprList (tao_yyvsp[0].exval,
+ 0),
+ 1);
+ }
+ else
+ {
+ UTL_ExprList *el = 0;
+ ACE_NEW_RETURN (el,
+ UTL_ExprList (tao_yyvsp[0].exval,
+ 0),
+ 1);
+ tao_yyvsp[-1].elval->nconc (el);
+ tao_yyval.elval = tao_yyvsp[-1].elval;
+ }
}
break;
-case 280:
+case 303:
{
+/* | /* EMPTY * /*/
tao_yyval.elval = 0;
}
break;
-case 281:
+case 304:
{
+/* array_dim : '['*/
idl_global->set_parse_state (IDL_GlobalData::PS_DimSqSeen);
}
break;
-case 282:
+case 305:
{
+/* positive_int_expr*/
idl_global->set_parse_state (IDL_GlobalData::PS_DimExprSeen);
}
break;
-case 283:
+case 306:
{
+/* ']'*/
idl_global->set_parse_state (IDL_GlobalData::PS_DimQsSeen);
+
/*
* Array dimensions are expressions which must be coerced to
- * positive integers
+ * positive integers.
*/
- if (tao_yyvsp[-2].exval == 0 || tao_yyvsp[-2].exval->coerce (AST_Expression::EV_ulong) == 0) {
- idl_global->err ()->coercion_error (tao_yyvsp[-2].exval, AST_Expression::EV_ulong);
- tao_yyval.exval = 0;
- } else
- tao_yyval.exval = tao_yyvsp[-2].exval;
+ if (tao_yyvsp[-2].exval == 0
+ || tao_yyvsp[-2].exval->coerce (AST_Expression::EV_ulong) == 0)
+ {
+ idl_global->err ()->coercion_error (tao_yyvsp[-2].exval,
+ AST_Expression::EV_ulong);
+ tao_yyval.exval = 0;
+ }
+ else
+ {
+ tao_yyval.exval = tao_yyvsp[-2].exval;
+ }
}
break;
-case 284:
+case 307:
{
+/* attribute : opt_readonly IDL_ATTRIBUTE*/
idl_global->set_parse_state (IDL_GlobalData::PS_AttrSeen);
}
break;
-case 285:
+case 308:
{
+/* param_type_spec*/
idl_global->set_parse_state (IDL_GlobalData::PS_AttrTypeSeen);
}
break;
-case 286:
+case 309:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+/* at_least_one_simple_declarator*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Attribute *a = 0;
FE_Declarator *d = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_AttrCompleted);
+
/*
* Create nodes representing attributes and add them to the
- * enclosing scope
+ * enclosing scope.
*/
- if (s != 0 && tao_yyvsp[-2].dcval != 0 && tao_yyvsp[0].dlval != 0) {
- for (UTL_DecllistActiveIterator l (tao_yyvsp[0].dlval); !l.is_done (); l.next ()) {
- d = l.item ();
- if (d == 0)
- continue;
- AST_Type *tp = d->compose (tao_yyvsp[-2].dcval);
- if (tp == 0)
- continue;
- a = idl_global->gen ()->create_attribute (tao_yyvsp[-5].bval,
- tp,
- (UTL_IdList *) d->name()->copy (),
- s->is_local (),
- s->is_abstract ());
- /*
- * Add one attribute to the enclosing scope
- */
- (void) s->fe_add_attribute (a);
+ if (s != 0
+ && tao_yyvsp[-2].dcval != 0
+ && tao_yyvsp[0].dlval != 0)
+ {
+ for (UTL_DecllistActiveIterator l (tao_yyvsp[0].dlval);
+ !l.is_done ();
+ l.next ())
+ {
+ d = l.item ();
+
+ if (d == 0)
+ {
+ continue;
+ }
+
+ AST_Type *tp = d->compose (tao_yyvsp[-2].dcval);
+
+ if (tp == 0)
+ {
+ continue;
+ }
+
+ a =
+ idl_global->gen ()->create_attribute (
+ tao_yyvsp[-5].bval,
+ tp,
+ (UTL_IdList *) d->name ()->copy (),
+ s->is_local (),
+ s->is_abstract ()
+ );
+ /*
+ * Add one attribute to the enclosing scope.
+ */
+ (void) s->fe_add_attribute (a);
+ }
}
- }
}
break;
-case 287:
+case 310:
{
+/* opt_readonly : IDL_READONLY*/
idl_global->set_parse_state (IDL_GlobalData::PS_AttrROSeen);
tao_yyval.bval = I_TRUE;
}
break;
-case 288:
+case 311:
{
+/* | /* EMPTY * /*/
tao_yyval.bval = I_FALSE;
}
break;
-case 289:
+case 312:
{
+/* exception : IDL_EXCEPTION*/
idl_global->set_parse_state (IDL_GlobalData::PS_ExceptSeen);
}
break;
-case 290:
+case 313:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- UTL_ScopedName *n = new UTL_ScopedName (tao_yyvsp[0].idval, 0);
+/* id*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n (tao_yyvsp[0].idval,
+ 0);
AST_Exception *e = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_ExceptIDSeen);
+
/*
* Create a node representing an exception and add it to
- * the enclosing scope
+ * the enclosing scope.
*/
- if (s != 0) {
- e = idl_global->gen ()->create_exception (n,
- s->is_local (),
- s->is_abstract ());
- (void) s->fe_add_exception (e);
- }
+ if (s != 0)
+ {
+ e = idl_global->gen ()->create_exception (&n,
+ s->is_local (),
+ s->is_abstract ());
+ (void) s->fe_add_exception (e);
+ }
+
/*
- * Push the exception scope on the scope stack
+ * Push the exception scope on the scope stack.
*/
- idl_global->scopes()->push (e);
+ idl_global->scopes ().push (e);
}
break;
-case 291:
+case 314:
{
+/* '{'*/
idl_global->set_parse_state (IDL_GlobalData::PS_ExceptSqSeen);
}
break;
-case 292:
+case 315:
{
+/* members*/
idl_global->set_parse_state (IDL_GlobalData::PS_ExceptBodySeen);
}
break;
-case 293:
+case 316:
{
+/* '}'*/
idl_global->set_parse_state (IDL_GlobalData::PS_ExceptQsSeen);
/*
- * Done with this exception. Pop its scope from the scope stack
+ * Done with this exception. Pop its scope from the scope stack.
*/
- idl_global->scopes ()->pop ();
+ idl_global->scopes ().pop ();
}
break;
-case 294:
+case 317:
{
+/* operation : opt_op_attribute op_type_spec*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpTypeSeen);
}
break;
-case 295:
+case 318:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
- UTL_ScopedName *n =
- new UTL_ScopedName (new Identifier (tao_yyvsp[0].strval), 0);
+/* IDENTIFIER*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ Identifier id (tao_yyvsp[0].strval);
+ UTL_ScopedName n (&id,
+ 0);
AST_Operation *o = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen);
+
/*
* Create a node representing an operation on an interface
- * and add it to its enclosing scope
+ * and add it to its enclosing scope.
*/
- if (s != 0 && tao_yyvsp[-2].dcval != 0) {
- AST_Type *tp = AST_Type::narrow_from_decl (tao_yyvsp[-2].dcval);
- if (tp == 0) {
- idl_global->err ()->not_a_type (tao_yyvsp[-2].dcval);
- } else if (tp->node_type () == AST_Decl::NT_except) {
- idl_global->err ()->not_a_type (tao_yyvsp[-2].dcval);
- } else {
- o = idl_global->gen ()->create_operation (tp,
- tao_yyvsp[-3].ofval,
- n,
- s->is_local (),
- s->is_abstract ());
- (void) s->fe_add_operation (o);
+ if (s != 0 && tao_yyvsp[-2].dcval != 0)
+ {
+ AST_Type *tp =
+ AST_Type::narrow_from_decl (tao_yyvsp[-2].dcval);
+
+ if (tp == 0)
+ {
+ idl_global->err ()->not_a_type (tao_yyvsp[-2].dcval);
+ }
+ else if (tp->node_type () == AST_Decl::NT_except)
+ {
+ idl_global->err ()->not_a_type (tao_yyvsp[-2].dcval);
+ }
+ else
+ {
+ o =
+ idl_global->gen ()->create_operation (tp,
+ tao_yyvsp[-3].ofval,
+ &n,
+ s->is_local (),
+ s->is_abstract ());
+ (void) s->fe_add_operation (o);
+ }
}
- }
+
+ ACE_OS::free (tao_yyvsp[0].strval);
+ tao_yyvsp[0].strval = 0;
+
/*
- * Push the operation scope onto the scopes stack
+ * Push the operation scope onto the scopes stack.
*/
- idl_global->scopes()->push (o);
+ idl_global->scopes ().push (o);
}
break;
-case 296:
+case 319:
{
+/* parameter_list*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
}
break;
-case 297:
+case 320:
{
+/* opt_raises*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
}
break;
-case 298:
+case 321:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+/* opt_context*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Operation *o = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_OpCompleted);
+
/*
- * Add exceptions and context to the operation
+ * Add exceptions and context to the operation.
*/
- if (s != 0 && s->scope_node_type() == AST_Decl::NT_op) {
- o = AST_Operation::narrow_from_scope (s);
+ if (s != 0 && s->scope_node_type () == AST_Decl::NT_op)
+ {
+ o = AST_Operation::narrow_from_scope (s);
+
+ if (tao_yyvsp[-2].nlval != 0 && o != 0)
+ {
+ (void) o->fe_add_exceptions (tao_yyvsp[-2].nlval);
+ }
+
+ if (tao_yyvsp[0].slval != 0)
+ {
+ (void) o->fe_add_context (tao_yyvsp[0].slval);
+ }
+ }
- if (tao_yyvsp[-2].nlval != 0 && o != 0)
- (void) o->fe_add_exceptions (tao_yyvsp[-2].nlval);
- if (tao_yyvsp[0].slval != 0)
- (void) o->fe_add_context (tao_yyvsp[0].slval);
- }
/*
- * Done with this operation. Pop its scope from the scopes stack
+ * Done with this operation. Pop its scope from the scopes stack.
*/
- idl_global->scopes ()->pop ();
+ idl_global->scopes ().pop ();
}
break;
-case 299:
+case 322:
{
+/* opt_op_attribute : IDL_ONEWAY*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpAttrSeen);
tao_yyval.ofval = AST_Operation::OP_oneway;
}
break;
-case 300:
+case 323:
{
+/* | IDL_IDEMPOTENT*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpAttrSeen);
tao_yyval.ofval = AST_Operation::OP_idempotent;
}
break;
-case 301:
+case 324:
{
+/* | /* EMPTY * /*/
tao_yyval.ofval = AST_Operation::OP_noflags;
}
break;
-case 303:
+case 326:
{
+/* op_type_spec : param_type_spec | IDL_VOID*/
tao_yyval.dcval =
- idl_global->scopes ()->bottom ()->lookup_primitive_type (
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
AST_Expression::EV_void
);
}
break;
-case 304:
+case 327:
{
+/* init_decl : IDL_FACTORY */
/*@@ PS_FactorySeen?*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpTypeSeen);
}
break;
-case 305:
+case 328:
{
+/* IDENTIFIER */
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
if (s->is_abstract ())
- {
- /*@@ Fire error*/
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("error in %s line %d:\n")
- ACE_TEXT ("Abstract valuetype can't have a ")
- ACE_TEXT ("factory construct.\n"),
- idl_global->filename ()->get_string (),
- idl_global->lineno ()));
- }
- UTL_ScopedName *n =
- new UTL_ScopedName (new Identifier (tao_yyvsp[0].strval), 0);
-
+ {
+ /*@@ Fire error*/
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("error in %s line %d:\n")
+ ACE_TEXT ("Abstract valuetype can't have a ")
+ ACE_TEXT ("factory construct.\n"),
+ idl_global->filename ()->get_string (),
+ idl_global->lineno ()));
+ }
+
+ Identifier id (tao_yyvsp[0].strval);
+ UTL_ScopedName n (&id,
+ 0);
AST_Factory *factory = 0;
idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen);
@@ -3459,257 +4723,1031 @@ case 305:
* and add it to its enclosing scope
*/
if (s != 0)
- {
- factory = idl_global->gen ()->create_factory (n);
- (void) s->fe_add_factory (factory);
- }
+ {
+ factory = idl_global->gen ()->create_factory (&n);
+ (void) s->fe_add_factory (factory);
+ }
+
/*
- * Push the operation scope onto the scopes stack
+ * Push the operation scope onto the scopes stack.
*/
- idl_global->scopes ()->push (factory);
+ idl_global->scopes ().push (factory);
}
break;
-case 306:
+case 329:
{
- /* TODO: replace parameter_list with rule that accepts only IN args*/
+/* init_parameter_list*/
+ /* TODO: replace parameter_list with rule that accepts only IN args */
idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
- idl_global->scopes ()->pop ();
+ idl_global->scopes ().pop ();
}
break;
-case 307:
+case 330:
{
+/* init_parameter_list : '('*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
}
break;
-case 308:
+case 331:
{
+/* ')'*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
}
break;
-case 309:
-#line 2588 "fe/idl.tao_yy"
+case 332:
{
+/* | '('*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
}
break;
-case 310:
+case 333:
{
+/* at_least_one_in_parameter ')'*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
}
break;
-case 312:
+case 335:
{
+/* in_parameters : in_parameters ','*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpParCommaSeen);
}
break;
-case 315:
+case 338:
{
+/* in_parameter : IDL_IN*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpParDirSeen);
}
break;
-case 316:
+case 339:
{
+/* param_type_spec*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpParTypeSeen);
}
break;
-case 317:
+case 340:
{
-
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+/* declarator*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Argument *a = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_OpParDeclSeen);
+
/*
* Create a node representing an argument to an operation
- * Add it to the enclosing scope (the operation scope)
+ * Add it to the enclosing scope (the operation scope).
*/
- if (tao_yyvsp[-2].dcval != 0 && tao_yyvsp[0].deval != 0 && s != 0)
- {
- AST_Type *tp = tao_yyvsp[0].deval->compose (tao_yyvsp[-2].dcval);
- if (tp != 0)
+ if (tao_yyvsp[-2].dcval != 0
+ && tao_yyvsp[0].deval != 0 &&
+ s != 0)
{
- a = idl_global->gen ()->create_argument (
- AST_Argument::dir_IN,
- tp,
- (UTL_IdList *) tao_yyvsp[0].deval->name ()->copy ()
- );
+ AST_Type *tp = tao_yyvsp[0].deval->compose (tao_yyvsp[-2].dcval);
+
+ if (tp != 0)
+ {
+ a = idl_global->gen ()->create_argument (
+ AST_Argument::dir_IN,
+ tp,
+ (UTL_IdList *) tao_yyvsp[0].deval->name ()->copy ()
+ );
- (void) s->fe_add_argument (a);
+ (void) s->fe_add_argument (a);
+ }
}
- }
}
break;
-case 318:
+case 341:
{
+/* parameter_list : '('*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
}
break;
-case 319:
+case 342:
{
+/* ')'*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
}
break;
-case 320:
+case 343:
{
+/* | '('*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
}
break;
-case 321:
+case 344:
{
+/* at_least_one_parameter ')'*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen);
}
break;
-case 323:
+case 346:
{
+/* parameters : parameters ','*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpParCommaSeen);
}
break;
-case 326:
+case 349:
{
+/* parameter : direction*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpParDirSeen);
}
break;
-case 327:
+case 350:
{
+/* param_type_spec*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpParTypeSeen);
}
break;
-case 328:
+case 351:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+/* declarator*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Argument *a = 0;
-
idl_global->set_parse_state (IDL_GlobalData::PS_OpParDeclSeen);
+
/*
* Create a node representing an argument to an operation
- * Add it to the enclosing scope (the operation scope)
+ * Add it to the enclosing scope (the operation scope).
*/
- if (tao_yyvsp[-2].dcval != 0 && tao_yyvsp[0].deval != 0 && s != 0) {
- AST_Type *tp = tao_yyvsp[0].deval->compose (tao_yyvsp[-2].dcval);
- if (tp != 0) {
- if (!s->is_local () && tp->is_local ())
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("error in %s line %d\n"),
- idl_global->filename ()->get_string (),
- idl_global->lineno ()));
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("Cannot use a local type as an ")
- ACE_TEXT ("argument of a remote operation\n")));
- }
- else
+ if (tao_yyvsp[-2].dcval != 0
+ && tao_yyvsp[0].deval != 0
+ && s != 0)
+ {
+ AST_Type *tp = tao_yyvsp[0].deval->compose (tao_yyvsp[-2].dcval);
+
+ if (tp != 0)
{
- a = idl_global->gen ()->create_argument (
- tao_yyvsp[-4].dival,
- tp,
- (UTL_IdList *) tao_yyvsp[0].deval->name ()->copy ()
- );
- (void) s->fe_add_argument (a);
+ if (!s->is_local () && tp->is_local ())
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("error in %s line %d\n"),
+ idl_global->filename ()->get_string (),
+ idl_global->lineno ()));
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Cannot use a local type as an ")
+ ACE_TEXT ("argument of a remote ")
+ ACE_TEXT ("operation\n")));
+ }
+ else
+ {
+ a =
+ idl_global->gen ()->create_argument (
+ tao_yyvsp[-4].dival,
+ tp,
+ (UTL_IdList *) tao_yyvsp[0].deval->name ()->copy ()
+ );
+ (void) s->fe_add_argument (a);
+ }
}
}
- }
}
break;
-case 329:
+case 352:
{
- tao_yyval.dcval = idl_global->scopes ()->bottom ()->lookup_primitive_type (tao_yyvsp[0].etval);
+/* param_type_spec : base_type_spec*/
+ tao_yyval.dcval =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ tao_yyvsp[0].etval
+ );
}
break;
-case 332:
+case 355:
{
- UTL_Scope *s = idl_global->scopes ()->top_non_null ();
+/* | string_type_spec*/
+/* | wstring_type_spec*/
+/* | scoped_name*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Decl *d = 0;
if (s != 0)
- d = s->lookup_by_name (tao_yyvsp[0].idlist, I_TRUE);
+ {
+ d = s->lookup_by_name (tao_yyvsp[0].idlist,
+ I_TRUE);
+ }
+
if (d == 0)
- idl_global->err ()->lookup_error (tao_yyvsp[0].idlist);
+ {
+ idl_global->err ()->lookup_error (tao_yyvsp[0].idlist);
+ }
+ else
+ {
+ AST_Decl::NodeType nt = d->node_type ();
+
+ if (nt == AST_Decl::NT_struct_fwd
+ || nt == AST_Decl::NT_union_fwd)
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_ILLEGAL_ADD,
+ d);
+
+ /* If we don't return here, we'll crash later.*/
+ return 1;
+ }
+ }
+
+
tao_yyval.dcval = d;
}
break;
-case 333:
+case 356:
{
+/* direction : IDL_IN*/
tao_yyval.dival = AST_Argument::dir_IN;
}
break;
-case 334:
+case 357:
{
+/* | IDL_OUT*/
tao_yyval.dival = AST_Argument::dir_OUT;
}
break;
-case 335:
+case 358:
{
+/* | IDL_INOUT*/
tao_yyval.dival = AST_Argument::dir_INOUT;
}
break;
-case 336:
+case 359:
{
+/* opt_raises : IDL_RAISES*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseSeen);
}
break;
-case 337:
+case 360:
{
+/* '('*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseSqSeen);
}
break;
-case 338:
+case 361:
{
+/* at_least_one_scoped_name ')'*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseQsSeen);
tao_yyval.nlval = tao_yyvsp[-1].nlval;
}
break;
-case 339:
+case 362:
{
tao_yyval.nlval = 0;
+/* | /* EMPTY * /*/
}
break;
-case 340:
+case 363:
{
+/* opt_context : IDL_CONTEXT*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpContextSeen);
}
break;
-case 341:
+case 364:
{
idl_global->set_parse_state (IDL_GlobalData::PS_OpContextSqSeen);
+/* '('*/
}
break;
-case 342:
+case 365:
{
+/* at_least_one_string_literal ')'*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpContextQsSeen);
tao_yyval.slval = tao_yyvsp[-1].slval;
}
break;
-case 343:
+case 366:
{
+/* | /* EMPTY * /*/
tao_yyval.slval = 0;
}
break;
-case 344:
+case 367:
{
- tao_yyval.slval = new UTL_StrList (tao_yyvsp[-1].sval, tao_yyvsp[0].slval);
+/* at_least_one_string_literal : IDL_STRING_LITERAL string_literals*/
+ ACE_NEW_RETURN (tao_yyval.slval,
+ UTL_StrList (tao_yyvsp[-1].sval,
+ tao_yyvsp[0].slval),
+ 1);
}
break;
-case 345:
+case 368:
{
+/* string_literals : string_literals ','*/
idl_global->set_parse_state (IDL_GlobalData::PS_OpContextCommaSeen);
}
break;
-case 346:
+case 369:
{
+/* IDL_STRING_LITERAL*/
if (tao_yyvsp[-3].slval == 0)
- tao_yyval.slval = new UTL_StrList (tao_yyvsp[0].sval, 0);
- else {
- tao_yyvsp[-3].slval->nconc (new UTL_StrList (tao_yyvsp[0].sval, 0));
- tao_yyval.slval = tao_yyvsp[-3].slval;
- }
+ {
+ ACE_NEW_RETURN (tao_yyval.slval,
+ UTL_StrList (tao_yyvsp[0].sval,
+ 0),
+ 1);
+ }
+ else
+ {
+ UTL_StrList *sl = 0;
+ ACE_NEW_RETURN (sl,
+ UTL_StrList (tao_yyvsp[0].sval,
+ 0),
+ 1);
+ tao_yyvsp[-3].slval->nconc (sl);
+ tao_yyval.slval = tao_yyvsp[-3].slval;
+ }
}
break;
-case 347:
+case 370:
{
+/* | /* EMPTY * /*/
tao_yyval.slval = 0;
}
break;
+case 371:
+{
+/* typeid_dcl : IDL_TYPEID scoped_name IDL_STRING_LITERAL*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Decl *d = s->lookup_by_name (tao_yyvsp[-1].idlist,
+ I_TRUE);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (tao_yyvsp[-1].idlist);
+ }
+ else
+ {
+ d->set_id_with_typeid (
+ tao_yyvsp[0].sval->get_string ()
+ );
+ }
+ }
+break;
+case 372:
+{
+/* typeprefix_dcl : IDL_TYPEPREFIX scoped_name IDL_STRING_LITERAL*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Decl *d = s->lookup_by_name (tao_yyvsp[-1].idlist,
+ I_TRUE);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (tao_yyvsp[-1].idlist);
+ }
+ else
+ {
+ d->set_prefix_with_typeprefix (
+ tao_yyvsp[0].sval->get_string ()
+ );
+ }
+ }
+break;
+case 375:
+{
+/* component_forward_decl : IDL_COMPONENT id*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n (tao_yyvsp[0].idval,
+ 0);
+ AST_ComponentFwd *f = 0;
+ idl_global->set_parse_state (
+ IDL_GlobalData::PS_ComponentForwardSeen
+ );
+
+ /*
+ * Create a node representing a forward declaration of a
+ * component. Store it in the enclosing scope.
+ */
+ if (s != 0)
+ {
+ f = idl_global->gen ()->create_component_fwd (&n);
+ (void) s->fe_add_component_fwd (f);
+ }
+ }
+break;
+case 376:
+{
+/* component_decl : component_header */
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Component *c = 0;
+
+ /*
+ * Make a new component node and add it to the enclosing scope.
+ */
+ if (s != 0 && tao_yyvsp[0].chval != 0)
+ {
+ c =
+ idl_global->gen ()->create_component (
+ tao_yyvsp[0].chval->name (),
+ tao_yyvsp[0].chval->base_component (),
+ tao_yyvsp[0].chval->supports (),
+ tao_yyvsp[0].chval->n_supports (),
+ tao_yyvsp[0].chval->supports_flat (),
+ tao_yyvsp[0].chval->n_supports_flat ()
+ );
+ AST_Interface *i = AST_Interface::narrow_from_decl (c);
+ AST_Interface::fwd_redefinition_helper (i,
+ s);
+ /*
+ * Add the component to its definition scope.
+ */
+ c = AST_Component::narrow_from_decl (i);
+ (void) s->fe_add_component (c);
+
+ /* This FE_ComponentHeader class isn't destroyed with the AST.*/
+ tao_yyvsp[0].chval->name ()->destroy ();
+ delete tao_yyvsp[0].chval;
+ tao_yyvsp[0].chval = 0;
+ }
+
+ /*
+ * Push it on the scope stack.
+ */
+ idl_global->scopes ().push (c);
+ }
+break;
+case 377:
+{
+/* '{'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_ComponentSqSeen);
+ }
+break;
+case 378:
+{
+/* component_exports*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_ComponentBodySeen);
+ }
+break;
+case 379:
+{
+/* '}'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_ComponentQsSeen);
+
+ /*
+ * Done with this component - pop it off the scopes stack.
+ */
+ idl_global->scopes ().pop ();
+ }
+break;
+case 380:
+{
+/* id*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_ComponentIDSeen);
+ }
+break;
+case 381:
+{
+/* component_inheritance_spec*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
+ }
+break;
+case 382:
+{
+/* supports_spec*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
+
+ /*
+ * Create an AST representation of the information in the header
+ * part of a component.
+ */
+ UTL_ScopedName n (tao_yyvsp[-4].idval,
+ 0);
+ ACE_NEW_RETURN (tao_yyval.chval,
+ FE_ComponentHeader (&n,
+ tao_yyvsp[-2].idlist,
+ tao_yyvsp[0].nlval,
+ I_FALSE),
+ 1);
+ }
+break;
+case 383:
+{
+/* component_inheritance_spec : ':'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritColonSeen);
+ }
+break;
+case 384:
+{
+/* scoped_name*/
+ tao_yyval.idlist = tao_yyvsp[0].idlist;
+ }
+break;
+case 385:
+{
+/* | /* EMPTY * /*/
+ tao_yyval.idlist = 0;
+ }
+break;
+case 388:
+{
+/* component_export : provides_decl*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_ProvidesDeclSeen);
+ }
+break;
+case 389:
+{
+/* ';'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+break;
+case 390:
+{
+/* | uses_decl*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_UsesDeclSeen);
+ }
+break;
+case 391:
+{
+/* ';'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+break;
+case 392:
+{
+/* | emits_decl*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_EmitsDeclSeen);
+ }
+break;
+case 393:
+{
+/* ';'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+break;
+case 394:
+{
+/* | publishes_decl*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_PublishesDeclSeen);
+ }
+break;
+case 395:
+{
+/* ';'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+break;
+case 396:
+{
+/* | consumes_decl*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_ConsumesDeclSeen);
+ }
+break;
+case 397:
+{
+/* ';'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+break;
+case 398:
+{
+/* | attribute*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclSeen);
+ }
+break;
+case 399:
+{
+/* ';'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+break;
+case 400:
+{
+/* provides_decl : IDL_PROVIDES interface_type id*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Component *c = AST_Component::narrow_from_scope (s);
+
+ if (c != 0)
+ {
+ AST_Component::port_description pd;
+ pd.id = tao_yyvsp[0].idval;
+ pd.impl = tao_yyvsp[-1].idlist;
+ c->provides ().enqueue_tail (pd);
+ }
+ }
+break;
+case 401:
+{
+/* interface_type : scoped_name*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Decl *d = s->lookup_by_name (tao_yyvsp[0].idlist,
+ I_TRUE);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (tao_yyvsp[0].idlist);
+ }
+ else if (d->node_type () != AST_Decl::NT_interface)
+ {
+ idl_global->err ()->interface_expected (d);
+ }
+
+ tao_yyval.idlist = tao_yyvsp[0].idlist;
+ }
+break;
+case 402:
+{
+/* | IDL_OBJECT*/
+ Identifier *corba_id = 0;
+ ACE_NEW_RETURN (corba_id,
+ Identifier ("Object"),
+ 1);
+ UTL_IdList *conc_name = 0;
+ ACE_NEW_RETURN (conc_name,
+ UTL_IdList (corba_id,
+ 0),
+ 1);
+ ACE_NEW_RETURN (corba_id,
+ Identifier ("CORBA"),
+ 1);
+ UTL_IdList *corba_name = 0;
+ ACE_NEW_RETURN (corba_name,
+ UTL_IdList (corba_id,
+ conc_name),
+ 1);
+ tao_yyval.idlist = corba_name;
+ }
+break;
+case 403:
+{
+/* uses_decl : IDL_USES opt_multiple interface_type id*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Component *c = AST_Component::narrow_from_scope (s);
+
+ if (c != 0)
+ {
+ AST_Component::uses_description ud;
+ ud.id = tao_yyvsp[0].idval;
+ ud.impl = tao_yyvsp[-1].idlist;
+ ud.is_multiple = tao_yyvsp[-2].bval;
+ c->uses ().enqueue_tail (ud);
+ }
+ }
+break;
+case 404:
+{
+/* opt_multiple : IDL_MULTIPLE*/
+ tao_yyval.bval = I_TRUE;
+ }
+break;
+case 405:
+{
+/* | /* EMPTY * /*/
+ tao_yyval.bval = I_FALSE;
+ }
+break;
+case 406:
+{
+/* emits_decl : IDL_EMITS scoped_name id*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Decl *d = s->lookup_by_name (tao_yyvsp[-1].idlist,
+ I_TRUE);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (tao_yyvsp[-1].idlist);
+ }
+ else if (d->node_type () != AST_Decl::NT_valuetype)
+ {
+ idl_global->err ()->valuetype_expected (d);
+ }
+
+ AST_Component *c = AST_Component::narrow_from_scope (s);
+
+ if (c != 0)
+ {
+ AST_Component::port_description pd;
+ pd.id = tao_yyvsp[0].idval;
+ pd.impl = tao_yyvsp[-1].idlist;
+ c->emits ().enqueue_tail (pd);
+ }
+ }
+break;
+case 407:
+{
+/* publishes_decl : IDL_PUBLISHES scoped_name id*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Decl *d = s->lookup_by_name (tao_yyvsp[-1].idlist,
+ I_TRUE);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (tao_yyvsp[-1].idlist);
+ }
+ else if (d->node_type () != AST_Decl::NT_valuetype)
+ {
+ idl_global->err ()->valuetype_expected (d);
+ }
+
+ AST_Component *c = AST_Component::narrow_from_scope (s);
+
+ if (c != 0)
+ {
+ AST_Component::port_description pd;
+ pd.id = tao_yyvsp[0].idval;
+ pd.impl = tao_yyvsp[-1].idlist;
+ c->publishes ().enqueue_tail (pd);
+ }
+ }
+break;
+case 408:
+{
+/* consumes_decl : IDL_CONSUMES scoped_name id*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Decl *d = s->lookup_by_name (tao_yyvsp[-1].idlist,
+ I_TRUE);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error (tao_yyvsp[-1].idlist);
+ }
+ else if (d->node_type () != AST_Decl::NT_valuetype)
+ {
+ idl_global->err ()->valuetype_expected (d);
+ }
+
+ AST_Component *c = AST_Component::narrow_from_scope (s);
+
+ if (c != 0)
+ {
+ AST_Component::port_description pd;
+ pd.id = tao_yyvsp[0].idval;
+ pd.impl = tao_yyvsp[-1].idlist;
+ c->consumes ().enqueue_tail (pd);
+ }
+ }
+break;
+case 409:
+{
+/* home_decl : home_header */
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Home *h = 0;
+
+ /*
+ * Make a new home node and add it to the enclosing scope.
+ */
+ if (s != 0 && tao_yyvsp[0].hhval != 0)
+ {
+ h =
+ idl_global->gen ()->create_home (
+ tao_yyvsp[0].hhval->name (),
+ tao_yyvsp[0].hhval->base_home (),
+ tao_yyvsp[0].hhval->managed_component (),
+ tao_yyvsp[0].hhval->primary_key (),
+ tao_yyvsp[0].hhval->supports (),
+ tao_yyvsp[0].hhval->n_supports (),
+ tao_yyvsp[0].hhval->supports_flat (),
+ tao_yyvsp[0].hhval->n_supports_flat ()
+ );
+ /*
+ * Add the home to its definition scope.
+ */
+ (void) s->fe_add_home (h);
+
+ /* This FE_HomeHeader class isn't destroyed with the AST.*/
+ tao_yyvsp[0].hhval->name ()->destroy ();
+ delete tao_yyvsp[0].hhval;
+ tao_yyvsp[0].hhval = 0;
+ }
+
+ /*
+ * Push it on the scope stack.
+ */
+ idl_global->scopes ().push (h);
+ }
+break;
+case 411:
+{
+/* home_header : IDL_HOME*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_HomeSeen);
+ }
+break;
+case 412:
+{
+/* id*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_HomeIDSeen);
+ }
+break;
+case 413:
+{
+/* home_inheritance_spec*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen);
+ }
+break;
+case 414:
+{
+/* supports_spec*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
+ }
+break;
+case 415:
+{
+/* IDL_MANAGES*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_ManagesSeen);
+ }
+break;
+case 416:
+{
+/* scoped_name*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_ManagesIDSeen);
+ }
+break;
+case 417:
+{
+/* primary_key_spec*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_PrimaryKeySpecSeen);
+
+ /*
+ * Create an AST representation of the information in the header
+ * part of a component home.
+ */
+ UTL_ScopedName n (tao_yyvsp[-10].idval,
+ 0);
+ ACE_NEW_RETURN (tao_yyval.hhval,
+ FE_HomeHeader (&n,
+ tao_yyvsp[-8].idlist,
+ tao_yyvsp[-6].nlval,
+ tao_yyvsp[-2].idlist,
+ tao_yyvsp[0].idlist),
+ 1);
+ }
+break;
+case 418:
+{
+/* home_inheritance_spec ':' */
+ idl_global->set_parse_state (IDL_GlobalData::PS_InheritColonSeen);
+ }
+break;
+case 419:
+{
+/* scoped_name*/
+ tao_yyval.idlist = tao_yyvsp[0].idlist;
+ }
+break;
+case 420:
+{
+/* | /* EMPTY * /*/
+ tao_yyval.idlist = 0;
+ }
+break;
+case 421:
+{
+/* primary_key_spec : IDL_PRIMARYKEY scoped_name*/
+ tao_yyval.idlist = tao_yyvsp[0].idlist;
+ }
+break;
+case 422:
+{
+/* | /* EMPTY * /*/
+ tao_yyval.idlist = 0;
+ }
+break;
+case 423:
+{
+/* home_body : '{'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_HomeSqSeen);
+ }
+break;
+case 424:
+{
+/* home_exports*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_HomeBodySeen);
+ }
+break;
+case 425:
+{
+/* '}'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_HomeQsSeen);
+ }
+break;
+case 429:
+{
+/* home_export : factory_decl*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_FactoryDeclSeen);
+ }
+break;
+case 430:
+{
+/* | ';'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+break;
+case 431:
+{
+/* | finder_decl*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_FinderDeclSeen);
+ }
+break;
+case 432:
+{
+/* | ';'*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+ }
+break;
+case 433:
+{
+/* factory_decl : IDL_FACTORY id*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n (tao_yyvsp[0].idval,
+ 0);
+ AST_Operation *o = 0;
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen);
+
+ /*
+ * Create a node representing a factory operation
+ * and add it to the enclosing scope.
+ */
+ if (s != 0)
+ {
+ AST_Home *home = AST_Home::narrow_from_scope (s);
+ AST_Component *rt = home->managed_component ();
+
+ o =
+ idl_global->gen ()->create_operation (
+ rt,
+ AST_Operation::OP_noflags,
+ &n,
+ I_TRUE,
+ I_FALSE
+ );
+ (void) s->fe_add_operation (o);
+ home->factories ().enqueue_tail (o);
+ }
+
+ ACE_OS::free (tao_yyvsp[0].idval);
+ tao_yyvsp[0].idval = 0;
+
+ /*
+ * Push the operation scope onto the scopes stack.
+ */
+ idl_global->scopes ().push (o);
+ }
+break;
+case 434:
+{
+/* init_parameter_list*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
+ }
+break;
+case 435:
+{
+/* opt_raises*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
+
+ /*
+ * Done with this operation. Pop its scope from the scopes stack.
+ */
+ idl_global->scopes ().pop ();
+ }
+break;
+case 436:
+{
+/* finder_decl : IDL_FINDER id*/
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n (tao_yyvsp[0].idval,
+ 0);
+ AST_Operation *o = 0;
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen);
+
+ /*
+ * Create a node representing a finder operation
+ * and add it to the enclosing scope.
+ */
+ if (s != 0)
+ {
+ AST_Home *home = AST_Home::narrow_from_scope (s);
+ AST_Component *rt = home->managed_component ();
+
+ o =
+ idl_global->gen ()->create_operation (
+ rt,
+ AST_Operation::OP_noflags,
+ &n,
+ I_TRUE,
+ I_FALSE
+ );
+ (void) s->fe_add_operation (o);
+ home->finders ().enqueue_tail (o);
+ }
+
+ ACE_OS::free (tao_yyvsp[0].idval);
+ tao_yyvsp[0].idval = 0;
+
+ /*
+ * Push the operation scope onto the scopes stack.
+ */
+ idl_global->scopes ().push (o);
+ }
+break;
+case 437:
+{
+/* init_parameter_list*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted);
+ }
+break;
+case 438:
+{
+/* opt_raises*/
+ idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted);
+
+ /*
+ * Done with this operation. Pop its scope from the scopes stack.
+ */
+ idl_global->scopes ().pop ();
+ }
+break;
}
tao_yyssp -= tao_yym;
tao_yystate = *tao_yyssp;
diff --git a/TAO/TAO_IDL/fe/y.tab.cpp.diff b/TAO/TAO_IDL/fe/y.tab.cpp.diff
index 5406607b7ae..4d7a8021e00 100644
--- a/TAO/TAO_IDL/fe/y.tab.cpp.diff
+++ b/TAO/TAO_IDL/fe/y.tab.cpp.diff
@@ -40,23 +40,3 @@
++tao_yynerrs;
tao_yyinrecovery:
if (tao_yyerrflag < 3)
-@@ -2683,7 +2682,10 @@
- idl_global->err ()->error0 (UTL_Error::EIDL_DISC_TYPE);
- }
-
-- tao_yyval.dcval = idl_global->scopes ()->bottom ()->lookup_primitive_type (tao_yyvsp[0].etval);
-+ tao_yyval.dcval =
-+ idl_global->scopes ()->bottom ()->lookup_primitive_type (
-+ tao_yyvsp[0].etval
-+ );
- }
- break;
- case 227:
-@@ -3495,6 +3497,7 @@
- }
- break;
- case 309:
-+#line 2588 "fe/idl.tao_yy"
- {
- idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen);
- }
diff --git a/TAO/TAO_IDL/fe/y.tab.h b/TAO/TAO_IDL/fe/y.tab.h
index 426abceb1e4..c79ca35e9a6 100644
--- a/TAO/TAO_IDL/fe/y.tab.h
+++ b/TAO/TAO_IDL/fe/y.tab.h
@@ -15,48 +15,66 @@
#define IDL_BOOLEAN 270
#define IDL_FIXED 271
#define IDL_ANY 272
-#define IDL_STRUCT 273
-#define IDL_UNION 274
-#define IDL_SWITCH 275
-#define IDL_ENUM 276
-#define IDL_SEQUENCE 277
-#define IDL_STRING 278
-#define IDL_WSTRING 279
-#define IDL_EXCEPTION 280
-#define IDL_CASE 281
-#define IDL_DEFAULT 282
-#define IDL_READONLY 283
-#define IDL_ATTRIBUTE 284
-#define IDL_ONEWAY 285
-#define IDL_IDEMPOTENT 286
-#define IDL_VOID 287
-#define IDL_IN 288
-#define IDL_OUT 289
-#define IDL_INOUT 290
-#define IDL_RAISES 291
-#define IDL_CONTEXT 292
-#define IDL_NATIVE 293
-#define IDL_LOCAL 294
-#define IDL_ABSTRACT 295
-#define IDL_CUSTOM 296
-#define IDL_FACTORY 297
-#define IDL_PRIVATE 298
-#define IDL_PUBLIC 299
-#define IDL_SUPPORTS 300
-#define IDL_TRUNCATABLE 301
-#define IDL_VALUETYPE 302
-#define IDL_INTEGER_LITERAL 303
-#define IDL_UINTEGER_LITERAL 304
-#define IDL_STRING_LITERAL 305
-#define IDL_CHARACTER_LITERAL 306
-#define IDL_FLOATING_PT_LITERAL 307
-#define IDL_TRUETOK 308
-#define IDL_FALSETOK 309
-#define IDL_SCOPE_DELIMITOR 310
-#define IDL_LEFT_SHIFT 311
-#define IDL_RIGHT_SHIFT 312
-#define IDL_WCHAR_LITERAL 313
-#define IDL_WSTRING_LITERAL 314
+#define IDL_OBJECT 273
+#define IDL_STRUCT 274
+#define IDL_UNION 275
+#define IDL_SWITCH 276
+#define IDL_ENUM 277
+#define IDL_SEQUENCE 278
+#define IDL_STRING 279
+#define IDL_WSTRING 280
+#define IDL_EXCEPTION 281
+#define IDL_CASE 282
+#define IDL_DEFAULT 283
+#define IDL_READONLY 284
+#define IDL_ATTRIBUTE 285
+#define IDL_ONEWAY 286
+#define IDL_IDEMPOTENT 287
+#define IDL_VOID 288
+#define IDL_IN 289
+#define IDL_OUT 290
+#define IDL_INOUT 291
+#define IDL_RAISES 292
+#define IDL_CONTEXT 293
+#define IDL_NATIVE 294
+#define IDL_LOCAL 295
+#define IDL_ABSTRACT 296
+#define IDL_CUSTOM 297
+#define IDL_FACTORY 298
+#define IDL_PRIVATE 299
+#define IDL_PUBLIC 300
+#define IDL_SUPPORTS 301
+#define IDL_TRUNCATABLE 302
+#define IDL_VALUETYPE 303
+#define IDL_COMPONENT 304
+#define IDL_CONSUMES 305
+#define IDL_EMITS 306
+#define IDL_EVENTTYPE 307
+#define IDL_FINDER 308
+#define IDL_GETRAISES 309
+#define IDL_HOME 310
+#define IDL_IMPORT 311
+#define IDL_MULTIPLE 312
+#define IDL_PRIMARYKEY 313
+#define IDL_PROVIDES 314
+#define IDL_PUBLISHES 315
+#define IDL_SETRAISES 316
+#define IDL_TYPEID 317
+#define IDL_TYPEPREFIX 318
+#define IDL_USES 319
+#define IDL_MANAGES 320
+#define IDL_INTEGER_LITERAL 321
+#define IDL_UINTEGER_LITERAL 322
+#define IDL_STRING_LITERAL 323
+#define IDL_CHARACTER_LITERAL 324
+#define IDL_FLOATING_PT_LITERAL 325
+#define IDL_TRUETOK 326
+#define IDL_FALSETOK 327
+#define IDL_SCOPE_DELIMITOR 328
+#define IDL_LEFT_SHIFT 329
+#define IDL_RIGHT_SHIFT 330
+#define IDL_WCHAR_LITERAL 331
+#define IDL_WSTRING_LITERAL 332
typedef union {
AST_Decl *dcval; /* Decl value */
UTL_StrList *slval; /* String list */
@@ -65,7 +83,8 @@ typedef union {
UTL_LabelList *llval; /* Label list */
UTL_DeclList *dlval; /* Declaration list */
FE_InterfaceHeader *ihval; /* Interface header */
- FE_obv_header *vhval; /* Valuetype header */
+ FE_OBVHeader *vhval; /* Valuetype header */
+ FE_ComponentHeader *chval; /* Component header */
AST_Expression *exval; /* Expression value */
AST_UnionLabel *ulval; /* Union label */
AST_Field *ffval; /* Field value */
diff --git a/TAO/TAO_IDL/include/Makefile.am b/TAO/TAO_IDL/include/Makefile.am
index af596bc04f3..3bfd920dbfb 100644
--- a/TAO/TAO_IDL/include/Makefile.am
+++ b/TAO/TAO_IDL/include/Makefile.am
@@ -19,6 +19,8 @@ noinst_HEADERS = \
ast_argument.h \
ast_array.h \
ast_attribute.h \
+ ast_component.h \
+ ast_component_fwd.h \
ast_concrete_type.h \
ast_constant.h \
ast_decl.h \
@@ -29,6 +31,7 @@ noinst_HEADERS = \
ast_extern.h \
ast_field.h \
ast_generator.h \
+ ast_home.h \
ast_interface.h \
ast_interface_fwd.h \
ast_module.h \
@@ -39,11 +42,15 @@ noinst_HEADERS = \
ast_sequence.h \
ast_string.h \
ast_structure.h \
+ ast_structure_fwd.h \
ast_type.h \
ast_typedef.h \
ast_union.h \
+ ast_union_fwd.h \
ast_union_branch.h \
ast_union_label.h \
+ ast_valuetype.h \
+ ast_valuetype_fwd.h \
be_extern.h \
drv_extern.h \
drv_link.h \
diff --git a/TAO/TAO_IDL/include/ast.h b/TAO/TAO_IDL/include/ast.h
index 501ff4a33c1..2485faaccfa 100644
--- a/TAO/TAO_IDL/include/ast.h
+++ b/TAO/TAO_IDL/include/ast.h
@@ -103,6 +103,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "ast_root.h" // class AST_Root
#include "ast_interface.h" // class AST_Interface
#include "ast_interface_fwd.h" // class AST_InterfaceFwd
+#include "ast_component.h" // class AST_Component
#include "ast_structure.h" // class AST_Structure
#include "ast_exception.h" // class AST_Exception
#include "ast_enum.h" // class AST_Enum
diff --git a/TAO/TAO_IDL/include/ast_argument.h b/TAO/TAO_IDL/include/ast_argument.h
index ddd5b649476..26557ba9da2 100644
--- a/TAO/TAO_IDL/include/ast_argument.h
+++ b/TAO/TAO_IDL/include/ast_argument.h
@@ -70,8 +70,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// Representation of argument to operation:
// An argument is a field with a direction attached
-#include "idl_fwd.h"
-#include "idl_narrow.h"
#include "ast_field.h"
diff --git a/TAO/TAO_IDL/include/ast_array.h b/TAO/TAO_IDL/include/ast_array.h
index 5acad2b1f39..1023ed7b1ec 100644
--- a/TAO/TAO_IDL/include/ast_array.h
+++ b/TAO/TAO_IDL/include/ast_array.h
@@ -67,8 +67,15 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _AST_ARRAY_AST_ARRAY_HH
#define _AST_ARRAY_AST_ARRAY_HH
+#include "ast_concrete_type.h"
+
+class UTL_ExprList;
+class AST_Expression;
+class AST_Type;
+class ast_visitor;
+
// Representation of array declaration:
-// An array is a combination of a list of dimensions and a base type
+// An array is a combination of a list of dimensions and a base type.
class TAO_IDL_FE_Export AST_Array : public virtual AST_ConcreteType
{
@@ -110,6 +117,10 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+protected:
+ virtual int compute_size_type (void);
+ // Compute the size type if it is unknown.
+
private:
// Data.
diff --git a/TAO/TAO_IDL/include/ast_attribute.h b/TAO/TAO_IDL/include/ast_attribute.h
index e4cbc42b833..de63d57a10f 100644
--- a/TAO/TAO_IDL/include/ast_attribute.h
+++ b/TAO/TAO_IDL/include/ast_attribute.h
@@ -67,8 +67,12 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _AST_ATTRIBUTE_AST_ATTRIBUTE_HH
#define _AST_ATTRIBUTE_AST_ATTRIBUTE_HH
+#include "ast_field.h"
+#include "utl_scoped_name.h"
+#include "ace/OS.h"
+
// Representation of attribute declaration:
-// An attribute is a field with a readonly property
+// An attribute is a field with a readonly property.
class TAO_IDL_FE_Export AST_Attribute : public virtual AST_Field
{
diff --git a/TAO/TAO_IDL/include/ast_component.h b/TAO/TAO_IDL/include/ast_component.h
new file mode 100644
index 00000000000..1a39702d51f
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_component.h
@@ -0,0 +1,87 @@
+// This may look like C, but it's really -*- C++ -*-
+// $Id$
+
+#ifndef _AST_COMPONENT_AST_COMPONENT_HH
+#define _AST_COMPONENT_AST_COMPONENT_HH
+
+#include "ast_interface.h"
+#include "ace/Unbounded_Queue.h"
+
+class TAO_IDL_FE_Export AST_Component : public virtual AST_Interface
+{
+public:
+ AST_Component (void);
+
+ AST_Component (UTL_ScopedName *n,
+ AST_Component *base_component,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface **supports_flat,
+ long n_supports_flat);
+
+ virtual ~AST_Component (void);
+
+ // This also calls the base class version.
+ virtual void redefine (AST_Interface *from);
+
+ // Utility data structure for a 'uses' declaration.
+ struct uses_description
+ {
+ Identifier *id;
+ UTL_ScopedName *impl;
+ idl_bool is_multiple;
+ };
+
+ // Utility data structure for all other port declarations.
+ struct port_description
+ {
+ Identifier *id;
+ UTL_ScopedName *impl;
+ };
+
+ // Accessors.
+
+ AST_Component *base_component (void) const;
+
+ AST_Interface **supports (void) const;
+
+ long n_supports (void) const;
+
+ ACE_Unbounded_Queue<port_description> &provides (void);
+
+ ACE_Unbounded_Queue<uses_description> &uses (void);
+
+ ACE_Unbounded_Queue<port_description> &emits (void);
+
+ ACE_Unbounded_Queue<port_description> &publishes (void);
+
+ ACE_Unbounded_Queue<port_description> &consumes (void);
+
+ // Cleanup function.
+ virtual void destroy (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_Component, AST_Interface);
+ DEF_NARROW_FROM_DECL(AST_Component);
+ DEF_NARROW_FROM_SCOPE(AST_Component);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+ // Check if we have redefined any of our parents' operations or attributes,
+ // and check if there is such a clash among the parents
+ virtual idl_bool redef_clash (void);
+
+private:
+ AST_Component *pd_base_component;
+ ACE_Unbounded_Queue<port_description> pd_provides;
+ ACE_Unbounded_Queue<uses_description> pd_uses;
+ ACE_Unbounded_Queue<port_description> pd_emits;
+ ACE_Unbounded_Queue<port_description> pd_publishes;
+ ACE_Unbounded_Queue<port_description> pd_consumes;
+};
+
+#endif // _AST_COMPONENT_AST_COMPONENT_HH
diff --git a/TAO/TAO_IDL/include/ast_component_fwd.h b/TAO/TAO_IDL/include/ast_component_fwd.h
new file mode 100644
index 00000000000..244a06757b4
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_component_fwd.h
@@ -0,0 +1,35 @@
+// This may look like C, but it's really -*- C++ -*-
+// $Id$
+
+#ifndef _AST_COMPONENT_FWD_AST_COMPONENT_FWD_HH
+#define _AST_COMPONENT_FWD_AST_COMPONENT_FWD_HH
+
+#include "ast_interface_fwd.h"
+
+// Representation of a forward component declaration.
+
+class TAO_IDL_FE_Export AST_ComponentFwd : public virtual AST_InterfaceFwd
+{
+public:
+ AST_ComponentFwd (void);
+
+ AST_ComponentFwd (AST_Interface *dummy,
+ UTL_ScopedName *n);
+
+ virtual ~AST_ComponentFwd (void);
+
+ // Cleanup function.
+ virtual void destroy (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_ComponentFwd, AST_InterfaceFwd);
+ DEF_NARROW_FROM_DECL(AST_ComponentFwd);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+};
+
+#endif // _AST_COMPONENT_FWD_AST_COMPONENT_FWD_HH
diff --git a/TAO/TAO_IDL/include/ast_concrete_type.h b/TAO/TAO_IDL/include/ast_concrete_type.h
index 68838a4a636..79f132748c3 100644
--- a/TAO/TAO_IDL/include/ast_concrete_type.h
+++ b/TAO/TAO_IDL/include/ast_concrete_type.h
@@ -67,6 +67,8 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _AST_CONCRETE_TYPE_AST_CONCRETE_TYPE_HH
#define _AST_CONCRETE_TYPE_AST_CONCRETE_TYPE_HH
+#include "ast_type.h"
+
// Class for all concrete types.
// This is useful to group together IDL types other than objects.
diff --git a/TAO/TAO_IDL/include/ast_constant.h b/TAO/TAO_IDL/include/ast_constant.h
index 61807f7cb6f..c94aae1ff6a 100644
--- a/TAO/TAO_IDL/include/ast_constant.h
+++ b/TAO/TAO_IDL/include/ast_constant.h
@@ -67,6 +67,10 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _AST_CONSTANT_AST_CONSTANT_HH
#define _AST_CONSTANT_AST_CONSTANT_HH
+#include "ast_expression.h"
+#include "ast_decl.h"
+#include "global_extern.h"
+
// Representation of constant declaration:
//
// NOTE: Part of the job of the constructor is to convert
@@ -80,9 +84,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
class TAO_IDL_FE_Export AST_Constant : public virtual AST_Decl
{
public:
- // Operations.
-
- // Constructor(s).
AST_Constant (void);
AST_Constant (AST_Expression::ExprType et,
@@ -94,18 +95,25 @@ public:
AST_Expression *ev,
UTL_ScopedName *n);
- // Destructor.
virtual ~AST_Constant (void);
// Data Accessors.
AST_Expression *constant_value (void);
-
AST_Expression::ExprType et (void);
// Accessors for the private member.
idl_bool ifr_added (void);
void ifr_added (idl_bool val);
+ const char *exprtype_to_string (void);
+ // Returns the appropriate type.
+
+ static const char *exprtype_to_string (AST_Expression::ExprType et);
+ // For use with ORBs without the CORBA namespace.
+
+ UTL_ScopedName *enum_full_name (void);
+ // If our type is enum, we have to generate the scoped name.
+
// Narrowing
DEF_NARROW_METHODS1(AST_Constant, AST_Decl);
DEF_NARROW_FROM_DECL(AST_Constant);
@@ -116,8 +124,10 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
-private:
- // Data.
+ // Cleanup.
+ virtual void destroy (void);
+
+protected:
AST_Expression *pd_constant_value;
// The value.
diff --git a/TAO/TAO_IDL/include/ast_decl.h b/TAO/TAO_IDL/include/ast_decl.h
index 6ce991ce0ac..2ef5ca02676 100644
--- a/TAO/TAO_IDL/include/ast_decl.h
+++ b/TAO/TAO_IDL/include/ast_decl.h
@@ -74,21 +74,16 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// records the type of the node. This may be useful for BEs to be able
// to distinguish the real type of a node given only a superclass.
-/*
-** DEPENDENCIES: utl_scope.hh, utl_scoped_name.hh, utl_strlist.hh
-**
-** USE: Included from ast.hh
-*/
-
-#include "idl_fwd.h"
-#include "idl_narrow.h"
-#include "idl_bool.h"
#include "utl_scoped_name.h"
-#include "utl_string.h"
+#include "idl_narrow.h"
// This is for AIX w/IBM C++
class Identifier;
+class UTL_Scope;
+class UTL_String;
+class ast_visitor;
+
// This class is needed (only for g++) to get around a bug in g++ which
// causes virtual operations to not be looked up correctly if an operation
// is defined in more than one virtual public base class. This class makes
@@ -125,14 +120,18 @@ public:
, NT_root // Denotes the root of AST
, NT_interface // Denotes an interface
, NT_interface_fwd // Fwd declared interface
+ , NT_valuetype // Denotes a valuetype
+ , NT_valuetype_fwd // Fwd declared valuetype
, NT_const // Denotes a constant
, NT_except // Denotes an exception
, NT_attr // Denotes an attribute
, NT_op // Denotes an operation
, NT_argument // Denotes an op. argument
, NT_union // Denotes a union
+ , NT_union_fwd // Fwd declared union
, NT_union_branch // Denotes a union branch
, NT_struct // Denotes a structure
+ , NT_struct_fwd // Fwd declared struct
, NT_field // Denotes a field in structure
, NT_enum // Denotes an enumeration
, NT_enum_val // Denotes an enum. value
@@ -146,6 +145,11 @@ public:
// dependent on the programming
// language
, NT_factory // Denotes a OBV factory construct
+ , NT_component // Denotes a CORBA component
+ , NT_component_fwd // Denotes a forward declared component
+ , NT_home // Denotes a CORBA component home
+ , NT_finder // Denotes a home finder
+ , NT_eventtype // Denotes a CCM event source or sink
};
// Operations.
@@ -193,6 +197,7 @@ public:
void set_name (UTL_ScopedName *n);
Identifier *local_name (void);
+ void local_name (Identifier *id);
Identifier *compute_local_name (const char *prefix,
const char *sufix);
@@ -201,6 +206,9 @@ public:
virtual const char *full_name (void);
// Return the stringified full name.
+ const char *flat_name (void);
+ // Return the flattened full scoped name.
+
const char *repoID (void);
void repoID (char *value);
// Accessors for the repository ID.
@@ -211,10 +219,20 @@ public:
const char *version (void);
void version (char *value);
- // Accessors for the version member.
+ // Accessors for the version_ member.
idl_bool anonymous (void) const;
- // Are we an anonymous (no repo ID) type?
+ // Accessors for the anonymous_ member.
+
+ idl_bool typeid_set (void) const;
+ void typeid_set (idl_bool val);
+ // Accessors for the typeid_set_ member.
+
+ void set_id_with_typeid (char *value);
+ // Called by a 'typeId' declaration.
+
+ void set_prefix_with_typeprefix (char *value);
+ // Called by a 'type_prefix' declaration.
// If there is _cxx_ in the beginning, we will remove that and keep
// a copy of the original name. TAO IDL's front end adds _cxx_
@@ -254,6 +272,12 @@ public:
// Return TRUE if "this" is a child of "s".
idl_bool is_child (AST_Decl *s);
+ idl_bool is_nested (void);
+ // Determines if we are inside of a nested scope or not.
+
+ UTL_ScopedName *last_referenced_as (void) const;
+ void last_referenced_as (UTL_ScopedName *n);
+
protected:
// These are not private because they're used by
// be_predefined_type' constructor.
@@ -267,6 +291,9 @@ protected:
void compute_full_name (void);
// Computes the stringified scoped name.
+ void compute_flat_name (void);
+ // Compute the flattened fully scoped name.
+
private:
// Data
@@ -289,7 +316,6 @@ private:
// What file defined in.
UTL_ScopedName *pd_name;
- // As given.
Identifier *pd_local_name;
// Name in scope.
@@ -312,10 +338,22 @@ private:
idl_bool anonymous_;
// Are we an anonymous (no repo ID) type?
- // Operations
+ idl_bool typeid_set_;
+ // Has our repo id been set by a typeId declaration?
- // Compute the full name of an AST node.
+ char *flat_name_;
+ // Flattened fully scoped name.
+
+ UTL_ScopedName *last_referenced_as_;
+ // Temporary holder of the most recent way we were reference.
+ // The top level component of this is added to pd_name_referenced.
+
+private:
void compute_full_name (UTL_ScopedName *n);
+ // Compute the full name of an AST node.
+
+ void set_prefix_with_typeprefix_r (char *value);
+ // Non-top-level version of set_prefix_with_typeprefix.
};
#endif // _AST_DECL_AST_DECL_HH
diff --git a/TAO/TAO_IDL/include/ast_enum.h b/TAO/TAO_IDL/include/ast_enum.h
index 39a5f81953d..e563f48c217 100644
--- a/TAO/TAO_IDL/include/ast_enum.h
+++ b/TAO/TAO_IDL/include/ast_enum.h
@@ -62,33 +62,25 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
#ifndef _AST_ENUM_AST_ENUM_HH
#define _AST_ENUM_AST_ENUM_HH
-// Representation of enum:
+#include "ast_concrete_type.h"
+#include "utl_scope.h"
-/*
-** DEPENDENCIES: ast_concrete_type.hh, utl_scope.hh, ast_enum_val.hh,
-** utl_scoped_name.hh, utl_strlist.hh, ast_expression.hh,
-**
-** USE: Included from ast.hh
-*/
+class AST_EnumVal;
class TAO_IDL_FE_Export AST_Enum : public virtual AST_ConcreteType,
public virtual UTL_Scope
{
public:
- // Operations.
-
- // Constructor(s)
AST_Enum (void);
AST_Enum (UTL_ScopedName *n,
idl_bool local,
idl_bool abstract);
- // Destructor.
virtual ~AST_Enum (void);
// Narrowing
@@ -100,16 +92,16 @@ public:
virtual void dump (ACE_OSTREAM_TYPE &);
// Look up an AST_EnumVal by value
- virtual AST_EnumVal *lookup_by_value (const AST_Expression *v);
+ AST_EnumVal *lookup_by_value (const AST_Expression *v);
// Get value to be assigned to next enumerator.
- virtual unsigned long next_enum_val (void);
+ unsigned long next_enum_val (void);
// Return the count of members
virtual int member_count (void);
// Convert a numeric value to the enum's string name for it.
- virtual UTL_ScopedName *value_to_name (const unsigned long v);
+ UTL_ScopedName *value_to_name (const unsigned long v);
// Cleanup function.
virtual void destroy (void);
diff --git a/TAO/TAO_IDL/include/ast_enum_val.h b/TAO/TAO_IDL/include/ast_enum_val.h
index 121c0600619..46b3ce331dd 100644
--- a/TAO/TAO_IDL/include/ast_enum_val.h
+++ b/TAO/TAO_IDL/include/ast_enum_val.h
@@ -67,7 +67,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _AST_ENUM_VAL_AST_ENUM_VAL_HH
#define _AST_ENUM_VAL_AST_ENUM_VAL_HH
-// Representation of enumerator in enum.
+#include "ast_constant.h"
// An enumerator is a constant of type unsigned long.
diff --git a/TAO/TAO_IDL/include/ast_exception.h b/TAO/TAO_IDL/include/ast_exception.h
index bce16beee09..c947b0fd9fa 100644
--- a/TAO/TAO_IDL/include/ast_exception.h
+++ b/TAO/TAO_IDL/include/ast_exception.h
@@ -67,6 +67,8 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _AST_EXCEPTION_AST_EXCEPTION_HH
#define _AST_EXCEPTION_AST_EXCEPTION_HH
+#include "ast_structure.h"
+
// NOTE: add (AST_ConcreteType *) is defined here because an exception
// can contain locally defined types in addition to fields.
//
@@ -78,7 +80,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
class TAO_IDL_FE_Export AST_Exception : public virtual AST_Structure
{
public:
- // Constructor(s).
AST_Exception (void);
AST_Exception (UTL_ScopedName *n,
@@ -104,7 +105,7 @@ public:
private:
friend int tao_yyparse (void);
- // Scope Management Protocol
+ // Scope Management Protocol.
virtual AST_Field *fe_add_field (AST_Field *f);
virtual AST_Union *fe_add_union (AST_Union *u);
virtual AST_Structure *fe_add_structure (AST_Structure *s);
diff --git a/TAO/TAO_IDL/include/ast_expression.h b/TAO/TAO_IDL/include/ast_expression.h
index 5fd20584ab3..50863ab8427 100644
--- a/TAO/TAO_IDL/include/ast_expression.h
+++ b/TAO/TAO_IDL/include/ast_expression.h
@@ -68,6 +68,12 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#define _AST_EXPRESSION_AST_EXPRESSION_HH
#include "ace/CDR_Stream.h"
+#include "utl_scoped_name.h"
+
+class UTL_String;
+class UTL_Scope;
+class ast_visitor;
+class AST_Decl;
// Representation of expression values.
@@ -111,6 +117,7 @@ public:
, EK_longlong
, EK_ulonglong
, EK_octet
+ , EK_floating_point
};
// Enum to define expression type.
@@ -131,7 +138,18 @@ public:
, EV_bool // Expression value is boolean.
, EV_string // Expression value is char *.
, EV_wstring // Expression value is wide string.
- , EV_any // Expression value is any of above.
+ , EV_enum // Expression value is from an enum.
+
+ // CORBA::Any and CORBA::Object are constructed in the parser first as
+ // expression values, then looked up by name to get the
+ // AST_PredefinedType entry. This is so the grammar non-terminals
+ // integer_type, float_type, bool_type, etc. can also be expression
+ // values in order to serve double duty -- as productions of const_type
+ // and also (along with object_type) as productions of base_type_spec,
+ // as found in the OMG IDL grammar specification.
+ , EV_any // Used for CORBA::Any operation parameters
+ , EV_object // Used for CORBA::Object parameters
+
, EV_void // Expression value is void (absent).
, EV_none // Expression value is missing.
};
@@ -234,32 +252,41 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+ // Cleanup.
+ virtual void destroy (void);
+
// Other operations.
// Evaluation and value coercion.
- virtual AST_ExprValue *eval (EvalKind ek);
+ AST_ExprValue *eval (EvalKind ek);
- virtual AST_ExprValue *coerce (ExprType t);
+ AST_ExprValue *coerce (ExprType t);
+
+ // Top-level method, called only from yy_parse.
+ AST_ExprValue *check_and_coerce (ExprType t,
+ AST_Decl *d);
// Evaluate then store value inside this AST_Expression.
- virtual void evaluate (EvalKind ek);
+ void evaluate (EvalKind ek);
- // Compare to AST_Expressions.
+ // Compare two AST_Expressions.
- virtual long operator== (AST_Expression *vc);
+ long operator== (AST_Expression *vc);
- virtual long compare (AST_Expression *vc);
+ long compare (AST_Expression *vc);
protected:
// Evaluate different sets of operators.
- virtual AST_ExprValue *eval_bin_op (EvalKind ek);
+ AST_ExprValue *eval_bin_op (EvalKind ek);
+
+ AST_ExprValue *eval_bit_op (EvalKind ek);
- virtual AST_ExprValue *eval_bit_op (EvalKind ek);
+ AST_ExprValue *eval_un_op (EvalKind ek);
- virtual AST_ExprValue *eval_un_op (EvalKind ek);
+ AST_ExprValue *eval_symbol (EvalKind ek);
- virtual AST_ExprValue *eval_symbol (EvalKind ek);
+ idl_bool type_mismatch (ExprType et);
private:
// Data.
diff --git a/TAO/TAO_IDL/include/ast_extern.h b/TAO/TAO_IDL/include/ast_extern.h
index 493a12eaa0b..0aadf08dd5d 100644
--- a/TAO/TAO_IDL/include/ast_extern.h
+++ b/TAO/TAO_IDL/include/ast_extern.h
@@ -67,27 +67,21 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _AST_EXTERN_AST_EXTERN_HH
#define _AST_EXTERN_AST_EXTERN_HH
-// ast_extern.hh
-//
-// Declares all global functions for the AST
+#include "idl_bool.h"
-/*
-** DEPENDENCIES: none
-**
-** USE: Included from idl_extern.hh
-*/
+class AST_Type;
+class AST_Decl;
-// Functions:
+// Declares all global functions for the AST
// Two functions are provided for storing AST nodes representing fwd
-// declared interfaces, and for checking the stored nodes after parsing
-// the entire AST. The check ensures that for each fwd declared interface
-// the full definition was also seen.
-
-extern void AST_record_fwd_interface(AST_InterfaceFwd *i);
-extern void AST_check_fwd_interface();
+// declared structs and unions, and for checking the stored nodes after
+// parsing the entire AST. The check ensures that for each fwd declared
+// type the full definition was also seen.
-extern idl_bool AST_illegal_recursive_type(AST_Decl *t);
+extern void AST_record_fwd_decl (AST_Type *i);
+extern TAO_IDL_FE_Export void AST_check_fwd_decls (void);
+extern idl_bool AST_illegal_recursive_type (AST_Decl *t);
#endif // _AST_EXTERN_AST_EXTERN_HH
diff --git a/TAO/TAO_IDL/include/ast_factory.h b/TAO/TAO_IDL/include/ast_factory.h
index 8d2becad7df..c97400cd0df 100644
--- a/TAO/TAO_IDL/include/ast_factory.h
+++ b/TAO/TAO_IDL/include/ast_factory.h
@@ -69,9 +69,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// Representation of OBV factory construct declaration.
-#include "idl_fwd.h"
-#include "idl_narrow.h"
-#include "utl_list.h"
#include "ast_decl.h"
#include "utl_scope.h"
#include "utl_scoped_name.h"
@@ -107,7 +104,7 @@ public:
DEF_NARROW_FROM_SCOPE(AST_Factory);
// AST Dumping.
- virtual void dump (ostream &o);
+ virtual void dump (ACE_OSTREAM_TYPE &o);
// Cleanup function.
virtual void destroy (void);
diff --git a/TAO/TAO_IDL/include/ast_field.h b/TAO/TAO_IDL/include/ast_field.h
index 6c9beb7ac42..d100a89ff08 100644
--- a/TAO/TAO_IDL/include/ast_field.h
+++ b/TAO/TAO_IDL/include/ast_field.h
@@ -67,7 +67,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _AST_FIELD_AST_FIELD_HH
#define _AST_FIELD_AST_FIELD_HH
-// Representation of a generic field
+// Representation of a generic field.
// Used as member in structures, exceptions and unions, and as a base
// type for attributes and arguments to operations
@@ -76,10 +76,10 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// is used directly inside a structure, the second when it is used as
// the base type for attributes and operations.
-#include "idl_fwd.h"
-#include "idl_narrow.h"
#include "ast_decl.h"
+#include "utl_scoped_name.h"
+class AST_Type;
class TAO_IDL_FE_Export AST_Field : public virtual AST_Decl
{
diff --git a/TAO/TAO_IDL/include/ast_generator.h b/TAO/TAO_IDL/include/ast_generator.h
index c58cc827bdd..c8ed5e484ca 100644
--- a/TAO/TAO_IDL/include/ast_generator.h
+++ b/TAO/TAO_IDL/include/ast_generator.h
@@ -67,6 +67,21 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _AST_GENERATOR_AST_GENERATOR_HH
#define _AST_GENERATOR_AST_GENERATOR_HH
+#include "ast_operation.h"
+#include "ast_argument.h"
+#include "ast_predefined_type.h"
+#include "ast_union_label.h"
+
+class AST_Root;
+class UTL_LabelList;
+class UTL_ExprList;
+class AST_StructureFwd;
+class AST_UnionFwd;
+class AST_ValueTypeFwd;
+class AST_Component;
+class AST_ComponentFwd;
+class AST_Home;
+
// Defines base class for node generators.
class TAO_IDL_FE_Export AST_Generator
@@ -88,36 +103,87 @@ public:
virtual AST_Root *create_root (UTL_ScopedName *n);
// Create a node representing an interface.
- virtual AST_Interface *create_interface (UTL_ScopedName *n,
- AST_Interface **ih,
- long nih,
- AST_Interface **ih_flat,
- long nih_flat,
- idl_bool local,
- idl_bool abstract);
+ virtual AST_Interface *create_interface (
+ UTL_ScopedName *n,
+ AST_Interface **inherits,
+ long n_inherits,
+ AST_Interface **inherits_flat,
+ long n_inherits_flat,
+ idl_bool local,
+ idl_bool abstract
+ );
// Create a node representing a forward declaration of an interface.
- virtual AST_InterfaceFwd *create_interface_fwd (UTL_ScopedName *n,
- idl_bool local,
- idl_bool abstract);
+ virtual AST_InterfaceFwd *create_interface_fwd (
+ UTL_ScopedName *n,
+ idl_bool local,
+ idl_bool abstract
+ );
- // Create a node representing an valuetype.
- virtual AST_Interface *create_valuetype (UTL_ScopedName *n,
- AST_Interface **ih,
- long nih);
+ // Create a node representing a valuetype.
+ virtual AST_ValueType *create_valuetype (
+ UTL_ScopedName *n,
+ AST_Interface **inherits,
+ long n_inherits,
+ AST_ValueType *inherits_concrete,
+ AST_Interface **inherits_flat,
+ long n_inherits_flat,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface *supports_concrete,
+ idl_bool abstract,
+ idl_bool truncatable
+ );
+
+ // Create a node representing a forward declaration of a valuetype.
+ virtual AST_ValueTypeFwd *create_valuetype_fwd (
+ UTL_ScopedName *n,
+ idl_bool abstract
+ );
+
+ // Create a node representing a component.
+ virtual AST_Component *create_component (
+ UTL_ScopedName *n,
+ AST_Component *base_component,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface **supports_flat,
+ long n_supports_flat
+ );
+
+ // Create a node representing a forward declaration of a component.
+ virtual AST_ComponentFwd *create_component_fwd (
+ UTL_ScopedName *n
+ );
- // Create a node representing a forward declaration of an valuetype.
- virtual AST_InterfaceFwd *create_valuetype_fwd (UTL_ScopedName *n);
+ // Create a node representing a component home.
+ virtual AST_Home *create_home (
+ UTL_ScopedName *n,
+ AST_Home *base_home,
+ AST_Component *managed_component,
+ AST_ValueType *primary_key,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface **supports_flat,
+ long n_supports_flat
+ );
// Create a node representing an exception.
- virtual AST_Exception *create_exception (UTL_ScopedName *n,
- idl_bool local,
- idl_bool abstract);
+ virtual AST_Exception *create_exception (
+ UTL_ScopedName *n,
+ idl_bool local,
+ idl_bool abstract
+ );
// Create a node representing a structure.
- virtual AST_Structure *create_structure (UTL_ScopedName *n,
- idl_bool local,
- idl_bool abstract);
+ virtual AST_Structure *create_structure (
+ UTL_ScopedName *n,
+ idl_bool local,
+ idl_bool abstract
+ );
+
+ // Create a node representing a forward declaration of a structure.
+ virtual AST_StructureFwd *create_structure_fwd (UTL_ScopedName *n);
// Create a node representing an enum.
virtual AST_Enum *create_enum (UTL_ScopedName *n,
@@ -125,11 +191,13 @@ public:
idl_bool abstract);
// Create a node representing an operation on an interface.
- virtual AST_Operation *create_operation (AST_Type *rt,
- AST_Operation::Flags fl,
- UTL_ScopedName *n,
- idl_bool local,
- idl_bool abstract);
+ virtual AST_Operation *create_operation (
+ AST_Type *rt,
+ AST_Operation::Flags fl,
+ UTL_ScopedName *n,
+ idl_bool local,
+ idl_bool abstract
+ );
// Create a node representing a field in a structure, exception or
// union.
@@ -139,16 +207,20 @@ public:
AST_Field::vis_NA);
// Create a node representing an argument to an operation.
- virtual AST_Argument *create_argument (AST_Argument::Direction d,
- AST_Type *ft,
- UTL_ScopedName *n);
+ virtual AST_Argument *create_argument (
+ AST_Argument::Direction d,
+ AST_Type *ft,
+ UTL_ScopedName *n
+ );
// Create a node representing an attribute.
- virtual AST_Attribute *create_attribute (idl_bool ro,
- AST_Type *ft,
- UTL_ScopedName *n,
- idl_bool local,
- idl_bool abstract);
+ virtual AST_Attribute *create_attribute (
+ idl_bool ro,
+ AST_Type *ft,
+ UTL_ScopedName *n,
+ idl_bool local,
+ idl_bool abstract
+ );
// Create a node representing a union.
virtual AST_Union *create_union (AST_ConcreteType *dt,
@@ -156,19 +228,25 @@ public:
idl_bool local,
idl_bool abstract);
+ // Create a node representing a forward declaration of a union.
+ virtual AST_UnionFwd *create_union_fwd (UTL_ScopedName *n);
+
// Create a node representing one branch in a union.
- virtual AST_UnionBranch *create_union_branch (UTL_LabelList *ll,
- AST_Type *ft,
- UTL_ScopedName *n);
+ virtual AST_UnionBranch *create_union_branch (
+ UTL_LabelList *ll,
+ AST_Type *ft,
+ UTL_ScopedName *n
+ );
// Create a node representing a label on a union branch.
virtual AST_UnionLabel *create_union_label (AST_UnionLabel::UnionLabel ul,
AST_Expression *lv);
// Create a node representing a constant
- virtual AST_Constant *create_constant (AST_Expression::ExprType et,
- AST_Expression *ev,
- UTL_ScopedName *n);
+ virtual AST_Constant *create_constant (
+ AST_Expression::ExprType et,
+ AST_Expression *ev,
+ UTL_ScopedName *n);
// Create various kinds of nodes representing expressions.
@@ -212,6 +290,7 @@ public:
// Create a node representing a sequence type.
virtual AST_Sequence *create_sequence (AST_Expression *v,
AST_Type *bt,
+ UTL_ScopedName *n,
idl_bool local,
idl_bool abstract);
diff --git a/TAO/TAO_IDL/include/ast_home.h b/TAO/TAO_IDL/include/ast_home.h
new file mode 100644
index 00000000000..1b731f7c2e1
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_home.h
@@ -0,0 +1,64 @@
+// This may look like C, but it's really -*- C++ -*-
+// $Id$
+
+#ifndef _AST_HOME_AST_HOME_HH
+#define _AST_HOME_AST_HOME_HH
+
+#include "ast_interface.h"
+#include "ace/Unbounded_Queue.h"
+
+class AST_Home;
+class AST_Component;
+class AST_ValueType;
+
+class TAO_IDL_FE_Export AST_Home : public virtual AST_Interface
+{
+public:
+ AST_Home (void);
+
+ AST_Home (UTL_ScopedName *n,
+ AST_Home *base_home,
+ AST_Component *managed_component,
+ AST_ValueType *primary_key,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface **supports_flat,
+ long n_supports_flat);
+
+ virtual ~AST_Home (void);
+
+ // Accessors.
+
+ AST_Home *base_home (void) const;
+
+ AST_Component *managed_component (void) const;
+
+ AST_ValueType *primary_key (void) const;
+
+ ACE_Unbounded_Queue<AST_Operation *> &factories (void);
+
+ ACE_Unbounded_Queue<AST_Operation *> &finders (void);
+
+ // Cleanup function.
+ virtual void destroy (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_Home, AST_Interface);
+ DEF_NARROW_FROM_DECL(AST_Home);
+ DEF_NARROW_FROM_SCOPE(AST_Home);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+private:
+ AST_Home *pd_base_home;
+ AST_Component *pd_managed_component;
+ AST_ValueType *pd_primary_key;
+ ACE_Unbounded_Queue<AST_Operation *> pd_factories;
+ ACE_Unbounded_Queue<AST_Operation *> pd_finders;
+};
+
+#endif // _AST_HOME_AST_HOME_HH
diff --git a/TAO/TAO_IDL/include/ast_interface.h b/TAO/TAO_IDL/include/ast_interface.h
index a66c700762b..c1617345af1 100644
--- a/TAO/TAO_IDL/include/ast_interface.h
+++ b/TAO/TAO_IDL/include/ast_interface.h
@@ -71,18 +71,14 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// be defined manifest locally; the constants defined in these
// enums are inserted in the enclosing scope.
-#include "idl_fwd.h"
-#include "idl_narrow.h"
#include "ast_type.h"
#include "utl_scope.h"
-#include "ast_decl.h"
-
+#include "ace/Unbounded_Queue.h"
class TAO_IDL_FE_Export AST_Interface : public virtual AST_Type,
public virtual UTL_Scope
{
public:
- // Constructor(s).
AST_Interface (void);
AST_Interface (UTL_ScopedName *n,
@@ -95,27 +91,21 @@ public:
virtual ~AST_Interface (void);
- // Data Accessors.
+ // This serves for both interfaces, value types and components.
static void fwd_redefinition_helper (AST_Interface *&i,
UTL_Scope *s);
+ // This serves only for interfaces, but it is called
+ // from the corresponding AST_ValueType function().
virtual void redefine (AST_Interface *from);
- AST_Interface **inherits (void);
-
- void set_inherits (AST_Interface **i);
-
- long n_inherits (void);
-
- void set_n_inherits (long i);
-
- AST_Interface **inherits_flat (void);
+ AST_Interface **inherits (void) const;
- void set_inherits_flat (AST_Interface **i);
+ long n_inherits (void) const;
- long n_inherits_flat (void);
+ AST_Interface **inherits_flat (void) const;
- void set_n_inherits_flat (long i);
+ long n_inherits_flat (void) const;
void be_add_operation (AST_Operation *);
@@ -125,23 +115,14 @@ public:
// Is this interface defined? This predicate returns FALSE when an
// interface was forward declared but not defined yet, and TRUE in
// all other cases.
- virtual idl_bool is_defined (void)
+ idl_bool is_defined (void)
{
return (pd_n_inherits < 0) ? I_FALSE : I_TRUE;
}
- idl_bool is_valuetype (void);
-
- void set_valuetype (void);
-
- idl_bool is_abstract_valuetype (void);
-
- void set_abstract_valuetype (void);
-
- // Check if any member's name clashes with a parent's
- // member's name, or if any parents' members' names
- // clash with each other.
- void inherited_name_clash (void);
+ // Check if we have redefined any of our parents' operations or attributes,
+ // and check if there is such a clash among the parents
+ virtual idl_bool redef_clash (void);
// Cleanup function.
virtual void destroy (void);
@@ -158,15 +139,6 @@ public:
virtual int ast_accept (ast_visitor *visitor);
protected:
-
- idl_bool is_valuetype_;
- //
-
-private:
- // Helper function for fwd_redefinition_helper.
- static idl_bool compare_names (AST_Interface *that,
- AST_Interface *other);
-
// Data.
// Immediate ancestors.
@@ -177,6 +149,22 @@ private:
AST_Interface **pd_inherits_flat;
long pd_n_inherits_flat;
+ // Queue data structure needed for breadth-first traversal of
+ // inheritance tree.
+ ACE_Unbounded_Queue<AST_Interface *> insert_queue;
+
+ // For a special case of a deeply nested inheritance graph and one specific
+ // way of inheritance in which a node that was already visited,
+ // but is not present in
+ // the queue, gets inserted at the tail. This situation arises when a node
+ // multiply inherits from two or more interfaces in which the first parent is
+ // higher up in the tree than the second parent. In addition, if the second
+ // parent turns out to be a child of the first .
+
+ // Queue of dequeued nodes to be searched for the above case.
+ ACE_Unbounded_Queue<AST_Interface *> del_queue;
+
+protected:
// Scope Management Protocol.
friend int tao_yyparse (void);
@@ -184,16 +172,20 @@ private:
virtual AST_Exception *fe_add_exception (AST_Exception *e);
- virtual AST_Attribute *fe_add_attribute(AST_Attribute *a);
+ virtual AST_Attribute *fe_add_attribute (AST_Attribute *a);
virtual AST_Field *fe_add_field (AST_Field *o);
- virtual AST_Operation *fe_add_operation(AST_Operation *o);
+ virtual AST_Operation *fe_add_operation (AST_Operation *o);
virtual AST_Union *fe_add_union (AST_Union *u);
virtual AST_Structure *fe_add_structure (AST_Structure *s);
+ virtual AST_UnionFwd *fe_add_union_fwd (AST_UnionFwd *u);
+
+ virtual AST_StructureFwd *fe_add_structure_fwd (AST_StructureFwd *s);
+
virtual AST_Enum *fe_add_enum (AST_Enum *e);
virtual AST_EnumVal *fe_add_enum_val (AST_EnumVal *v);
@@ -202,7 +194,19 @@ private:
virtual AST_Native *fe_add_native (AST_Native *n);
- virtual AST_Factory *fe_add_factory (AST_Factory *f);
+ // Lookup based on the local name, override of UTL_Scope definition.
+ // This version checks for redefinitions of attributes or operations.
+ AST_Decl *lookup_for_add (AST_Decl *d,
+ idl_bool treat_as_ref);
+
+ void redef_clash_populate_r (AST_Interface *t);
+ // Populate the insert queue with our parents, and, if we are a
+ // valuetype, with our supported interface and our parents'
+ // supported interfaces.
+
+ int insert_non_dup (AST_Interface *t);
+ // Do non-duplicating insert of bi, by searching both the
+ // insert queue and the delete queue.
};
#endif // _AST_INTERFACE_AST_INTERFACE_HH
diff --git a/TAO/TAO_IDL/include/ast_interface_fwd.h b/TAO/TAO_IDL/include/ast_interface_fwd.h
index 621e3a6988b..dd7db4a8060 100644
--- a/TAO/TAO_IDL/include/ast_interface_fwd.h
+++ b/TAO/TAO_IDL/include/ast_interface_fwd.h
@@ -67,23 +67,22 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _AST_INTERFACE_FWD_AST_INTERFACE_FWD_HH
#define _AST_INTERFACE_FWD_AST_INTERFACE_FWD_HH
+#include "ast_type.h"
+
+class AST_Interface;
+
// Representation of a forward interface declaration.
class TAO_IDL_FE_Export AST_InterfaceFwd : public virtual AST_Type
{
public:
- // Operations.
-
- // Constructor(s).
AST_InterfaceFwd (void);
AST_InterfaceFwd (AST_Interface *dummy,
UTL_ScopedName *n);
- // Destructor.
virtual ~AST_InterfaceFwd (void);
- // Data Accessors.
AST_Interface *full_definition (void);
void set_full_definition (AST_Interface *nfd);
@@ -92,7 +91,9 @@ public:
virtual idl_bool is_local (void);
virtual idl_bool is_valuetype (void);
virtual idl_bool is_abstract_valuetype (void);
- virtual void set_abstract_valuetype (void);
+
+ // Cleanup function.
+ virtual void destroy (void);
// Narrowing.
DEF_NARROW_METHODS1(AST_InterfaceFwd, AST_Type);
@@ -105,10 +106,8 @@ public:
virtual int ast_accept (ast_visitor *visitor);
private:
- // Data.
-
AST_Interface *pd_full_definition;
- // The interface this is a forward declaration of
+ // The interface this is a forward declaration of.
};
#endif // _AST_INTERFACE_FWD_AST_INTERFACE_FWD_HH
diff --git a/TAO/TAO_IDL/include/ast_module.h b/TAO/TAO_IDL/include/ast_module.h
index 6df56041b42..1b5cf150164 100644
--- a/TAO/TAO_IDL/include/ast_module.h
+++ b/TAO/TAO_IDL/include/ast_module.h
@@ -67,6 +67,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _AST_MODULE_AST_MODULE_HH
#define _AST_MODULE_AST_MODULE_HH
+#include "ast_decl.h"
+#include "utl_scope.h"
+
// Representation of module.
//
// NOTE: add(AST_EnumValue *) is defined here because enums can
@@ -133,18 +136,32 @@ private:
virtual AST_Module *fe_add_module (AST_Module *m);
- virtual AST_Interface *fe_add_interface (AST_Interface *i);
+ virtual AST_Interface *fe_add_interface (AST_Interface *i);
virtual AST_InterfaceFwd *fe_add_interface_fwd (AST_InterfaceFwd *i);
+ virtual AST_ValueType *fe_add_valuetype (AST_ValueType *i);
+
+ virtual AST_ValueTypeFwd *fe_add_valuetype_fwd (AST_ValueTypeFwd *i);
+
+ virtual AST_Component *fe_add_component (AST_Component *i);
+
+ virtual AST_ComponentFwd *fe_add_component_fwd (AST_ComponentFwd *i);
+
+ virtual AST_Home *fe_add_home (AST_Home *i);
+
virtual AST_Constant *fe_add_constant (AST_Constant *c);
virtual AST_Exception *fe_add_exception (AST_Exception *e);
virtual AST_Union *fe_add_union (AST_Union *u);
+ virtual AST_UnionFwd *fe_add_union_fwd (AST_UnionFwd *u);
+
virtual AST_Structure *fe_add_structure (AST_Structure *s);
+ virtual AST_StructureFwd *fe_add_structure_fwd (AST_StructureFwd *s);
+
virtual AST_Enum *fe_add_enum (AST_Enum *e);
virtual AST_EnumVal *fe_add_enum_val (AST_EnumVal *v);
diff --git a/TAO/TAO_IDL/include/ast_native.h b/TAO/TAO_IDL/include/ast_native.h
index 7627faf4354..164d2ff4085 100644
--- a/TAO/TAO_IDL/include/ast_native.h
+++ b/TAO/TAO_IDL/include/ast_native.h
@@ -4,6 +4,8 @@
#ifndef _AST_NATIVE_H_
#define _AST_NATIVE_H_
+#include "ast_type.h"
+
// Representation of "native" IDL type added by the POA spec.
class TAO_IDL_FE_Export AST_Native : public virtual AST_Type
diff --git a/TAO/TAO_IDL/include/ast_operation.h b/TAO/TAO_IDL/include/ast_operation.h
index 80708f8c031..1e14ee1071e 100644
--- a/TAO/TAO_IDL/include/ast_operation.h
+++ b/TAO/TAO_IDL/include/ast_operation.h
@@ -67,14 +67,10 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _AST_OPERATION_AST_OPERATION_HH
#define _AST_OPERATION_AST_OPERATION_HH
-// Representation of operation declaration.
-
-#include "idl_fwd.h"
-#include "idl_narrow.h"
-#include "utl_list.h"
#include "ast_decl.h"
#include "utl_scope.h"
-#include "utl_scoped_name.h"
+
+class UTL_ExceptList;
class TAO_IDL_FE_Export AST_Operation : public virtual AST_Decl,
public virtual UTL_Scope
@@ -112,6 +108,9 @@ public:
// Public operations.
+ int void_return_type (void);
+ /// Returns 1 if the operation has a void return type.
+
/// Return the number of arguments
virtual int argument_count (void);
@@ -143,6 +142,9 @@ public:
// Method to add exceptions
UTL_ExceptList *be_add_exceptions (UTL_ExceptList *t);
+ AST_Argument *be_add_argument (AST_Argument *arg);
+ // Add an argument to the scope.
+
// Cleanup function.
virtual void destroy (void);
diff --git a/TAO/TAO_IDL/include/ast_predefined_type.h b/TAO/TAO_IDL/include/ast_predefined_type.h
index 912f0240ac9..72b604b69f2 100644
--- a/TAO/TAO_IDL/include/ast_predefined_type.h
+++ b/TAO/TAO_IDL/include/ast_predefined_type.h
@@ -67,10 +67,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _AST_PREDEFINED_TYPE_AST_PREDEFINED_TYPE_HH
#define _AST_PREDEFINED_TYPE_AST_PREDEFINED_TYPE_HH
-// Representation of predefined types:
-//
-// Instances of this class are inserted into the global context by
-// the front end before the start of parsing.
+#include "ast_concrete_type.h"
+
+class ast_visitor;
class TAO_IDL_FE_Export AST_PredefinedType : public virtual AST_ConcreteType
{
@@ -91,7 +90,8 @@ public:
, PT_wchar // Predefined type "CORBA::WChar"
, PT_boolean // Predefined type "boolean"
, PT_octet // Predefined type "octet"
- , PT_any // Predefined type "any"
+ , PT_any // Predefined type "CORBA::Any"
+ , PT_object // Predefined type "CORBA::Object"
, PT_void // Predefined type "void"
, PT_pseudo // Predefined type for pseudo objects
};
@@ -119,6 +119,13 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+ // Cleanup.
+ virtual void destroy (void);
+
+protected:
+ virtual int compute_size_type (void);
+ // Compute the size type if it is unknown.
+
private:
// Data.
diff --git a/TAO/TAO_IDL/include/ast_root.h b/TAO/TAO_IDL/include/ast_root.h
index f4f92ae9323..f8bbacdfa57 100644
--- a/TAO/TAO_IDL/include/ast_root.h
+++ b/TAO/TAO_IDL/include/ast_root.h
@@ -67,14 +67,13 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _AST_ROOT_AST_ROOT_HH
#define _AST_ROOT_AST_ROOT_HH
+#include "ast_module.h"
+
// Representation of root of AST.
class TAO_IDL_FE_Export AST_Root : public virtual AST_Module
{
public:
- // Operations.
-
- // Constructor(s) and destructor.
AST_Root (void);
AST_Root (UTL_ScopedName *n);
@@ -92,6 +91,9 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+ // Cleanup.
+ virtual void destroy ();
+
private:
friend class FE_Declarator;
friend int tao_yyparse (void);
diff --git a/TAO/TAO_IDL/include/ast_sequence.h b/TAO/TAO_IDL/include/ast_sequence.h
index 148a6e87a01..855dd739896 100644
--- a/TAO/TAO_IDL/include/ast_sequence.h
+++ b/TAO/TAO_IDL/include/ast_sequence.h
@@ -67,20 +67,22 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _AST_SEQUENCE_AST_SEQUENCE_HH
#define _AST_SEQUENCE_AST_SEQUENCE_HH
-// Representation of sequence declaration:
-//
+#include "ast_concrete_type.h"
+#include "idl_bool.h"
+
+class AST_Expression;
+class AST_Type;
+
// A sequence is a combination of a maximum size and a base type.
class TAO_IDL_FE_Export AST_Sequence : public virtual AST_ConcreteType
{
public:
- // Operations.
-
- // Constructor(s).
AST_Sequence (void);
AST_Sequence (AST_Expression *max_size,
AST_Type *bt,
+ UTL_ScopedName *n,
idl_bool local,
idl_bool abstract);
diff --git a/TAO/TAO_IDL/include/ast_string.h b/TAO/TAO_IDL/include/ast_string.h
index 634c5648eb4..db5a89f1123 100644
--- a/TAO/TAO_IDL/include/ast_string.h
+++ b/TAO/TAO_IDL/include/ast_string.h
@@ -67,6 +67,11 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _AST_STRING_AST_STRING_HH
#define _AST_STRING_AST_STRING_HH
+#include "ast_concrete_type.h"
+#include "utl_scoped_name.h"
+
+class AST_Expression;
+
// Representation of string declaration.
// A string type is represented by a maximum size.
@@ -78,10 +83,10 @@ public:
// Constructor(s) and destructor
AST_String (void);
- AST_String (AST_Expression *max_size);
-
- AST_String (AST_Expression *max_size,
- long wide);
+ AST_String (AST_Decl::NodeType nt,
+ UTL_ScopedName *n,
+ AST_Expression *max_size,
+ long wide = 1);
virtual ~AST_String (void);
@@ -99,6 +104,9 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+ // Cleanup.
+ virtual void destroy (void);
+
private:
// Data.
diff --git a/TAO/TAO_IDL/include/ast_structure.h b/TAO/TAO_IDL/include/ast_structure.h
index 1e87b078a5c..3f37b011656 100644
--- a/TAO/TAO_IDL/include/ast_structure.h
+++ b/TAO/TAO_IDL/include/ast_structure.h
@@ -67,8 +67,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _AST_STRUCTURE_AST_STRUCTURE_HH
#define _AST_STRUCTURE_AST_STRUCTURE_HH
-#include "ace/Unbounded_Queue.h"
-
// Representation of structure:
//
// NOTE: add (AST_ConcreteType *) is defined here because a structure
@@ -79,13 +77,14 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// enums are inserted in the enclosing scope. It is unlikely that
// a BE writer will need to overload this function in AST_Structure.
+#include "ast_concrete_type.h"
+#include "utl_scope.h"
+#include "ace/Unbounded_Queue.h"
+
class TAO_IDL_FE_Export AST_Structure : public virtual AST_ConcreteType,
public virtual UTL_Scope
{
public:
- // Operations.
-
- // Constructor(s).
AST_Structure (void);
AST_Structure (UTL_ScopedName *n,
@@ -97,7 +96,6 @@ public:
idl_bool local,
idl_bool abstract);
- // Destructor.
virtual ~AST_Structure (void);
// Narrowing.
@@ -130,6 +128,11 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+
+protected:
+ virtual int compute_size_type (void);
+ // Compute the size type if it is unknown.
+
protected:
ACE_Unbounded_Queue<AST_Field *> fields_;
// Container for this struct's field nodes. Excludes nodes included
diff --git a/TAO/TAO_IDL/include/ast_structure_fwd.h b/TAO/TAO_IDL/include/ast_structure_fwd.h
new file mode 100644
index 00000000000..770642c0b81
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_structure_fwd.h
@@ -0,0 +1,45 @@
+// This may look like C, but it's really -*- C++ -*-
+// $Id$
+
+#ifndef _AST_STRUCTURE_FWD_AST_STRUCTURE_FWD_HH
+#define _AST_STRUCTURE_FWD_AST_STRUCTURE_FWD_HH
+
+#include "ast_type.h"
+
+class AST_Structure;
+
+// Representation of a forward structure declaration.
+
+class TAO_IDL_FE_Export AST_StructureFwd : public virtual AST_Type
+{
+public:
+ AST_StructureFwd (void);
+
+ AST_StructureFwd (UTL_ScopedName *n);
+
+ virtual ~AST_StructureFwd (void);
+
+ AST_Structure *full_definition (void);
+ void set_full_definition (AST_Structure *nfd);
+
+ virtual idl_bool is_defined (void);
+
+ // Cleanup function.
+ virtual void destroy (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_StructureFwd, AST_Type);
+ DEF_NARROW_FROM_DECL(AST_StructureFwd);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+private:
+ AST_Structure *pd_full_definition;
+ // The structure this is a forward declaration of.
+};
+
+#endif // _AST_STRUCTURE_FWD_AST_STRUCTURE_FWD_HH
diff --git a/TAO/TAO_IDL/include/ast_type.h b/TAO/TAO_IDL/include/ast_type.h
index 66e2d1f72ba..28c4b9c20d4 100644
--- a/TAO/TAO_IDL/include/ast_type.h
+++ b/TAO/TAO_IDL/include/ast_type.h
@@ -67,28 +67,32 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _AST_TYPE_AST_TYPE_HH
#define _AST_TYPE_AST_TYPE_HH
+#include "ast_decl.h"
+
// Class for all IDL types
//
// This is useful wherever any IDL type defining construct can appear
// such as the base type for a typedef or array.
-#include "idl_fwd.h"
-#include "idl_narrow.h"
-#include "ast_decl.h"
-
-
class TAO_IDL_FE_Export AST_Type : public virtual AST_Decl
{
public:
+ enum SIZE_TYPE
+ {
+ SIZE_UNKNOWN,
+ FIXED,
+ VARIABLE
+ };
+ // Indicates if we are fixed size or variable. Most useful for structs,
+ // unions, and arrays.
+
// Operations.
- // Constructor(s).
AST_Type (void);
AST_Type (AST_Decl::NodeType nt,
UTL_ScopedName *n);
- // Destructor.
virtual ~AST_Type (void);
virtual idl_bool in_recursion (AST_Type *node = 0);
@@ -100,14 +104,31 @@ public:
// the corresponding forward declaration classes.
virtual idl_bool is_defined (void);
+ virtual void size_type (SIZE_TYPE);
+ // Set the size type.
+
+ virtual SIZE_TYPE size_type (void);
+ // Return our size type.
+
// Accessors/mutators for the private members.
+ idl_bool has_constructor (void);
+ // Accessor for protected member.
+
+ void has_constructor (idl_bool value);
+ // Mutator for protected member.
+
idl_bool ifr_added (void);
void ifr_added (idl_bool val);
idl_bool ifr_fwd_added (void);
void ifr_fwd_added (idl_bool val);
+ const char *nested_type_name (AST_Decl *d,
+ const char *suffix = 0,
+ const char *prefix = 0);
+ // Type name of a node used when generating declarations.
+
// Narrowing.
DEF_NARROW_METHODS1(AST_Type, AST_Decl);
DEF_NARROW_FROM_DECL(AST_Type);
@@ -115,13 +136,36 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+ // Cleanup.
+ virtual void destroy (void);
+
protected:
+ virtual int compute_size_type (void);
+ // Determine our size type and set it if it is unknown.
+
+ const char *nested_name (const char *local_name,
+ const char *full_name,
+ AST_Decl *use_scope,
+ const char *suffix,
+ const char *prefix);
+ // Type name of a node used when generating declarations.
+
// Has the full definition been added to the Interface Repository?
// Used for types which can have members and can be forward declared.
idl_bool ifr_added_;
// Has this node been forward declared in this IDL file?
idl_bool ifr_fwd_added_;
+
+ SIZE_TYPE size_type_;
+ // Whether we are fixed or variable size (by default fixed).
+
+ idl_bool has_constructor_;
+ // Attribute that helps a union determine whether a member
+ // should be included by value or by reference.
+
+ char *nested_type_name_;
+ // For the corresponding method.
};
#endif // _AST_TYPE_AST_TYPE_HH
diff --git a/TAO/TAO_IDL/include/ast_typedef.h b/TAO/TAO_IDL/include/ast_typedef.h
index 428aa7bf994..e31c3b1b696 100644
--- a/TAO/TAO_IDL/include/ast_typedef.h
+++ b/TAO/TAO_IDL/include/ast_typedef.h
@@ -67,6 +67,8 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _AST_TYPEDEF_AST_TYPEDEF_HH
#define _AST_TYPEDEF_AST_TYPEDEF_HH
+#include "ast_type.h"
+
// Representation of typedef declaration.
// A typedef declaration is a renaming of a base type.
@@ -102,6 +104,13 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+ // Cleanup.
+ virtual void destroy (void);
+
+protected:
+ virtual int compute_size_type (void);
+ // Compute the size type if it is unknown.
+
private:
// Data.
diff --git a/TAO/TAO_IDL/include/ast_union.h b/TAO/TAO_IDL/include/ast_union.h
index 1f3ba7da1c0..1da84ff230b 100644
--- a/TAO/TAO_IDL/include/ast_union.h
+++ b/TAO/TAO_IDL/include/ast_union.h
@@ -67,8 +67,8 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _AST_UNION_AST_UNION_HH
#define _AST_UNION_AST_UNION_HH
-// Representation of union declaration:
-//
+#include "ast_structure.h"
+
// NOTE: add (AST_ConcreteType *) is defined here because a union
// can contain locally defined types in addition to fields.
//
@@ -140,6 +140,10 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+protected:
+ virtual int compute_size_type (void);
+ // Compute the size type if it is unknown.
+
private:
// Data.
@@ -148,7 +152,7 @@ private:
AST_Expression::ExprType pd_udisc_type;
// Its expression type.
- // Convention: udisc_type == EV_any denotes an enum value.
+ // Convention: udisc_type == EV_enum denotes an enum value.
// Operations.
diff --git a/TAO/TAO_IDL/include/ast_union_branch.h b/TAO/TAO_IDL/include/ast_union_branch.h
index 0ced0e3236e..191d3b4003e 100644
--- a/TAO/TAO_IDL/include/ast_union_branch.h
+++ b/TAO/TAO_IDL/include/ast_union_branch.h
@@ -67,6 +67,13 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _AST_UNION_BRANCH_AST_UNION_BRAN_HH
#define _AST_UNION_BRANCH_AST_UNION_BRAN_HH
+#include "ast_field.h"
+#include "utl_scoped_name.h"
+
+class UTL_LabelList;
+class AST_Type;
+class AST_UnionLabel;
+
// Representation of union branch declaration.
// A branch of a union is a field with a label.
diff --git a/TAO/TAO_IDL/include/ast_union_fwd.h b/TAO/TAO_IDL/include/ast_union_fwd.h
new file mode 100644
index 00000000000..96115d06b32
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_union_fwd.h
@@ -0,0 +1,45 @@
+// This may look like C, but it's really -*- C++ -*-
+// $Id$
+
+#ifndef _AST_UNION_FWD_AST_UNION_FWD_HH
+#define _AST_UNION_FWD_AST_UNION_FWD_HH
+
+#include "ast_type.h"
+
+class AST_Union;
+
+// Representation of a forward union declaration.
+
+class TAO_IDL_FE_Export AST_UnionFwd : public virtual AST_Type
+{
+public:
+ AST_UnionFwd (void);
+
+ AST_UnionFwd (UTL_ScopedName *n);
+
+ virtual ~AST_UnionFwd (void);
+
+ AST_Union *full_definition (void);
+ void set_full_definition (AST_Union *nfd);
+
+ virtual idl_bool is_defined (void);
+
+ // Cleanup function.
+ virtual void destroy (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_UnionFwd, AST_Type);
+ DEF_NARROW_FROM_DECL(AST_UnionFwd);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+private:
+ AST_Union *pd_full_definition;
+ // The union this is a forward declaration of.
+};
+
+#endif // _AST_UNION_FWD_AST_UNION_FWD_HH
diff --git a/TAO/TAO_IDL/include/ast_union_label.h b/TAO/TAO_IDL/include/ast_union_label.h
index 5f0182221af..f173ee5b459 100644
--- a/TAO/TAO_IDL/include/ast_union_label.h
+++ b/TAO/TAO_IDL/include/ast_union_label.h
@@ -67,6 +67,12 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _AST_UNION_LABEL_AST_UNION_LABEL_HH
#define _AST_UNION_LABEL_AST_UNION_LABEL_HH
+#include "TAO_IDL_FE_Export.h"
+#include "ace/OS.h"
+
+class AST_Expression;
+class ast_visitor;
+
// Defines labels for unions.
class TAO_IDL_FE_Export AST_UnionLabel
@@ -75,13 +81,10 @@ public:
// Define kind of label.
enum UnionLabel
{
- UL_default // Label is "default".
- , UL_label // Regular label.
+ UL_default
+ , UL_label
};
- // Operations.
-
- // Constructor(s) and destructor.
AST_UnionLabel (void);
AST_UnionLabel (UnionLabel lk,
@@ -89,7 +92,6 @@ public:
virtual ~AST_UnionLabel (void);
- // Data Accessors.
UnionLabel label_kind (void);
AST_Expression *label_val (void);
diff --git a/TAO/TAO_IDL/include/ast_valuetype.h b/TAO/TAO_IDL/include/ast_valuetype.h
new file mode 100644
index 00000000000..7c7d15e26bf
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_valuetype.h
@@ -0,0 +1,66 @@
+// This may look like C, but it's really -*- C++ -*-
+// $Id$
+
+#ifndef _AST_INTERFACE_AST_VALUETYPE_HH
+#define _AST_INTERFACE_AST_VALUETYPE_HH
+
+#include "ast_interface.h"
+
+class TAO_IDL_FE_Export AST_ValueType : public virtual AST_Interface
+{
+public:
+ AST_ValueType (void);
+
+ AST_ValueType (UTL_ScopedName *n,
+ AST_Interface **inherits,
+ long n_inherits,
+ AST_ValueType *inherits_concrete,
+ AST_Interface **inherits_flat,
+ long n_inherits_flat,
+ AST_Interface **supports,
+ long n_supports,
+ AST_Interface *supports_concrete,
+ idl_bool abstract,
+ idl_bool truncatable);
+
+ virtual ~AST_ValueType (void);
+
+ // This also calls the base class version.
+ virtual void redefine (AST_Interface *from);
+
+ AST_Interface **supports (void) const;
+
+ long n_supports (void) const;
+
+ AST_ValueType *inherits_concrete (void) const;
+
+ AST_Interface *supports_concrete (void) const;
+
+ idl_bool truncatable (void) const;
+
+ // Cleanup function.
+ virtual void destroy (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_ValueType, AST_Interface);
+ DEF_NARROW_FROM_DECL(AST_ValueType);
+ DEF_NARROW_FROM_SCOPE(AST_ValueType);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+protected:
+ AST_Interface **pd_supports;
+ long pd_n_supports;
+ AST_ValueType *pd_inherits_concrete;
+ AST_Interface *pd_supports_concrete;
+
+ idl_bool pd_truncatable;
+
+ virtual AST_Factory *fe_add_factory (AST_Factory *f);
+};
+
+#endif // _AST_INTERFACE_AST_VALUETYPE_HH
diff --git a/TAO/TAO_IDL/include/ast_valuetype_fwd.h b/TAO/TAO_IDL/include/ast_valuetype_fwd.h
new file mode 100644
index 00000000000..3f9affdf93f
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_valuetype_fwd.h
@@ -0,0 +1,35 @@
+// This may look like C, but it's really -*- C++ -*-
+// $Id$
+
+#ifndef _AST_INTERFACE_FWD_AST_VALUETYPE_FWD_HH
+#define _AST_INTERFACE_FWD_AST_VALUETYPE_FWD_HH
+
+#include "ast_interface_fwd.h"
+
+// Representation of a forward valuetype declaration.
+
+class TAO_IDL_FE_Export AST_ValueTypeFwd : public virtual AST_InterfaceFwd
+{
+public:
+ AST_ValueTypeFwd (void);
+
+ AST_ValueTypeFwd (AST_Interface *dummy,
+ UTL_ScopedName *n);
+
+ virtual ~AST_ValueTypeFwd (void);
+
+ // Cleanup function.
+ virtual void destroy (void);
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_ValueTypeFwd, AST_InterfaceFwd);
+ DEF_NARROW_FROM_DECL(AST_ValueTypeFwd);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+};
+
+#endif // _AST_INTERFACE_FWD_AST_VALUETYPE_FWD_HH
diff --git a/TAO/TAO_IDL/include/ast_visitor.h b/TAO/TAO_IDL/include/ast_visitor.h
index 64d24d9582b..2859b9a33e3 100644
--- a/TAO/TAO_IDL/include/ast_visitor.h
+++ b/TAO/TAO_IDL/include/ast_visitor.h
@@ -29,13 +29,14 @@ class AST_PredefinedType;
class AST_Module;
class AST_Interface;
class AST_InterfaceFwd;
-
-// These classes don't exist now, but they may someday.
-// class AST_Valuetype;
-// class AST_ValuetypeFwd;
+class AST_ValueType;
+class AST_ValueTypeFwd;
+class AST_Component;
+class AST_ComponentFwd;
+class AST_Home;
class AST_Factory;
-
class AST_Structure;
+class AST_StructureFwd;
class AST_Exception;
class AST_Expression;
class AST_Enum;
@@ -44,6 +45,7 @@ class AST_Field;
class AST_Argument;
class AST_Attribute;
class AST_Union;
+class AST_UnionFwd;
class AST_UnionBranch;
class AST_UnionLabel;
class AST_Constant;
@@ -97,10 +99,19 @@ public:
virtual int visit_interface_fwd (AST_InterfaceFwd *node) = 0;
// Visit interface_fwd
- virtual int visit_valuetype (AST_Interface *node) = 0;
+ virtual int visit_valuetype (AST_ValueType *node) = 0;
+ // Visit valuetype.
+
+ virtual int visit_valuetype_fwd (AST_ValueTypeFwd *node) = 0;
+ // Visit valuetype_fwd
+
+ virtual int visit_component (AST_Component *node) = 0;
// Visit valuetype.
- virtual int visit_valuetype_fwd (AST_InterfaceFwd *node) = 0;
+ virtual int visit_home (AST_Home *node) = 0;
+ // Visit valuetype.
+
+ virtual int visit_component_fwd (AST_ComponentFwd *node) = 0;
// Visit valuetype_fwd
virtual int visit_factory (AST_Factory *node) = 0;
@@ -109,6 +120,9 @@ public:
virtual int visit_structure (AST_Structure *node) = 0;
// Visit a structure.
+ virtual int visit_structure_fwd (AST_StructureFwd *node) = 0;
+ // Visit a structure.
+
virtual int visit_exception (AST_Exception *node) = 0;
// Visit exception
@@ -133,6 +147,9 @@ public:
virtual int visit_union (AST_Union *node) = 0;
// Visit union.
+ virtual int visit_union_fwd (AST_UnionFwd *node) = 0;
+ // Visit union.
+
virtual int visit_union_branch (AST_UnionBranch *node) = 0;
// Visit union branch.
diff --git a/TAO/TAO_IDL/include/drv_extern.h b/TAO/TAO_IDL/include/drv_extern.h
index 3097f4ad8b4..7de6ded7ae0 100644
--- a/TAO/TAO_IDL/include/drv_extern.h
+++ b/TAO/TAO_IDL/include/drv_extern.h
@@ -67,22 +67,15 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _DRV_EXTERN_DRV_EXTERN_HH
#define _DRV_EXTERN_DRV_EXTERN_HH
-// External functions for the IDL compiler driver program
+// The ACE_Process_Options default size of 1024 is sometimes not enough.
+const unsigned long TAO_IDL_COMMAND_LINE_BUFFER_SIZE = 4 * 1024;
-// Functions
-
-extern void DRV_init (void);
+// External functions for the IDL compiler driver program.
extern void DRV_parse_args (long, char **);
extern void DRV_usage (void);
-
extern void DRV_pre_proc (const char *myfile);
-
extern void DRV_cpp_init (void);
extern void DRV_cpp_putarg (const char *str);
extern void DRV_cpp_new_location (const char *new_loc);
-extern void DRV_fork (void);
-extern int DRV_check_gperf (void);
-extern void DRV_check_for_include (const char* buf);
-
#endif // _DRV_EXTERN_DRV_EXTERN_HH
diff --git a/TAO/TAO_IDL/include/drv_private.h b/TAO/TAO_IDL/include/drv_private.h
deleted file mode 100644
index ab89a4e7862..00000000000
--- a/TAO/TAO_IDL/include/drv_private.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// $Id$
-
-/*
-
-COPYRIGHT
-
-Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
-States of America. All Rights Reserved.
-
-This product is protected by copyright and distributed under the following
-license restricting its use.
-
-The Interface Definition Language Compiler Front End (CFE) is made
-available for your use provided that you include this license and copyright
-notice on all media and documentation and the software program in which
-this product is incorporated in whole or part. You may copy and extend
-functionality (but may not remove functionality) of the Interface
-Definition Language CFE without charge, but you are not authorized to
-license or distribute it to anyone else except as part of a product or
-program developed by you or with the express written consent of Sun
-Microsystems, Inc. ("Sun").
-
-The names of Sun Microsystems, Inc. and any of its subsidiaries or
-affiliates may not be used in advertising or publicity pertaining to
-distribution of Interface Definition Language CFE as permitted herein.
-
-This license is effective until terminated by Sun for failure to comply
-with this license. Upon termination, you shall destroy or return all code
-and documentation for the Interface Definition Language CFE.
-
-INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
-ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
-FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
-DEALING, USAGE OR TRADE PRACTICE.
-
-INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
-ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
-TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
-
-SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
-RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
-INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
-
-IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
-ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
-DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-Use, duplication, or disclosure by the government is subject to
-restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
-Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
-52.227-19.
-
-Sun, Sun Microsystems and the Sun logo are trademarks or registered
-trademarks of Sun Microsystems, Inc.
-
-SunSoft, Inc.
-2550 Garcia Avenue
-Mountain View, California 94043
-
-NOTE:
-
-SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
-trademarks or registered trademarks of Sun Microsystems, Inc.
-
-*/
-
-#ifndef _DRV_PRIVATE_DRV_PRIVATE_HH
-#define _DRV_PRIVATE_DRV_PRIVATE_HH
-
-// Define data and functions which are private to
-// the DRV but which must be accessible throughout the DRV
-
-// Data
-
-// The ACE_Process_Options default size of 1024 is sometimes not enough.
-const unsigned long TAO_IDL_COMMAND_LINE_BUFFER_SIZE = 4 * 1024;
-
-extern const char *DRV_files[];
-// All files to be processed
-
-extern long DRV_nfiles;
-// How many are there?
-
-extern long DRV_file_index;
-// What's the file I am responsible for?
-
-// Functions
-
-extern void DRV_drive (const char *);
-// Compiler driver for single file
-
-#endif // _DRV_PRIVATE_DRV_PRIVATE_HH
diff --git a/TAO/TAO_IDL/include/fe_declarator.h b/TAO/TAO_IDL/include/fe_declarator.h
index 55e4db68caf..e34495f5d9e 100644
--- a/TAO/TAO_IDL/include/fe_declarator.h
+++ b/TAO/TAO_IDL/include/fe_declarator.h
@@ -67,7 +67,12 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _FE_DECLARATOR_FE_DECLARATOR_HH
#define _FE_DECLARATOR_FE_DECLARATOR_HH
-class FE_Declarator
+#include "utl_scoped_name.h"
+
+class AST_Decl;
+class AST_Type;
+
+class FE_Declarator
{
public:
// Enum to denote types of declarators.
@@ -95,6 +100,7 @@ public:
// Compose an FE_Declarator into an AST_Type once all the needed information
// is available.
AST_Type *compose (AST_Decl* tc);
+ virtual void destroy (void);
private:
// Data.
diff --git a/TAO/TAO_IDL/include/fe_extern.h b/TAO/TAO_IDL/include/fe_extern.h
index b8627e3609c..f7a398b97e2 100644
--- a/TAO/TAO_IDL/include/fe_extern.h
+++ b/TAO/TAO_IDL/include/fe_extern.h
@@ -67,38 +67,17 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _FE_EXTERN_FE_EXTERN_HH
#define _FE_EXTERN_FE_EXTERN_HH
-// fe_extern.hh
-//
-// Declares all global functions for the FE
-
-/*
-** DEPENDENCIES: none
-**
-** USE: Included from idl_extern.hh
-*/
-
-// Functions:
-
-// Initialization:
-//
-// FE initialization is done in two stages, with the BE initialization
-// occurring in between. The first stage is responsible for creating
-// the sope stack. The BE initialization creates the generator object
-// which is then used in the second stage to create the global scope
-// and to populate it with nodes for the predefined types
+#include "TAO_IDL_FE_Export.h"
-TAO_IDL_FE_Export void
-FE_init_stage1 (void); // Initialize stage 1
+// Declares all global functions for the FE
TAO_IDL_FE_Export void
-FE_init_stage2 (void); // Initialize stage 2
-
-// Interface to Yacc parser
+FE_init (void);
class File;
TAO_IDL_FE_Export int
-FE_yyparse (void); // Invode yyparse
+FE_yyparse (void);
TAO_IDL_FE_Export void
FE_set_yyin (File *); // Set yyin
@@ -107,7 +86,6 @@ FE_set_yyin (File *); // Set yyin
class UTL_Error;
class UTL_Indenter;
-class UTL_String;
TAO_IDL_FE_Export UTL_Error *
FE_new_UTL_Error (void);
@@ -115,7 +93,4 @@ FE_new_UTL_Error (void);
TAO_IDL_FE_Export UTL_Indenter *
FE_new_UTL_Indenter (void);
-TAO_IDL_FE_Export UTL_String *
-FE_new_UTL_String (char *);
-
#endif // _FE_EXTERN_FE_EXTERN_HH
diff --git a/TAO/TAO_IDL/include/fe_interface_header.h b/TAO/TAO_IDL/include/fe_interface_header.h
index bfcd9a2ae89..b651676de8c 100644
--- a/TAO/TAO_IDL/include/fe_interface_header.h
+++ b/TAO/TAO_IDL/include/fe_interface_header.h
@@ -67,119 +67,168 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _FE_INTERFACE_HEADER_FE_INTERFACE_HH
#define _FE_INTERFACE_HEADER_FE_INTERFACE_HH
-// FE_InterfaceHeader
-//
+#include "utl_scoped_name.h"
+
+class UTL_NameList;
+class AST_Interface;
+class AST_ValueType;
+class AST_Component;
+class AST_Home;
+
+// FE_interfade_header
// Internal class for FE to describe interface headers
//
// FE_obv_header
-// Internal class for FE to describe valuetype headers
+// Internal class for FE to describe valuetype headers.
//
+// FE_component_header
+// Internal class for FE to describe component headers.
-/*
-** DEPENDENCIES: utl_scoped_name.hh, ast_interface.hh, utl_scope.hh,
-** ast_decl.hh
-**
-** USE: Included from fe.hh
-*/
-
-class TAO_IDL_FE_Export FE_InterfaceHeader
+class FE_InterfaceHeader
{
public:
- // Operations
-
- // Constructor(s)
FE_InterfaceHeader (UTL_ScopedName *n,
- UTL_NameList *l,
- UTL_NameList *supports = 0,
- idl_bool compile_now = 1);
+ UTL_NameList *inherits,
+ idl_bool is_local,
+ idl_bool is_abstract,
+ idl_bool compile_now);
virtual ~FE_InterfaceHeader (void);
- // Data Accessors
- UTL_ScopedName *interface_name (void);
- AST_Interface **inherits (void);
- long n_inherits (void);
- AST_Interface **inherits_flat (void);
- long n_inherits_flat (void);
+ // Data Accessors.
+ UTL_ScopedName *name (void) const;
+ AST_Interface **inherits (void) const;
+ long n_inherits (void) const;
+ AST_Interface **inherits_flat (void) const;
+ long n_inherits_flat (void) const;
- virtual idl_bool is_local (void);
+ idl_bool is_local (void) const;
// See if we are a local interface.
- virtual idl_bool is_abstract (void);
+ idl_bool is_abstract (void) const;
// See if we are an abstract interface.
- // Data
+ // Data.
protected:
- UTL_ScopedName *pd_interface_name; // Interface name
-private:
- // Used for eventual code generation
- AST_Interface **pd_inherits; // Inherited interfaces
- long pd_n_inherits; // How many
+ UTL_ScopedName *pd_interface_name;
+
+ // Inherited interfaces.
+ AST_Interface **pd_inherits;
+ long pd_n_inherits;
- // Used for name clash checking
- AST_Interface **pd_inherits_flat; // All ancestors
- long pd_n_inherits_flat; // How many
+ // Used for name clash checking.
+ AST_Interface **pd_inherits_flat;
+ long pd_n_inherits_flat;
- // Operations
+ idl_bool pd_is_local;
+ idl_bool pd_is_abstract;
+
+ // Operations.
// Compile the flattened unique list of interfaces which this
- // interface inherits from
+ // interface inherits from.
protected:
- void compile_inheritance(UTL_NameList *l,
- UTL_NameList *supports);
-private:
- void compile_one_inheritance(AST_Interface *i);
-
- // called from compile_inheritance()
- virtual idl_bool check_first (AST_Interface *i);
- virtual idl_bool check_further (AST_Interface *i);
- virtual idl_bool check_supports (AST_Interface *i);
+ virtual void compile_inheritance (UTL_NameList *ifaces,
+ idl_bool for_valuetype);
+
+ void compile_one_inheritance (AST_Interface *i);
+
+ // Called from compile_inheritance().
+ int check_inherit (AST_Interface *i,
+ idl_bool for_valuetype);
};
-class FE_Local_InterfaceHeader : public FE_InterfaceHeader
+class FE_OBVHeader : public FE_InterfaceHeader
{
public:
- FE_Local_InterfaceHeader (UTL_ScopedName *n,
- UTL_NameList *l,
- UTL_NameList *supports = 0);
- virtual idl_bool is_local (void);
- // See if we are a local interface.
+ FE_OBVHeader (UTL_ScopedName *n,
+ UTL_NameList *inherits,
+ UTL_NameList *supports,
+ idl_bool truncatable);
+ virtual ~FE_OBVHeader (void);
+
+ // Data Accessors.
+ AST_Interface **supports (void) const;
+ long n_supports (void) const;
+ AST_ValueType *inherits_concrete (void) const;
+ AST_Interface *supports_concrete (void) const;
+ idl_bool truncatable (void) const;
+
+protected:
+ // Supported interfaces.
+ AST_Interface **pd_supports;
+ long pd_n_supports;
+
+ AST_ValueType *pd_inherits_concrete;
+ AST_Interface *pd_supports_concrete;
+
+ // Currently ignored.
+ idl_bool pd_truncatable;
+
+protected:
+ void compile_supports (UTL_NameList *supports);
+ idl_bool check_concrete_supported_inheritance (AST_Interface *d);
};
-class FE_Abstract_InterfaceHeader : public FE_InterfaceHeader
+// Unlike value types, a component's supported interfaces are simply
+// added to the inheritance list in generated code, so we use the
+// existing base class mechanism for managing the inheritance list
+// to manage the derived class's supported interface list.
+class FE_ComponentHeader : public FE_InterfaceHeader
{
public:
- FE_Abstract_InterfaceHeader (UTL_ScopedName *n,
- UTL_NameList *l,
- UTL_NameList *supports = 0);
- virtual idl_bool is_abstract (void);
- // See if we are a local interface.
+ FE_ComponentHeader (UTL_ScopedName *n,
+ UTL_ScopedName *base_component,
+ UTL_NameList *supports,
+ idl_bool compile_now);
+ virtual ~FE_ComponentHeader (void);
+
+ // Data Accessors.
+ AST_Component *base_component (void) const;
+ AST_Interface **supports (void) const;
+ long n_supports (void) const;
+ AST_Interface **supports_flat (void) const;
+ long n_supports_flat (void) const;
+
+protected:
+ AST_Component *pd_base_component;
+
+protected:
+ virtual void compile_inheritance (UTL_NameList *supports,
+ idl_bool for_valuetype);
};
-class FE_obv_header : public FE_InterfaceHeader
+// We use the 'base_component' member of the base class to
+// store the 'managed_component' member of the derived class.
+// By inheriting from FE_ComponentHeader, we also get the
+// reuse of the mechanism described in the comment above
+// for handling the supported interface list.
+class FE_HomeHeader : public FE_ComponentHeader
{
public:
- // Constructor(s)
- FE_obv_header(UTL_ScopedName *n, UTL_NameList *l, UTL_NameList *supports);
- virtual ~FE_obv_header() {}
+ FE_HomeHeader (UTL_ScopedName *n,
+ UTL_ScopedName *base_home,
+ UTL_NameList *supports,
+ UTL_ScopedName *managed_component,
+ UTL_ScopedName *primary_key);
+ virtual ~FE_HomeHeader (void);
- // Data Accessors
- void valuetype_name (UTL_ScopedName *n);
- long n_concrete ();
+ // Data Accessors.
+ AST_Home *base_home (void) const;
+ AST_Component *managed_component (void) const;
+ AST_ValueType *primary_key (void) const;
- private:
-
- // called from compile_inheritance()
- virtual idl_bool check_first (AST_Interface *i);
- virtual idl_bool check_further (AST_Interface *i);
- virtual idl_bool check_supports (AST_Interface *i);
+protected:
+ AST_Home *pd_base_home;
+ AST_ValueType *pd_primary_key;
- idl_bool truncatable_; /* currently 0, ignored */
- long n_concrete_;
+protected:
+ virtual void compile_inheritance (UTL_NameList *supports,
+ idl_bool for_valuetype);
};
#endif // _FE_INTERFACE_HEADER_FE_INTERFACE_HH
diff --git a/TAO/TAO_IDL/include/fe_private.h b/TAO/TAO_IDL/include/fe_private.h
index 90f8e2edcf7..0c975ff65b2 100644
--- a/TAO/TAO_IDL/include/fe_private.h
+++ b/TAO/TAO_IDL/include/fe_private.h
@@ -67,15 +67,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _FE_FE_HH
#define _FE_FE_HH
-// fe_private.hh - Defines data which is private to the FE but
-// which must be accessible throughout the FE
-
-// FE includes
-
-#include "fe_interface_header.h"// class FE_InterfaceHeader
-#include "fe_declarator.h" // class FE_Declarator
-
-// FE Operations
+#include "TAO_IDL_FE_Export.h"
// Define an entry for the C++ keyword and its mapping.
struct TAO_IDL_FE_Export TAO_IDL_CPP_Keyword_Entry
@@ -90,9 +82,11 @@ class TAO_IDL_FE_Export TAO_IDL_CPP_Keyword_Table
// Define a table that provides the lookup for the C++
// keyword. The lookup uses a perfect hash function
private:
- unsigned int hash (const char *str, unsigned int len);
+ unsigned int hash (const char *str,
+ unsigned int len);
public:
- const TAO_IDL_CPP_Keyword_Entry *lookup (const char *str, unsigned int len);
+ const TAO_IDL_CPP_Keyword_Entry *lookup (const char *str,
+ unsigned int len);
};
#endif /* _FE_FE_HH */
diff --git a/TAO/TAO_IDL/include/global_extern.h b/TAO/TAO_IDL/include/global_extern.h
index b00c7405497..dce69d00c37 100644
--- a/TAO/TAO_IDL/include/global_extern.h
+++ b/TAO/TAO_IDL/include/global_extern.h
@@ -67,6 +67,12 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _GLOBAL_EXTERN_GLOBAL_EXTERN_HH
#define _GLOBAL_EXTERN_GLOBAL_EXTERN_HH
+#include "TAO_IDL_FE_Export.h"
+#include "idl_global.h"
+#include "idl_bool.h"
+
+class AST_Decl;
+
// global_extern.hh - Global data for the IDL compiler
extern TAO_IDL_FE_Export IDL_GlobalData *idl_global;
diff --git a/TAO/TAO_IDL/include/idl.h b/TAO/TAO_IDL/include/idl.h
deleted file mode 100644
index 5584939d163..00000000000
--- a/TAO/TAO_IDL/include/idl.h
+++ /dev/null
@@ -1,97 +0,0 @@
-// $Id$
-
-/*
-
-COPYRIGHT
-
-Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
-States of America. All Rights Reserved.
-
-This product is protected by copyright and distributed under the following
-license restricting its use.
-
-The Interface Definition Language Compiler Front End (CFE) is made
-available for your use provided that you include this license and copyright
-notice on all media and documentation and the software program in which
-this product is incorporated in whole or part. You may copy and extend
-functionality (but may not remove functionality) of the Interface
-Definition Language CFE without charge, but you are not authorized to
-license or distribute it to anyone else except as part of a product or
-program developed by you or with the express written consent of Sun
-Microsystems, Inc. ("Sun").
-
-The names of Sun Microsystems, Inc. and any of its subsidiaries or
-affiliates may not be used in advertising or publicity pertaining to
-distribution of Interface Definition Language CFE as permitted herein.
-
-This license is effective until terminated by Sun for failure to comply
-with this license. Upon termination, you shall destroy or return all code
-and documentation for the Interface Definition Language CFE.
-
-INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
-ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
-FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
-DEALING, USAGE OR TRADE PRACTICE.
-
-INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
-ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
-TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
-
-SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
-RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
-INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
-
-IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
-ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
-DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-Use, duplication, or disclosure by the government is subject to
-restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
-Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
-52.227-19.
-
-Sun, Sun Microsystems and the Sun logo are trademarks or registered
-trademarks of Sun Microsystems, Inc.
-
-SunSoft, Inc.
-2550 Garcia Avenue
-Mountain View, California 94043
-
-NOTE:
-
-SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
-trademarks or registered trademarks of Sun Microsystems, Inc.
-
- */
-
-#ifndef _IDL_IDL_HH
-#define _IDL_IDL_HH
-
-// idl.hh
-//
-// Main include file for IDL compiler. Includes the rest of the
-// files defining the different units of the compiler
-
-#include "ace/ACE.h" // Most important ACE include file
-#include "ace/streams.h" // iostreams
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-#include "TAO_IDL_FE_Export.h" // Defines export macro
-#include "idl_narrow.h" // IDL Narrowing mechanism
-#include "idl_defines.h" // Constants for IDL compiler
-#include "idl_fwd.h" // Forward decls of classes
-#include "idl_bool.h" // Defines boolean for IDL
-#include "utl_string.h" // Defines utility string class
-#include "utl_identifier.h" // Defines utility identifier class
-#include "ast.h" // AST classes
-#include "util.h" // Utility classes
-
-#if defined (interface)
-// Mingw needs this.
-# undef interface
-#endif /* defined (interface) */
-
-#endif // _IDL_IDL_HH
diff --git a/TAO/TAO_IDL/include/idl_bool.h b/TAO/TAO_IDL/include/idl_bool.h
index 838e7dbfcb8..b7356d80247 100644
--- a/TAO/TAO_IDL/include/idl_bool.h
+++ b/TAO/TAO_IDL/include/idl_bool.h
@@ -62,25 +62,17 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
#ifndef _IDL_BOOL_IDL_BOOL_HH
#define _IDL_BOOL_IDL_BOOL_HH
/*
- * idl_bool.hh - Boolean definitions for IDL CFE
- *
* This is interim. When porting to a new platform, this file will be
* modified to incorporate definitions for the boolean type suitable
* for the new platform.
*/
-/*
-** DEPENDENCIES: NONE
-**
-** USE: Included from idl.hh
-*/
-
#ifndef I_TRUE
#define I_TRUE 1
#endif
@@ -89,6 +81,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#define I_FALSE 0
#endif
-typedef long idl_bool;
+typedef long idl_bool;
#endif // _IDL_BOOL_IDL_BOOL_HH
diff --git a/TAO/TAO_IDL/include/idl_defines.h b/TAO/TAO_IDL/include/idl_defines.h
index 17b2bc4d71e..6f86e74d154 100644
--- a/TAO/TAO_IDL/include/idl_defines.h
+++ b/TAO/TAO_IDL/include/idl_defines.h
@@ -84,4 +84,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#define IDL_CF_INFORMATIVE (long)(1 << 4)
#define IDL_CF_NOWARNINGS (long)(1 << 5)
+#define NAMEBUFSIZE 1024
+// Maximum length of static buffers used to store names.
+
#endif // _IDL_DEFINES_IDL_DEFINES_HH
diff --git a/TAO/TAO_IDL/include/idl_extern.h b/TAO/TAO_IDL/include/idl_extern.h
deleted file mode 100644
index 1c3b6deee88..00000000000
--- a/TAO/TAO_IDL/include/idl_extern.h
+++ /dev/null
@@ -1,79 +0,0 @@
-// $Id$
-
-/*
-
-COPYRIGHT
-
-Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
-States of America. All Rights Reserved.
-
-This product is protected by copyright and distributed under the following
-license restricting its use.
-
-The Interface Definition Language Compiler Front End (CFE) is made
-available for your use provided that you include this license and copyright
-notice on all media and documentation and the software program in which
-this product is incorporated in whole or part. You may copy and extend
-functionality (but may not remove functionality) of the Interface
-Definition Language CFE without charge, but you are not authorized to
-license or distribute it to anyone else except as part of a product or
-program developed by you or with the express written consent of Sun
-Microsystems, Inc. ("Sun").
-
-The names of Sun Microsystems, Inc. and any of its subsidiaries or
-affiliates may not be used in advertising or publicity pertaining to
-distribution of Interface Definition Language CFE as permitted herein.
-
-This license is effective until terminated by Sun for failure to comply
-with this license. Upon termination, you shall destroy or return all code
-and documentation for the Interface Definition Language CFE.
-
-INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
-ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
-FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
-DEALING, USAGE OR TRADE PRACTICE.
-
-INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
-ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
-TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
-
-SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
-RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
-INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
-
-IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
-ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
-DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-Use, duplication, or disclosure by the government is subject to
-restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
-Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
-52.227-19.
-
-Sun, Sun Microsystems and the Sun logo are trademarks or registered
-trademarks of Sun Microsystems, Inc.
-
-SunSoft, Inc.
-2550 Garcia Avenue
-Mountain View, California 94043
-
-NOTE:
-
-SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
-trademarks or registered trademarks of Sun Microsystems, Inc.
-
- */
-
-#ifndef _IDL_EXTERN_IDL_EXTERN_HH
-#define _IDL_EXTERN_IDL_EXTERN_HH
-
-// idl_extern.hh
-//
-// Global variables and functions for IDL compiler
-
-#include "fe_extern.h" // External API of FE
-#include "ast_extern.h" // External API of AST
-#include "nr_extern.h" // External API of NR
-#include "global_extern.h" // Global data
-
-#endif // _IDL_EXTERN_IDL_EXTERN_HH
diff --git a/TAO/TAO_IDL/include/idl_fwd.h b/TAO/TAO_IDL/include/idl_fwd.h
deleted file mode 100644
index 5198f1bcae8..00000000000
--- a/TAO/TAO_IDL/include/idl_fwd.h
+++ /dev/null
@@ -1,148 +0,0 @@
-// $Id$
-
-/*
-
-COPYRIGHT
-
-Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
-States of America. All Rights Reserved.
-
-This product is protected by copyright and distributed under the following
-license restricting its use.
-
-The Interface Definition Language Compiler Front End (CFE) is made
-available for your use provided that you include this license and copyright
-notice on all media and documentation and the software program in which
-this product is incorporated in whole or part. You may copy and extend
-functionality (but may not remove functionality) of the Interface
-Definition Language CFE without charge, but you are not authorized to
-license or distribute it to anyone else except as part of a product or
-program developed by you or with the express written consent of Sun
-Microsystems, Inc. ("Sun").
-
-The names of Sun Microsystems, Inc. and any of its subsidiaries or
-affiliates may not be used in advertising or publicity pertaining to
-distribution of Interface Definition Language CFE as permitted herein.
-
-This license is effective until terminated by Sun for failure to comply
-with this license. Upon termination, you shall destroy or return all code
-and documentation for the Interface Definition Language CFE.
-
-INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
-ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
-FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
-DEALING, USAGE OR TRADE PRACTICE.
-
-INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
-ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
-TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
-
-SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
-RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
-INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
-
-IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
-ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
-DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-Use, duplication, or disclosure by the government is subject to
-restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
-Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
-52.227-19.
-
-Sun, Sun Microsystems and the Sun logo are trademarks or registered
-trademarks of Sun Microsystems, Inc.
-
-SunSoft, Inc.
-2550 Garcia Avenue
-Mountain View, California 94043
-
-NOTE:
-
-SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
-trademarks or registered trademarks of Sun Microsystems, Inc.
-
- */
-
-#ifndef _IDL_FWD_IDL_FWD_HH
-#define _IDL_FWD_IDL_FWD_HH
-
-// idl_fwd.hh
-//
-// Forward declaration of all class names in CFE-BEs contract
-
-/*
-** DEPENDENCIES: NONE
-**
-** USE: Included from idl.hh
-*/
-
-// Class for global data representation:
-
-class IDL_GlobalData; // Global data is stored in an
- // instance of this
-
-// Classes for utility of the IDL compiler:
-
-class UTL_ScopeStack; // Stack of scopes
-class UTL_Scope; // A definition scope (mixin)
-
-class UTL_LongList; // List of longs
-class UTL_StrList; // List of strings
-class UTL_StrlistActiveIterator; // Active iterator for list of strings
-class UTL_IdList; // List of identifiers
-class UTL_IdListActiveIterator; // Active iterator for list of id's
-class UTL_ExceptList; // List of exceptions
-class UTL_NameList; // List of scoped names
-class UTL_ExprList; // List of expressions
-class UTL_InterfList; // List of interfaces
-class UTL_LabelList; // List of union branch labels
-class UTL_DeclList; // List of declarators
-class UTL_String; // String class
-class UTL_Identifier; // Identifier class
-
-class UTL_Error; // Error class
-class UTL_Indenter; // Indenter class
-
-// Classes for utility of the FE. These classes are used only
-// by the FE but their forward declaration is needed because lists
-// of them are constructed by classes in UTL
-
-class FE_InterfaceHeader; // Interface header
-class FE_Declarator; // Declarator
-
-// Generator class for the AST
-
-class AST_Generator; // Generate nodes of various types
-
-// Classes for AST:
-
-class AST_Decl; // The rock bottom base class
-
-class AST_PredefinedType; // A predefined type
-class AST_Type; // An IDL type
-class AST_ConcreteType; // An IDL concrete type
-class AST_Module; // A module
-class AST_Root; // The root of an AST (a module)
-class AST_Interface; // An interface
-class AST_InterfaceFwd; // A forward interface decl
-class AST_Constant; // A constant declaration
-class AST_Expression; // Value of an expression
-class AST_Exception; // An exception declaration
-class AST_Attribute; // An attribute declaration
-class AST_Operation; // An operation declaration
-class AST_Argument; // An argument to an operation
-class AST_Union; // A union declaration
-class AST_UnionBranch; // A branch in a union
-class AST_UnionLabel; // A union branch label
-class AST_Structure; // A structure declaration
-class AST_Field; // A field in a structure or union
-class AST_Enum; // An enum declaration
-class AST_EnumVal; // An enumerator in an enum
-class AST_Sequence; // A sequence declaration
-class AST_String; // A string declaration
-class AST_Array; // An array declaration
-class AST_Typedef; // A typedef declaration
-class AST_Native; // A native declaration
-
-#endif // _IDL_FWD_IDL_FWD_HH
diff --git a/TAO/TAO_IDL/include/idl_global.h b/TAO/TAO_IDL/include/idl_global.h
index 10f32c661da..521a2e71b90 100644
--- a/TAO/TAO_IDL/include/idl_global.h
+++ b/TAO/TAO_IDL/include/idl_global.h
@@ -70,6 +70,16 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "ace/SString.h"
#include "ace/Hash_Map_Manager_T.h"
#include "ace/Containers_T.h"
+#include "idl_bool.h"
+#include "ast_expression.h"
+#include "ast_predefined_type.h"
+#include "utl_stack.h"
+
+class AST_Root;
+class AST_Generator;
+class UTL_Error;
+class UTL_String;
+class UTL_Indenter;
// idl_global.hh
//
@@ -85,29 +95,60 @@ public:
// where context sensitive behavior is required
enum ParseState {
PS_NoState // No state
- , PS_TypeDeclSeen // Seen complete typedef declaration
+ , PS_TypeDeclSeen // Seen complete type declaration
+ , PS_TypeIdDeclSeen // Seen complete typeId declaration
+ , PS_TypePrefixDeclSeen // Seen complete type_prefix declaration
, PS_ConstDeclSeen // Seen complete const declaration
, PS_ExceptDeclSeen // Seen complete exception declaration
, PS_InterfaceDeclSeen // Seen complete interface declaration
, PS_ModuleDeclSeen // Seen complete module declaration
- , PS_ValuetypeDeclSeen // Seen complete valuetype declaration
+ , PS_ValueTypeDeclSeen // Seen complete valuetype declaration
+ , PS_ComponentDeclSeen // Seen complete component declaration
+ , PS_HomeDeclSeen // Seen complete home declaration
+ , PS_EventDeclSeen // Seen complete eventtype declartion
, PS_AttrDeclSeen // Seen complete attribute declaration
, PS_OpDeclSeen // Seen complete operation declaration
+ , PS_ProvidesDeclSeen // Seen complete privides declaration
+ , PS_UsesDeclSeen // Seen complete uses declaration
+ , PS_EmitsDeclSeen // Seen complete emits declaration
+ , PS_PublishesDeclSeen // Seen complete publishes declaration
+ , PS_FactoryDeclSeen // Seen complete factory declaration
+ , PS_FinderDeclSeen // Seen complete finder declaration
+ , PS_ConsumesDeclSeen // Seen complete subscribes declaration
, PS_ModuleSeen // Seen a MODULE keyword
, PS_ModuleIDSeen // Seen the module ID
, PS_ModuleSqSeen // '{' seen for module
, PS_ModuleQsSeen // '}' seen for module
, PS_ModuleBodySeen // Seen complete module body
+ , PS_InheritColonSeen // Seen ':' in inheritance list
+ , PS_InheritSpecSeen // Seen a complete inheritance spec
+ , PS_SupportSpecSeen // Seen a complete supports spec
+ , PS_ManagesSeen // Seen a MANAGES keyword
+ , PS_ManagesIDSeen // Seen the scoped name referred to by MANAGES
+ , PS_PrimaryKeySpecSeen // Seen a complete primary key spec
, PS_InterfaceSeen // Seen an INTERFACE keyword
, PS_InterfaceIDSeen // Seen the interface ID
- , PS_InheritSpecSeen // Seen a complete inheritance spec
- , PS_ForwardDeclSeen // Forward interface decl seen
+ , PS_InterfaceForwardSeen // Forward interface decl seen
, PS_InterfaceSqSeen // '{' seen for interface
, PS_InterfaceQsSeen // '}' seen for interface
, PS_InterfaceBodySeen // Seen an interface body
- , PS_InheritColonSeen // Seen ':' in inheritance list
- , PS_ValuetypeSeen // Seen a VALUETYPE keyword
- , PS_ValuetypeIDSeen // Seen the valuetype ID
+ , PS_ValueTypeSeen // Seen a VALUETYPE keyword
+ , PS_ValueTypeForwardSeen // Forward valuetype decl seen
+ , PS_ValueTypeIDSeen // Seen the valuetype ID
+ , PS_ValueTypeSqSeen // '{' seen for value type
+ , PS_ValueTypeQsSeen // '}' seen for value type
+ , PS_ValueTypeBodySeen // Seen a value type body
+ , PS_ComponentSeen // Seen a component declaration
+ , PS_ComponentIDSeen // Seen the component ID
+ , PS_ComponentForwardSeen // Seen a forward declaration of a component
+ , PS_ComponentSqSeen // '{' seen for component
+ , PS_ComponentQsSeen // '}' seen for component
+ , PS_ComponentBodySeen // Seen a component body
+ , PS_HomeSeen // Seen a home declaration
+ , PS_HomeIDSeen // Seen the home ID
+ , PS_HomeSqSeen // '{' seen for home
+ , PS_HomeQsSeen // '}' seen for home
+ , PS_HomeBodySeen // Seen a home body
, PS_SNListCommaSeen // Seen ',' in list of scoped names
, PS_ScopedNameSeen // Seen a complete scoped name
, PS_SN_IDSeen // Seen an identifier as part of a scoped name
@@ -125,11 +166,13 @@ public:
, PS_StructSqSeen // '{' seen for struct
, PS_StructQsSeen // '}' seen for struct
, PS_StructBodySeen // Seen complete body of struct decl
+ , PS_StructForwardSeen // Forward struct decl seen
, PS_MemberTypeSeen // Seen type of struct or except member
, PS_MemberDeclsSeen // Seen decls of struct or except members
, PS_MemberDeclsCompleted // Completed one struct or except member to ';'
, PS_UnionSeen // Seen a UNION keyword
, PS_UnionIDSeen // Seen the union ID
+ , PS_UnionForwardSeen // Forward union decl seen
, PS_SwitchSeen // Seen the SWITCH keyword
, PS_SwitchOpenParSeen // Seen the switch open par.
, PS_SwitchTypeSeen // Seen the switch type spec
@@ -210,9 +253,7 @@ public:
virtual ~IDL_GlobalData (void);
// Operations
- virtual UTL_ScopeStack *scopes (void); // Scopes stack
- virtual void set_scopes (UTL_ScopeStack *);
- // Set it
+ virtual UTL_ScopeStack &scopes (void); // Scopes stack
virtual AST_Root *root (void); // Root of AST
virtual void set_root (AST_Root *); // Set it
@@ -345,6 +386,12 @@ public:
virtual idl_bool obv_support (void);
// check if OBV (Valuetype) support is enabled
+ void component_support (idl_bool);
+ // set enable/disable CORBA component support
+
+ idl_bool component_support (void);
+ // check if CORBA component support is enabled
+
virtual void case_diff_error (idl_bool);
// report an error (1) for indentifiers in the same scope
// that differ only by case, or report a warning (0).
@@ -352,6 +399,12 @@ public:
virtual idl_bool case_diff_error (void);
// are we strict about case-only differences or not?
+ virtual void nest_orb (idl_bool);
+ // Set on or off whether we are using the NEST ORB.
+
+ virtual idl_bool nest_orb (void);
+ // are we beIng used with the NEST ORB?
+
virtual void destroy (void);
// Cleanup function.
@@ -384,7 +437,7 @@ public:
private:
// Data
- UTL_ScopeStack *pd_scopes; // Store scopes stack
+ UTL_ScopeStack pd_scopes; // Store scopes stack
AST_Root *pd_root; // Store AST root
AST_Generator *pd_gen; // Store generator
UTL_Error *pd_err; // Error object
@@ -436,10 +489,16 @@ private:
idl_bool obv_support_;
// Do we support OBV (Valuetype)?
+ idl_bool component_support_;
+ // Do we support the CCM (CORBA Component Model)?
+
idl_bool case_diff_error_;
// Do we report an error for indentifiers in the same scope that differ
// only by case? or just a warning?
+ idl_bool nest_orb_;
+ // Is this front end being used for the NEST ORB?
+
ACE_CString idl_flags_;
// Concatenation of all the command line options.
diff --git a/TAO/TAO_IDL/include/nr_extern.h b/TAO/TAO_IDL/include/nr_extern.h
index 84a0b599685..0e9195b8d57 100644
--- a/TAO/TAO_IDL/include/nr_extern.h
+++ b/TAO/TAO_IDL/include/nr_extern.h
@@ -67,6 +67,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _NR_EXTERN_NR_EXTERN_HH
#define _NR_EXTERN_NR_EXTERN_HH
+class UTL_Scope;
+class AST_Decl;
+
// nr_extern.hh - Defines entry points provided by narrowing
// Convert between an UTL_Scope and an AST_Decl.
diff --git a/TAO/TAO_IDL/include/util.h b/TAO/TAO_IDL/include/util.h
deleted file mode 100644
index c8a35f0e685..00000000000
--- a/TAO/TAO_IDL/include/util.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// $Id$
-
-/*
-
-COPYRIGHT
-
-Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
-States of America. All Rights Reserved.
-
-This product is protected by copyright and distributed under the following
-license restricting its use.
-
-The Interface Definition Language Compiler Front End (CFE) is made
-available for your use provided that you include this license and copyright
-notice on all media and documentation and the software program in which
-this product is incorporated in whole or part. You may copy and extend
-functionality (but may not remove functionality) of the Interface
-Definition Language CFE without charge, but you are not authorized to
-license or distribute it to anyone else except as part of a product or
-program developed by you or with the express written consent of Sun
-Microsystems, Inc. ("Sun").
-
-The names of Sun Microsystems, Inc. and any of its subsidiaries or
-affiliates may not be used in advertising or publicity pertaining to
-distribution of Interface Definition Language CFE as permitted herein.
-
-This license is effective until terminated by Sun for failure to comply
-with this license. Upon termination, you shall destroy or return all code
-and documentation for the Interface Definition Language CFE.
-
-INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
-ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
-FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
-DEALING, USAGE OR TRADE PRACTICE.
-
-INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
-ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
-TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
-
-SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
-RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
-INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
-
-IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
-ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
-DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-Use, duplication, or disclosure by the government is subject to
-restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
-Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
-52.227-19.
-
-Sun, Sun Microsystems and the Sun logo are trademarks or registered
-trademarks of Sun Microsystems, Inc.
-
-SunSoft, Inc.
-2550 Garcia Avenue
-Mountain View, California 94043
-
-NOTE:
-
-SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
-trademarks or registered trademarks of Sun Microsystems, Inc.
-
- */
-
-#ifndef _UTIL_UTIL_HH
-#define _UTIL_UTIL_HH
-
-// util.hh - Includes commonly used things defined in the util directory
-
-#include "utl_stack.h" // class fe_stack
-#include "utl_exprlist.h" // class UTL_ExprList
-#include "utl_strlist.h" // class UTL_StrList
-#include "utl_idlist.h" // class UTL_IdList
-#include "utl_exceptlist.h" // class UTL_ExceptList
-#include "utl_namelist.h" // class UTL_NameList
-#include "utl_labellist.h" // class UTL_LabelList
-#include "utl_decllist.h" // class UTL_DeclList
-#include "idl_global.h" // Class IDL_GlobalData
-#include "utl_err.h" // class UTL_Error
-#include "utl_indenter.h" // class UTL_Indenter
-
-#endif // _UTIL_UTIL_HH
diff --git a/TAO/TAO_IDL/include/utl_decllist.h b/TAO/TAO_IDL/include/utl_decllist.h
index 0eb903ce37e..45492f4dce7 100644
--- a/TAO/TAO_IDL/include/utl_decllist.h
+++ b/TAO/TAO_IDL/include/utl_decllist.h
@@ -67,8 +67,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _UTL_DECLLIST_UTL_DECLLIST_HH
#define _UTL_DECLLIST_UTL_DECLLIST_HH
-// utl_decllist.hh
-//
+#include "TAO_IDL_FE_Export.h"
+#include "utl_list.h"
+
// List of FE_Declarator nodes
// NOTE: This list class only works correctly because we use single public
@@ -77,11 +78,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// will cease to operate correctly if you use either multiple or
// public virtual inheritance.
-/*
-** DEPENDENCIES: utl_list.hh, fe_declarator.hh
-**
-** USE: Included from util.hh
-*/
+class FE_Declarator;
class TAO_IDL_FE_Export UTL_DeclList : public UTL_List
{
@@ -89,14 +86,18 @@ public:
// Operations
// Constructor(s)
- UTL_DeclList(FE_Declarator *s, UTL_DeclList *cdr);
+ UTL_DeclList (FE_Declarator *s,
+ UTL_DeclList *cdr);
// Get element
- FE_Declarator *head();
+ FE_Declarator *head (void);
+
+ // Cleanup.
+ virtual void destroy (void);
private:
// Data
- FE_Declarator *pd_car_data; // The element this list stores
+ FE_Declarator *pd_car_data; // The element this list stores
};
// Active iterator fooor UTL_DeclList
@@ -107,10 +108,10 @@ public:
// Operations
// Constructor(s)
- UTL_DecllistActiveIterator(UTL_DeclList *s);
+ UTL_DecllistActiveIterator (UTL_DeclList *s);
// Get current item
- FE_Declarator *item();
+ FE_Declarator *item (void);
};
#endif // _UTL_DECLLIST_UTL_DECLLIST_HH
diff --git a/TAO/TAO_IDL/include/utl_err.h b/TAO/TAO_IDL/include/utl_err.h
index 17fccba5d85..5ee7811832a 100644
--- a/TAO/TAO_IDL/include/utl_err.h
+++ b/TAO/TAO_IDL/include/utl_err.h
@@ -67,16 +67,16 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _UTL_ERR_UTL_ERR_HH
#define _UTL_ERR_UTL_ERR_HH
-// utl_err.hh
-//
-// Defines error codes and error handling class for UTL
-// This will change as a result of internationalization
+#include "AST_Expression.h"
+#include "idl_global.h"
+#include "utl_scoped_name.h"
-/*
-** DEPENDENCIES: ast.hh
-**
-** USE: Included from util.hh
-*/
+class AST_Decl;
+class AST_Interface;
+class AST_Enum;
+class AST_Union;
+class AST_UnionLabel;
+class UTL_String;
class TAO_IDL_FE_Export UTL_Error
{
@@ -96,6 +96,9 @@ public:
EIDL_ILLEGAL_VERSION, // Bad number in #pragma version statement
EIDL_VERSION_RESET, // Can't reset version, even to same number
EIDL_ID_RESET, // Tried to set id to a different string
+ EIDL_TYPEID_RESET, // Can't set repo id with 'typeid' twice
+ EIDL_INVALID_TYPEID, // Can't use 'typeid' on this type.
+ EIDL_INVALID_TYPEPREFIX, // Can't use 'typeprefix on this type
EIDL_DISC_TYPE, // Illegal discriminator type in union
EIDL_LABEL_TYPE, // Mismatch with discriminator type in union
EIDL_ILLEGAL_ADD, // Illegal add action
@@ -103,9 +106,14 @@ public:
EIDL_ILLEGAL_RAISES, // Error in "raises" clause
EIDL_ILLEGAL_CONTEXT, // Error in "context" clause
EIDL_CANT_INHERIT, // Cannot inherit from non-interface
+ EIDL_CANT_SUPPORT, // Cannot support a non-interface
EIDL_LOOKUP_ERROR, // Identifier not found
EIDL_INHERIT_FWD_ERROR, // Cannot inherit from fwd decl interface
+ EIDL_SUPPORTS_FWD_ERROR, // Cannot support a fwd decl interface
EIDL_CONSTANT_EXPECTED, // We got something else..
+ EIDL_INTERFACE_EXPECTED, // We got something else..
+ EIDL_VALUETYPE_EXPECTED, // We got something else..
+ EIDL_ABSTRACT_EXPECTED, // We got something else..
EIDL_NAME_CASE_ERROR, // Identifier spellings differ only in case
EIDL_NAME_CASE_WARNING, // Same as above, but only a warning
EIDL_KEYWORD_ERROR, // Case-insensitive clash with IDL keyword
@@ -113,6 +121,7 @@ public:
EIDL_ENUM_VAL_EXPECTED, // Expected an enumerator
EIDL_ENUM_VAL_NOT_FOUND, // Didnt find an enumerator with that name
EIDL_EVAL_ERROR, // Error in evaluating expression
+ EIDL_INCOMPATIBLE_TYPE, // Assign floating pt. to integer or vice versa
EIDL_AMBIGUOUS, // Ambiguous name definition
EIDL_DECL_NOT_DEFINED, // Forward declared but never defined
EIDL_FWD_DECL_LOOKUP, // Tried to lookup in fwd declared intf
@@ -152,7 +161,7 @@ public:
AST_Decl *t3);
// Report a syntax error in IDL input
- void syntax_error(IDL_GlobalData::ParseState ps);
+ void syntax_error (IDL_GlobalData::ParseState ps);
// Report clash of declared and referenced indentifiers
void redef_error (char *n,
@@ -198,17 +207,57 @@ public:
void inheritance_error (UTL_ScopedName *n,
AST_Decl *d);
- void abstract_inheritance_error (UTL_ScopedName *n);
+ // Report an attempt to use a forward declared interface which
+ // hasn't been defined yet in an inheritance spec
+ void supports_fwd_error (UTL_ScopedName *n,
+ AST_Interface *f);
+
+ // Report an attempt to inherit from something other than an interface
+ void supports_error (UTL_ScopedName *n,
+ AST_Decl *d);
+
+ // Report an attempt to illegally inherit from an abstract type.
+ void abstract_inheritance_error (UTL_ScopedName *v,
+ UTL_ScopedName *i);
+
+ // Report an attempt to support more then one abstract type.
+ void abstract_support_error (UTL_ScopedName *v,
+ UTL_ScopedName *i);
+
+ // A concrete supported interface must inherit from all concrete
+ // interfaces supported by the valuetype's ancestors, and all of
+ // those conrete interfaces' ancestors.
+ void concrete_supported_inheritance_error (UTL_ScopedName *v,
+ UTL_ScopedName *i);
// Report an error while evaluating an expression (division by zero, etc.)
void eval_error (AST_Expression *d);
+ // Report incompatible types in constant assignment
+ void incompatible_type_error (AST_Expression *d);
+
// Report a situation where a constant was expected but we got
// something else instead. This most likely is a case where a union
// label did not evaluate to a constant
void constant_expected (UTL_ScopedName *n,
AST_Decl *d);
+ // Report a situation where an interface was expected but we got
+ // something else instead. This most likely is a case in a supports
+ // or inheritance list.
+ void interface_expected (AST_Decl *d);
+
+ // Report a situation where an value type was expected but we got
+ // something else instead. This most likely is a case in a primary
+ // key, emits, publishes or consumes declaration.
+ void valuetype_expected (AST_Decl *d);
+
+ // Report a situation where an abstract type was expected but we got
+ // something else instead. This is the case in an inheritance
+ // list where a concrete type appears after an abstract type, or
+ // where a valuetype inherits more than one concrete valuetype.
+ void abstract_expected (AST_Decl *d);
+
// Report a situation where an enumerator was expected but we got
// something else instead. This occurs when a union with an enum
// discriminator is being parsed and one of the branch labels is
@@ -227,7 +276,7 @@ public:
AST_Decl *d);
// Report a forward declared interface which was never defined
- void fwd_decl_not_defined (AST_Interface *d);
+ void fwd_decl_not_defined (AST_Type *d);
// Report attempt to lookup in forward declared interface
void fwd_decl_lookup (AST_Interface *d,
diff --git a/TAO/TAO_IDL/include/utl_exceptlist.h b/TAO/TAO_IDL/include/utl_exceptlist.h
index 3d411e2a6a4..f10b5d575ab 100644
--- a/TAO/TAO_IDL/include/utl_exceptlist.h
+++ b/TAO/TAO_IDL/include/utl_exceptlist.h
@@ -67,9 +67,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _UTL_EXCEPTLIST_UTL_EXCEPTLIST_HH
#define _UTL_EXCEPTLIST_UTL_EXCEPTLIST_HH
-// utl_exceptlist.hh
-//
-// List of AST_Exception nodes
+#include "utl_list.h"
+
+class AST_Exception;
// NOTE: This list class only works correctly because we use single public
// inheritance, as opposed to multiple inheritance or public virtual.
@@ -77,40 +77,29 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// will cease to operate correctly if you use either multiple or
// public virtual inheritance.
-/*
-** DEPENDENCIES: utl_list.hh, ast_exception.hh
-**
-** USE: Included from util.hh
-*/
-
class TAO_IDL_FE_Export UTL_ExceptList : public UTL_List
{
public:
- // Operations
+ UTL_ExceptList (AST_Exception *s,
+ UTL_ExceptList *cdr);
- // Constructor(s)
- UTL_ExceptList(AST_Exception *s, UTL_ExceptList *cdr);
-
- // Get list item
- AST_Exception *head();
+ // Get list item.
+ AST_Exception *head (void);
private:
- // Data
- AST_Exception *pd_car_data; // Item of this list
+ // Data.
+ AST_Exception *pd_car_data;
};
-// Active iterator for UTL_ExceptList
+// Active iterator for UTL_ExceptList.
class TAO_IDL_FE_Export UTL_ExceptlistActiveIterator
: public UTL_ListActiveIterator
{
public:
- // Operations
-
- // Constructor(s)
- UTL_ExceptlistActiveIterator(UTL_ExceptList *s);
+ UTL_ExceptlistActiveIterator (UTL_ExceptList *s);
// Get current item
- AST_Exception *item();
+ AST_Exception *item (void);
};
#endif // _UTL_EXCEPTLIST_UTL_EXCEPTLIST_HH
diff --git a/TAO/TAO_IDL/include/utl_exprlist.h b/TAO/TAO_IDL/include/utl_exprlist.h
index 11e2aec397a..53e09c7a500 100644
--- a/TAO/TAO_IDL/include/utl_exprlist.h
+++ b/TAO/TAO_IDL/include/utl_exprlist.h
@@ -62,14 +62,16 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
#ifndef _UTL_EXPRLIST_UTL_EXPRLIST_HH
#define _UTL_EXPRLIST_UTL_EXPRLIST_HH
-// utl_exprlist.hh
-//
-// List of strings
+#include "utl_list.h"
+
+class AST_Expression;
+
+// List of expressions.
// NOTE: This list class only works correctly because we use single public
// inheritance, as opposed to multiple inheritance or public virtual.
@@ -77,39 +79,28 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// will cease to operate correctly if you use either multiple or
// public virtual inheritance.
-/*
-** DEPENDENCIES: ast_expression.hh, utl_list.hh
-**
-** USE: Included from util.hh
-*/
-
class TAO_IDL_FE_Export UTL_ExprList : public UTL_List
{
public:
- // Operations
+ UTL_ExprList (AST_Expression *s,
+ UTL_ExprList *cdr);
- // Constructor(s)
- UTL_ExprList(AST_Expression *s, UTL_ExprList *cdr);
-
- // Get list item
- AST_Expression *head();
+ // Get list item.
+ AST_Expression *head (void);
private:
- // Data
- AST_Expression *pd_car_data; // List item
+ // Data.
+ AST_Expression *pd_car_data;
};
-// Active iterator for UTL_ExprList
+// Active iterator for UTL_ExprList.
class UTL_ExprlistActiveIterator : public UTL_ListActiveIterator
{
public:
- // Operations
-
- // Constructor(s)
- UTL_ExprlistActiveIterator(UTL_ExprList *s);
+ UTL_ExprlistActiveIterator (UTL_ExprList *s);
- // Get current item
- AST_Expression *item();
+ // Get current item.
+ AST_Expression *item (void);
};
#endif // _UTL_EXPRLIST_UTL_EXPRLIST_HH
diff --git a/TAO/TAO_IDL/include/utl_identifier.h b/TAO/TAO_IDL/include/utl_identifier.h
index 05a82fb4605..5aef90772af 100644
--- a/TAO/TAO_IDL/include/utl_identifier.h
+++ b/TAO/TAO_IDL/include/utl_identifier.h
@@ -67,29 +67,20 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _UTL_IDENTIFIER_UTL_IDENTIFIER_HH
#define _UTL_IDENTIFIER_UTL_IDENTIFIER_HH
-// utl_identifier.hh
-//
-// Identifier
-
-/*
-** DEPENDENCIES: utl_string.hh
-**
-** USE: Included from util.hh
-*/
-
-#include "idl_fwd.h"
-#include "utl_string.h"
+#include "ace/OS.h"
+#include "TAO_IDL_FE_Export.h"
+#include "idl_bool.h"
class TAO_IDL_FE_Export Identifier
{
public:
- Identifier ();
+ Identifier (void);
// Default Constructor.
Identifier (const char *s);
// Constructor.
- virtual ~Identifier ();
+ virtual ~Identifier (void);
// Destructor.
// Operations
@@ -115,7 +106,7 @@ public:
idl_bool escaped (void) const;
// Accessor for the member.
- virtual void dump (ACE_OSTREAM_TYPE &o);
+ virtual void dump (ACE_OSTREAM_TYPE &o);
// Dump to an ostream.
virtual void destroy (void);
diff --git a/TAO/TAO_IDL/include/utl_idlist.h b/TAO/TAO_IDL/include/utl_idlist.h
index 11113a51807..92a38e297cc 100644
--- a/TAO/TAO_IDL/include/utl_idlist.h
+++ b/TAO/TAO_IDL/include/utl_idlist.h
@@ -67,8 +67,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _UTL_IDLIST_UTL_IDLIST_HH
#define _UTL_IDLIST_UTL_IDLIST_HH
-// utl_idlist.hh
-//
// List of Identifiers
// NOTE: This list class only works correctly because we use single public
@@ -77,16 +75,11 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// will cease to operate correctly if you use either multiple or
// public virtual inheritance.
-/*
-** DEPENDENCIES: utl_list.hh, utl_identifier.hh
-**
-** USE: Included from util.hh
-*/
+#include "TAO_IDL_FE_Export.h"
+#include "utl_list.h"
+#include "ace/OS.h"
-#include "idl_fwd.h"
-#include "utl_list.h"
-#include "utl_identifier.h"
-#include "utl_string.h"
+class Identifier;
class TAO_IDL_FE_Export UTL_IdList : public UTL_List
{
@@ -100,32 +93,34 @@ public:
UTL_IdList *cdr);
// Constructor(s)
- virtual ~UTL_IdList() {}
+ virtual ~UTL_IdList (void) {}
// destructor
- // =AST Dumping
-
virtual void dump (ACE_OSTREAM_TYPE &o);
- // dump to ostream
+ // Dump to ostream.
virtual void destroy (void);
// Cleanup function.
- // Other operations
+ UTL_List *copy (void);
+ // Copy the list.
- UTL_List *copy ();
- // Copy the list
+ Identifier *head (void);
+ // Get element.
- Identifier *head ();
- // get element
+ Identifier *last_component (void);
+ // Get last element in this list.
- Identifier *last_component ();
- // Get last element in this list
+ Identifier *first_component (void);
+ // Get first element in this list holding a non-empty string.
+
+ int compare (UTL_IdList *other);
+ // Compares each component for equality.
private:
Identifier *pd_car_data;
};
-// Active iterator for UTL_IdList
+// Active iterator for UTL_IdList.
class TAO_IDL_FE_Export UTL_IdListActiveIterator
: public UTL_ListActiveIterator
@@ -136,10 +131,9 @@ class TAO_IDL_FE_Export UTL_IdListActiveIterator
// Iterator for the IDList
public:
UTL_IdListActiveIterator (UTL_IdList *s);
- // Constructor(s)
- Identifier *item ();
- // retrieves the next item
+ Identifier *item (void);
+ // Retrieves the next item.
};
#endif // _UTL_IDLIST_UTL_IDLIST_HH
diff --git a/TAO/TAO_IDL/include/utl_indenter.h b/TAO/TAO_IDL/include/utl_indenter.h
index e50edd3681b..451fffe6417 100644
--- a/TAO/TAO_IDL/include/utl_indenter.h
+++ b/TAO/TAO_IDL/include/utl_indenter.h
@@ -62,22 +62,16 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
#ifndef _UTL_INDENTER_UTL_INDENTER_HH
#define _UTL_INDENTER_UTL_INDENTER_HH
-// UTL indenter:
-//
+#include "ace/OS.h"
+
// Utility class for control of indentation level during dumping
// May also be useful for BEs that want to produce nicely formatted
-// output
-
-/*
-** DEPENDENCIES: NONE
-**
-** USE: in CFE in dumping the AST
-*/
+// output.
class UTL_Indenter
{
@@ -86,32 +80,28 @@ class UTL_Indenter
// =DESCRIPTION
// useful in generating indented output
public:
- // Operations
-
- UTL_Indenter(); // constructor
- // Constructor(s)
+ UTL_Indenter (void);
- virtual ~UTL_Indenter() {}
- // destructor
+ ~UTL_Indenter (void) {}
- void reset();
- // Reset indentation level to 0
+ void reset (void);
+ // Reset indentation level to 0.
- void increase();
- // Increase indentation level
+ void increase (void);
+ // Increase indentation level.
- void decrease();
- // Decrease indentation level
+ void decrease (void);
+ // Decrease indentation level.
void skip_to (ACE_OSTREAM_TYPE &o);
- // Skip to indentation level stop
+ // Skip to indentation level stop.
void skip_to (FILE *fp);
- // skip to indentation level stop
+ // skip to indentation level stop.
private:
- // Data
- long pd_indent_level; // How far to indent
+ // How far to indent.
+ long pd_indent_level;
};
#endif // _UTL_INDENTER_UTL_INDENTER_HH
diff --git a/TAO/TAO_IDL/include/utl_labellist.h b/TAO/TAO_IDL/include/utl_labellist.h
index 5881cdb5013..80b8d8d505f 100644
--- a/TAO/TAO_IDL/include/utl_labellist.h
+++ b/TAO/TAO_IDL/include/utl_labellist.h
@@ -62,14 +62,16 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
#ifndef _UTL_LABELLIST_UTL_LABELLIST_HH
#define _UTL_LABELLIST_UTL_LABELLIST_HH
-// utl_labellist.hh
-//
-// List of AST_UnionBranch nodes
+#include "utl_list.h"
+
+class AST_UnionLabel;
+
+// List of AST_UnionBranch nodes.
// NOTE: This list class only works correctly because we use single public
// inheritance, as opposed to multiple inheritance or public virtual.
@@ -77,39 +79,27 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// will cease to operate correctly if you use either multiple or
// public virtual inheritance.
-/*
-** DEPENDENCIES: utl_list.hh, ast_union_label.hh
-**
-** USE: Included from util.hh
-*/
-
class TAO_IDL_FE_Export UTL_LabelList : public UTL_List
{
public:
- // Operations
+ UTL_LabelList (AST_UnionLabel *s,
+ UTL_LabelList *cdr);
- // Constructor(s)
- UTL_LabelList(AST_UnionLabel *s, UTL_LabelList *cdr);
-
- // Get list item
- AST_UnionLabel *head();
+ // Get list item.
+ AST_UnionLabel *head (void);
private:
- // Data
- AST_UnionLabel *pd_car_data; // List item
+ AST_UnionLabel *pd_car_data;
};
-// Active iterator for UTL_LabelList
+// Active iterator for UTL_LabelList.
class UTL_LabellistActiveIterator : public UTL_ListActiveIterator
{
public:
- // Operations
-
- // Constructor(s)
- UTL_LabellistActiveIterator(UTL_LabelList *source);
+ UTL_LabellistActiveIterator (UTL_LabelList *source);
- // Get current item
- AST_UnionLabel *item();
+ // Get current item.
+ AST_UnionLabel *item (void);
};
#endif // _UTL_LABELLIST_UTL_LABELLIST_HH
diff --git a/TAO/TAO_IDL/include/utl_list.h b/TAO/TAO_IDL/include/utl_list.h
index b66cca0b739..98e9952d3a4 100644
--- a/TAO/TAO_IDL/include/utl_list.h
+++ b/TAO/TAO_IDL/include/utl_list.h
@@ -67,15 +67,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _UTL_LIST_UTL_LIST_HH
#define _UTL_LIST_UTL_LIST_HH
-// utl_list.hh
-//
-// General single-linked lists
-
-/*
-** DEPENDENCIES: NONE
-**
-** USE: Included from util.hh
-*/
+// General single-linked list.
// NOTE: This list class only works correctly because we use single public
// inheritance, as opposed to multiple inheritance or public virtual.
@@ -83,64 +75,63 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// will cease to operate correctly if you use either multiple or
// public virtual inheritance.
-// Forward declare active iterator for UTL_List
-class UTL_ListActiveIterator;
+#include "TAO_IDL_FE_Export.h"
+#include "idl_bool.h"
+
+// Forward declare active iterator for UTL_List.
+class UTL_ListActiveIterator;
class TAO_IDL_FE_Export UTL_List
{
public:
- // Operations
-
- // Constructor
UTL_List (UTL_List *c);
- // Destructor
virtual ~UTL_List (void);
- // Smash last cdr pointer in "this" with l
+ // Smash last cdr pointer in "this" with l.
void nconc (UTL_List *l);
- // Copy the list starting at "this"
- virtual UTL_List *copy ();
+ // Copy the list starting at "this".
+ virtual UTL_List *copy (void);
- // Get next list
- UTL_List *tail ();
+ // Get next list.
+ UTL_List *tail (void);
// Set next list
void set_tail (UTL_List *l);
// How long is this list?
- long length ();
+ long length (void);
+
+ // Cleanup.
+ virtual void destroy (void);
private:
- // Data
- UTL_List *pd_cdr_data; // The next list
+ // The next list.
+ UTL_List *pd_cdr_data;
// Operations
- long list_length (long n); // How long is it?
+ long list_length (long n);
- // Friend class
- friend class UTL_ListActiveIterator; // Friend class
+ // Friend class.
+ friend class UTL_ListActiveIterator;
};
-// Active iterator for lists
+// Active iterator for lists.
class TAO_IDL_FE_Export UTL_ListActiveIterator
{
public:
- // Operations
-
- // Constructor(s)
UTL_ListActiveIterator (UTL_List *s);
- // Get next list
- virtual void next ();
+ // Get next list.
+ virtual void next (void);
// Are we at the end of this list?
- virtual long is_done ();
+ virtual idl_bool is_done (void);
protected:
- // Data
- UTL_List *source; // On what to iterate?
+ // On what to iterate?
+ UTL_List *source;
};
#endif // _UTL_LIST_UTL_LIST_HH
diff --git a/TAO/TAO_IDL/include/utl_namelist.h b/TAO/TAO_IDL/include/utl_namelist.h
index 198b5c5c002..193fa38bab5 100644
--- a/TAO/TAO_IDL/include/utl_namelist.h
+++ b/TAO/TAO_IDL/include/utl_namelist.h
@@ -62,14 +62,14 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
#ifndef _UTL_NAMELIST_UTL_NAMELIST_HH
#define _UTL_NAMELIST_UTL_NAMELIST_HH
-// utl_namelist.hh
-//
-// List of UTL_ScopedName nodes
+#include "utl_scoped_name.h"
+
+// List of UTL_ScopedName nodes.
// NOTE: This list class only works correctly because we use single public
// inheritance, as opposed to multiple inheritance or public virtual.
@@ -77,39 +77,28 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// will cease to operate correctly if you use either multiple or
// public virtual inheritance.
-/*
-** DEPENDENCIES: utl_list.hh, utl_scoped_name.hh
-**
-** USE: Included from util.hh
-*/
-
class TAO_IDL_FE_Export UTL_NameList : public UTL_List
{
public:
- // Operations
-
- // Constructor(s)
- UTL_NameList(UTL_ScopedName *s, UTL_NameList *cdr);
+ UTL_NameList (UTL_ScopedName *s,
+ UTL_NameList *cdr);
- // Get list item
- UTL_ScopedName *head();
+ // Get list item.
+ UTL_ScopedName *head (void);
private:
- // Data
- UTL_ScopedName *pd_car_data; // List item
+ // List item.
+ UTL_ScopedName *pd_car_data;
};
-// Active iterator for UTL_NameList
+// Active iterator for UTL_NameList.
class UTL_NamelistActiveIterator : public UTL_ListActiveIterator
{
public:
- // Operations
-
- // Constructor(s)
- UTL_NamelistActiveIterator(UTL_NameList *source);
+ UTL_NamelistActiveIterator (UTL_NameList *source);
- // Get current item
- UTL_ScopedName *item();
+ // Get current item.
+ UTL_ScopedName *item (void);
};
#endif // _UTL_NAMELIST_UTL_NAMELIST_HH
diff --git a/TAO/TAO_IDL/include/utl_scope.h b/TAO/TAO_IDL/include/utl_scope.h
index 835342e9715..a40cc055387 100644
--- a/TAO/TAO_IDL/include/utl_scope.h
+++ b/TAO/TAO_IDL/include/utl_scope.h
@@ -81,15 +81,44 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// the responsibility of those functions then to call the add()
// function defined in the parent "AST_" class.
-#include "idl_fwd.h"
-#include "idl_narrow.h"
#include "ast_decl.h"
#include "ast_expression.h"
+#include "ast_typedef.h"
#include "utl_scoped_name.h"
// This is for AIX w/IBM C++.
class Identifier;
+class AST_PredefinedType;
+class AST_Module;
+class AST_Interface;
+class AST_InterfaceFwd;
+class AST_ValueType;
+class AST_ValueTypeFwd;
+class AST_Component;
+class AST_ComponentFwd;
+class AST_Home;
+class AST_Constant;
+class AST_Exception;
+class AST_Attribute;
+class AST_Operation;
+class AST_Argument;
+class AST_Union;
+class AST_UnionFwd;
+class AST_UnionBranch;
+class AST_Structure;
+class AST_StructureFwd;
+class AST_Field;
+class AST_Enum;
+class AST_EnumVal;
+class AST_Sequence;
+class AST_String;
+class AST_Array;
+class AST_Native;
+class AST_Factory;
+class UTL_StrList;
+class UTL_NameList;
+
// Forward declaration of active iterator for UTL_Scope.
class UTL_ScopeActiveIterator;
@@ -121,6 +150,16 @@ public:
virtual AST_InterfaceFwd *add_interface_fwd (AST_InterfaceFwd *i);
+ virtual AST_ValueType *add_valuetype (AST_ValueType *i);
+
+ virtual AST_ValueTypeFwd *add_valuetype_fwd (AST_ValueTypeFwd *i);
+
+ virtual AST_Component *add_component (AST_Component *i);
+
+ virtual AST_ComponentFwd *add_component_fwd (AST_ComponentFwd *i);
+
+ virtual AST_Home *add_home (AST_Home *i);
+
virtual AST_Constant *add_constant (AST_Constant *c);
virtual AST_Exception *add_exception (AST_Exception *e);
@@ -133,10 +172,14 @@ public:
virtual AST_Union *add_union (AST_Union *u);
+ virtual AST_UnionFwd *add_union_fwd (AST_UnionFwd *u);
+
virtual AST_UnionBranch *add_union_branch (AST_UnionBranch *b);
virtual AST_Structure *add_structure (AST_Structure *s);
+ virtual AST_StructureFwd *add_structure_fwd (AST_StructureFwd *s);
+
virtual AST_Field *add_field (AST_Field *f);
virtual AST_Enum *add_enum (AST_Enum *e);
@@ -178,22 +221,22 @@ public:
// Other Operations.
// Name Lookup Mechanism
- virtual AST_Decl *lookup_by_name (UTL_ScopedName *,
- idl_bool treat_as_ref,
- idl_bool in_parent = 1);
+ AST_Decl *lookup_by_name (UTL_ScopedName *,
+ idl_bool treat_as_ref,
+ idl_bool in_parent = 1);
// Look up the Identifier * specified only in the local scope.
- virtual AST_Decl *lookup_by_name_local (Identifier *,
- long index);
+ AST_Decl *lookup_by_name_local (Identifier *,
+ long index);
// Look up a predefined type by its ExprType.
- virtual AST_Decl *lookup_primitive_type (AST_Expression::ExprType);
+ AST_Decl *lookup_primitive_type (AST_Expression::ExprType);
// Look up one of the pseudo-object types.
AST_Decl *lookup_pseudo (Identifier *);
// How many entries are used?
- virtual unsigned long nmembers (void);
+ unsigned long nmembers (void);
// Add to decls. Node represents a local declaration
// The new decl e is inserted after ex if ex is not 0.
@@ -248,13 +291,17 @@ protected:
virtual AST_Decl *look_in_inherited (UTL_ScopedName *,
idl_bool treat_as_ref);
// Lookup based on the local name.
- virtual AST_Decl *lookup_for_add (AST_Decl *d,
- idl_bool treat_as_ref);
+ AST_Decl *lookup_for_add (AST_Decl *d,
+ idl_bool treat_as_ref);
// Is there a (case-insensitive) clash between a local name
// and an IDL keyword?
int idl_keyword_clash (Identifier *e);
+ // Checks for modules, or defns of forward declared struct or unions.
+ idl_bool redef_clash (AST_Decl::NodeType new_nt,
+ AST_Decl::NodeType scope_elem_nt);
+
private:
// Data.
@@ -302,9 +349,19 @@ private:
virtual AST_Interface *fe_add_interface (AST_Interface *i);
- virtual AST_InterfaceFwd *fe_add_interface_fwd (AST_InterfaceFwd *i);
+ virtual AST_InterfaceFwd *fe_add_interface_fwd (AST_InterfaceFwd *i);
+
+ virtual AST_ValueType *fe_add_valuetype (AST_ValueType *i);
- virtual AST_Constant *fe_add_constant (AST_Constant *c);
+ virtual AST_ValueTypeFwd *fe_add_valuetype_fwd (AST_ValueTypeFwd *i);
+
+ virtual AST_Component *fe_add_component (AST_Component *i);
+
+ virtual AST_ComponentFwd *fe_add_component_fwd (AST_ComponentFwd *i);
+
+ virtual AST_Home *fe_add_home (AST_Home *i);
+
+ virtual AST_Constant *fe_add_constant (AST_Constant *i);
virtual AST_Exception *fe_add_exception (AST_Exception *e);
@@ -316,10 +373,14 @@ private:
virtual AST_Union *fe_add_union (AST_Union *u);
+ virtual AST_UnionFwd *fe_add_union_fwd (AST_UnionFwd *u);
+
virtual AST_UnionBranch *fe_add_union_branch (AST_UnionBranch *b);
virtual AST_Structure *fe_add_structure (AST_Structure *s);
+ virtual AST_StructureFwd *fe_add_structure_fwd (AST_StructureFwd *s);
+
virtual AST_Field *fe_add_field (AST_Field *f);
virtual AST_Enum *fe_add_enum (AST_Enum *e);
@@ -354,27 +415,32 @@ public:
UTL_Scope::ScopeIterationKind ik);
// Advance to next item.
- virtual void next (void);
+ void next (void);
// Get current item.
- virtual AST_Decl *item (void);
+ AST_Decl *item (void);
// Have we iterated over entire scope?
- virtual idl_bool is_done (void);
+ idl_bool is_done (void);
// What kind of iterator is this?
- virtual UTL_Scope::ScopeIterationKind iteration_kind (void);
+ UTL_Scope::ScopeIterationKind iteration_kind (void);
// What stage are we in with this iterator?
- virtual UTL_Scope::ScopeIterationKind iteration_stage (void);
+ UTL_Scope::ScopeIterationKind iteration_stage (void);
private:
- // Data.
+ // Scope to iterate over.
+ UTL_Scope *iter_source;
+
+ // What kind of iteration?
+ UTL_Scope::ScopeIterationKind ik;
+
+ // What stage?
+ UTL_Scope::ScopeIterationKind stage;
- UTL_Scope *iter_source; // Scope to iterate over
- UTL_Scope::ScopeIterationKind ik; // What kind of iteration
- UTL_Scope::ScopeIterationKind stage; // What stage
- long il; // What location in stage
+ // What location in stage?
+ long il;
};
#endif // _UTL_SCOPE_UTL_SCOPE_HH
diff --git a/TAO/TAO_IDL/include/utl_scoped_name.h b/TAO/TAO_IDL/include/utl_scoped_name.h
index 2cdc381bf2f..9cb63b6d043 100644
--- a/TAO/TAO_IDL/include/utl_scoped_name.h
+++ b/TAO/TAO_IDL/include/utl_scoped_name.h
@@ -67,16 +67,11 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _AST_SCOPED_NAME_AST_SCOPED_NAME_HH
#define _AST_SCOPED_NAME_AST_SCOPED_NAME_HH
-// Define UTL_ScopedName as a list of strings
+#include "utl_idlist.h"
-/*
-** DEPENDENCIES: utl_strlist.hh
-**
-** USE: Included from ast.hh
-*/
-
-typedef UTL_IdList UTL_ScopedName;
+// Define UTL_ScopedName as a list of strings.
-typedef UTL_IdListActiveIterator UTL_ScopedNameActiveIterator;
+typedef UTL_IdList UTL_ScopedName;
+typedef UTL_IdListActiveIterator UTL_ScopedNameActiveIterator;
#endif // _AST_SCOPED_NAME_AST_SCOPED_NAME_HH
diff --git a/TAO/TAO_IDL/include/utl_stack.h b/TAO/TAO_IDL/include/utl_stack.h
index 91418c4fe50..e7084338265 100644
--- a/TAO/TAO_IDL/include/utl_stack.h
+++ b/TAO/TAO_IDL/include/utl_stack.h
@@ -62,89 +62,85 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
#ifndef _UTL_STACK_UTL_STACK_HH
#define _UTL_STACK_UTL_STACK_HH
-// utl_stack.hh - Defines the UTL_ScopeStack class - a stack of scopes
-//
-// UTL_ScopeStack implements scope nesting
+#include "TAO_IDL_FE_Export.h"
-/*
-** DEPENDENCIES: utl_scope.hh
-**
-** USE: Included from util.hh
-*/
+class UTL_Scope;
-// Forward declaration of active iterator for UTL_ScopeStack
-class UTL_ScopeStackActiveIterator;
+// UTL_ScopeStack implements scope nesting.
+
+// Forward declaration of active iterator for UTL_ScopeStack.
+class UTL_ScopeStackActiveIterator;
class TAO_IDL_FE_Export UTL_ScopeStack
{
public:
- // Operations
-
- // Constructor and destructor
- UTL_ScopeStack();
- virtual ~UTL_ScopeStack();
+ UTL_ScopeStack (void);
+ ~UTL_ScopeStack (void);
- // Return top element
- virtual UTL_Scope *top();
+ // Return top element.
+ UTL_Scope *top (void);
- // Pop top element
- virtual void pop();
+ // Pop top element.
+ void pop (void);
- // Clear entire stack
- virtual void clear();
+ // Clear entire stack.
+ void clear (void);
- // Push an element on the stack and return stack
- virtual UTL_ScopeStack *push(UTL_Scope *el);
+ // Push an element on the stack and return stack.
+ UTL_ScopeStack *push (UTL_Scope *el);
// How deep is the stack now?
- virtual unsigned long depth();
+ unsigned long depth (void);
- // Return bottom element
- virtual UTL_Scope *bottom();
+ // Return bottom element.
+ UTL_Scope *bottom (void);
- // Return (top - 1) element
- virtual UTL_Scope *next_to_top();
+ // Return (top - 1) element.
+ UTL_Scope *next_to_top (void);
- // return topmost non-NULL element
- virtual UTL_Scope *top_non_null();
+ // return topmost non-NULL element.
+ UTL_Scope *top_non_null (void);
private:
- // Data
- UTL_Scope **pd_stack_data; // Store scopes stack
- unsigned long pd_stack_data_nalloced; // How many allocated?
- unsigned long pd_stack_top; // How many used?
+ // Store scopes stack
+ UTL_Scope **pd_stack_data;
- // Friend active iterator class for UTL_ScopeStack
- friend class UTL_ScopeStackActiveIterator;
+ // How many allocated?
+ unsigned long pd_stack_data_nalloced;
+
+ // How many used?
+ unsigned long pd_stack_top;
+
+ // Friend active iterator class for UTL_ScopeStack.
+ friend class UTL_ScopeStackActiveIterator;
};
-// Active iterator for UTL_ScopeStack
+// Active iterator for UTL_ScopeStack.
class TAO_IDL_FE_Export UTL_ScopeStackActiveIterator
{
public:
- // Operations
+ UTL_ScopeStackActiveIterator (UTL_ScopeStack &s);
- // Constructor
- UTL_ScopeStackActiveIterator(UTL_ScopeStack *s);
+ // Advance to next element.
+ void next (void);
- // Advance to next element
- virtual void next();
-
- // Get current item
- virtual UTL_Scope *item();
+ // Get current item.
+ UTL_Scope*item (void);
// Is the iteration finished?
- virtual long is_done();
+ long is_done (void);
private:
- // Data
- UTL_ScopeStack *source; // On what to iterate?
- long il; // Where are we in iteration?
+ // On what to iterate?
+ UTL_ScopeStack &source;
+
+ // Where are we in iteration?
+ long il;
};
#endif // _UTL_STACK_UTL_STACK_HH
diff --git a/TAO/TAO_IDL/include/utl_string.h b/TAO/TAO_IDL/include/utl_string.h
index b64dd3b7b36..e6aa8be7946 100644
--- a/TAO/TAO_IDL/include/utl_string.h
+++ b/TAO/TAO_IDL/include/utl_string.h
@@ -62,18 +62,14 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
#ifndef _STRING_STRING_HH
#define _STRING_STRING_HH
-// utl_string.hh - contains a quick and dirty TEMPORARY string implementation
-
-/*
-** DEPENDENCIES: NONE
-**
-** USE: Included from util.hh
-*/
+#include "TAO_IDL_FE_Export.h"
+#include "idl_bool.h"
+#include "ace/OS.h"
class TAO_IDL_FE_Export UTL_String
{
@@ -82,27 +78,17 @@ class TAO_IDL_FE_Export UTL_String
// =DESCRIPTION
// string class to store identifiers
public:
- // =Operations
-
UTL_String (void);
- // Default constructor.
UTL_String (const char *str);
- // Construct from a const char *.
UTL_String (UTL_String *s);
- // Copy constructor.
-
- virtual ~UTL_String (void);
- // Destructor.
- // =AST Dumping.
+ ~UTL_String (void);
virtual void dump (ACE_OSTREAM_TYPE &o);
// Dump to the ostream.
- // =Other Operations
-
char *get_string (void);
// Get contents of utl_string.
@@ -110,10 +96,10 @@ public:
// Get canonical representation. This is (implemented as) the all upper
// case corresponding string.
- virtual long compare (UTL_String *s);
+ idl_bool compare (UTL_String *s);
// Compare two UTL_String *
- virtual long compare_quiet (UTL_String *s);
+ long compare_quiet (UTL_String *s);
// Like the above but without error or warning message output.
virtual void destroy (void);
@@ -130,8 +116,6 @@ private:
unsigned long len;
// How long is string.
- // =Private helper operations.
-
void canonicalize (void);
// Compute canonical representation.
};
diff --git a/TAO/TAO_IDL/include/utl_strlist.h b/TAO/TAO_IDL/include/utl_strlist.h
index eb9ca3e4291..9a4a02cab9f 100644
--- a/TAO/TAO_IDL/include/utl_strlist.h
+++ b/TAO/TAO_IDL/include/utl_strlist.h
@@ -62,14 +62,17 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
#ifndef _UTL_STRLIST_UTL_STRLIST_HH
#define _UTL_STRLIST_UTL_STRLIST_HH
-// utl_strlist.hh
-//
-// List of String nodes
+#include "utl_list.h"
+#include "ace/OS.h"
+
+class UTL_String;
+
+// List of String nodes.
// NOTE: This list class only works correctly because we use single public
// inheritance, as opposed to multiple inheritance or public virtual.
@@ -77,46 +80,35 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// will cease to operate correctly if you use either multiple or
// public virtual inheritance.
-/*
-** DEPENDENCIES: utl_list.hh, utl_string.hh
-**
-** USE: Included from util.hh
-*/
-
class TAO_IDL_FE_Export UTL_StrList : public UTL_List
{
public:
- // Operations
-
- // Constructor
- UTL_StrList(UTL_String *s, UTL_StrList *cdr);
+ UTL_StrList (UTL_String *s,
+ UTL_StrList *cdr);
- // Destructor
virtual ~UTL_StrList (void);
// AST Dumping
- virtual void dump(ACE_OSTREAM_TYPE &o);
-
- // Other Operations
+ virtual void dump (ACE_OSTREAM_TYPE &o);
// Copy a list of strings
- virtual UTL_List *copy();
+ virtual UTL_List *copy (void);
// Cleanup method.
virtual void destroy (void);
// Get list element
- UTL_String *head();
+ UTL_String *head (void);
// Set the list element
- void set_head(UTL_String *);
+ void set_head (UTL_String *);
// Get last element in this list
- UTL_String *last_component();
+ UTL_String *last_component (void);
private:
- // Data
- UTL_String *pd_car_data; // The list item
+ // The list item
+ UTL_String *pd_car_data;
};
// Active iterator for UTL_StrList
@@ -124,13 +116,10 @@ class TAO_IDL_FE_Export UTL_StrlistActiveIterator
: public UTL_ListActiveIterator
{
public:
- // Operations
-
- // Constructor(s)
UTL_StrlistActiveIterator(UTL_StrList *s);
- // Get current item
- UTL_String *item();
+ // Get current item.
+ UTL_String *item (void);
};
#endif // _UTL_STRLIST_UTL_STRLIST_HH
diff --git a/TAO/TAO_IDL/narrow/narrow.cpp b/TAO/TAO_IDL/narrow/narrow.cpp
index 2a0e7c7ca49..8d4529547d7 100644
--- a/TAO/TAO_IDL/narrow/narrow.cpp
+++ b/TAO/TAO_IDL/narrow/narrow.cpp
@@ -64,17 +64,26 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
*/
-#include "idl.h"
-#include "idl_extern.h"
-
-ACE_RCSID(narrow, narrow, "$Id$")
+#include "ast_module.h"
+#include "ast_root.h"
+#include "ast_valuetype.h"
+#include "ast_component.h"
+#include "ast_home.h"
+#include "ast_operation.h"
+#include "ast_factory.h"
+#include "ast_exception.h"
+#include "ast_union.h"
+#include "ast_enum.h"
+#include "ast_interface_fwd.h"
+#include "utl_scope.h"
+
+ACE_RCSID (narrow,
+ narrow,
+ "$Id$")
// Narrowing functions for AST
-/*
- * Convert a UTL_Scope node into an AST_Decl node if possible
- */
-AST_Decl *
+TAO_IDL_FE_Export AST_Decl *
ScopeAsDecl (UTL_Scope *s)
{
if (s == 0) return 0;
@@ -87,6 +96,12 @@ ScopeAsDecl (UTL_Scope *s)
return AST_Root::narrow_from_scope (s);
case AST_Decl::NT_interface:
return AST_Interface::narrow_from_scope (s);
+ case AST_Decl::NT_valuetype:
+ return AST_ValueType::narrow_from_scope (s);
+ case AST_Decl::NT_component:
+ return AST_Component::narrow_from_scope (s);
+ case AST_Decl::NT_home:
+ return AST_Home::narrow_from_scope (s);
case AST_Decl::NT_op:
return AST_Operation::narrow_from_scope (s);
case AST_Decl::NT_factory:
@@ -107,7 +122,7 @@ ScopeAsDecl (UTL_Scope *s)
/*
* Convert an AST_Decl to a UTL_Scope if possible
*/
-UTL_Scope *
+TAO_IDL_FE_Export UTL_Scope *
DeclAsScope (AST_Decl *d)
{
if (d == 0) return 0;
@@ -125,6 +140,12 @@ DeclAsScope (AST_Decl *d)
*/
case AST_Decl::NT_interface:
return AST_Interface::narrow_from_decl (d);
+ case AST_Decl::NT_valuetype:
+ return AST_ValueType::narrow_from_decl (d);
+ case AST_Decl::NT_component:
+ return AST_Component::narrow_from_decl (d);
+ case AST_Decl::NT_home:
+ return AST_Home::narrow_from_decl (d);
case AST_Decl::NT_module:
return AST_Module::narrow_from_decl (d);
case AST_Decl::NT_root:
diff --git a/TAO/TAO_IDL/tao_idl.bor b/TAO/TAO_IDL/tao_idl.bor
index f2a7d2e5dba..2ab115690dc 100644
--- a/TAO/TAO_IDL/tao_idl.bor
+++ b/TAO/TAO_IDL/tao_idl.bor
@@ -6,9 +6,7 @@ NAME = tao_idl
OBJFILES = \
$(OBJDIR)\drv_args.obj \
- $(OBJDIR)\drv_init.obj \
$(OBJDIR)\drv_preproc.obj \
- $(OBJDIR)\drv_private.obj \
$(OBJDIR)\tao_idl.obj
CFLAGS = $(ACE_CFLAGS) $(TAO_IDL_FE_CFLAGS) $(TAO_IDL_BE_CFLAGS)
diff --git a/TAO/TAO_IDL/tao_idl.cpp b/TAO/TAO_IDL/tao_idl.cpp
index c83c18c6380..75f30225c44 100644
--- a/TAO/TAO_IDL/tao_idl.cpp
+++ b/TAO/TAO_IDL/tao_idl.cpp
@@ -64,18 +64,37 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
*/
-#include "idl.h"
+#include "idl_defines.h"
+#include "be_codegen.h"
+#include "be_generator.h"
+#include "be_extern.h"
#include "global_extern.h"
#include "fe_extern.h"
-#include "drv_private.h"
+#include "ast_root.h"
+#include "ast_extern.h"
+#include "utl_string.h"
#include "drv_extern.h"
-#include "be.h"
#include "ace/Process.h"
#include "../tao/Version.h"
-ACE_RCSID(TAO_IDL, tao_idl, "$Id$")
+ACE_RCSID (TAO_IDL,
+ tao_idl,
+ "$Id$")
-#define IDL_CFE_VERSION "1.3.0"
+#define IDL_CFE_VERSION "1.3.0"
+
+#if !defined (NFILES)
+# define NFILES 1024
+#endif /* ! NFILES */
+
+const char *DRV_files[NFILES];
+long DRV_nfiles = 0;
+long DRV_file_index = -1;
+
+const size_t LOCAL_ESCAPES_BUFFER_SIZE = 1024;
+
+extern TAO_IDL_BE_Export void BE_produce (void);
+extern TAO_IDL_BE_Export void BE_abort (void);
// Initialize the BE. The protocol requires only that this routine
// return an instance of AST_Generator (or a subclass thereof).
@@ -115,51 +134,60 @@ DRV_version (void)
BE_version ();
}
-// Fork off a process, wait for it to die.
void
-DRV_fork (void)
+DRV_init (void)
{
- for (DRV_file_index = 0;
- DRV_file_index < DRV_nfiles;
- ++DRV_file_index)
- {
- ACE_Process_Options options (1,
- TAO_IDL_COMMAND_LINE_BUFFER_SIZE);
- options.creation_flags (ACE_Process_Options::NO_EXEC);
- options.command_line ("%s %s %s",
- idl_global->prog_name (),
- idl_global->idl_flags (),
- DRV_files[DRV_file_index]);
- ACE_Process manager;
- pid_t child_pid = manager.spawn (options);
-
- if (child_pid == 0)
- {
- // OK, do it to this file (in the child).
- DRV_drive (DRV_files[DRV_file_index]);
- ACE_OS::exit (0);
- }
-
- if (child_pid == ACE_INVALID_PID)
- {
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("IDL: spawn failed\n")));
-
- ACE_OS::exit (99);
- }
-
- // child_pid is the process id of something at this point.
- if (manager.wait () == -1)
- {
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("IDL: wait failed\n")));
-
- ACE_OS::exit (99);
- }
- }
-
- // Now the parent process can exit.
- ACE_OS::exit (0);
+ // Initialize FE global data object.
+ ACE_NEW (idl_global,
+ IDL_GlobalData);
+
+ // Initialize some of its data.
+ idl_global->set_root (0);
+ idl_global->set_gen (0);
+ idl_global->set_err (FE_new_UTL_Error ());
+ idl_global->set_err_count (0);
+ idl_global->set_indent (FE_new_UTL_Indenter ());
+ idl_global->set_filename (0);
+ idl_global->set_main_filename (0);
+ idl_global->set_real_filename (0);
+ idl_global->set_stripped_filename (0);
+ idl_global->set_import (I_TRUE);
+ idl_global->set_in_main_file (I_FALSE);
+ idl_global->set_lineno (-1);
+ idl_global->set_prog_name (0);
+
+#if defined (TAO_IDL_PREPROCESSOR)
+ idl_global->set_cpp_location (TAO_IDL_PREPROCESSOR);
+#elif defined (ACE_CC_PREPROCESSOR)
+ idl_global->set_cpp_location (ACE_CC_PREPROCESSOR);
+#else
+ // Just default to cc
+ idl_global->set_cpp_location ("cc");
+#endif /* TAO_IDL_PREPROCESSOR */
+
+ char local_escapes[LOCAL_ESCAPES_BUFFER_SIZE];
+ ACE_OS::memset (&local_escapes,
+ 0,
+ LOCAL_ESCAPES_BUFFER_SIZE);
+
+ idl_global->set_local_escapes (local_escapes);
+ idl_global->set_be ("");
+ idl_global->set_compile_flags (0);
+ idl_global->set_read_from_stdin (I_FALSE);
+ idl_global->set_include_file_names (0);
+ idl_global->set_n_include_file_names (0);
+ idl_global->set_parse_state (IDL_GlobalData::PS_NoState);
+
+ // Put an empty prefix on the stack for the global scope.
+ idl_global->pragma_prefixes ().push (ACE::strnew (""));
+
+ // Initialize BE global data object.
+ ACE_NEW (be_global,
+ BE_GlobalData);
+
+ // Initialize driver private data
+ DRV_nfiles = 0;
+ DRV_file_index = 0;
}
/*
@@ -167,9 +195,8 @@ DRV_fork (void)
**
** LOGIC:
**
-** 1. Initialize the CFE, stage 1. This builds the scope stack
** 2. Initialize the BE. This builds an instance of the generator
-** 3. Initialize the CFE, stage 2. This builds the global scope
+** 3. Initialize the FE. This builds the global scope
** and populates it with the predefined types
** 4. Invoke FE_yyparse
** 5. Check for errors from FE_yyparse. If any, exit now
@@ -201,9 +228,6 @@ DRV_drive (const char *s)
DRV_pre_proc (s);
- // Initialize FE stage 1.
- FE_init_stage1 ();
-
// Initialize BE.
AST_Generator *gen = BE_init ();
@@ -221,8 +245,8 @@ DRV_drive (const char *s)
idl_global->set_gen (gen);
}
- // Initialize FE stage 2.
- FE_init_stage2 ();
+ // Initialize FE.
+ FE_init ();
// Parse.
if (idl_global->compile_flags () & IDL_CF_INFORMATIVE)
@@ -286,12 +310,72 @@ DRV_drive (const char *s)
s));
}
- BE_produce ();
+ // Make sure all forward declared structs and unions are defined
+ // before proceeding to code generation.
+ AST_check_fwd_decls ();
+ long error_count = idl_global->err_count ();
+
+ if (error_count == 0)
+ {
+ BE_produce ();
+ }
+ else
+ {
+ ACE_OS::exit (ACE_static_cast (int,
+ error_count));
+ }
// Exit cleanly.
ACE_OS::exit (0);
}
+// Fork off a process, wait for it to die.
+void
+DRV_fork (void)
+{
+ for (DRV_file_index = 0;
+ DRV_file_index < DRV_nfiles;
+ ++DRV_file_index)
+ {
+ ACE_Process_Options options (1,
+ TAO_IDL_COMMAND_LINE_BUFFER_SIZE);
+ options.creation_flags (ACE_Process_Options::NO_EXEC);
+ options.command_line ("%s %s %s",
+ idl_global->prog_name (),
+ idl_global->idl_flags (),
+ DRV_files[DRV_file_index]);
+ ACE_Process manager;
+ pid_t child_pid = manager.spawn (options);
+
+ if (child_pid == 0)
+ {
+ // OK, do it to this file (in the child).
+ DRV_drive (DRV_files[DRV_file_index]);
+ ACE_OS::exit (0);
+ }
+
+ if (child_pid == ACE_INVALID_PID)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("IDL: spawn failed\n")));
+
+ ACE_OS::exit (99);
+ }
+
+ // child_pid is the process id of something at this point.
+ if (manager.wait () == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("IDL: wait failed\n")));
+
+ ACE_OS::exit (99);
+ }
+ }
+
+ // Now the parent process can exit.
+ ACE_OS::exit (0);
+}
+
/*
** LOGIC:
**
diff --git a/TAO/TAO_IDL/tao_idl.dsp b/TAO/TAO_IDL/tao_idl.dsp
index 2e26be3d610..a0da8d7ad26 100644
--- a/TAO/TAO_IDL/tao_idl.dsp
+++ b/TAO/TAO_IDL/tao_idl.dsp
@@ -91,18 +91,10 @@ SOURCE=.\driver\drv_args.cpp
# End Source File
# Begin Source File
-SOURCE=.\driver\drv_init.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\driver\drv_preproc.cpp
# End Source File
# Begin Source File
-SOURCE=.\driver\drv_private.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\tao_idl.cpp
# End Source File
# End Group
@@ -113,10 +105,6 @@ SOURCE=.\tao_idl.cpp
SOURCE=.\include\drv_extern.h
# End Source File
-# Begin Source File
-
-SOURCE=.\include\drv_private.h
-# End Source File
# End Group
# End Target
# End Project
diff --git a/TAO/TAO_IDL/tao_idl_static.dsp b/TAO/TAO_IDL/tao_idl_static.dsp
index c703c6b8c26..dbbfba7cb13 100644
--- a/TAO/TAO_IDL/tao_idl_static.dsp
+++ b/TAO/TAO_IDL/tao_idl_static.dsp
@@ -51,7 +51,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:console /machine:I386
-# ADD LINK32 user32.lib advapi32.lib TAO_IDL_BE_LIBs.lib TAO_IDL_FE_LIBs.lib aces.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\..\bin\Release\tao_idl_static.exe" /libpath:"..\..\ace"
+# ADD LINK32 TAO_IDL_BE_LIBs.lib TAO_IDL_FE_LIBs.lib aces.lib advapi32.lib user32.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\..\bin\Release\tao_idl_static.exe" /libpath:"..\..\ace"
# SUBTRACT LINK32 /pdb:none /map
!ELSEIF "$(CFG)" == "TAO_IDL Compiler Static - Win32 Static Debug"
@@ -77,7 +77,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 user32.lib advapi32.lib TAO_IDL_FE_LIBsd.lib TAO_IDL_BE_LIBsd.lib acesd.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\..\bin\tao_idl_static.exe" /pdbtype:sept /libpath:"..\..\ace"
+# ADD LINK32 TAO_IDL_FE_LIBsd.lib TAO_IDL_BE_LIBsd.lib acesd.lib advapi32.lib user32.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\..\bin\tao_idl_static.exe" /pdbtype:sept /libpath:"..\..\ace"
# SUBTRACT LINK32 /pdb:none /nodefaultlib
!ENDIF
@@ -95,18 +95,10 @@ SOURCE=.\driver\drv_args.cpp
# End Source File
# Begin Source File
-SOURCE=.\driver\drv_init.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\driver\drv_preproc.cpp
# End Source File
# Begin Source File
-SOURCE=.\driver\drv_private.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\tao_idl.cpp
# End Source File
# End Group
@@ -117,10 +109,6 @@ SOURCE=.\tao_idl.cpp
SOURCE=.\include\drv_extern.h
# End Source File
-# Begin Source File
-
-SOURCE=.\include\drv_private.h
-# End Source File
# End Group
# End Target
# End Project
diff --git a/TAO/TAO_IDL/util/utl_decllist.cpp b/TAO/TAO_IDL/util/utl_decllist.cpp
index 07031753b60..dd34ce2c344 100644
--- a/TAO/TAO_IDL/util/utl_decllist.cpp
+++ b/TAO/TAO_IDL/util/utl_decllist.cpp
@@ -74,36 +74,48 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// will cease to operate correctly if you use either multiple or
// public virtual inheritance.
-#include "idl.h"
-#include "idl_extern.h"
+#include "utl_decllist.h"
+#include "fe_declarator.h"
-ACE_RCSID(util, utl_decllist, "$Id$")
+ACE_RCSID (util,
+ utl_decllist,
+ "$Id$")
/*
* Constructor(s)
*/
-UTL_DeclList::UTL_DeclList(FE_Declarator *s, UTL_DeclList *cdr)
- : UTL_List(cdr),
- pd_car_data(s)
+UTL_DeclList::UTL_DeclList (FE_Declarator *s,
+ UTL_DeclList *cdr)
+ : UTL_List(cdr),
+ pd_car_data(s)
{
}
/*
- * Private operations
- */
-
-/*
* Public operations
*/
// Get list item
FE_Declarator *
-UTL_DeclList::head()
+UTL_DeclList::head (void)
{
return pd_car_data;
}
+void
+UTL_DeclList::destroy (void)
+{
+ if (this->pd_car_data != 0)
+ {
+ this->pd_car_data->destroy ();
+ delete this->pd_car_data;
+ this->pd_car_data = 0;
+ }
+
+ this->UTL_List::destroy ();
+}
+
/*
* Redefinition of inherited virtual operations
*/
@@ -115,7 +127,7 @@ UTL_DeclList::head()
*/
UTL_DecllistActiveIterator::UTL_DecllistActiveIterator (UTL_DeclList *s)
- : UTL_ListActiveIterator(s)
+ : UTL_ListActiveIterator (s)
{
}
@@ -129,14 +141,14 @@ UTL_DecllistActiveIterator::UTL_DecllistActiveIterator (UTL_DeclList *s)
// Get current item
FE_Declarator *
-UTL_DecllistActiveIterator::item()
+UTL_DecllistActiveIterator::item (void)
{
if (source == 0)
{
return 0;
}
- return ((UTL_DeclList *) source)->head();
+ return ((UTL_DeclList *) source)->head ();
}
/*
diff --git a/TAO/TAO_IDL/util/utl_err.cpp b/TAO/TAO_IDL/util/utl_err.cpp
index e22053dac0d..d27dd86cef4 100644
--- a/TAO/TAO_IDL/util/utl_err.cpp
+++ b/TAO/TAO_IDL/util/utl_err.cpp
@@ -67,24 +67,25 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// utl_err.cc - Implementation of error reporting object for IDL
// compiler program
-#include "idl.h"
-#include "idl_extern.h"
-
-ACE_RCSID(util, utl_err, "$Id$")
-
-#if defined(ACE_GCC_HONORS_STD_NAMESPACE) && (ACE_GCC_HONORS_STD_NAMESPACE == 1)
+#include "utl_err.h"
+#include "utl_identifier.h"
+#include "utl_string.h"
+#include "global_extern.h"
+#include "nr_extern.h"
+#include "ast_interface.h"
+#include "ast_enum.h"
+#include "ast_union.h"
+#include "ast_union_label.h"
+
+ACE_RCSID (util,
+ utl_err,
+ "$Id$")
+
+#if defined (ACE_GCC_HONORS_STD_NAMESPACE) \
+ && (ACE_GCC_HONORS_STD_NAMESPACE == 1)
using std::cerr;
#endif
-
-/*
- * Helper functions to do:
- *
- * - Convert an error code to an error string
- * - Print out an error message header
- * - Convert an ExprType to a string
- */
-
// Convert an error code into a const char *
static const char *
error_string (UTL_Error::ErrorCode c)
@@ -115,12 +116,18 @@ error_string (UTL_Error::ErrorCode c)
return "version already set by #pragma version or #pragma id, ";
case UTL_Error::EIDL_ID_RESET:
return "cannot reset id to a different string, ";
+ case UTL_Error::EIDL_TYPEID_RESET:
+ return "repo id already set by previous call to 'typeid', ";
+ case UTL_Error::EIDL_INVALID_TYPEID:
+ return "'typeid' may not be applied to this type, ";
+ case UTL_Error::EIDL_INVALID_TYPEPREFIX:
+ return "'typeprefix' may not be applied to this type, ";
case UTL_Error::EIDL_DISC_TYPE:
return "union with illegal discriminator type, ";
case UTL_Error::EIDL_LABEL_TYPE:
return "label type incompatible with union discriminator type, ";
case UTL_Error::EIDL_ILLEGAL_ADD:
- return "illegal add operation, ";
+ return "forward declared type may be used only as a sequence element, ";
case UTL_Error::EIDL_ILLEGAL_USE:
return "illegal type used in expression, ";
case UTL_Error::EIDL_ILLEGAL_RAISES:
@@ -128,16 +135,31 @@ error_string (UTL_Error::ErrorCode c)
case UTL_Error::EIDL_ILLEGAL_CONTEXT:
return "error in context(..) clause, ";
case UTL_Error::EIDL_CANT_INHERIT:
+ // More intelligible message printed by error routine.
+ return "";
+ case UTL_Error::EIDL_CANT_SUPPORT:
+ // More intelligible message printed by error routine.
return "";
case UTL_Error::EIDL_LOOKUP_ERROR:
return "error in lookup of symbol: ";
case UTL_Error::EIDL_INHERIT_FWD_ERROR:
- /* More intelligible message printed by error routine */
+ // More intelligible message printed by error routine.
+ return "";
+ case UTL_Error::EIDL_SUPPORTS_FWD_ERROR:
+ // More intelligible message printed by error routine.
return "";
case UTL_Error::EIDL_CONSTANT_EXPECTED:
return "constant expected: ";
+ case UTL_Error::EIDL_INTERFACE_EXPECTED:
+ return "interface expected: ";
+ case UTL_Error::EIDL_VALUETYPE_EXPECTED:
+ return "value type expected: ";
+ case UTL_Error::EIDL_ABSTRACT_EXPECTED:
+ return "abstract type expected: ";
case UTL_Error::EIDL_EVAL_ERROR:
return "expression evaluation error: ";
+ case UTL_Error::EIDL_INCOMPATIBLE_TYPE:
+ return "incompatible types in constant assignment: ";
case UTL_Error::EIDL_NAME_CASE_ERROR:
return "identifier spellings differ only in case: ";
case UTL_Error::EIDL_NAME_CASE_WARNING:
@@ -216,8 +238,8 @@ exprtype_to_string (AST_Expression::ExprType t)
return "boolean";
case AST_Expression::EV_string:
return "string";
- case AST_Expression::EV_any:
- return "any";
+ case AST_Expression::EV_enum:
+ return "enum";
case AST_Expression::EV_void:
return "void";
case AST_Expression::EV_none:
@@ -235,29 +257,52 @@ exprtype_to_string (AST_Expression::ExprType t)
// Convert a parse state into a possible error message
static const char *
-parse_state_to_error_message(IDL_GlobalData::ParseState ps)
+parse_state_to_error_message (IDL_GlobalData::ParseState ps)
{
- switch (ps) {
+ switch (ps)
+ {
case IDL_GlobalData::PS_NoState:
- return "Statement can not be parsed";
+ return "Statement cannot be parsed";
case IDL_GlobalData::PS_TypeDeclSeen:
return "Malformed typedef declaration";
+ case IDL_GlobalData::PS_TypeIdDeclSeen:
+ return "Malformed type id declaration";
+ case IDL_GlobalData::PS_TypePrefixDeclSeen:
+ return "Malformed type prefix declaration";
case IDL_GlobalData::PS_ConstDeclSeen:
return "Malformed const declaration";
case IDL_GlobalData::PS_ExceptDeclSeen:
- return
- "Malformed exception declaration";
+ return "Malformed exception declaration";
case IDL_GlobalData::PS_InterfaceDeclSeen:
- return
- "Malformed interface declaration";
+ return "Malformed interface declaration";
+ case IDL_GlobalData::PS_ValueTypeDeclSeen:
+ return "Malformed value type declaration";
+ case IDL_GlobalData::PS_ComponentDeclSeen:
+ return "Malformed value type declaration";
+ case IDL_GlobalData::PS_HomeDeclSeen:
+ return "Malformed home declaration";
+ case IDL_GlobalData::PS_EventDeclSeen:
+ return "Malformed value type declaration";
case IDL_GlobalData::PS_ModuleDeclSeen:
return "Malformed module declaration";
case IDL_GlobalData::PS_AttrDeclSeen:
- return
- "Malformed attribute declaration";
+ return "Malformed attribute declaration";
case IDL_GlobalData::PS_OpDeclSeen:
- return
- "Malformed operation declaration";
+ return "Malformed operation declaration";
+ case IDL_GlobalData::PS_ProvidesDeclSeen:
+ return "Malformed provides declaration";
+ case IDL_GlobalData::PS_UsesDeclSeen:
+ return "Malformed uses declaration";
+ case IDL_GlobalData::PS_EmitsDeclSeen:
+ return "Malformed emits declaration";
+ case IDL_GlobalData::PS_PublishesDeclSeen:
+ return "Malformed publishes declaration";
+ case IDL_GlobalData::PS_ConsumesDeclSeen:
+ return "Malformed consumes declaration";
+ case IDL_GlobalData::PS_FactoryDeclSeen:
+ return "Malformed factory declaration";
+ case IDL_GlobalData::PS_FinderDeclSeen:
+ return "Malformed finder declaration";
case IDL_GlobalData::PS_ModuleSeen:
return "Missing module identifier following MODULE keyword";
case IDL_GlobalData::PS_ModuleIDSeen:
@@ -268,22 +313,68 @@ parse_state_to_error_message(IDL_GlobalData::ParseState ps)
return "Illegal syntax following module '}' closer";
case IDL_GlobalData::PS_ModuleBodySeen:
return "Illegal syntax following module body statement(s)";
- case IDL_GlobalData::PS_InterfaceSeen:
- return "Missing interface identifier following INTERFACE keyword";
- case IDL_GlobalData::PS_InterfaceIDSeen:
- return "Illegal syntax following interface identifier";
+ case IDL_GlobalData::PS_InheritColonSeen:
+ return "Illegal syntax following ':' starting inheritance list";
case IDL_GlobalData::PS_InheritSpecSeen:
return "Missing '{' or illegal syntax following inheritance spec";
- case IDL_GlobalData::PS_ForwardDeclSeen:
+ case IDL_GlobalData::PS_SupportSpecSeen:
+ return "Missing '{' or illegal syntax following support spec";
+ case IDL_GlobalData::PS_ManagesSeen:
+ return "Missing component identifier following MANAGES keyword";
+ case IDL_GlobalData::PS_ManagesIDSeen:
+ return "Illegal syntax following managed component identifier";
+ case IDL_GlobalData::PS_PrimaryKeySpecSeen:
+ return "Illegal syntax following primary key spec";
+ case IDL_GlobalData::PS_InterfaceSeen:
+ return "Missing interface identifier following INTERFACE keyword";
+ case IDL_GlobalData::PS_InterfaceForwardSeen:
return "Missing ';' following forward interface declaration";
+ case IDL_GlobalData::PS_InterfaceIDSeen:
+ return "Missing '{' or illegal syntax following interface identifier";
case IDL_GlobalData::PS_InterfaceSqSeen:
return "Illegal syntax following interface '{' opener";
case IDL_GlobalData::PS_InterfaceQsSeen:
return "Illegal syntax following interface '}' closer";
case IDL_GlobalData::PS_InterfaceBodySeen:
return "Illegal syntax following interface body statement(s)";
- case IDL_GlobalData::PS_InheritColonSeen:
- return "Illegal syntax following ':' starting inheritance list";
+ case IDL_GlobalData::PS_ValueTypeSeen:
+ return "Missing interface identifier following VALUETYPE keyword";
+ case IDL_GlobalData::PS_ValueTypeForwardSeen:
+ return "Missing ';' following forward value type declaration";
+ case IDL_GlobalData::PS_ValueTypeIDSeen:
+ return "Missing '{' or illegal syntax following value type identifier";
+ case IDL_GlobalData::PS_ValueTypeSqSeen:
+ return "Illegal syntax following value type '{' opener";
+ case IDL_GlobalData::PS_ValueTypeQsSeen:
+ return "Illegal syntax following value type '}' closer";
+ case IDL_GlobalData::PS_ValueTypeBodySeen:
+ return "Illegal syntax following value type body statement(s)";
+ case IDL_GlobalData::PS_ComponentSeen:
+ return "Missing component identifier following COMPONENT keyword";
+ case IDL_GlobalData::PS_ComponentForwardSeen:
+ return "Missing ';' following forward component declaration";
+ case IDL_GlobalData::PS_ComponentIDSeen:
+ return "Missing '{' or illegal syntax following component identifier";
+ case IDL_GlobalData::PS_ComponentSqSeen:
+ return "Illegal syntax following component '{' opener";
+ case IDL_GlobalData::PS_ComponentQsSeen:
+ return "Illegal syntax following component '}' closer";
+ case IDL_GlobalData::PS_ComponentBodySeen:
+ return "Illegal syntax following component body statement(s)";
+ case IDL_GlobalData::PS_HomeSeen:
+ return "Missing component identifier following HOME keyword";
+ case IDL_GlobalData::PS_HomeIDSeen:
+ return "Missing '{' or illegal syntax following home identifier";
+ case IDL_GlobalData::PS_HomeSqSeen:
+ return "Illegal syntax following home '{' opener";
+ case IDL_GlobalData::PS_HomeQsSeen:
+ return "Illegal syntax following home '}' closer";
+ case IDL_GlobalData::PS_HomeBodySeen:
+ return "Illegal syntax following home body statement(s)";
+ case IDL_GlobalData::PS_StructForwardSeen:
+ return "Missing ';' following forward struct declaration";
+ case IDL_GlobalData::PS_UnionForwardSeen:
+ return "Missing ';' following forward union declaration";
case IDL_GlobalData::PS_SNListCommaSeen:
return "Found illegal scoped name in scoped name list";
case IDL_GlobalData::PS_ScopedNameSeen:
@@ -508,7 +599,7 @@ UTL_Error::error1 (UTL_Error::ErrorCode c,
idl_error_header (c,
idl_global->lineno (),
idl_global->filename ());
- d->name ()->dump (cerr);
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -522,9 +613,10 @@ UTL_Error::error2 (UTL_Error::ErrorCode c,
idl_error_header (c,
idl_global->lineno (),
idl_global->filename ());
- d1->name ()->dump (cerr);
- cerr << ", ";
- d2->name ()->dump (cerr);
+ d1->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
+ ACE_ERROR ((LM_ERROR,
+ ", "));
+ d2->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -539,11 +631,13 @@ UTL_Error::error3 (UTL_Error::ErrorCode c,
idl_error_header (c,
idl_global->lineno (),
idl_global->filename ());
- d1->name ()->dump (cerr);
- cerr << ", ";
- d2->name ()->dump (cerr);
- cerr << ", ";
- d3->name ()->dump (cerr);
+ d1->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
+ ACE_ERROR ((LM_ERROR,
+ ", "));
+ d2->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
+ ACE_ERROR ((LM_ERROR,
+ ", "));
+ d3->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -555,7 +649,8 @@ UTL_Error::warning0 (UTL_Error::ErrorCode c)
idl_error_header (c,
idl_global->lineno (),
idl_global->filename ());
- cerr << "\n";
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
}
void
@@ -565,7 +660,7 @@ UTL_Error::warning1 (UTL_Error::ErrorCode c,
idl_error_header (c,
idl_global->lineno (),
idl_global->filename ());
- d->name ()->dump (cerr);
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
"\n"));
}
@@ -578,9 +673,10 @@ UTL_Error::warning2 (UTL_Error::ErrorCode c,
idl_error_header (c,
idl_global->lineno (),
idl_global->filename ());
- d1->name ()->dump (cerr);
- cerr << ", ";
- d2->name ()->dump (cerr);
+ d1->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
+ ACE_ERROR ((LM_ERROR,
+ ", "));
+ d2->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
"\n"));
}
@@ -594,11 +690,13 @@ UTL_Error::warning3 (UTL_Error::ErrorCode c,
idl_error_header (c,
idl_global->lineno (),
idl_global->filename ());
- d1->name ()->dump (cerr);
- cerr << ", ";
- d2->name ()->dump (cerr);
- cerr << ", ";
- d3->name ()->dump (cerr);
+ d1->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
+ ACE_ERROR ((LM_ERROR,
+ ", "));
+ d2->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
+ ACE_ERROR ((LM_ERROR,
+ ", "));
+ d3->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
"\n"));
}
@@ -611,8 +709,10 @@ UTL_Error::coercion_error (AST_Expression *v,
idl_error_header (EIDL_COERCION_FAILURE,
v->line (),
v->file_name ());
- v->dump (cerr);
- cerr << " to " << exprtype_to_string (t) << "\n";
+ v->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ " to %s\n",
+ exprtype_to_string (t)));
idl_global->set_err_count (idl_global->err_count () + 1);
}
@@ -623,8 +723,9 @@ UTL_Error::lookup_error (UTL_ScopedName *n)
idl_error_header (EIDL_LOOKUP_ERROR,
idl_global->lineno (),
idl_global->filename ());
- n->dump (cerr);
- cerr << "\n";
+ n->dump (*ACE_DEFAULT_LOG_STREAM);;
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
}
@@ -679,10 +780,10 @@ UTL_Error::inheritance_fwd_error (UTL_ScopedName *n,
f->file_name ());
ACE_ERROR ((LM_ERROR,
"interface "));
- n->dump (cerr);
+ n->dump (*ACE_DEFAULT_LOG_STREAM);
ACE_ERROR ((LM_ERROR,
" cannot inherit from forward declared interface "));
- f->local_name ()->dump (cerr);
+ f->local_name ()->dump (*ACE_DEFAULT_LOG_STREAM);
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -696,30 +797,109 @@ UTL_Error::inheritance_error (UTL_ScopedName *n,
idl_error_header (EIDL_CANT_INHERIT,
idl_global->lineno (),
idl_global->filename ());
- n->dump (cerr);
+ n->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
" attempts to inherit from "));
- d->name ()->dump (cerr);
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
}
-// Report inheritance from non-abstract valuetype.
+// Report an attempt to support an interface which was only
+// declared forward but not yet defined.
void
-UTL_Error::abstract_inheritance_error (UTL_ScopedName *n)
+UTL_Error::supports_fwd_error (UTL_ScopedName *n,
+ AST_Interface *f)
+{
+ idl_error_header (EIDL_SUPPORTS_FWD_ERROR,
+ f->line (),
+ f->file_name ());
+ ACE_ERROR ((LM_ERROR,
+ "interface "));
+ n->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ " cannot support forward declared interface "));
+ f->local_name ()->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report an attempt to support something other than an interface.
+void
+UTL_Error::supports_error (UTL_ScopedName *n,
+ AST_Decl *d)
+{
+ idl_error_header (EIDL_CANT_SUPPORT,
+ idl_global->lineno (),
+ idl_global->filename ());
+ n->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ " attempts to support "));
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report illegal inheritance from non-abstract valuetype or interface.
+void
+UTL_Error::abstract_inheritance_error (UTL_ScopedName *v,
+ UTL_ScopedName *i)
{
idl_error_header (EIDL_CANT_INHERIT,
idl_global->lineno (),
idl_global->filename ());
ACE_ERROR ((LM_ERROR,
" abstract valuetype "));
- n->dump (cerr);
+ v->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ " attempts to inherit from nonabstract type: "));
+ i->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report illegal support of non-abstract interface.
+void
+UTL_Error::abstract_support_error (UTL_ScopedName *v,
+ UTL_ScopedName *i)
+{
+ idl_error_header (EIDL_CANT_SUPPORT,
+ idl_global->lineno (),
+ idl_global->filename ());
ACE_ERROR ((LM_ERROR,
- " attempts to inherit from nonabstract type\n"));
+ " valuetype "));
+ v->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ " attempts to support more than one concrete type: "));
+ i->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
}
+void
+UTL_Error::concrete_supported_inheritance_error (UTL_ScopedName *v,
+ UTL_ScopedName *i)
+{
+ idl_error_header (EIDL_CANT_SUPPORT,
+ idl_global->lineno (),
+ idl_global->filename ());
+ ACE_ERROR ((LM_ERROR,
+ " valuetype "));
+ v->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ " supports concrete interface that does not inherit from"
+ " all ancestors of valuetype's ancestor's concrete supported"
+ " interface: "));
+ i->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
// Report an error while evaluating an expression.
void
@@ -728,7 +908,20 @@ UTL_Error::eval_error (AST_Expression *v)
idl_error_header (EIDL_EVAL_ERROR,
v->line (),
v->file_name ());
- v->dump (cerr);
+ v->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report an error while evaluating an expression.
+void
+UTL_Error::incompatible_type_error (AST_Expression *v)
+{
+ idl_error_header (EIDL_INCOMPATIBLE_TYPE,
+ idl_global->lineno (),
+ idl_global->filename ());
+ v->dump (*ACE_DEFAULT_LOG_STREAM);
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -744,10 +937,56 @@ UTL_Error::constant_expected (UTL_ScopedName *n,
idl_error_header (EIDL_CONSTANT_EXPECTED,
d->line (),
d->file_name ());
- n->dump (cerr);
+ n->dump (*ACE_DEFAULT_LOG_STREAM);
ACE_ERROR ((LM_ERROR,
" bound to "));
- d->dump (cerr);
+ d->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report a situation where an interface was expected but we got
+// something else instead. This most likely is a case in a supports
+// or inheritance list.
+void
+UTL_Error::interface_expected (AST_Decl *d)
+{
+ idl_error_header (EIDL_INTERFACE_EXPECTED,
+ d->line (),
+ d->file_name ());
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report a situation where an value type was expected but we got
+// something else instead. This most likely is a case in a primary
+// key, emits, publishes or consumes declaration.
+void
+UTL_Error::valuetype_expected (AST_Decl *d)
+{
+ idl_error_header (EIDL_VALUETYPE_EXPECTED,
+ d->line (),
+ d->file_name ());
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report a situation where an abstract type was expected but we got
+// something else instead. This is the case in an inheritance
+// list where a concrete type appears after an abstract type, or
+// where a valuetype inherits more than one concrete valuetype.
+void
+UTL_Error::abstract_expected (AST_Decl *d)
+{
+ idl_error_header (EIDL_ABSTRACT_EXPECTED,
+ d->line (),
+ d->file_name ());
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -767,7 +1006,7 @@ UTL_Error::enum_val_expected (AST_Union *u,
ACE_ERROR ((LM_ERROR,
" union %s, ",
u->local_name ()->get_string ()));
- l->dump (cerr);
+ l->dump (*ACE_DEFAULT_LOG_STREAM);
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -790,7 +1029,7 @@ UTL_Error::enum_val_lookup_failure (AST_Union *u,
" union %s, enum %s, enumerator ",
u->local_name ()->get_string (),
e->local_name ()->get_string ()));
- n->dump (cerr);
+ n->dump (*ACE_DEFAULT_LOG_STREAM);
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -874,10 +1113,10 @@ UTL_Error::ambiguous (UTL_Scope *s,
ACE_ERROR ((LM_ERROR,
" scope: %s, collision: ",
(ScopeAsDecl (s))->local_name ()->get_string ()));
- d->name ()->dump (cerr);
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
" vs. "));
- l->name ()->dump (cerr);
+ l->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -885,14 +1124,14 @@ UTL_Error::ambiguous (UTL_Scope *s,
// Report a forward declared interface which was never defined.
void
-UTL_Error::fwd_decl_not_defined (AST_Interface *d)
+UTL_Error::fwd_decl_not_defined (AST_Type *d)
{
idl_error_header (EIDL_DECL_NOT_DEFINED,
- d->line(),
- d->file_name());
+ d->line (),
+ d->file_name ());
ACE_ERROR ((LM_ERROR,
"interface "));
- d->local_name ()->dump (cerr);
+ d->local_name ()->dump (*ACE_DEFAULT_LOG_STREAM);
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -904,14 +1143,14 @@ UTL_Error::fwd_decl_lookup (AST_Interface *d,
UTL_ScopedName *n)
{
idl_error_header (EIDL_FWD_DECL_LOOKUP,
- idl_global->lineno(),
- idl_global->filename());
+ idl_global->lineno (),
+ idl_global->filename ());
ACE_ERROR ((LM_ERROR,
"trying to look up "));
- n->dump (cerr);
+ n->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
" in undefined forward declared interface "));
- d->local_name ()->dump (cerr);
+ d->local_name ()->dump (*ACE_DEFAULT_LOG_STREAM);
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -925,10 +1164,10 @@ UTL_Error::redefinition_in_scope (AST_Decl *d,
idl_error_header (EIDL_REDEF_SCOPE,
d->line (),
d->file_name ());
- d->name ()->dump (cerr);
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
", "));
- s->name ()->dump (cerr);
+ s->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -939,8 +1178,8 @@ void
UTL_Error::not_a_type (AST_Decl *d)
{
idl_error_header (EIDL_NOT_A_TYPE,
- idl_global->lineno(),
- idl_global->filename());
+ idl_global->lineno (),
+ idl_global->filename ());
if (d == 0 || d->name () == 0)
{
ACE_ERROR ((LM_ERROR,
@@ -948,7 +1187,7 @@ UTL_Error::not_a_type (AST_Decl *d)
}
else
{
- d->name ()->dump (cerr);
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
}
ACE_ERROR ((LM_ERROR,
@@ -965,3 +1204,4 @@ UTL_Error::back_end (long lineno,
s);
idl_global->set_err_count (idl_global->err_count () + 1);
}
+
diff --git a/TAO/TAO_IDL/util/utl_exceptlist.cpp b/TAO/TAO_IDL/util/utl_exceptlist.cpp
index 8ad5d138ead..f92c1ccabbe 100644
--- a/TAO/TAO_IDL/util/utl_exceptlist.cpp
+++ b/TAO/TAO_IDL/util/utl_exceptlist.cpp
@@ -62,7 +62,7 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
// utl_exceptlist.cc
//
@@ -74,68 +74,40 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// will cease to operate correctly if you use either multiple or
// public virtual inheritance.
-#include "idl.h"
-#include "idl_extern.h"
+#include "utl_exceptlist.h"
-ACE_RCSID(util, utl_exceptlist, "$Id$")
+ACE_RCSID (util,
+ utl_exceptlist,
+ "$Id$")
-/*
- * Constructor(s)
- */
-
-UTL_ExceptList::UTL_ExceptList(AST_Exception *s, UTL_ExceptList *cdr)
- : UTL_List(cdr),
- pd_car_data(s)
+UTL_ExceptList::UTL_ExceptList (AST_Exception *s,
+ UTL_ExceptList *cdr)
+ : UTL_List (cdr),
+ pd_car_data (s)
{
}
-/*
- * Private operations
- */
-
-/*
- * Public operations
- */
-
-// Get list item
+// Get list item.
AST_Exception *
-UTL_ExceptList::head()
+UTL_ExceptList::head (void)
{
- return pd_car_data;
+ return this->pd_car_data;
}
-/*
- * Redefinition of inherited virtual operations
- */
-
-// UTL_ExceptList active iterator
-
-/*
- * Constructor
- */
-
-UTL_ExceptlistActiveIterator::UTL_ExceptlistActiveIterator(UTL_ExceptList *s)
- : UTL_ListActiveIterator(s)
+UTL_ExceptlistActiveIterator::UTL_ExceptlistActiveIterator (UTL_ExceptList *s)
+ : UTL_ListActiveIterator(s)
{
}
-/*
- * Private operations
- */
-
-/*
- * Public operations
- */
-
-// Get current item
+// Get current item.
AST_Exception *
-UTL_ExceptlistActiveIterator::item()
+UTL_ExceptlistActiveIterator::item (void)
{
- if (source == NULL)
- return NULL;
- return ((UTL_ExceptList *) source)->head();
+ if (source == 0)
+ {
+ return 0;
+ }
+
+ return ((UTL_ExceptList *) source)->head ();
}
-/*
- * Redefinition of inherited virtual operations
- */
diff --git a/TAO/TAO_IDL/util/utl_exprlist.cpp b/TAO/TAO_IDL/util/utl_exprlist.cpp
index 0f3c5a3b2a8..2f96cded1b5 100644
--- a/TAO/TAO_IDL/util/utl_exprlist.cpp
+++ b/TAO/TAO_IDL/util/utl_exprlist.cpp
@@ -62,11 +62,9 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
-// utl_exprlist.cc
-//
-// Implementation of a list of strings
+// Implementation of a list of expressions.
// NOTE: This list class only works correctly because we use single public
// inheritance, as opposed to multiple inheritance or public virtual.
@@ -74,68 +72,40 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// will cease to operate correctly if you use either multiple or
// public virtual inheritance.
-#include "idl.h"
-#include "idl_extern.h"
+#include "utl_exprlist.h"
-ACE_RCSID(util, utl_exprlist, "$Id$")
+ACE_RCSID (util,
+ utl_exprlist,
+ "$Id$")
-/*
- * Constructor(s)
- */
-
-UTL_ExprList::UTL_ExprList(AST_Expression *s, UTL_ExprList *cdr)
- : UTL_List(cdr),
- pd_car_data(s)
+UTL_ExprList::UTL_ExprList (AST_Expression *s,
+ UTL_ExprList *cdr)
+ : UTL_List(cdr),
+ pd_car_data(s)
{
}
-/*
- * Private operations
- */
-
-/*
- * Public operations
- */
-
-// Get list item
+// Get list item.
AST_Expression *
-UTL_ExprList::head()
+UTL_ExprList::head (void)
{
- return pd_car_data;
+ return this->pd_car_data;
}
-/*
- * Redefinition of inherited virtual operations
- */
-
-// UTL_ExprList active iterator
-
-/*
- * Constructor
- */
-
-UTL_ExprlistActiveIterator::UTL_ExprlistActiveIterator(UTL_ExprList *s)
- : UTL_ListActiveIterator(s)
+UTL_ExprlistActiveIterator::UTL_ExprlistActiveIterator (UTL_ExprList *s)
+ : UTL_ListActiveIterator(s)
{
}
-/*
- * Private operations
- */
-
-/*
- * Public operations
- */
-
-// Get current item
+// Get current item.
AST_Expression *
-UTL_ExprlistActiveIterator::item()
+UTL_ExprlistActiveIterator::item (void)
{
- if (source == NULL)
- return NULL;
- return ((UTL_ExprList *) source)->head();
+ if (source == 0)
+ {
+ return 0;
+ }
+
+ return ((UTL_ExprList *) source)->head ();
}
-/*
- * Redefinition of inherited virtual operations
- */
diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp
index 48ee3661f6a..4641ca4cd4b 100644
--- a/TAO/TAO_IDL/util/utl_global.cpp
+++ b/TAO/TAO_IDL/util/utl_global.cpp
@@ -62,58 +62,63 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
-
-// utl_global.cc - Implementation of class IDL_GlobalData
-//
+*/
-#include "idl.h"
-#include "idl_extern.h"
+#include "idl_global.h"
+#include "global_extern.h"
+#include "ast_root.h"
+#include "ast_generator.h"
+#include "utl_identifier.h"
+#include "utl_indenter.h"
+#include "utl_err.h"
+#include "utl_string.h"
-ACE_RCSID(util, utl_global, "$Id$")
+ACE_RCSID (util,
+ utl_global,
+ "$Id$")
// Define an increment for the size of the array used to store names of
-// included files
-#undef INCREMENT
-#define INCREMENT 64
+// included files.
+#undef INCREMENT
+#define INCREMENT 64
IDL_GlobalData::IDL_GlobalData (void)
- : pd_scopes (0),
- pd_root (0),
- pd_gen (0),
- pd_err (0),
- pd_err_count (0),
- pd_lineno (0),
- pd_filename (0),
- pd_main_filename (0),
- pd_real_filename (0),
- pd_stripped_filename (0),
- pd_import (I_FALSE),
- pd_in_main_file (I_FALSE),
- pd_prog_name (0),
- pd_cpp_location (0),
- pd_compile_flags (0),
- pd_be (0),
- pd_local_escapes (0),
- pd_indent (0),
- pd_read_from_stdin (I_FALSE),
- pd_include_file_names (0),
- pd_n_include_file_names (0),
- pd_n_alloced_file_names (0),
- included_idl_files_ (0),
- n_included_idl_files_ (0),
- n_allocated_idl_files_ (0),
- pd_parse_state (PS_NoState),
- pd_idl_src_file (0),
- gperf_path_ (0),
- temp_dir_ (0),
- ident_string_ (0),
- obv_support_ (I_FALSE),
- case_diff_error_ (I_TRUE),
- idl_flags_ (""),
- last_seen_index_ (1),
- repeat_include_ (0)
- {
+ : pd_root (0),
+ pd_gen (0),
+ pd_err (0),
+ pd_err_count (0),
+ pd_lineno (0),
+ pd_filename (0),
+ pd_main_filename (0),
+ pd_real_filename (0),
+ pd_stripped_filename (0),
+ pd_import (I_FALSE),
+ pd_in_main_file (I_FALSE),
+ pd_prog_name (0),
+ pd_cpp_location (0),
+ pd_compile_flags (0),
+ pd_be (0),
+ pd_local_escapes (0),
+ pd_indent (0),
+ pd_read_from_stdin (I_FALSE),
+ pd_include_file_names (0),
+ pd_n_include_file_names (0),
+ pd_n_alloced_file_names (0),
+ included_idl_files_ (0),
+ n_included_idl_files_ (0),
+ n_allocated_idl_files_ (0),
+ pd_parse_state (PS_NoState),
+ pd_idl_src_file (0),
+ gperf_path_ (0),
+ temp_dir_ (0),
+ ident_string_ (0),
+ obv_support_ (I_FALSE),
+ component_support_ (I_FALSE),
+ case_diff_error_ (I_TRUE),
+ nest_orb_ (I_FALSE),
+ idl_flags_ (""),
+ last_seen_index_ (1)
+{
// Path for the perfect hash generator(gperf) program.
// Default is $ACE_ROOT/bin/gperf unless ACE_GPERF is defined.
// Use ACE_GPERF if $ACE_ROOT hasn't been set or won't be set
@@ -162,18 +167,12 @@ IDL_GlobalData::~IDL_GlobalData (void)
}
// Get or set scopes stack
-UTL_ScopeStack *
+UTL_ScopeStack &
IDL_GlobalData::scopes (void)
{
return this->pd_scopes;
}
-void
-IDL_GlobalData::set_scopes (UTL_ScopeStack *s)
-{
- this->pd_scopes = s;
-}
-
// Get or set root of AST
AST_Root *
IDL_GlobalData::root (void)
@@ -412,10 +411,10 @@ IDL_GlobalData::set_local_escapes (const char *e)
{
if (this->pd_local_escapes != 0)
{
- ACE_OS::free (this->pd_local_escapes);
+ delete [] this->pd_local_escapes;
}
- this->pd_local_escapes = ACE_OS::strdup (e);
+ this->pd_local_escapes = ACE::strnew (e);
}
// Get or set indent object
@@ -472,7 +471,7 @@ IDL_GlobalData::store_include_file_name (UTL_String *n)
unsigned long i;
long seen = this->seen_include_file_before (n);
- // Check if we need to store it at all or whether we've seen it already
+ // Check if we need to store it at all or whether we've seen it already.
if (seen)
{
this->last_seen_index_ = seen;
@@ -489,16 +488,22 @@ IDL_GlobalData::store_include_file_name (UTL_String *n)
if (this->pd_n_alloced_file_names == 0)
{
this->pd_n_alloced_file_names = INCREMENT;
- this->pd_include_file_names = new UTL_String *[this->pd_n_alloced_file_names];
+ ACE_NEW (this->pd_include_file_names,
+ UTL_String *[this->pd_n_alloced_file_names]);
}
else
{
o_include_file_names = this->pd_include_file_names;
o_n_alloced_file_names = this->pd_n_alloced_file_names;
this->pd_n_alloced_file_names += INCREMENT;
- this->pd_include_file_names = new UTL_String *[this->pd_n_alloced_file_names];
- for (i = 0; i < o_n_alloced_file_names; i++)
- this->pd_include_file_names[i] = o_include_file_names[i];
+ ACE_NEW (this->pd_include_file_names,
+ UTL_String *[this->pd_n_alloced_file_names]);
+
+ for (i = 0; i < o_n_alloced_file_names; ++i)
+ {
+ this->pd_include_file_names[i] = o_include_file_names[i];
+ }
+
delete [] o_include_file_names;
}
}
@@ -552,7 +557,6 @@ IDL_GlobalData::add_to_included_idl_files (char* file_name)
else
{
// Adding more storage.
-
char** old_included_idl_files =
this->included_idl_files_;
size_t n_old_allocated_idl_files =
@@ -560,8 +564,12 @@ IDL_GlobalData::add_to_included_idl_files (char* file_name)
this->n_allocated_idl_files_ += INCREMENT;
ACE_NEW (this->included_idl_files_,
char *[this->n_allocated_idl_files_]);
- for (size_t i = 0; i < n_old_allocated_idl_files; i++)
- this->included_idl_files_ [i] = old_included_idl_files [i];
+
+ for (size_t i = 0; i < n_old_allocated_idl_files; ++i)
+ {
+ this->included_idl_files_ [i] = old_included_idl_files [i];
+ }
+
delete [] old_included_idl_files;
}
}
@@ -717,18 +725,18 @@ IDL_GlobalData::PredefinedTypeToExprType(AST_PredefinedType::PredefinedType pt)
case AST_PredefinedType::PT_void:
return AST_Expression::EV_void;
default:
- return AST_Expression::EV_any;
+ return AST_Expression::EV_enum;
}
}
// returns the IDL source file being copiled
-UTL_String* IDL_GlobalData::idl_src_file()
+UTL_String* IDL_GlobalData::idl_src_file (void)
{
return this->pd_idl_src_file;
}
// set the source IDL file that is being parsed
-void IDL_GlobalData::idl_src_file(UTL_String *s)
+void IDL_GlobalData::idl_src_file (UTL_String *s)
{
this->pd_idl_src_file = s;
}
@@ -797,6 +805,18 @@ IDL_GlobalData::obv_support (void)
}
void
+IDL_GlobalData::component_support (idl_bool val)
+{
+ this->component_support_ = val;
+}
+
+idl_bool
+IDL_GlobalData::component_support (void)
+{
+ return this->component_support_;
+}
+
+void
IDL_GlobalData::case_diff_error (idl_bool val)
{
this->case_diff_error_ = val;
@@ -809,6 +829,18 @@ IDL_GlobalData::case_diff_error (void)
}
void
+IDL_GlobalData::nest_orb (idl_bool val)
+{
+ this->nest_orb_ = val;
+}
+
+idl_bool
+IDL_GlobalData::nest_orb (void)
+{
+ return this->nest_orb_;
+}
+
+void
IDL_GlobalData::destroy (void)
{
if (this->pd_filename != 0)
@@ -839,8 +871,12 @@ IDL_GlobalData::destroy (void)
this->pd_stripped_filename = 0;
}
- delete [] this->ident_string_;
- this->ident_string_ = 0;
+ if (this->pd_idl_src_file != 0)
+ {
+ this->pd_idl_src_file->destroy ();
+ delete this->pd_idl_src_file;
+ this->pd_idl_src_file = 0;
+ }
size_t size = this->pragma_prefixes ().size ();
char *trash = 0;
@@ -851,6 +887,25 @@ IDL_GlobalData::destroy (void)
delete [] trash;
trash = 0;
}
+
+ this->pd_root->destroy ();
+ delete this->pd_root;
+ this->pd_root = 0;
+
+ delete this->pd_err;
+ this->pd_err = 0;
+ delete this->pd_gen;
+ this->pd_gen = 0;
+ delete this->pd_indent;
+ this->pd_indent = 0;
+ delete [] this->pd_local_escapes;
+ this->pd_local_escapes = 0;
+ delete [] this->gperf_path_;
+ this->gperf_path_ = 0;
+ delete [] this->temp_dir_;
+ this->temp_dir_ = 0;
+ delete [] this->ident_string_;
+ this->ident_string_ = 0;
}
void
@@ -966,28 +1021,3 @@ IDL_GlobalData::string_to_scoped_name (char *s)
return retval;
}
-
-long
-IDL_GlobalData::last_seen_index (void) const
-{
- return this->last_seen_index_;
-}
-
-void
-IDL_GlobalData::last_seen_index (long val)
-{
- this->last_seen_index_ = val;
-}
-
-idl_bool
-IDL_GlobalData::repeat_include (void) const
-{
- return this->repeat_include_;
-}
-
-void
-IDL_GlobalData::repeat_include (idl_bool val)
-{
- this->repeat_include_ = val;
-}
-
diff --git a/TAO/TAO_IDL/util/utl_identifier.cpp b/TAO/TAO_IDL/util/utl_identifier.cpp
index 3a1b5c23027..367c1e467f2 100644
--- a/TAO/TAO_IDL/util/utl_identifier.cpp
+++ b/TAO/TAO_IDL/util/utl_identifier.cpp
@@ -62,20 +62,18 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
-// utl_identifier - Implementation of identifiers
+#include "utl_identifier.h"
+#include "global_extern.h"
+#include "utl_err.h"
+#include "utl_string.h"
-#include "idl.h"
-#include "idl_extern.h"
+ACE_RCSID (util,
+ utl_identifier,
+ "$Id$")
-ACE_RCSID(util, utl_identifier, "$Id$")
-
-/*
- * Constructors
- */
-
-Identifier::Identifier ()
+Identifier::Identifier (void)
: pv_string (0),
escaped_ (0)
{
@@ -111,16 +109,21 @@ Identifier::Identifier (const char *s)
if (shift)
{
- this->pv_string = ACE_OS::strdup (s + 1);
+ this->pv_string = ACE::strnew (s + 1);
}
else
{
- this->pv_string = ACE_OS::strdup (s);
+ this->pv_string = ACE::strnew (s);
}
}
Identifier::~Identifier (void)
{
+ if (this->pv_string != 0)
+ {
+ delete this->pv_string;
+ this->pv_string = 0;
+ }
}
// Operations.
@@ -134,12 +137,12 @@ Identifier::get_string (void)
void
Identifier::replace_string (const char * s)
{
- if (this->pv_string)
+ if (this->pv_string != 0)
{
- ACE_OS::free (this->pv_string);
+ delete [] this->pv_string;
}
- this->pv_string = ACE_OS::strdup (s);
+ this->pv_string = ACE::strnew (s);
}
// Compare two Identifier *
@@ -179,7 +182,7 @@ long
Identifier::case_compare_quiet (Identifier *o)
{
UTL_String member (this->pv_string);
- UTL_String other (o->get_string ());
+ UTL_String other (o->pv_string);
long result = member.compare_quiet (&other);
@@ -217,15 +220,10 @@ Identifier::dump (ACE_OSTREAM_TYPE &o)
return;
}
- o << get_string ();
+ o << this->pv_string;
}
void
Identifier::destroy (void)
{
- if (this->pv_string)
- {
- ACE_OS::free (this->pv_string);
- this->pv_string = 0;
- }
}
diff --git a/TAO/TAO_IDL/util/utl_idlist.cpp b/TAO/TAO_IDL/util/utl_idlist.cpp
index afa1c933569..54f4b88522c 100644
--- a/TAO/TAO_IDL/util/utl_idlist.cpp
+++ b/TAO/TAO_IDL/util/utl_idlist.cpp
@@ -64,20 +64,20 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
*/
-// utl_idlist.cc
-//
-// Implementation of a list of utl_string nodes
+// Implementation of a list of utl_string nodes.
// NOTE: This list class only works correctly because we use single public
-// inheritance, as opposed to multiple inheritance or public virtual.
+// inheritance, as opposed to multiple inheritance or public virtual.
// It relies on a type-unsafe cast from UTL_List to subclasses, which
// will cease to operate correctly if you use either multiple or
// public virtual inheritance.
-#include "idl.h"
-#include "idl_extern.h"
+#include "utl_idlist.h"
+#include "utl_identifier.h"
-ACE_RCSID(util, utl_idlist, "$Id$")
+ACE_RCSID (util,
+ utl_idlist,
+ "$Id$")
// Constructor
UTL_IdList::UTL_IdList (Identifier *s,
@@ -117,14 +117,14 @@ UTL_IdList::copy (void)
Identifier *
UTL_IdList::head (void)
{
- return pd_car_data;
+ return this->pd_car_data;
}
// Get last item of this list.
Identifier *
UTL_IdList::last_component (void)
{
- if (this->tail ()== 0)
+ if (this->tail () == 0)
{
return this->head ();
}
@@ -132,16 +132,59 @@ UTL_IdList::last_component (void)
return ((UTL_IdList *) this->tail ())->last_component ();
}
+// Get first item of this list holding a non-empty string.
+Identifier *
+UTL_IdList::first_component (void)
+{
+ if (ACE_OS::strlen (this->pd_car_data->get_string ()) > 0)
+ {
+ return this->pd_car_data;
+ }
+
+ return ((UTL_IdList *) this->tail ())->first_component ();
+}
+
+int
+UTL_IdList::compare (UTL_IdList *other)
+{
+ long this_length = this->length ();
+
+ if (this_length != other->length ())
+ {
+ return 1;
+ }
+
+ Identifier *this_id = 0;
+ Identifier *other_id = 0;
+
+ for (UTL_IdListActiveIterator this_iter (this), other_iter (other);
+ !this_iter.is_done ();
+ this_iter.next (), other_iter.next ())
+ {
+ this_id = this_iter.item ();
+ other_id = other_iter.item ();
+
+ if (ACE_OS::strcmp (this_id->get_string (),
+ other_id->get_string ())
+ != 0)
+ {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
// AST Dumping.
void
UTL_IdList::dump (ACE_OSTREAM_TYPE &o)
{
- UTL_IdListActiveIterator i (this);
-
long first = I_TRUE;
long second = I_FALSE;
- while (!(i.is_done ()))
+ for (UTL_IdListActiveIterator i (this);
+ !i.is_done ();
+ i.next ())
{
if (!first)
{
@@ -165,30 +208,19 @@ UTL_IdList::dump (ACE_OSTREAM_TYPE &o)
second = I_TRUE;
}
}
-
- i.next ();
}
}
void
UTL_IdList::destroy (void)
{
- Identifier *id = 0;
- UTL_IdListActiveIterator i (this);
-
- while (!(i.is_done ()))
+ if (this->pd_car_data != 0)
{
- id = i.item ();
-
- if (id != 0)
- {
- id->destroy ();
- delete id;
- id = 0;
- }
-
- i.next ();
+ delete this->pd_car_data;
+ this->pd_car_data = 0;
}
+
+ this->UTL_List::destroy ();
}
// UTL_IdList active iterator.
diff --git a/TAO/TAO_IDL/util/utl_indenter.cpp b/TAO/TAO_IDL/util/utl_indenter.cpp
index ba00f0cb394..06702447ce1 100644
--- a/TAO/TAO_IDL/util/utl_indenter.cpp
+++ b/TAO/TAO_IDL/util/utl_indenter.cpp
@@ -67,69 +67,62 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// utl_indenter.cc - Implementation of indenter for dumping IDL AST
//
-#include "idl.h"
-#include "idl_extern.h"
+#include "utl_indenter.h"
-ACE_RCSID(util, utl_indenter, "$Id$")
+ACE_RCSID (util,
+ utl_indenter,
+ "$Id$")
/*
* Constructors
*/
-UTL_Indenter::UTL_Indenter ()
+UTL_Indenter::UTL_Indenter (void)
: pd_indent_level (0)
{
}
-/*
- * Private operations
- */
-
-/*
- * Public operations
- */
-
-// Reset indentation level
+// Reset indentation level.
void
-UTL_Indenter::reset ()
+UTL_Indenter::reset (void)
{
- pd_indent_level = 0;
+ this->pd_indent_level = 0;
}
-// Increase indentation level
+// Increase indentation level.
void
-UTL_Indenter::increase ()
+UTL_Indenter::increase (void)
{
- pd_indent_level++;
+ ++this->pd_indent_level;
}
-// Decrease indentation level
+// Decrease indentation level.
void
UTL_Indenter::decrease ()
{
- if (pd_indent_level > 0)
- pd_indent_level--;
+ if (this->pd_indent_level > 0)
+ {
+ --this->pd_indent_level;
+ }
}
-// Produce white space to indent to current indentation level on ostream o
+// Produce white space to indent to current indentation level on ostream o.
void
UTL_Indenter::skip_to (ACE_OSTREAM_TYPE &o)
{
- long i;
-
- for (i = 0; i < pd_indent_level; i++)
- o << " ";
+ for (long i = 0; i < this->pd_indent_level; ++i)
+ {
+ o << " ";
+ }
}
-// Produce white space to indent to current indentation level on ostream o
+// Produce white space to indent to current indentation level on ostream o.
void
UTL_Indenter::skip_to (FILE *fp)
{
- long i;
-
- for (i = 0; i < pd_indent_level; i++)
- ACE_OS::fprintf (fp, " ");
+ for (long i = 0; i < this->pd_indent_level; ++i)
+ {
+ ACE_OS::fprintf (fp,
+ " ");
+ }
}
-/*
- * Redefined virtual operations
- */
diff --git a/TAO/TAO_IDL/util/utl_labellist.cpp b/TAO/TAO_IDL/util/utl_labellist.cpp
index ac155b68602..8241f3c63c7 100644
--- a/TAO/TAO_IDL/util/utl_labellist.cpp
+++ b/TAO/TAO_IDL/util/utl_labellist.cpp
@@ -64,78 +64,49 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
*/
-// utl_labellist.cc
-//
-// Implementation of a list of scoped names
+// Implementation of a list of union labels.
// NOTE: This list class only works correctly because we use single public
// inheritance, as opposed to multiple inheritance or public virtual.
-// It relies on a type-unsafe cast from UTL_List to subclasses, which
-// will cease to operate correctly if you use either multiple or
-// public virtual inheritance.
+// It relies on a type-unsafe cast from UTL_List to subclasses, which
+// will cease to operate correctly if you use either multiple or
+// public virtual inheritance.
-#include "idl.h"
-#include "idl_extern.h"
+#include "utl_labellist.h"
-ACE_RCSID(util, utl_labellist, "$Id$")
+ACE_RCSID (util,
+ utl_labellist,
+ "$Id$")
-/*
- * Constructor(s)
- */
-
-UTL_LabelList::UTL_LabelList(AST_UnionLabel *s, UTL_LabelList *cdr)
- : UTL_List(cdr),
- pd_car_data(s)
+UTL_LabelList::UTL_LabelList (AST_UnionLabel *s,
+ UTL_LabelList *cdr)
+ : UTL_List(cdr),
+ pd_car_data(s)
{
}
-/*
- * Private operations
- */
-
-/*
- * Public operations
- */
-
-// Get list item
+// Get list item.
AST_UnionLabel *
-UTL_LabelList::head()
+UTL_LabelList::head (void)
{
- return pd_car_data;
+ return this->pd_car_data;
}
-/*
- * Redefinition of inherited virtual operations
- */
-
-// UTL_LabelList active iterator
-
-/*
- * Constructor
- */
-
-UTL_LabellistActiveIterator::UTL_LabellistActiveIterator(UTL_LabelList *s)
- : UTL_ListActiveIterator(s)
+UTL_LabellistActiveIterator::UTL_LabellistActiveIterator (UTL_LabelList *s)
+ : UTL_ListActiveIterator (s)
{
}
-/*
- * Private operations
- */
-
-/*
- * Public operations
- */
-// Get current item
+// Get current item.
AST_UnionLabel *
-UTL_LabellistActiveIterator::item()
+UTL_LabellistActiveIterator::item (void)
{
- if (source == NULL)
- return NULL;
- return ((UTL_LabelList *) source)->head();
+ if (source == 0)
+ {
+ return 0;
+ }
+
+ return ((UTL_LabelList *) source)->head ();
}
-/*
- * Redefinition of inherited virtual operations
- */
diff --git a/TAO/TAO_IDL/util/utl_list.cpp b/TAO/TAO_IDL/util/utl_list.cpp
index a1c98460ee8..3fc44127e25 100644
--- a/TAO/TAO_IDL/util/utl_list.cpp
+++ b/TAO/TAO_IDL/util/utl_list.cpp
@@ -62,115 +62,136 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
-// utl_list.cc
-//
-// Implementation of generic single-linked lists
+// Implementation of generic single-linked list.
// NOTE: This list class only works correctly because we use single public
// inheritance, as opposed to multiple inheritance or public virtual.
-// It relies on a type-unsafe cast from UTL_List to subclasses, which
-// will cease to operate correctly if you use either multiple or
-// public virtual inheritance.
+// It relies on a type-unsafe cast from UTL_List to subclasses, which
+// will cease to operate correctly if you use either multiple or
+// public virtual inheritance.
-#include "idl.h"
-#include "idl_extern.h"
+#include "utl_list.h"
+#include "ace/OS.h"
-ACE_RCSID(util, utl_list, "$Id$")
+ACE_RCSID (util,
+ utl_list,
+ "$Id$")
-// Constructor
UTL_List::UTL_List (UTL_List *c)
: pd_cdr_data (c)
{
}
-// Destructor
UTL_List::~UTL_List (void)
{
-// delete this->pd_cdr_data;
-// this->pd_cdr_data = 0;
}
-// Private operations
-
-// Compute list length
+// Compute list length.
long
UTL_List::list_length (long n)
{
- if (pd_cdr_data == NULL)
- return n;
+ if (this->pd_cdr_data == 0)
+ {
+ return n;
+ }
else
- return pd_cdr_data->list_length (n+1);
+ {
+ return this->pd_cdr_data->list_length (n + 1);
+ }
}
-// Public operations
-
-// Smash last cdr with l
+// Smash last cdr with l.
void
UTL_List::nconc (UTL_List *l)
{
- if (pd_cdr_data == NULL)
- pd_cdr_data = l;
+ if (this->pd_cdr_data == 0)
+ {
+ this->pd_cdr_data = l;
+ }
else
- pd_cdr_data->nconc (l);
+ {
+ this->pd_cdr_data->nconc (l);
+ }
}
-// Override this operation to copy lists of other types
+// Override this operation to copy lists of other types.
UTL_List *
-UTL_List::copy ()
+UTL_List::copy (void)
{
- if (pd_cdr_data == NULL)
- return new UTL_List (NULL);
+ UTL_List *retval = 0;
+
+ if (this->pd_cdr_data == 0)
+ {
+ ACE_NEW_RETURN (retval,
+ UTL_List (0),
+ 0);
+ }
+ else
+ {
+ ACE_NEW_RETURN (retval,
+ UTL_List (this->pd_cdr_data->copy ()),
+ 0);
+ }
- return new UTL_List (pd_cdr_data->copy ());
+ return retval;
}
-// Get next list
+// Get next list.
UTL_List *
-UTL_List::tail ()
+UTL_List::tail (void)
{
return pd_cdr_data;
}
-// Set next list
+// Set next list.
void
UTL_List::set_tail (UTL_List *l)
{
+ this->pd_cdr_data->destroy ();
this->pd_cdr_data = l;
}
-// Compute list length
+// Compute list length.
long
-UTL_List::length ()
+UTL_List::length (void)
{
return list_length (1);
}
-// UTL_List active iterator
+void
+UTL_List::destroy (void)
+{
+ if (this->pd_cdr_data != 0)
+ {
+ this->pd_cdr_data->destroy ();
+ delete this->pd_cdr_data;
+ this->pd_cdr_data = 0;
+ }
+}
+
+// UTL_List active iterator.
-// Constructor
UTL_ListActiveIterator::UTL_ListActiveIterator (UTL_List *s)
: source (s)
{
}
-/*
- * Public operations
- */
-
// Is iterator done?
-long
-UTL_ListActiveIterator::is_done ()
+idl_bool
+UTL_ListActiveIterator::is_done (void)
{
- return (source == NULL) ? I_TRUE : I_FALSE;
+ return (this->source == 0) ? I_TRUE : I_FALSE;
}
-// Advance to next item
+// Advance to next item.
void
-UTL_ListActiveIterator::next ()
+UTL_ListActiveIterator::next (void)
{
- if (source != NULL)
- source = source->tail ();
+ if (this->source != 0)
+ {
+ this->source = this->source->tail ();
+ }
}
diff --git a/TAO/TAO_IDL/util/utl_namelist.cpp b/TAO/TAO_IDL/util/utl_namelist.cpp
index 9f9869d32de..92b3e7a998a 100644
--- a/TAO/TAO_IDL/util/utl_namelist.cpp
+++ b/TAO/TAO_IDL/util/utl_namelist.cpp
@@ -62,80 +62,50 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
-// utl_namelist.cc
-//
-// Implementation of a list of scoped names
+// Implementation of a list of scoped names.
// NOTE: This list class only works correctly because we use single public
// inheritance, as opposed to multiple inheritance or public virtual.
-// It relies on a type-unsafe cast from UTL_List to subclasses, which
-// will cease to operate correctly if you use either multiple or
-// public virtual inheritance.
+// It relies on a type-unsafe cast from UTL_List to subclasses, which
+// will cease to operate correctly if you use either multiple or
+// public virtual inheritance.
-#include "idl.h"
-#include "idl_extern.h"
+#include "utl_namelist.h"
-ACE_RCSID(util, utl_namelist, "$Id$")
+ACE_RCSID (util,
+ utl_namelist,
+ "$Id$")
-/*
- * Constructor(s)
- */
-
-UTL_NameList::UTL_NameList(UTL_ScopedName *s, UTL_NameList *cdr)
- : UTL_List(cdr),
- pd_car_data(s)
+UTL_NameList::UTL_NameList (UTL_ScopedName *s,
+ UTL_NameList *cdr)
+ : UTL_List(cdr),
+ pd_car_data(s)
{
}
-/*
- * Private operations
- */
-
-/*
- * Public operations
- */
-
-// Get list item
+// Get list item.
UTL_ScopedName *
-UTL_NameList::head()
+UTL_NameList::head (void)
{
- return pd_car_data;
+ return this->pd_car_data;
}
-/*
- * Redefinition of inherited virtual operations
- */
-
-// UTL_NameList active iterator
-
-/*
- * Constructor
- */
-
-UTL_NamelistActiveIterator::UTL_NamelistActiveIterator(UTL_NameList *s)
- : UTL_ListActiveIterator(s)
+UTL_NamelistActiveIterator::UTL_NamelistActiveIterator (UTL_NameList *s)
+ : UTL_ListActiveIterator(s)
{
}
-/*
- * Private operations
- */
-
-/*
- * Public operations
- */
-
-// Get current item
+// Get current item.
UTL_ScopedName *
-UTL_NamelistActiveIterator::item()
+UTL_NamelistActiveIterator::item (void)
{
- if (source == NULL)
- return NULL;
- return ((UTL_NameList *) source)->head();
+ if (source == 0)
+ {
+ return 0;
+ }
+
+ return ((UTL_NameList *) source)->head ();
}
-/*
- * Redefinition of inherited virtual operations
- */
diff --git a/TAO/TAO_IDL/util/utl_scope.cpp b/TAO/TAO_IDL/util/utl_scope.cpp
index 9fd79747f2d..695bfa7a4f6 100644
--- a/TAO/TAO_IDL/util/utl_scope.cpp
+++ b/TAO/TAO_IDL/util/utl_scope.cpp
@@ -64,10 +64,44 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
*/
-#include "idl.h"
-#include "idl_extern.h"
-
-ACE_RCSID(util, utl_scope, "$Id$")
+#include "utl_scope.h"
+#include "utl_identifier.h"
+#include "utl_err.h"
+#include "utl_indenter.h"
+#include "utl_string.h"
+#include "ast_valuetype.h"
+#include "ast_valuetype_fwd.h"
+#include "ast_component.h"
+#include "ast_component_fwd.h"
+#include "ast_home.h"
+#include "ast_typedef.h"
+#include "ast_type.h"
+#include "ast_root.h"
+#include "ast_array.h"
+#include "ast_enum.h"
+#include "ast_concrete_type.h"
+#include "ast_sequence.h"
+#include "ast_string.h"
+#include "ast_structure_fwd.h"
+#include "ast_exception.h"
+#include "ast_constant.h"
+#include "ast_attribute.h"
+#include "ast_operation.h"
+#include "ast_argument.h"
+#include "ast_union.h"
+#include "ast_union_fwd.h"
+#include "ast_union_branch.h"
+#include "ast_field.h"
+#include "ast_enum_val.h"
+#include "ast_native.h"
+#include "ast_factory.h"
+#include "ast_visitor.h"
+#include "nr_extern.h"
+#include "global_extern.h"
+
+ACE_RCSID (util,
+ utl_scope,
+ "$Id$")
#undef INCREMENT
#define INCREMENT 64
@@ -320,8 +354,8 @@ UTL_Scope::lookup_for_add (AST_Decl *d,
return 0;
}
- return lookup_by_name_local (id,
- 0);
+ return this->lookup_by_name_local (id,
+ 0);
}
int
@@ -361,6 +395,35 @@ UTL_Scope::idl_keyword_clash (Identifier *e)
return 0;
}
+idl_bool
+UTL_Scope::redef_clash (AST_Decl::NodeType new_nt,
+ AST_Decl::NodeType scope_elem_nt)
+{
+ switch (new_nt)
+ {
+ case AST_Decl::NT_module:
+ return scope_elem_nt != AST_Decl::NT_module;
+ case AST_Decl::NT_struct:
+ case AST_Decl::NT_struct_fwd:
+ return scope_elem_nt != AST_Decl::NT_struct_fwd;
+ case AST_Decl::NT_union:
+ case AST_Decl::NT_union_fwd:
+ return scope_elem_nt != AST_Decl::NT_union_fwd;
+ case AST_Decl::NT_interface:
+ return scope_elem_nt != AST_Decl::NT_interface_fwd;
+ case AST_Decl::NT_interface_fwd:
+ return (scope_elem_nt != AST_Decl::NT_interface_fwd
+ && scope_elem_nt != AST_Decl::NT_interface);
+ case AST_Decl::NT_valuetype:
+ return scope_elem_nt != AST_Decl::NT_valuetype_fwd;
+ case AST_Decl::NT_valuetype_fwd:
+ return (scope_elem_nt != AST_Decl::NT_valuetype_fwd
+ && scope_elem_nt != AST_Decl::NT_valuetype);
+ default:
+ return I_TRUE;
+ }
+}
+
// Public operations.
// Scope Management Protocol.
@@ -417,6 +480,66 @@ UTL_Scope::add_interface_fwd (AST_InterfaceFwd *i)
return i;
}
+AST_ValueType *
+UTL_Scope::add_valuetype (AST_ValueType *i)
+{
+ if (i == 0)
+ {
+ return 0;
+ }
+
+ i->set_added (I_TRUE);
+ return i;
+}
+
+AST_ValueTypeFwd *
+UTL_Scope::add_valuetype_fwd (AST_ValueTypeFwd *i)
+{
+ if (i == 0)
+ {
+ return 0;
+ }
+
+ i->set_added (I_TRUE);
+ return i;
+}
+
+AST_Component *
+UTL_Scope::add_component (AST_Component *i)
+{
+ if (i == 0)
+ {
+ return 0;
+ }
+
+ i->set_added (I_TRUE);
+ return i;
+}
+
+AST_ComponentFwd *
+UTL_Scope::add_component_fwd (AST_ComponentFwd *i)
+{
+ if (i == 0)
+ {
+ return 0;
+ }
+
+ i->set_added (I_TRUE);
+ return i;
+}
+
+AST_Home *
+UTL_Scope::add_home (AST_Home *i)
+{
+ if (i == 0)
+ {
+ return 0;
+ }
+
+ i->set_added (I_TRUE);
+ return i;
+}
+
AST_Exception *
UTL_Scope::add_exception (AST_Exception *e)
{
@@ -525,6 +648,18 @@ UTL_Scope::add_union (AST_Union *u)
return u;
}
+AST_UnionFwd *
+UTL_Scope::add_union_fwd (AST_UnionFwd *u)
+{
+ if (u == 0)
+ {
+ return 0;
+ }
+
+ u->set_added (I_TRUE);
+ return u;
+}
+
AST_UnionBranch *
UTL_Scope::add_union_branch (AST_UnionBranch *u)
{
@@ -557,6 +692,18 @@ UTL_Scope::add_structure (AST_Structure *s)
return s;
}
+AST_StructureFwd *
+UTL_Scope::add_structure_fwd (AST_StructureFwd *s)
+{
+ if (s == 0)
+ {
+ return 0;
+ }
+
+ s->set_added (I_TRUE);
+ return s;
+}
+
AST_Field *
UTL_Scope::add_field (AST_Field *f)
{
@@ -728,6 +875,36 @@ UTL_Scope::fe_add_interface_fwd (AST_InterfaceFwd *)
return 0;
}
+AST_ValueType *
+UTL_Scope::fe_add_valuetype (AST_ValueType *)
+{
+ return 0;
+}
+
+AST_ValueTypeFwd *
+UTL_Scope::fe_add_valuetype_fwd (AST_ValueTypeFwd *)
+{
+ return 0;
+}
+
+AST_Component *
+UTL_Scope::fe_add_component (AST_Component *)
+{
+ return 0;
+}
+
+AST_ComponentFwd *
+UTL_Scope::fe_add_component_fwd (AST_ComponentFwd *)
+{
+ return 0;
+}
+
+AST_Home *
+UTL_Scope::fe_add_home (AST_Home *)
+{
+ return 0;
+}
+
AST_Exception *
UTL_Scope::fe_add_exception (AST_Exception *)
{
@@ -776,6 +953,12 @@ UTL_Scope::fe_add_union (AST_Union *)
return 0;
}
+AST_UnionFwd *
+UTL_Scope::fe_add_union_fwd (AST_UnionFwd *)
+{
+ return 0;
+}
+
AST_UnionBranch *
UTL_Scope::fe_add_union_branch (AST_UnionBranch *)
{
@@ -788,6 +971,12 @@ UTL_Scope::fe_add_structure (AST_Structure *)
return 0;
}
+AST_StructureFwd *
+UTL_Scope::fe_add_structure_fwd (AST_StructureFwd *)
+{
+ return 0;
+}
+
AST_Field *
UTL_Scope::fe_add_field (AST_Field *)
{
@@ -968,7 +1157,7 @@ UTL_Scope::lookup_pseudo (Identifier *e)
|| ACE_OS::strcmp (name_string, "ValueBase") == 0)
{
// Iterate over the global scope.
- UTL_ScopeActiveIterator global_iter (idl_global->scopes ()->bottom (),
+ UTL_ScopeActiveIterator global_iter (idl_global->scopes ().bottom (),
UTL_Scope::IK_decls);
i = &global_iter;
@@ -1009,18 +1198,16 @@ UTL_Scope::lookup_pseudo (Identifier *e)
AST_Decl *
UTL_Scope::lookup_primitive_type (AST_Expression::ExprType et)
{
- AST_Decl *as_decl = 0;
- UTL_Scope *ancestor = 0;
- AST_PredefinedType *t = 0;
AST_PredefinedType::PredefinedType pdt;
- as_decl = ScopeAsDecl (this);
+ AST_Decl *as_decl = ScopeAsDecl (this);
if (as_decl == 0)
{
return 0;
}
- ancestor = as_decl->defined_in ();
+
+ UTL_Scope *ancestor = as_decl->defined_in ();
if (ancestor != 0)
{
@@ -1071,9 +1258,13 @@ UTL_Scope::lookup_primitive_type (AST_Expression::ExprType et)
case AST_Expression::EV_any:
pdt = AST_PredefinedType::PT_any;
break;
+ case AST_Expression::EV_object:
+ pdt = AST_PredefinedType::PT_object;
+ break;
case AST_Expression::EV_void:
pdt = AST_PredefinedType::PT_void;
break;
+ case AST_Expression::EV_enum:
case AST_Expression::EV_string:
case AST_Expression::EV_wstring:
case AST_Expression::EV_none:
@@ -1081,6 +1272,8 @@ UTL_Scope::lookup_primitive_type (AST_Expression::ExprType et)
return 0;
}
+ AST_PredefinedType *t = 0;
+
for (UTL_ScopeActiveIterator i (this, UTL_Scope::IK_decls);
!i.is_done();
i.next ())
@@ -1091,7 +1284,7 @@ UTL_Scope::lookup_primitive_type (AST_Expression::ExprType et)
{
t = AST_PredefinedType::narrow_from_decl (as_decl);
- if (t == NULL)
+ if (t == 0)
{
continue;
}
@@ -1237,10 +1430,14 @@ UTL_Scope::lookup_by_name_local (Identifier *e,
{
if (index == 0)
{
- // Special case for forward declared interfaces.
- // Look through the forward declaration and retrieve
- // the full definition.
- if (d->node_type () == AST_Decl::NT_interface_fwd)
+ AST_Decl::NodeType nt = d->node_type ();
+
+ // Special case for forward declared interfaces,
+ // In this case, we want to return
+ // the full definition member, whether defined yet or not
+ if (nt == AST_Decl::NT_interface_fwd
+ || nt == AST_Decl::NT_valuetype_fwd
+ || nt == AST_Decl::NT_component_fwd)
{
d = AST_InterfaceFwd::narrow_from_decl (d)->full_definition ();
}
@@ -1346,10 +1543,11 @@ UTL_Scope::lookup_by_name (UTL_ScopedName *e,
if (d == 0)
{
- // Special case for scope which is an interface. We have to look
- // in the inherited interfaces as well.
- // Look before parent scopes.
- if (pd_scope_node_type == AST_Decl::NT_interface)
+ // Special case for scope which is an interface or value type.
+ // We have to look in the inherited interfaces as well.
+ // Look before parent scopes.
+ if (pd_scope_node_type == AST_Decl::NT_interface
+ || pd_scope_node_type == AST_Decl::NT_valuetype)
{
d = look_in_inherited (e,
treat_as_ref);
@@ -1397,16 +1595,6 @@ UTL_Scope::lookup_by_name (UTL_ScopedName *e,
id = e->head ();
}
- // If we have stripped e to the last component, then
- // add it - the last component of a scoped name is
- // the only one that counts as a reference in a scope.
- if (id == e->last_component ())
- {
- add_to_referenced (d,
- I_FALSE,
- id);
- }
-
AST_Type *t = AST_Type::narrow_from_decl (d);
// Are we a type, rather than an identifier?
@@ -1420,15 +1608,23 @@ UTL_Scope::lookup_by_name (UTL_ScopedName *e,
if (s != 0)
{
AST_Decl *parent = ScopeAsDecl (s);
-
- // If the scope we are defined in is itself inside
- // an interface or valuetype, then we should also
- // be exported to the interface (or valuetype) scope.
- if (parent->node_type () == AST_Decl::NT_interface)
+ AST_Decl::NodeType nt = parent->node_type ();
+
+ // If the scope we are defined in is itself
+ // inside a module, then we should also
+ // be exported to the enclosing scope,
+ // recursive until we get to the enclosing
+ // module (or root) scope. (CORBA 2.6 3.15.3).
+ while (nt != AST_Decl::NT_module
+ && nt != AST_Decl::NT_root)
{
s->add_to_referenced (d,
I_FALSE,
d->local_name ());
+
+ s = parent->defined_in ();
+ parent = ScopeAsDecl (s);
+ nt = parent->node_type ();
}
}
}
@@ -1507,7 +1703,7 @@ UTL_Scope::add_to_referenced (AST_Decl *e,
// Special case for forward declared interfaces in the
// scope in which they're defined. Cannot add before full
// definition is seen.
- if (e->node_type() == AST_Decl::NT_interface)
+ if (e->node_type () == AST_Decl::NT_interface)
{
itf = AST_Interface::narrow_from_decl(e);
@@ -1652,8 +1848,8 @@ UTL_Scope::add_to_scope (AST_Decl *e,
return;
}
- AST_Decl **tmp = this->pd_referenced;
- long i = this->pd_referenced_used;
+ AST_Decl **tmp = this->pd_decls;
+ long i = this->pd_decls_used;
Identifier *decl_name = e->local_name ();
char *decl_string = decl_name->get_string ();
@@ -1666,46 +1862,19 @@ UTL_Scope::add_to_scope (AST_Decl *e,
// in this scope.
for (; i > 0; i--, tmp++)
{
- if ((*tmp)->defined_in () == this)
- {
- // A local declaration doesn't use a scoped name.
- ref_name = (*tmp)->local_name ();
- ref_string = ref_name->get_string ();
- }
- else
- {
- // If this item is merely referenced in this scope,
- // then only the top level of whatever scoped name
- // is used may clash with a local declaration.
- UTL_ScopedName *s = (*tmp)->name ();
-
- UTL_IdListActiveIterator iter (s);
-
- ref_name = iter.item ();
- ref_string = ref_name->get_string ();
-
- // Get the first non-null component of the scoped
- // nane that's not the global double colon.
- while (!ACE_OS::strcmp (ref_string, "")
- || !ACE_OS::strcmp (ref_string, "::"))
- {
- iter.next ();
- ref_name = iter.item ();
- ref_string = ref_name->get_string ();
- }
- }
+ // A local declaration doesn't use a scoped name.
+ ref_name = (*tmp)->local_name ();
+ ref_string = ref_name->get_string ();
- // If the names compare exactly, it's a redefinition
+ // If the names compare exactly, it's a redefini8tion
// error, unless they're both modules (which can be
// reopened) or we have a belated definition of a
// forward-declared interface.
- AST_Decl::NodeType nt = e->node_type ();
+ AST_Decl::NodeType new_nt = e->node_type ();
+ AST_Decl::NodeType scope_elem_nt = (*tmp)->node_type ();
if (decl_name->compare (ref_name) == I_TRUE
- && nt != AST_Decl::NT_module
- && nt != AST_Decl::NT_interface_fwd
- && ((*tmp)->node_type () != AST_Decl::NT_interface_fwd
- || nt != AST_Decl::NT_interface))
+ && this->redef_clash (new_nt, scope_elem_nt) == I_TRUE)
{
idl_global->err ()->redef_error (decl_string,
ref_string);
@@ -1864,14 +2033,16 @@ UTL_Scope::referenced (AST_Decl *e,
return I_TRUE;
}
- if ((*tmp)->node_type () == AST_Decl::NT_interface_fwd
- && e->node_type () == AST_Decl::NT_interface)
+ // Are we definging a forward declared struct, union, or interface,
+ // or reopening a module?
+ idl_bool forward_redef = this->redef_clash (e->node_type (),
+ (*tmp)->node_type ());
+
+ if (forward_redef == I_FALSE)
{
member = (*tmp)->local_name ();
test = e->local_name ();
- // If we're just defining a forward
- // declared interface, no need to go any further.
if (member->compare (test) == I_TRUE)
{
return I_FALSE;
@@ -2023,6 +2194,27 @@ UTL_Scope::nmembers (void)
void
UTL_Scope::destroy (void)
{
+ for (UTL_ScopeActiveIterator iter (this, IK_both);
+ !iter.is_done ();
+ iter.next ())
+ {
+ AST_Decl *i = iter.item ();
+ i->destroy ();
+ delete i;
+ i = 0;
+ }
+
+ delete [] this->pd_decls;
+ this->pd_decls = 0;
+
+ delete [] this->pd_local_types;
+ this->pd_local_types = 0;
+
+ delete [] this->pd_referenced;
+ this->pd_referenced = 0;
+
+ delete [] this->pd_name_referenced;
+ this->pd_name_referenced = 0;
}
// Narrowing.
@@ -2037,9 +2229,9 @@ UTL_ScopeActiveIterator::UTL_ScopeActiveIterator (
UTL_Scope::ScopeIterationKind i
)
: iter_source (s),
- ik(i),
- stage(i == UTL_Scope::IK_both ? UTL_Scope::IK_localtypes : i),
- il(0)
+ ik (i),
+ stage (i == UTL_Scope::IK_both ? UTL_Scope::IK_localtypes : i),
+ il (0)
{
}
diff --git a/TAO/TAO_IDL/util/utl_stack.cpp b/TAO/TAO_IDL/util/utl_stack.cpp
index 29f6dc49b26..26db4e8c209 100644
--- a/TAO/TAO_IDL/util/utl_stack.cpp
+++ b/TAO/TAO_IDL/util/utl_stack.cpp
@@ -62,48 +62,35 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
-/*
- * utl_stack.cc - Implementation of class UTL_ScopeStack
- */
-
-#include "idl.h"
-#include "ast_decl.h"
-#include "idl_extern.h"
-
-ACE_RCSID(util, utl_stack, "$Id$")
+#include "utl_stack.h"
+#include "utl_scope.h"
+#include "global_extern.h"
-// Class UTL_ScopeStack
+ACE_RCSID (util,
+ utl_stack,
+ "$Id$")
#undef INCREMENT
#define INCREMENT 64
-/*
- * Constructor(s) and destructor
- */
-
-UTL_ScopeStack::UTL_ScopeStack()
- : pd_stack_data(new UTL_Scope *[INCREMENT]),
- pd_stack_data_nalloced(INCREMENT),
- pd_stack_top(0)
+UTL_ScopeStack::UTL_ScopeStack (void)
+ : pd_stack_data_nalloced (INCREMENT),
+ pd_stack_top (0)
{
+ ACE_NEW (this->pd_stack_data,
+ UTL_Scope *[INCREMENT]);
}
-UTL_ScopeStack::~UTL_ScopeStack()
+UTL_ScopeStack::~UTL_ScopeStack (void)
{
- if (pd_stack_data != NULL)
- delete pd_stack_data;
+ if (this->pd_stack_data != 0)
+ {
+ delete this->pd_stack_data;
+ }
}
-/*
- * Private operations
- */
-
-/*
- * Public operations
- */
-
// Push an element on the stack.
UTL_ScopeStack *
UTL_ScopeStack::push (UTL_Scope *el)
@@ -112,7 +99,7 @@ UTL_ScopeStack::push (UTL_Scope *el)
long ostack_data_nalloced;
long i;
- // Make sure there's space for one more
+ // Make sure there's space for one more.
if (this->pd_stack_data_nalloced == this->pd_stack_top)
{
ostack_data_nalloced = this->pd_stack_data_nalloced;
@@ -158,115 +145,111 @@ UTL_ScopeStack::pop (void)
--this->pd_stack_top;
}
-// Return top element on stack
+// Return top element on stack.
UTL_Scope *
UTL_ScopeStack::top (void)
{
- if (pd_stack_top <= 0)
- return NULL;
- return pd_stack_data[pd_stack_top - 1];
+ if (this->pd_stack_top <= 0)
+ {
+ return 0;
+ }
+
+ return this->pd_stack_data[pd_stack_top - 1];
}
-// Return bottom element on stack
+// Return bottom element on stack.
UTL_Scope *
UTL_ScopeStack::bottom (void)
{
- if (pd_stack_top == 0)
- return NULL;
- return pd_stack_data[0];
+ if (this->pd_stack_top == 0)
+ {
+ return 0;
+ }
+
+ return this->pd_stack_data[0];
}
-// Clear entire stack
+// Clear entire stack.
void
UTL_ScopeStack::clear (void)
{
- pd_stack_top = 0;
+ this->pd_stack_top = 0;
}
// How deep is the stack?
unsigned long
UTL_ScopeStack::depth (void)
{
- return pd_stack_top;
+ return this->pd_stack_top;
}
-// Return (top - 1) element on stack
+// Return (top - 1) element on stack.
UTL_Scope *
UTL_ScopeStack::next_to_top (void)
{
UTL_Scope *tmp, *retval;
- if (depth() < 2)
- return NULL;
+ if (this->depth () < 2)
+ {
+ return 0;
+ }
- tmp = top(); // Save top
- (void) pop(); // Pop it
- retval = top(); // Get next one down
- (void) push(tmp); // Push top back
+ tmp = top (); // Save top
+ (void) pop (); // Pop it
+ retval = top (); // Get next one down
+ (void) push (tmp); // Push top back
return retval; // Return next one down
}
-// Return topmost non-NULL element
+// Return topmost non-NULL element.
UTL_Scope *
UTL_ScopeStack::top_non_null (void)
{
- long i;
+ for (long i = this->pd_stack_top - 1; i >= 0; --i)
+ {
+ if (this->pd_stack_data[i] != 0)
+ {
+ return this->pd_stack_data[i];
+ }
+ }
- for (i = pd_stack_top - 1; i >= 0; i--)
- if (pd_stack_data[i] != NULL)
- return pd_stack_data[i];
- return NULL;
+ return 0;
}
-/*
- * Redefinition of inherited virtual operations
- */
-
-// Class UTL_ScopeStackActiveIterator
-
-/*
- * Constructor(s)
- */
-
-UTL_ScopeStackActiveIterator::UTL_ScopeStackActiveIterator(UTL_ScopeStack *s)
- : source(s),
- il(s->pd_stack_top - 1)
+UTL_ScopeStackActiveIterator::UTL_ScopeStackActiveIterator (UTL_ScopeStack &s)
+ : source (s),
+ il (s.pd_stack_top - 1)
{
}
-/*
- * Private operations
- */
-
-/*
- * Public operations
- */
-
// Advance to next item
void
-UTL_ScopeStackActiveIterator::next()
+UTL_ScopeStackActiveIterator::next (void)
{
il--;
}
-// Get current item
+// Get current item.
UTL_Scope *
-UTL_ScopeStackActiveIterator::item()
+UTL_ScopeStackActiveIterator::item (void)
{
- if (il >= 0)
- return source->pd_stack_data[il];
- return NULL;
+ if (this->il >= 0)
+ {
+ return this->source.pd_stack_data[il];
+ }
+
+ return 0;
}
// Is this iteration done?
long
-UTL_ScopeStackActiveIterator::is_done()
+UTL_ScopeStackActiveIterator::is_done (void)
{
- if (il >= 0)
- return I_FALSE;
+ if (this->il >= 0)
+ {
+ return I_FALSE;
+ }
+
return I_TRUE;
}
-/*
- * Redefinition of inherited virtual operations
- */
diff --git a/TAO/TAO_IDL/util/utl_string.cpp b/TAO/TAO_IDL/util/utl_string.cpp
index b5a714dc421..2b23ce2face 100644
--- a/TAO/TAO_IDL/util/utl_string.cpp
+++ b/TAO/TAO_IDL/util/utl_string.cpp
@@ -64,17 +64,13 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
*/
-// utl_string.cc - Implementation of quick and dirty TEMPORARY String
-// for IDL compiler
+#include "utl_string.h"
+#include "global_extern.h"
+#include "utl_err.h"
-#include "idl.h"
-#include "idl_extern.h"
-
-ACE_RCSID(util, utl_string, "$Id$")
-
-/*
- * Constructors.
- */
+ACE_RCSID (util,
+ utl_string,
+ "$Id$")
UTL_String::UTL_String (void)
: p_str (0),
@@ -132,10 +128,6 @@ UTL_String::~UTL_String (void)
{
}
-/*
- * Private operations.
- */
-
// Compute a canonical form for this string. This is (implemented as)
// a corresponding string with all upper case characters where the
// original has lower case characters, identical characters otherwise.
@@ -157,12 +149,8 @@ UTL_String::canonicalize (void)
c_str[this->len] = '\0';
}
-/*
- * Public operations.
- */
-
// Compare two UTL_String *.
-long
+idl_bool
UTL_String::compare (UTL_String *s)
{
char *s_c_str;
@@ -180,9 +168,7 @@ UTL_String::compare (UTL_String *s)
(ACE_OS::strcmp (this->c_str, s_c_str) == 0) ? I_TRUE : I_FALSE;
}
- /*
- * Check that the names are typed consistently.
- */
+ // Check that the names are typed consistently.
if (result == I_TRUE
&& ACE_OS::strcmp (this->p_str, s->get_string ()) != 0)
{
@@ -268,10 +254,6 @@ UTL_String::get_canonical_rep (void)
return this->c_str;
}
-/*
- * Redefined virtual operations.
- */
-
// AST Dumping.
void
UTL_String::dump (ACE_OSTREAM_TYPE &o)
diff --git a/TAO/TAO_IDL/util/utl_strlist.cpp b/TAO/TAO_IDL/util/utl_strlist.cpp
index c7776e5cff3..c1e7cdaaf54 100644
--- a/TAO/TAO_IDL/util/utl_strlist.cpp
+++ b/TAO/TAO_IDL/util/utl_strlist.cpp
@@ -62,113 +62,132 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
-// utl_strlist.cc
-//
-// Implementation of a list of utl_string nodes
+// Implementation of a list of utl_string nodes.
// NOTE: This list class only works correctly because we use single public
// inheritance, as opposed to multiple inheritance or public virtual.
-// It relies on a type-unsafe cast from UTL_List to subclasses, which
-// will cease to operate correctly if you use either multiple or
-// public virtual inheritance.
+// It relies on a type-unsafe cast from UTL_List to subclasses, which
+// will cease to operate correctly if you use either multiple or
+// public virtual inheritance.
-#include "idl.h"
-#include "idl_extern.h"
+#include "utl_strlist.h"
+#include "utl_string.h"
-ACE_RCSID(util, utl_strlist, "$Id$")
+ACE_RCSID (util,
+ utl_strlist,
+ "$Id$")
-// Constructor
-UTL_StrList::UTL_StrList(UTL_String *s, UTL_StrList *cdr)
- : UTL_List(cdr),
- pd_car_data(s)
+UTL_StrList::UTL_StrList (UTL_String *s,
+ UTL_StrList *cdr)
+ : UTL_List(cdr),
+ pd_car_data(s)
{
}
-// Destructor
UTL_StrList::~UTL_StrList (void)
{
}
-// Public operations
-
-// Get list item
+// Get list item.
UTL_String *
-UTL_StrList::head()
+UTL_StrList::head (void)
{
- return pd_car_data;
+ return this->pd_car_data;
}
-// Set list item
+// Set list item.
void
-UTL_StrList::set_head(UTL_String *s)
+UTL_StrList::set_head (UTL_String *s)
{
- pd_car_data = s;
+ this->pd_car_data = s;
}
// Get last item of this list
UTL_String *
-UTL_StrList::last_component()
+UTL_StrList::last_component (void)
{
- if (tail() == NULL)
- return pd_car_data;
- return ((UTL_StrList *) tail())->last_component();
+ if (this->tail () == 0)
+ {
+ return pd_car_data;
+ }
+
+ return ((UTL_StrList *) this->tail ())->last_component();
}
-// Copy a list
+// Copy a list.
UTL_List *
-UTL_StrList::copy()
+UTL_StrList::copy (void)
{
- if (tail() == NULL)
- return new UTL_StrList(head(), NULL);
- return new UTL_StrList(head(), (UTL_StrList *) tail()->copy());
+ UTL_List *retval = 0;
+
+ if (this->tail () == 0)
+ {
+ ACE_NEW_RETURN (retval,
+ UTL_StrList (head (),
+ 0),
+ 0);
+ }
+ else
+ {
+ ACE_NEW_RETURN (retval,
+ UTL_StrList (head (),
+ (UTL_StrList *) this->tail ()->copy ()),
+ 0);
+ }
+
+ return retval;
}
void
UTL_StrList::destroy (void)
{
UTL_String *str = 0;
- UTL_StrlistActiveIterator *i = 0;
- ACE_NEW (i,
- UTL_StrlistActiveIterator (this));
- while (!(i->is_done ()))
+ for (UTL_StrlistActiveIterator i (this); !i.is_done (); i.next ())
{
- str = i->item ();
+ str = i.item ();
str->destroy ();
delete str;
str = 0;
- i->next ();
}
-
- delete i;
}
// AST Dumping
void
-UTL_StrList::dump(ACE_OSTREAM_TYPE &o)
+UTL_StrList::dump (ACE_OSTREAM_TYPE &o)
{
- char *s;
- UTL_StrlistActiveIterator *i = new UTL_StrlistActiveIterator(this);
- idl_bool first = I_TRUE;
- idl_bool second = I_FALSE;
-
- while (!(i->is_done())) {
- if (!first)
- o << "::";
- else if (second)
- first = second = I_FALSE;
- s = i->item()->get_string();
- o << s;
- if (first) {
- if (strcmp(s, "::") != 0)
- first = I_FALSE;
- else
- second = I_TRUE;
+ char *s = 0;
+ idl_bool first = I_TRUE;
+ idl_bool second = I_FALSE;
+
+ for (UTL_StrlistActiveIterator i (this); !i.is_done(); i.next ())
+ {
+ if (!first)
+ {
+ o << "::";
+ }
+ else if (second)
+ {
+ first = second = I_FALSE;
+ }
+
+ s = i.item ()->get_string ();
+ o << s;
+
+ if (first)
+ {
+ if (ACE_OS::strcmp (s, "::") != 0)
+ {
+ first = I_FALSE;
+ }
+ else
+ {
+ second = I_TRUE;
+ }
+ }
}
- i->next();
- }
}
/*
@@ -181,8 +200,8 @@ UTL_StrList::dump(ACE_OSTREAM_TYPE &o)
* Constructor
*/
-UTL_StrlistActiveIterator::UTL_StrlistActiveIterator(UTL_StrList *s)
- : UTL_ListActiveIterator(s)
+UTL_StrlistActiveIterator::UTL_StrlistActiveIterator (UTL_StrList *s)
+ : UTL_ListActiveIterator (s)
{
}
@@ -196,11 +215,14 @@ UTL_StrlistActiveIterator::UTL_StrlistActiveIterator(UTL_StrList *s)
// Get current item
UTL_String *
-UTL_StrlistActiveIterator::item()
+UTL_StrlistActiveIterator::item (void)
{
- if (source == NULL)
- return NULL;
- return ((UTL_StrList *) source)->head();
+ if (source == 0)
+ {
+ return 0;
+ }
+
+ return ((UTL_StrList *) source)->head ();
}
/*
diff --git a/TAO/TAO_IDL/util/utl_tmpl/utl_idlist.cpp b/TAO/TAO_IDL/util/utl_tmpl/utl_idlist.cpp
index 229376234ba..becb6e8d3d1 100644
--- a/TAO/TAO_IDL/util/utl_tmpl/utl_idlist.cpp
+++ b/TAO/TAO_IDL/util/utl_tmpl/utl_idlist.cpp
@@ -80,35 +80,48 @@ UTL_IdList::UTL_IdList(Identifier *s, UTL_IdList *cdr)
// Get last item of this list
Identifier *
-UTL_IdList::last_component()
+UTL_IdList::last_component (void)
{
- if (tail() == NULL)
- return head();
- return tail()->last_component();
+ if (tail() == 0)
+ {
+ return head ();
+ }
+
+ return tail ()->last_component ();
}
// AST Dumping
void
-UTL_IdList::dump(ACE_OSTREAM_TYPE &o)
+UTL_IdList::dump (ACE_OSTREAM_TYPE &o)
{
- UTL_IdListActiveIterator *i = new UTL_IdListActiveIterator(this);
- long first = I_TRUE;
- long second = I_FALSE;
-
- while (!(i->is_done())) {
- if (!first)
- o << "::";
- else if (second)
- first = second = I_FALSE;
- i->item()->dump(o);
- if (first) {
- if (strcmp(i->item()->get_string(), "::") != 0)
- first = I_FALSE;
- else
- second = I_TRUE;
+ long first = I_TRUE;
+ long second = I_FALSE;
+
+ for (UTL_IdListActiveIterator (this); !i.is_done (); i.next ())
+ {
+ if (!first)
+ {
+ o << "::";
+ }
+ else if (second)
+ {
+ first = second = I_FALSE;
+ }
+
+ i.item ()->dump (o);
+
+ if (first)
+ {
+ if (ACE_OS::strcmp (i.item ()->get_string (), "::") != 0)
+ {
+ first = I_FALSE;
+ }
+ else
+ {
+ second = I_TRUE;
+ }
+ }
}
- i->next();
- }
}
/*
@@ -121,8 +134,8 @@ UTL_IdList::dump(ACE_OSTREAM_TYPE &o)
* Constructor
*/
-UTL_IdListActiveIterator::UTL_IdListActiveIterator(UTL_IdList *s)
- : UTL_ListActiveIterator<UTL_IdList, Identifier>(s)
+UTL_IdListActiveIterator::UTL_IdListActiveIterator (UTL_IdList *s)
+ : UTL_ListActiveIterator<UTL_IdList, Identifier> (s)
{
}
diff --git a/TAO/TAO_IDL/util/utl_tmpl/utl_strlist.cpp b/TAO/TAO_IDL/util/utl_tmpl/utl_strlist.cpp
index c9649d21b93..baeeb6b0f77 100644
--- a/TAO/TAO_IDL/util/utl_tmpl/utl_strlist.cpp
+++ b/TAO/TAO_IDL/util/utl_tmpl/utl_strlist.cpp
@@ -89,28 +89,39 @@ UTL_StrList::last_component()
// AST Dumping
void
-UTL_StrList::dump(ACE_OSTREAM_TYPE &o)
+UTL_StrList::dump (ACE_OSTREAM_TYPE &o)
{
- char *s;
- UTL_StrlistActiveIterator *i = new UTL_StrlistActiveIterator(this);
- long first = I_TRUE;
- long second = I_FALSE;
-
- while (!(i->is_done())) {
- if (!first)
- o << "::";
- else if (second)
- first = second = I_FALSE;
- s = i->item()->get_string();
- o << s;
- if (first) {
- if (strcmp(s, "::") != 0)
- first = I_FALSE;
- else
- second = I_TRUE;
+ char *s = 0;;
+ UTL_StrlistActiveIterator *i = new UTL_StrlistActiveIterator (this);
+ long first = I_TRUE;
+ long second = I_FALSE;
+
+ for (UTL_StrlistActiveIterator (this); !i.is_done(); i.next ())
+ {
+ if (!first)
+ {
+ o << "::";
+ }
+ else if (second)
+ {
+ first = second = I_FALSE;
+ }
+
+ s = i.item ()->get_string ();
+ o << s;
+
+ if (first)
+ {
+ if (ACE_OS::strcmp (s, "::") != 0)
+ {
+ first = I_FALSE;
+ }
+ else
+ {
+ second = I_TRUE;
+ }
+ }
}
- i->next();
- }
}
/*